Module arrow2::compute::arithmetics::basic
source · Available on crate feature
compute_arithmetics
only.Expand description
Contains arithemtic functions for PrimitiveArray
s.
Each operation has four variants, like the rest of Rust’s ecosystem:
Traits
Trait describing a
NativeType
whose semantics of arithmetic in Arrow equals
the semantics in Rust.
A counter example is i128
, that in arrow represents a decimal while in rust represents
a signed integer.Functions
Adds two primitive arrays with the same type.
Panics if the sum of one pair of values overflows.
Adds a scalar T to a primitive array of type T.
Panics if the sum of the values overflows.
Checked addition of two primitive arrays. If the result from the sum
overflows, the validity for that index is changed to None
Checked addition of a scalar T to a primitive array of type T. If the
result from the sum overflows then the validity index for that value is
changed to None
Checked division of two primitive arrays. If the result from the division
overflows, the result for the operation will change the validity array
making this operation None
Checked division of a primitive array of type T by a scalar T. If the
divisor is zero then the validity array is changed to None.
Checked multiplication of two primitive arrays. If the result from the
multiplications overflows, the validity for that index is changed
returned.
Checked multiplication of a scalar T to a primitive array of type T. If the
result from the multiplication overflows, then the validity for that index is
changed to None
Checked negates values from array.
Checked operation of raising an array of primitives to the power of
exponent. If the result from the multiplications overflows, the validity
for that index is changed returned.
Checked remainder of two primitive arrays. If the result from the remainder
overflows, the result for the operation will change the validity array
making this operation None
Checked remainder of a primitive array of type T by a scalar T. If the
divisor is zero then the validity array is changed to None.
Checked subtraction of two primitive arrays. If the result from the
subtraction overflow, the validity for that index is changed
Checked subtraction of a scalar T to a primitive array of type T. If the
result from the subtraction overflows, then the validity for that index
is changed to None
Divides two primitive arrays with the same type.
Panics if the divisor is zero of one pair of values overflows.
Divide a primitive array of type T by a scalar T.
Panics if the divisor is zero.
Multiplies two primitive arrays with the same type.
Panics if the multiplication of one pair of values overflows.
Multiply a scalar T to a primitive array of type T.
Panics if the multiplication of the values overflows.
Negates values from array.
Overflowing addition of two primitive arrays. If the result from the sum is
larger than the possible number for this type, the result for the operation
will be an array with overflowed values and a validity array indicating
the overflowing elements from the array.
Overflowing addition of a scalar T to a primitive array of type T. If the
result from the sum is larger than the possible number for this type, then
the result will be an array with overflowed values and a validity array
indicating the overflowing elements from the array
Overflowing multiplication of two primitive arrays. If the result from the
mul overflows, the result for the operation will be an array with
overflowed values and a validity array indicating the overflowing elements
from the array.
Overflowing multiplication of a scalar T to a primitive array of type T. If
the result from the mul overflows for this type,
then the result will be an array with overflowed values and a validity
array indicating the overflowing elements from the array
Overflowing subtraction of two primitive arrays. If the result from the sub
is smaller than the possible number for this type, the result for the
operation will be an array with overflowed values and a validity array
indicating the overflowing elements from the array.
Overflowing subtraction of a scalar T to a primitive array of type T. If
the result from the sub is smaller than the possible number for this type,
then the result will be an array with overflowed values and a validity
array indicating the overflowing elements from the array
Raises an array of primitives to the power of exponent. Panics if one of
the values values overflows.
Remainder of two primitive arrays with the same type.
Panics if the divisor is zero of one pair of values overflows.
Remainder a primitive array of type T by a scalar T.
Panics if the divisor is zero.
Saturating addition of two primitive arrays. If the result from the sum is
larger than the possible number for this type, the result for the operation
will be the saturated value.
Saturated addition of a scalar T to a primitive array of type T. If the
result from the sum is larger than the possible number for this type, then
the result will be saturated
Saturating multiplication of two primitive arrays. If the result from the
multiplication overflows, the result for the
operation will be the saturated value.
Saturated multiplication of a scalar T to a primitive array of type T. If the
result from the mul overflows for this type, then
the result will be saturated
Saturating subtraction of two primitive arrays. If the result from the sub
is smaller than the possible number for this type, the result for the
operation will be the saturated value.
Saturated subtraction of a scalar T to a primitive array of type T. If the
result from the sub is smaller than the possible number for this type, then
the result will be saturated
Subtracts two primitive arrays with the same type.
Panics if the subtraction of one pair of values overflows.
Subtract a scalar T to a primitive array of type T.
Panics if the subtraction of the values overflows.
Wrapping addition of two
PrimitiveArray
s.
It wraps around at the boundary of the type if the result overflows.Wrapping addition of a scalar T to a
PrimitiveArray
of type T.
It do nothing if the result overflows.Wrapping multiplication of two
PrimitiveArray
s.
It wraps around at the boundary of the type if the result overflows.Wrapping multiplication of a scalar T to a
PrimitiveArray
of type T.
It do nothing if the result overflows.Wrapping negates values from array.
Wrapping subtraction of two
PrimitiveArray
s.
It wraps around at the boundary of the type if the result overflows.Wrapping subtraction of a scalar T to a
PrimitiveArray
of type T.
It do nothing if the result overflows.