PALISADE Lattice Crypto Library  1.11.9
A lattice crypto library for software engineers by software engineers.
Classes | Public Types | Public Member Functions | List of all members
lbcrypto::MatrixStrassen< Element > Class Template Reference

Public Types

typedef vector< vector< Element > > data_t
 
typedef vector< Element > lineardata_t
 
typedef vector< Element >::iterator it_lineardata_t
 
typedef std::function< Element(void)> alloc_func
 

Public Member Functions

 MatrixStrassen (alloc_func allocZero, size_t rows, size_t cols)
 
 MatrixStrassen (alloc_func allocZero, size_t rows, size_t cols, alloc_func allocGen)
 
 MatrixStrassen (alloc_func allocZero)
 
void SetSize (size_t rows, size_t cols)
 
 MatrixStrassen (const MatrixStrassen< Element > &other)
 
MatrixStrassen< Element > & operator= (const MatrixStrassen< Element > &other)
 
MatrixStrassen< Element > & Ones ()
 
MatrixStrassen< Element > & Fill (const Element &val)
 
MatrixStrassen< Element > & Identity ()
 
MatrixStrassen< Element > GadgetVector (int32_t base=2) const
 
double Norm () const
 
MatrixStrassen< Element > operator* (MatrixStrassen< Element > const &other) const
 
MatrixStrassen< Element > ScalarMult (Element const &other) const
 
MatrixStrassen< Element > operator* (Element const &other) const
 
bool Equal (MatrixStrassen< Element > const &other) const
 
bool operator== (MatrixStrassen< Element > const &other) const
 
bool operator!= (MatrixStrassen< Element > const &other) const
 
const data_t & GetData () const
 
size_t GetRows () const
 
size_t GetCols () const
 
alloc_func GetAllocator () const
 
void SetFormat (Format format)
 
MatrixStrassen< Element > Add (MatrixStrassen< Element > const &other) const
 
MatrixStrassen< Element > operator+ (MatrixStrassen< Element > const &other) const
 
MatrixStrassen< Element > & operator+= (MatrixStrassen< Element > const &other)
 
MatrixStrassen< Element > Sub (MatrixStrassen< Element > const &other) const
 
MatrixStrassen< Element > operator- (MatrixStrassen< Element > const &other) const
 
MatrixStrassen< Element > & operator-= (MatrixStrassen< Element > const &other)
 
MatrixStrassen< Element > Transpose () const
 
void Determinant (Element *result) const
 
MatrixStrassen< Element > CofactorMatrixStrassen () const
 
MatrixStrassen< Element > & VStack (MatrixStrassen< Element > const &other)
 
MatrixStrassen< Element > & HStack (MatrixStrassen< Element > const &other)
 
Element & operator() (size_t row, size_t col)
 
Element const & operator() (size_t row, size_t col) const
 
MatrixStrassen< Element > ExtractRow (size_t row) const
 
void SwitchFormat ()
 
MatrixStrassen< Element > Mult (const MatrixStrassen< Element > &other, int nrec=0, int pad=-1) const
 
MatrixStrassen< Element > MultByUnityVector () const
 
MatrixStrassen< Element > MultByRandomVector (std::vector< int > ranvec) const
 

Constructor & Destructor Documentation

◆ MatrixStrassen() [1/4]

template<class Element>
lbcrypto::MatrixStrassen< Element >::MatrixStrassen ( alloc_func  allocZero,
size_t  rows,
size_t  cols 
)
inline

Constructor that initializes matrix values using a zero allocator

Parameters
&allocZerolambda function for zero initialization.
&rowsnumber of rows.
&rowsnumber of columns.

◆ MatrixStrassen() [2/4]

template<class Element >
lbcrypto::MatrixStrassen< Element >::MatrixStrassen ( alloc_func  allocZero,
size_t  rows,
size_t  cols,
alloc_func  allocGen 
)

Constructor that initializes matrix values using a distribution generation allocator

Parameters
&allocZerolambda function for zero initialization (used for initializing derived matrix objects)
&rowsnumber of rows.
&rowsnumber of columns.
&allocGenlambda function for intialization using a distribution generator.

◆ MatrixStrassen() [3/4]

template<class Element>
lbcrypto::MatrixStrassen< Element >::MatrixStrassen ( alloc_func  allocZero)
inlineexplicit

Constructor of an empty matrix; SetSize must be called on this matrix to use it Basically this exists to support deserializing

Parameters
&allocZerolambda function for zero initialization.

◆ MatrixStrassen() [4/4]

template<class Element>
lbcrypto::MatrixStrassen< Element >::MatrixStrassen ( const MatrixStrassen< Element > &  other)
inline

Copy constructor

Parameters
&otherthe matrix object to be copied

Member Function Documentation

◆ Add()

template<class Element>
MatrixStrassen<Element> lbcrypto::MatrixStrassen< Element >::Add ( MatrixStrassen< Element > const &  other) const
inline

MatrixStrassen addition

Parameters
&otherthe matrix to be added
Returns
the resulting matrix

◆ CofactorMatrixStrassen()

template<class Element >
MatrixStrassen< Element > lbcrypto::MatrixStrassen< Element >::CofactorMatrixStrassen ( ) const
inline

Cofactor matrix - the matrix of determinants of the minors A_{ij} multiplied by -1^{i+j}

Returns
the cofactor matrix for the given matrix

◆ Determinant()

template<class Element >
void lbcrypto::MatrixStrassen< Element >::Determinant ( Element *  result) const
inline

MatrixStrassen determinant - found using Laplace formula with complexity O(d!), where d is the dimension

Parameters
*resultwhere the result is stored

◆ Equal()

template<class Element>
bool lbcrypto::MatrixStrassen< Element >::Equal ( MatrixStrassen< Element > const &  other) const
inline

Equality check

Parameters
&otherthe matrix object to compare to
Returns
the boolean result

◆ ExtractRow()

template<class Element>
MatrixStrassen<Element> lbcrypto::MatrixStrassen< Element >::ExtractRow ( size_t  row) const
inline

MatrixStrassen row extractor

Parameters
&rowrow index
Returns
the row at the index

◆ Fill()

template<class Element >
MatrixStrassen< Element > & lbcrypto::MatrixStrassen< Element >::Fill ( const Element &  val)
inline

Fill matrix using the same element

Parameters
&valthe element the matrix is filled by
Returns
the resulting matrix

◆ GadgetVector()

template<class Element >
MatrixStrassen< Element > lbcrypto::MatrixStrassen< Element >::GadgetVector ( int32_t  base = 2) const
inline

Sets the first row to be powers of two

Returns
the resulting matrix

◆ GetAllocator()

template<class Element>
alloc_func lbcrypto::MatrixStrassen< Element >::GetAllocator ( ) const
inline

Get property to access the zero allocator for the matrix

Returns
the lambda function corresponding to the element zero allocator

◆ GetCols()

template<class Element>
size_t lbcrypto::MatrixStrassen< Element >::GetCols ( ) const
inline

Get property to access the number of columns in the matrix

Returns
the number of columns

◆ GetData()

template<class Element>
const data_t& lbcrypto::MatrixStrassen< Element >::GetData ( ) const
inline

Get property to access the data as a vector of vectors

Returns
the data as vector of vectors

◆ GetRows()

template<class Element>
size_t lbcrypto::MatrixStrassen< Element >::GetRows ( ) const
inline

Get property to access the number of rows in the matrix

Returns
the number of rows

◆ HStack()

template<class Element >
MatrixStrassen< Element > & lbcrypto::MatrixStrassen< Element >::HStack ( MatrixStrassen< Element > const &  other)
inline

Add columns the right of the matrix

Parameters
&otherthe matrix to be added to the right of current matrix
Returns
the resulting matrix

◆ Identity()

template<class Element >
MatrixStrassen< Element > & lbcrypto::MatrixStrassen< Element >::Identity ( )
inline

In-place change of the current matrix to Identity matrix

Returns
the resulting matrix

◆ Mult()

template<class Element >
MatrixStrassen< Element > lbcrypto::MatrixStrassen< Element >::Mult ( const MatrixStrassen< Element > &  other,
int  nrec = 0,
int  pad = -1 
) const

MatrixStrassen multiplication

Parameters
&otherthe multiplier matrix
Returns
the result of multiplication

◆ Norm()

template<class Element >
double lbcrypto::MatrixStrassen< Element >::Norm ( ) const
inline

Computes the infinity norm

Returns
the norm in double format

◆ Ones()

template<class Element >
MatrixStrassen< Element > & lbcrypto::MatrixStrassen< Element >::Ones ( )
inline

In-place change of the current matrix to a matrix of all ones

Returns
the resulting matrix

◆ operator!=()

template<class Element>
bool lbcrypto::MatrixStrassen< Element >::operator!= ( MatrixStrassen< Element > const &  other) const
inline

Operator for non-equality check

Parameters
&otherthe matrix object to compare to
Returns
the boolean result

◆ operator()() [1/2]

template<class Element>
Element& lbcrypto::MatrixStrassen< Element >::operator() ( size_t  row,
size_t  col 
)
inline

MatrixStrassen indexing operator - writeable instance of the element

Parameters
&rowrow index
&colcolumn index
Returns
the element at the index

◆ operator()() [2/2]

template<class Element>
Element const& lbcrypto::MatrixStrassen< Element >::operator() ( size_t  row,
size_t  col 
) const
inline

MatrixStrassen indexing operator - read-only instance of the element

Parameters
&rowrow index
&colcolumn index
Returns
the element at the index

◆ operator*() [1/2]

template<class Element>
MatrixStrassen<Element> lbcrypto::MatrixStrassen< Element >::operator* ( MatrixStrassen< Element > const &  other) const
inline

Operator for matrix multiplication

Parameters
&otherthe multiplier matrix
Returns
the result of multiplication

◆ operator*() [2/2]

template<class Element>
MatrixStrassen<Element> lbcrypto::MatrixStrassen< Element >::operator* ( Element const &  other) const
inline

Operator for scalar multiplication

Parameters
&otherthe multiplier element
Returns
the result of multiplication

◆ operator+()

template<class Element>
MatrixStrassen<Element> lbcrypto::MatrixStrassen< Element >::operator+ ( MatrixStrassen< Element > const &  other) const
inline

Operator for matrix addition

Parameters
&otherthe matrix to be added
Returns
the resulting matrix

◆ operator+=()

template<class Element >
MatrixStrassen< Element > & lbcrypto::MatrixStrassen< Element >::operator+= ( MatrixStrassen< Element > const &  other)
inline

Operator for in-place addition

Parameters
&otherthe matrix to be added
Returns
the resulting matrix (same object)

◆ operator-()

template<class Element>
MatrixStrassen<Element> lbcrypto::MatrixStrassen< Element >::operator- ( MatrixStrassen< Element > const &  other) const
inline

Operator for matrix substraction

Parameters
&otherthe matrix to be substracted
Returns
the resulting matrix

◆ operator-=()

template<class Element >
MatrixStrassen< Element > & lbcrypto::MatrixStrassen< Element >::operator-= ( MatrixStrassen< Element > const &  other)
inline

Operator for in-place matrix substraction

Parameters
&otherthe matrix to be substracted
Returns
the resulting matrix (same object)

◆ operator=()

template<class Element >
MatrixStrassen< Element > & lbcrypto::MatrixStrassen< Element >::operator= ( const MatrixStrassen< Element > &  other)
inline

Assignment operator

Parameters
&otherthe matrix object whose values are to be copied
Returns
the resulting matrix

◆ operator==()

template<class Element>
bool lbcrypto::MatrixStrassen< Element >::operator== ( MatrixStrassen< Element > const &  other) const
inline

Operator for equality check

Parameters
&otherthe matrix object to compare to
Returns
the boolean result

◆ ScalarMult()

template<class Element>
MatrixStrassen<Element> lbcrypto::MatrixStrassen< Element >::ScalarMult ( Element const &  other) const
inline

Multiplication of matrix by a scalar

Parameters
&otherthe multiplier element
Returns
the result of multiplication

◆ SetFormat()

template<class Element >
void lbcrypto::MatrixStrassen< Element >::SetFormat ( Format  format)

Sets the evaluation or coefficient representation for all ring elements that support the SetFormat method

Parameters
&formatthe enum value corresponding to coefficient or evaluation representation

◆ Sub()

template<class Element>
MatrixStrassen<Element> lbcrypto::MatrixStrassen< Element >::Sub ( MatrixStrassen< Element > const &  other) const
inline

MatrixStrassen substraction

Parameters
&otherthe matrix to be substracted
Returns
the resulting matrix

◆ SwitchFormat()

template<class Element >
void lbcrypto::MatrixStrassen< Element >::SwitchFormat ( )
inline

Call switch format for each (ring) element

◆ Transpose()

template<class Element >
MatrixStrassen< Element > lbcrypto::MatrixStrassen< Element >::Transpose ( ) const
inline

MatrixStrassen transposition

Returns
the resulting matrix

◆ VStack()

template<class Element >
MatrixStrassen< Element > & lbcrypto::MatrixStrassen< Element >::VStack ( MatrixStrassen< Element > const &  other)
inline

Add rows to bottom of the matrix

Parameters
&otherthe matrix to be added to the bottom of current matrix
Returns
the resulting matrix

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