Template Class BigVectorInterface
Defined in File vector.h
Page Contents
Template Parameter Order
typename T
typename I
Class Documentation
-
template<typename T, typename I>
class lbcrypto::BigVectorInterface -
Public Functions
-
T &operator=(const T &vec)
Copy assignment operator.
- Parameters
&vec – is the vector to be assigned from.
- Returns
assigned vector ref.
-
T &operator=(T &&vec)
Move assignment operator.
- Parameters
&vec – is the vector to be assigned from.
- Returns
assigned vector ref.
-
T &operator=(std::initializer_list<std::string> strvec)
Assignment operator from initializer list of strings.
- Parameters
&&strvec – is the list of strings.
- Returns
assigned vector ref.
-
T &operator=(std::initializer_list<uint64_t> vec)
Assignment operator from initializer list of unsigned integers.
- Parameters
&&vec – is the list of integers.
- Returns
assigned vector ref.
-
T &operator=(uint64_t val)
Assignment operator to assign value val to first entry, 0 for the rest of entries.
- Parameters
val – is the unsigned integer the first entry to be assigned from.
- Returns
assigned vector ref.
-
void SetModulus(const I &value)
Sets the vector modulus.
- Parameters
value – is the value to set.
value – is the modulus value to set.
-
void SwitchModulus(const I &value)
Sets the vector modulus and changes the values to match the new modulus.
- Parameters
value – is the value to set.
-
size_t GetLength() const
Gets the vector length.
- Returns
vector length.
-
T Mod(const I &modulus) const
Vector modulus operator.
- Parameters
&modulus – is the modulus to perform on the current vector entries.
- Returns
is the result of the modulus operation on current vector.
-
T &ModEq(const I &modulus)
Vector modulus operator. In-place variant.
- Parameters
&modulus – is the modulus to perform on the current vector entries.
- Returns
is the result of the modulus operation on current vector.
-
T ModAdd(const I &b) const
Scalar-to-vector modulus addition operation.
- Parameters
&b – is the scalar to perform operation with.
- Returns
is the result of the modulus addition operation.
-
T &ModAddEq(const I &b)
Scalar-to-vector modulus addition operation. In-place variant.
- Parameters
&b – is the scalar to perform operation with.
- Returns
is the result of the modulus addition operation.
-
T ModAddAtIndex(usint i, const I &b) const
Scalar modulus addition at a particular index.
- Parameters
i – is the index of the entry to add.
&b – is the scalar to add.
- Returns
is the result of the modulus addition operation.
-
T &ModAddAtIndexEq(usint i, const I &b)
Scalar modulus addition at a particular index. In-place variant.
- Parameters
i – is the index of the entry to add.
&b – is the scalar to add.
- Returns
is the result of the modulus addition operation.
-
T ModAdd(const T &b) const
Vector component wise modulus addition.
- Parameters
&b – is the vector to perform operation with.
- Returns
is the result of the component wise modulus addition operation.
-
T &ModAddEq(const T &b)
Vector component wise modulus addition. In-place variant.
- Parameters
&b – is the vector to perform operation with.
- Returns
is the result of the component wise modulus addition operation.
-
T ModSub(const I &b) const
Scalar-from-vector modulus subtraction operation.
- Parameters
&b – is the scalar to perform operation with.
- Returns
is the result of the modulus subtraction operation.
-
T &ModSubEq(const I &b)
Scalar-from-vector modulus subtraction operation. In-place variant.
- Parameters
&b – is the scalar to perform operation with.
- Returns
is the result of the modulus subtraction operation.
-
T ModSub(const T &b) const
Vector component wise modulus subtraction.
- Parameters
&b – is the vector to perform operation with.
- Returns
is the result of the component wise modulus subtraction operation.
-
T &ModSubEq(const T &b)
Vector component wise modulus subtraction. In-place variant.
- Parameters
&b – is the vector to perform operation with.
- Returns
is the result of the component wise modulus subtraction operation.
-
T ModMul(const I &b) const
Scalar-to-vector modulus multiplication operation.
- Parameters
&b – is the scalar to perform operation with.
- Returns
is the result of the modulus multiplication operation.
-
T &ModMulEq(const I &b)
Scalar-to-vector modulus multiplication operation. In-place variant.
- Parameters
&b – is the scalar to perform operation with.
- Returns
is the result of the modulus multiplication operation.
-
T ModMul(const T &b) const
Vector component wise modulus multiplication.
- Parameters
&b – is the vector to perform operation with.
- Returns
is the result of the component wise modulus multiplication operation.
-
T &ModMulEq(const T &b)
Vector component wise modulus multiplication. In-place variant.
- Parameters
&b – is the vector to perform operation with.
- Returns
is the result of the component wise modulus multiplication operation.
-
T ModExp(const I &b) const
Scalar modulus exponentiation operation.
- Parameters
&b – is the scalar to perform operation with.
- Returns
is the result of the modulus exponentiation operation.
-
T &ModExpEq(const I &b)
Scalar modulus exponentiation operation. In-place variant.
- Parameters
&b – is the scalar to perform operation with.
- Returns
is the result of the modulus exponentiation operation.
-
T ModInverse() const
Modulus inverse operation.
- Returns
is the result of the component wise modulus inverse operation.
-
T &ModInverseEq()
Modulus inverse operation. In-place variant.
- Returns
is the result of the component wise modulus inverse operation.
-
T ModByTwo() const
Modulus 2 operation, also a least significant bit.
- Returns
is the result of the component wise modulus 2 operation, also a least significant bit.
-
T &ModByTwoEq()
Modulus 2 operation, also a least significant bit. In-place variant.
- Returns
is the result of the component wise modulus 2 operation, also a least significant bit.
-
T MultiplyAndRound(const I &p, const I &q) const
Multiply and Rounding operation. Returns [x*p/q] where [] is the rounding operation.
- Parameters
&p – is the numerator to be multiplied.
&q – is the denominator to be divided.
- Returns
is the result of multiply and round operation.
-
T &MultiplyAndRoundEq(const I &p, const I &q)
Multiply and Rounding operation. Returns [x*p/q] where [] is the rounding operation. In-place variant.
- Parameters
&p – is the numerator to be multiplied.
&q – is the denominator to be divided.
- Returns
is the result of multiply and round operation.
-
T DivideAndRound(const I &q) const
Divide and Rounding operation. Returns [x/q] where [] is the rounding operation.
- Parameters
&q – is the denominator to be divided.
- Returns
is the result of divide and round operation.
-
T &DivideAndRoundEq(const I &q)
Divide and Rounding operation. Returns [x/q] where [] is the rounding operation. In-place variant.
- Parameters
&q – is the denominator to be divided.
- Returns
is the result of divide and round operation.
-
T GetDigitAtIndexForBase(usint index, usint base) const
Digit vector at a specific index for all entries for a given number base. Example: for vector (83, 1, 45), index 2 and base 4 we have:
|83| |3,0,1,1| |1| |1 | —base 4 decomposition–> |1,0,0,0| —at index 2–> |0| |45| |1,3,2,0| |2|index:0,1,2,3
The return vector is (1,0,2)
- Parameters
index – is the index to return the digit from in all entries.
base – is the base to use for the operation.
- Returns
is the digit at a specific index for all entries for a given number base
Protected Functions
-
~BigVectorInterface() = default
Friends
-
inline friend bool operator==(const T &a, const T &b)
Equals to operator.
- Parameters
&b – is vector to be compared.
- Returns
true if equal and false otherwise.
-
inline friend bool operator!=(const T &a, const T &b)
Not equal to operator.
- Parameters
b – is vector to be compared.
- Returns
true if not equal and false otherwise.
-
inline friend T operator+(const T &a, const I &b)
inline operators for the scara-to-vector modulus addition operations.
-
inline friend T operator+(const T &a, const T &b)
inline operators for the vector component wise modulus addition operations.
-
inline friend T operator-(const T &a, const I &b)
inline operators for the scalar-from-vector modulus subtraction operations.
-
inline friend T operator-(const T &a, const T &b)
inline operators for the vector component wise modulus subtraction operations.
-
inline friend T operator*(const T &a, const I &b)
inline operators for the scalar-to-vector modulus multiplication operations.
-
T &operator=(const T &vec)