PALISADE Lattice Crypto Library  1.11.9
A lattice crypto library for software engineers by software engineers.
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
NTL::myVecP< myT > Class Template Reference

The class for representing vectors of ubint with associated modulo math. More...

#include <mubintvecntl.h>

Inheritance diagram for NTL::myVecP< myT >:
Inheritance graph
[legend]
Collaboration diagram for NTL::myVecP< myT >:
Collaboration graph
[legend]

Public Member Functions

 myVecP (const size_t length)
 
 myVecP (INIT_SIZE_TYPE, const long length)
 
 myVecP (const myVecP< myT > &a)
 
 myVecP (myVecP< myT > &&a)
 
 myVecP (const long n, const myT &q)
 
 myVecP (const long n, const myT &q, std::initializer_list< std::string > rhs)
 
 myVecP (const long n, const myT &q, std::initializer_list< uint64_t > rhs)
 
 myVecP (const myVecP< myT > &a, const myT &q)
 
 myVecP (size_t n, const std::string &sq)
 
 myVecP (const myVecP< myT > &a, const std::string &sq)
 
 myVecP (size_t n, uint64_t q)
 
 myVecP (const myVecP< myT > &a, const uint64_t q)
 
 myVecP (std::vector< std::string > &s)
 
 myVecP (std::vector< std::string > &s, const myT &q)
 
 myVecP (std::vector< std::string > &s, const char *sq)
 
 myVecP (std::vector< std::string > &s, const uint64_t q)
 
void clear (myVecP &x)
 
const myVecPoperator= (const myVecP &a)
 
const myVecPoperator= (myVecP &&a)
 
const myVecPoperator= (std::initializer_list< uint64_t > rhs)
 
const myVecPoperator= (std::initializer_list< int32_t > rhs)
 
const myVecPoperator= (std::initializer_list< std::string > rhs)
 
const myVecPoperator= (uint64_t rhs)
 
myT & at (size_t i)
 
const myT & at (size_t i) const
 
myT & operator[] (size_t idx)
 
const myT & operator[] (size_t idx) const
 
void push_back (const myT &a)
 
void SwitchModulus (const myT &newModulus)
 
bool isModulusSet (void) const
 
bool SameModulus (const myVecP &a) const
 
void SetModulus (const uint64_t &value)
 
void SetModulus (const myT &value)
 
void SetModulus (const std::string &value)
 
void SetModulus (const myVecP &value)
 
const myT & GetModulus () const
 
int CopyModulus (const myVecP &rhs)
 
size_t GetLength (void) const
 
void resize (size_t n)
 
myVecP Mod (const myT &b) const
 
const myVecPModEq (const myT &b)
 
myVecP ModAdd (const myT &b) const
 
const myVecPModAddEq (const myT &b)
 
myVecP ModAddAtIndex (size_t i, const myT &b) const
 
const myVecPModAddAtIndexEq (size_t i, const myT &b)
 
myVecP ModAdd (const myVecP &b) const
 
const myVecPModAddEq (const myVecP &b)
 
void modadd_p (myVecP &x, const myVecP &a, const myVecP &b) const
 
myVecP ModSub (const myT &b) const
 
const myVecPModSubEq (const myT &b)
 
myVecP ModSub (const myVecP &b) const
 
const myVecPModSubEq (const myVecP &b)
 
void modsub_p (myVecP &x, const myVecP &a, const myVecP &b) const
 
myVecP ModMul (const myT &b) const
 
const myVecPModMulEq (const myT &b)
 
myVecP ModMul (const myVecP &b) const
 
const myVecPModMulEq (const myVecP &b)
 
void modmul_p (myVecP &x, const myVecP &a, const myVecP &b) const
 
myVecP ModExp (const myT &b) const
 
const myVecPModExpEq (const myT &b)
 
myVecP ModInverse () const
 
const myVecPModInverseEq ()
 
myVecP ModByTwo () const
 
const myVecPModByTwoEq ()
 
myVecP MultiplyAndRound (const myT &p, const myT &q) const
 
const myVecPMultiplyAndRoundEq (const myT &p, const myT &q)
 
myVecP DivideAndRound (const myT &q) const
 
const myVecPDivideAndRoundEq (const myT &q)
 
myVecP GetDigitAtIndexForBase (size_t index, usint base) const
 
template<class Archive >
std::enable_if<!cereal::traits::is_text_archive< Archive >::value, void >::type save (Archive &ar, std::uint32_t const version) const
 
template<class Archive >
std::enable_if< cereal::traits::is_text_archive< Archive >::value, void >::type save (Archive &ar, std::uint32_t const version) const
 
template<class Archive >
std::enable_if<!cereal::traits::is_text_archive< Archive >::value, void >::type load (Archive &ar, std::uint32_t const version)
 
template<class Archive >
std::enable_if< cereal::traits::is_text_archive< Archive >::value, void >::type load (Archive &ar, std::uint32_t const version)
 
std::string SerializedObjectName () const
 
- Public Member Functions inherited from lbcrypto::BigVectorInterface< myVecP< myT >, myT >
const myVecP< myT > & operator= (const myVecP< myT > &vec)
 
const myVecP< myT > & operator= (myVecP< myT > &&vec)
 
const myVecP< myT > & operator= (std::initializer_list< std::string > strvec)
 
const myVecP< myT > & operator= (std::initializer_list< uint64_t > vec)
 
const myVecP< myT > & operator= (uint64_t val)
 
myT & at (size_t idx)
 
const myT & at (size_t idx) const
 
myT & operator[] (size_t idx)
 
const myT & operator[] (size_t idx) const
 
void SetModulus (const myT &value)
 
void SwitchModulus (const myT &value)
 
const myT & GetModulus () const
 
size_t GetLength () const
 
myVecP< myT > Mod (const myT &modulus) const
 
const myVecP< myT > & ModEq (const myT &modulus)
 
myVecP< myT > ModAdd (const myT &b) const
 
myVecP< myT > ModAdd (const myVecP< myT > &b) const
 
const myVecP< myT > & ModAddEq (const myT &b)
 
const myVecP< myT > & ModAddEq (const myVecP< myT > &b)
 
myVecP< myT > ModAddAtIndex (usint i, const myT &b) const
 
const myVecP< myT > & ModAddAtIndexEq (usint i, const myT &b)
 
myVecP< myT > ModSub (const myT &b) const
 
myVecP< myT > ModSub (const myVecP< myT > &b) const
 
const myVecP< myT > & ModSubEq (const myT &b)
 
const myVecP< myT > & ModSubEq (const myVecP< myT > &b)
 
myVecP< myT > ModMul (const myT &b) const
 
myVecP< myT > ModMul (const myVecP< myT > &b) const
 
const myVecP< myT > & ModMulEq (const myT &b)
 
const myVecP< myT > & ModMulEq (const myVecP< myT > &b)
 
myVecP< myT > ModExp (const myT &b) const
 
const myVecP< myT > & ModExpEq (const myT &b)
 
myVecP< myT > ModInverse () const
 
const myVecP< myT > & ModInverseEq ()
 
myVecP< myT > ModByTwo () const
 
const myVecP< myT > & ModByTwoEq ()
 
myVecP< myT > MultiplyAndRound (const myT &p, const myT &q) const
 
const myVecP< myT > & MultiplyAndRoundEq (const myT &p, const myT &q)
 
myVecP< myT > DivideAndRound (const myT &q) const
 
const myVecP< myT > & DivideAndRoundEq (const myT &q)
 
myVecP< myT > GetDigitAtIndexForBase (usint index, usint base) const
 

Static Public Member Functions

static myVecP Single (const myT &val, const myT &modulus)
 
static uint32_t SerializedVersion ()
 

Protected Member Functions

bool IndexCheck (size_t index) const
 

Friends

std::ostream & operator<< (std::ostream &os, const myVecP< myT > &ptr_obj)
 

Additional Inherited Members

- Public Types inherited from lbcrypto::BigVectorInterface< myVecP< myT >, myT >
typedef myT Integer
 

Detailed Description

template<typename myT>
class NTL::myVecP< myT >

The class for representing vectors of ubint with associated modulo math.

Member Function Documentation

◆ DivideAndRound()

template<class myT >
myVecP< myT > NTL::myVecP< myT >::DivideAndRound ( const myT &  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<class myT >
const myVecP< myT > & NTL::myVecP< myT >::DivideAndRoundEq ( const myT &  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<class myT >
myVecP< myT > NTL::myVecP< myT >::GetDigitAtIndexForBase ( size_t  index,
usint  base 
) const

Digit vector at a specific index for all entries for a given number base. Warning: only power-of-2 bases are currently supported. 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

◆ Mod()

template<class myT >
myVecP< myT > NTL::myVecP< myT >::Mod ( const myT &  b) 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 myT>
myVecP NTL::myVecP< myT >::ModAdd ( const myT &  b) const
inline

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 myT>
myVecP NTL::myVecP< myT >::ModAdd ( const myVecP< myT > &  b) const
inline

Vector component wise modulus addition.

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

◆ modadd_p()

template<class myT >
void NTL::myVecP< myT >::modadd_p ( myVecP< myT > &  x,
const myVecP< myT > &  a,
const myVecP< myT > &  b 
) const
inline

procedural version for the vector component wise modulus addition operation.

◆ ModAddAtIndex()

template<class myT >
myVecP< myT > NTL::myVecP< myT >::ModAddAtIndex ( size_t  i,
const myT &  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<class myT >
const myVecP< myT > & NTL::myVecP< myT >::ModAddAtIndexEq ( size_t  i,
const myT &  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 myT>
const myVecP& NTL::myVecP< myT >::ModAddEq ( const myT &  b)
inline

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 myT>
const myVecP& NTL::myVecP< myT >::ModAddEq ( const myVecP< myT > &  b)
inline

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<class myT >
myVecP< myT > NTL::myVecP< myT >::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<class myT >
const myVecP< myT > & NTL::myVecP< myT >::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<class myT >
const myVecP< myT > & NTL::myVecP< myT >::ModEq ( const myT &  b)

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<class myT >
myVecP< myT > NTL::myVecP< myT >::ModExp ( const myT &  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<class myT >
const myVecP< myT > & NTL::myVecP< myT >::ModExpEq ( const myT &  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<class myT >
myVecP< myT > NTL::myVecP< myT >::ModInverse ( void  ) const

Modulus inverse operation.

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

◆ ModInverseEq()

template<class myT >
const myVecP< myT > & NTL::myVecP< myT >::ModInverseEq ( void  )

Modulus inverse operation. In-place variant.

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

◆ ModMul() [1/2]

template<typename myT>
myVecP NTL::myVecP< myT >::ModMul ( const myT &  b) const
inline

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 myT>
myVecP NTL::myVecP< myT >::ModMul ( const myVecP< myT > &  b) const
inline

Vector component wise modulus multiplication.

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

◆ modmul_p()

template<class myT >
void NTL::myVecP< myT >::modmul_p ( myVecP< myT > &  x,
const myVecP< myT > &  a,
const myVecP< myT > &  b 
) const
inline

procedural version for the vector component wise modulus multiplication operation.

◆ ModMulEq() [1/2]

template<typename myT>
const myVecP& NTL::myVecP< myT >::ModMulEq ( const myT &  b)
inline

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 myT>
const myVecP& NTL::myVecP< myT >::ModMulEq ( const myVecP< myT > &  b)
inline

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 myT>
myVecP NTL::myVecP< myT >::ModSub ( const myT &  b) const
inline

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 myT>
myVecP NTL::myVecP< myT >::ModSub ( const myVecP< myT > &  b) const
inline

Vector component wise modulus subtraction.

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

◆ modsub_p()

template<class myT >
void NTL::myVecP< myT >::modsub_p ( myVecP< myT > &  x,
const myVecP< myT > &  a,
const myVecP< myT > &  b 
) const

procedural version for the vector component wise modulus subtraction operation.

◆ ModSubEq() [1/2]

template<typename myT>
const myVecP& NTL::myVecP< myT >::ModSubEq ( const myT &  b)
inline

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 myT>
const myVecP& NTL::myVecP< myT >::ModSubEq ( const myVecP< myT > &  b)
inline

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<class myT >
myVecP< myT > NTL::myVecP< myT >::MultiplyAndRound ( const myT &  p,
const myT &  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<class myT >
const myVecP< myT > & NTL::myVecP< myT >::MultiplyAndRoundEq ( const myT &  p,
const myT &  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.

Friends And Related Function Documentation

◆ operator<<

template<typename myT>
std::ostream& operator<< ( std::ostream &  os,
const myVecP< myT > &  ptr_obj 
)
friend

ostream operator to output vector values to console

Parameters
osis the std ostream object.
&ptr_objis the BigVectorImpl object to be printed.
Returns
std ostream object which captures the vector values.

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