Skip to main content

Module arithmetic

Module arithmetic 

Source
Expand description

Traits for arithmetic on IntegerVectors.

Modules§

abs_squared
Implementations of AbsSquared, the squared norm of a vector: the sum of the squares of its elements.
add
Implementations of Add and AddAssign, for adding vectors.
add_mul
Adding a multiple of one vector to another, by implementations of AddMul and AddMulAssign.
add_mul_shl
Implementations of AddMulShl and AddMulShlAssign, for adding a scalar multiple of one vector, shifted left, to another.
balanced_mod
Implementations of BalancedMod and BalancedModAssign, which reduce every element of a vector to the representative closest to zero modulo a number.
balanced_mod_power_of_2
Implementations of BalancedModPowerOf2 and BalancedModPowerOf2Assign, which reduce every element of a vector to the representative closest to zero modulo a power of 2.
canonical_primitive_part
Implementations of CanonicalPrimitivePart, CanonicalPrimitivePartAssign, and ContentAndCanonicalPrimitivePart, which compute the primitive part of a vector with its first nonzero element made positive.
canonicalize_sign
Implementations of CanonicalizeSign and CanonicalizeSignAssign, which negate a vector if its pivot is negative.
content
Implementations of Content, PrimitivePart, PrimitivePartAssign, and ContentAndPrimitivePart, which compute the GCD of a vector’s elements and the vector divided by it.
content_chained
Implementations of ContentChained, which computes the GCD of a number and a vector’s elements.
div_exact
Exact division of a vector by a scalar, by implementations of DivExact and DivExactAssign.
dot
Implementations of Dot, the dot product of two vectors.
dot_sign
Implementations of DotSign, the sign of the dot product of two vectors.
element_lcm
An implementation of ElementLcm, the LCM of the elements.
element_product
An implementation of ElementProduct, the product of the elements.
element_sum
An implementation of ElementSum, the sum of the elements.
entrywise_abs
Implementations of EntrywiseAbs, EntrywiseAbsAssign, and EntrywiseUnsignedAbs, which replace every element of a vector by its absolute value.
entrywise_div_round
Dividing every element of a vector by a scalar and rounding each quotient, by implementations of EntrywiseDivRound and EntrywiseDivRoundAssign.
entrywise_shl_round
Left-shifting a vector (multiplying it by a power of 2) and rounding every element, by implementations of EntrywiseShlRound and EntrywiseShlRoundAssign.
entrywise_shr_round
Right-shifting a vector (dividing it by a power of 2) and rounding every element, by implementations of EntrywiseShrRound and EntrywiseShrRoundAssign.
height
An implementation of Height and HeightRef, the largest height of any element.
l1_norm
An implementation of L1Norm, the sum of the absolute values of the elements.
mod_op
Implementations of Mod, Rem, and RemAssign, for reducing every element of a vector modulo a number.
mod_power_of_2
Implementations of ModPowerOf2, RemPowerOf2, and RemPowerOf2Assign, for reducing every element of a vector modulo a power of 2.
multi_crt
IntegerVector::multi_balanced_crt, which combines vectors of residues modulo many word-sized moduli into balanced representatives by the Chinese remainder theorem.
neg
Implementations of Neg and NegAssign, for negating a vector.
scalar_div
Implementations of Div and DivAssign, for dividing a vector by a scalar.
scalar_mul
Implementations of Mul and MulAssign, for multiplying a vector by a scalar, with the scalar on either side.
shl
Left-shifting a vector (multiplying it by a power of 2), by implementations of Shl and ShlAssign.
shr
Right-shifting a vector (dividing it by a power of 2 and taking the floor), by implementations of Shr and ShrAssign.
sub
Implementations of Sub and SubAssign, for subtracting vectors.
sub_mul
Subtracting a multiple of one vector from another, by implementations of SubMul and SubMulAssign.
sub_mul_shl
Implementations of SubMulShl and SubMulShlAssign, for subtracting a scalar multiple of one vector, shifted left, from another.
sum
Implementations of Sum, for adding up vectors entry by entry.