PALISADE Lattice Crypto Library  1.11.9
A lattice crypto library for software engineers by software engineers.
Public Types | Public Member Functions | Friends | List of all members
lbcrypto::BigVectorInterface< T, I > Class Template Reference

Public Types

typedef I Integer
 

Public Member Functions

const T & operator= (const T &vec)
 
const T & operator= (T &&vec)
 
const T & operator= (std::initializer_list< std::string > strvec)
 
const T & operator= (std::initializer_list< uint64_t > vec)
 
const T & operator= (uint64_t val)
 
I & at (size_t idx)
 
const I & at (size_t idx) const
 
I & operator[] (size_t idx)
 
const I & operator[] (size_t idx) const
 
void SetModulus (const I &value)
 
void SwitchModulus (const I &value)
 
const I & GetModulus () const
 
size_t GetLength () const
 
Mod (const I &modulus) const
 
const T & ModEq (const I &modulus)
 
ModAdd (const I &b) const
 
const T & ModAddEq (const I &b)
 
ModAddAtIndex (usint i, const I &b) const
 
const T & ModAddAtIndexEq (usint i, const I &b)
 
ModAdd (const T &b) const
 
const T & ModAddEq (const T &b)
 
ModSub (const I &b) const
 
const T & ModSubEq (const I &b)
 
ModSub (const T &b) const
 
const T & ModSubEq (const T &b)
 
ModMul (const I &b) const
 
const T & ModMulEq (const I &b)
 
ModMul (const T &b) const
 
const T & ModMulEq (const T &b)
 
ModExp (const I &b) const
 
const T & ModExpEq (const I &b)
 
ModInverse () const
 
const T & ModInverseEq ()
 
ModByTwo () const
 
const T & ModByTwoEq ()
 
MultiplyAndRound (const I &p, const I &q) const
 
const T & MultiplyAndRoundEq (const I &p, const I &q)
 
DivideAndRound (const I &q) const
 
const T & DivideAndRoundEq (const I &q)
 
GetDigitAtIndexForBase (usint index, usint base) const
 

Friends

bool operator== (const T &a, const T &b)
 
bool operator!= (const T &a, const T &b)
 
operator% (const T &a, const I &b)
 inline operators for the modulus operations.
 
const T & operator%= (T &a, const I &b)
 
operator+ (const T &a, const I &b)
 inline operators for the scara-to-vector modulus addition operations.
 
const T & operator+= (T &a, const I &b)
 
operator+ (const T &a, const T &b)
 
const T & operator+= (T &a, const T &b)
 
operator- (const T &a, const I &b)
 
const T & operator-= (T &a, const I &b)
 
operator- (const T &a, const T &b)
 
const T & operator-= (T &a, const T &b)
 
operator- (const T &a)
 inline operator for the unary minus
 
operator* (const T &a, const I &b)
 
const T & operator*= (T &a, const I &b)
 
operator* (const T &a, const T &b)
 
const T & operator*= (T &a, const T &b)
 

Member Function Documentation

◆ DivideAndRound()

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::DivideAndRound ( const I &  q) const

Divide and Rounding operation. Returns [x/q] where [] is the rounding operation.

Parameters
&qis the denominator to be divided.
Returns
is the result of divide and round operation.

◆ DivideAndRoundEq()

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::DivideAndRoundEq ( const I &  q)

Divide and Rounding operation. Returns [x/q] where [] is the rounding operation. In-place variant.

Parameters
&qis the denominator to be divided.
Returns
is the result of divide and round operation.

◆ GetDigitAtIndexForBase()

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::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:

                      index:0,1,2,3

|83| |3,0,1,1| |1| |1 | –base 4 decomposition–> |1,0,0,0| –at index 2–> |0| |45| |1,3,2,0| |2|

The return vector is (1,0,2)

Parameters
indexis the index to return the digit from in all entries.
baseis the base to use for the operation.
Returns
is the digit at a specific index for all entries for a given number base

◆ GetLength()

template<typename T, typename I>
size_t lbcrypto::BigVectorInterface< T, I >::GetLength ( ) const

Gets the vector length.

Returns
vector length.

◆ GetModulus()

template<typename T, typename I>
const I& lbcrypto::BigVectorInterface< T, I >::GetModulus ( ) const

Gets the vector modulus.

Returns
the vector modulus.

◆ Mod()

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::Mod ( const I &  modulus) const

Vector modulus operator.

Parameters
&modulusis the modulus to perform on the current vector entries.
Returns
is the result of the modulus operation on current vector.

◆ ModAdd() [1/2]

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::ModAdd ( const I &  b) const

Scalar-to-vector modulus addition operation.

Parameters
&bis the scalar to perform operation with.
Returns
is the result of the modulus addition operation.

◆ ModAdd() [2/2]

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::ModAdd ( const T &  b) const

Vector component wise modulus addition.

Parameters
&bis the vector to perform operation with.
Returns
is the result of the component wise modulus addition operation.

◆ ModAddAtIndex()

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::ModAddAtIndex ( usint  i,
const I &  b 
) const

Scalar modulus addition at a particular index.

Parameters
iis the index of the entry to add.
&bis the scalar to add.
Returns
is the result of the modulus addition operation.

◆ ModAddAtIndexEq()

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModAddAtIndexEq ( usint  i,
const I &  b 
)

Scalar modulus addition at a particular index. In-place variant.

Parameters
iis the index of the entry to add.
&bis the scalar to add.
Returns
is the result of the modulus addition operation.

◆ ModAddEq() [1/2]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModAddEq ( const I &  b)

Scalar-to-vector modulus addition operation. In-place variant.

Parameters
&bis the scalar to perform operation with.
Returns
is the result of the modulus addition operation.

◆ ModAddEq() [2/2]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModAddEq ( const T &  b)

Vector component wise modulus addition. In-place variant.

Parameters
&bis the vector to perform operation with.
Returns
is the result of the component wise modulus addition operation.

◆ ModByTwo()

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::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.

◆ ModByTwoEq()

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::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.

◆ ModEq()

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModEq ( const I &  modulus)

Vector modulus operator. In-place variant.

Parameters
&modulusis the modulus to perform on the current vector entries.
Returns
is the result of the modulus operation on current vector.

◆ ModExp()

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::ModExp ( const I &  b) const

Scalar modulus exponentiation operation.

Parameters
&bis the scalar to perform operation with.
Returns
is the result of the modulus exponentiation operation.

◆ ModExpEq()

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModExpEq ( const I &  b)

Scalar modulus exponentiation operation. In-place variant.

Parameters
&bis the scalar to perform operation with.
Returns
is the result of the modulus exponentiation operation.

◆ ModInverse()

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::ModInverse ( ) const

Modulus inverse operation.

Returns
is the result of the component wise modulus inverse operation.

◆ ModInverseEq()

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModInverseEq ( )

Modulus inverse operation. In-place variant.

Returns
is the result of the component wise modulus inverse operation.

◆ ModMul() [1/2]

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::ModMul ( const I &  b) const

Scalar-to-vector modulus multiplication operation.

Parameters
&bis the scalar to perform operation with.
Returns
is the result of the modulus multiplication operation.

◆ ModMul() [2/2]

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::ModMul ( const T &  b) const

Vector component wise modulus multiplication.

Parameters
&bis the vector to perform operation with.
Returns
is the result of the component wise modulus multiplication operation.

◆ ModMulEq() [1/2]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModMulEq ( const I &  b)

Scalar-to-vector modulus multiplication operation. In-place variant.

Parameters
&bis the scalar to perform operation with.
Returns
is the result of the modulus multiplication operation.

◆ ModMulEq() [2/2]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModMulEq ( const T &  b)

Vector component wise modulus multiplication. In-place variant.

Parameters
&bis the vector to perform operation with.
Returns
is the result of the component wise modulus multiplication operation.

◆ ModSub() [1/2]

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::ModSub ( const I &  b) const

Scalar-from-vector modulus subtraction operation.

Parameters
&bis the scalar to perform operation with.
Returns
is the result of the modulus subtraction operation.

◆ ModSub() [2/2]

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::ModSub ( const T &  b) const

Vector component wise modulus subtraction.

Parameters
&bis the vector to perform operation with.
Returns
is the result of the component wise modulus subtraction operation.

◆ ModSubEq() [1/2]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModSubEq ( const I &  b)

Scalar-from-vector modulus subtraction operation. In-place variant.

Parameters
&bis the scalar to perform operation with.
Returns
is the result of the modulus subtraction operation.

◆ ModSubEq() [2/2]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::ModSubEq ( const T &  b)

Vector component wise modulus subtraction. In-place variant.

Parameters
&bis the vector to perform operation with.
Returns
is the result of the component wise modulus subtraction operation.

◆ MultiplyAndRound()

template<typename T, typename I>
T lbcrypto::BigVectorInterface< T, I >::MultiplyAndRound ( const I &  p,
const I &  q 
) const

Multiply and Rounding operation. Returns [x*p/q] where [] is the rounding operation.

Parameters
&pis the numerator to be multiplied.
&qis the denominator to be divided.
Returns
is the result of multiply and round operation.

◆ MultiplyAndRoundEq()

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::MultiplyAndRoundEq ( const I &  p,
const I &  q 
)

Multiply and Rounding operation. Returns [x*p/q] where [] is the rounding operation. In-place variant.

Parameters
&pis the numerator to be multiplied.
&qis the denominator to be divided.
Returns
is the result of multiply and round operation.

◆ operator=() [1/5]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::operator= ( const T &  vec)

Copy assignment operator.

Parameters
&vecis the vector to be assigned from.
Returns
assigned vector ref.

◆ operator=() [2/5]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::operator= ( T &&  vec)

Move assignment operator.

Parameters
&vecis the vector to be assigned from.
Returns
assigned vector ref.

◆ operator=() [3/5]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::operator= ( std::initializer_list< std::string >  strvec)

Assignment operator from initializer list of strings.

Parameters
&&strvecis the list of strings.
Returns
assigned vector ref.

◆ operator=() [4/5]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::operator= ( std::initializer_list< uint64_t >  vec)

Assignment operator from initializer list of unsigned integers.

Parameters
&&vecis the list of integers.
Returns
assigned vector ref.

◆ operator=() [5/5]

template<typename T, typename I>
const T& lbcrypto::BigVectorInterface< T, I >::operator= ( uint64_t  val)

Assignment operator to assign value val to first entry, 0 for the rest of entries.

Parameters
valis the unsigned integer the first entry to be assigned from.
Returns
assigned vector ref.

◆ SetModulus()

template<typename T, typename I>
void lbcrypto::BigVectorInterface< T, I >::SetModulus ( const I &  value)

Sets the vector modulus.

Parameters
valueis the value to set.
valueis the modulus value to set.

◆ SwitchModulus()

template<typename T, typename I>
void lbcrypto::BigVectorInterface< T, I >::SwitchModulus ( const I &  value)

Sets the vector modulus and changes the values to match the new modulus.

Parameters
valueis the value to set.

Friends And Related Function Documentation

◆ operator!=

template<typename T, typename I>
bool operator!= ( const T &  a,
const T &  b 
)
friend

Not equal to operator.

Parameters
bis vector to be compared.
Returns
true if not equal and false otherwise.

◆ operator* [1/2]

template<typename T, typename I>
T operator* ( const T &  a,
const I &  b 
)
friend

inline operators for the scalar-to-vector modulus multiplication operations.

◆ operator* [2/2]

template<typename T, typename I>
T operator* ( const T &  a,
const T &  b 
)
friend

inline operators for the vector component wise modulus multiplication operations.

◆ operator+

template<typename T, typename I>
T operator+ ( const T &  a,
const T &  b 
)
friend

inline operators for the vector component wise modulus addition operations.

◆ operator- [1/2]

template<typename T, typename I>
T operator- ( const T &  a,
const I &  b 
)
friend

inline operators for the scalar-from-vector modulus subtraction operations.

◆ operator- [2/2]

template<typename T, typename I>
T operator- ( const T &  a,
const T &  b 
)
friend

inline operators for the vector component wise modulus subtraction operations.

◆ operator==

template<typename T, typename I>
bool operator== ( const T &  a,
const T &  b 
)
friend

Equals to operator.

Parameters
&bis vector to be compared.
Returns
true if equal and false otherwise.

The documentation for this class was generated from the following file: