Hypercomplex
Abstract & fast header-only C++ template library for lattice-based cryptosystems in high-dimensional algebras
|
#include <Hypercomplex.hpp>
Public Member Functions | |
Hypercomplex (const T *ARR) | |
This is the main constructor. More... | |
Hypercomplex (const Hypercomplex &H) | |
This is the copy constructor. More... | |
uint64_t | _ () const |
Dimensionality getter. More... | |
T | norm () const |
Calculate Euclidean norm of a number. More... | |
Hypercomplex | inv () const |
Calculate inverse of a given number. More... | |
template<const uint64_t newdim> | |
Hypercomplex< T, newdim > | expand () const |
Cast a number into a higher dimension. More... | |
Hypercomplex | operator~ () const |
Create a complex conjugate. More... | |
Hypercomplex | operator- () const |
Create an additive inverse of a given number. More... | |
Hypercomplex & | operator= (const Hypercomplex &H) |
Assignment operator. More... | |
T const & | operator[] (const uint64_t i) const |
Access operator (const) More... | |
T & | operator[] (const uint64_t i) |
Access operator (non-const) More... | |
Hypercomplex & | operator+= (const Hypercomplex &H) |
Addition-Assignment operator. More... | |
Hypercomplex & | operator-= (const Hypercomplex &H) |
Subtraction-Assignment operator. More... | |
Hypercomplex & | operator*= (const Hypercomplex &H) |
Multiplication-Assignment operator. More... | |
Hypercomplex & | operator^= (const uint64_t x) |
Power-Assignment operator. More... | |
Hypercomplex & | operator/= (const Hypercomplex &H) |
Division-Assignment operator. More... | |
Static Public Member Functions | |
static void | init () |
Basis multiplication table initialiser. | |
static void | clear () |
Cleanup function: free all memory. | |
static Hypercomplex | MUL (const Hypercomplex &H1, const Hypercomplex &H2) |
Optimised multiplication function. More... | |
Main class of the library
|
explicit |
This is the main constructor.
[in] | ARR | array of numbers |
Template parameters are:
Hypercomplex< T, dim >::Hypercomplex | ( | const Hypercomplex< T, dim > & | H | ) |
This is the copy constructor.
[in] | H | existing class instance |
Template parameters are:
|
inline |
Dimensionality getter.
Hypercomplex< T, newdim > Hypercomplex< T, dim >::expand |
Cast a number into a higher dimension.
New dimension is passed as a function template parameter, as the return class is not the same as the caller's class.
Hypercomplex< T, dim > Hypercomplex< T, dim >::inv |
Calculate inverse of a given number.
|
inlinestatic |
Optimised multiplication function.
[in] | H1 | LHS operand |
[in] | H2 | RHS operand |
|
inline |
Calculate Euclidean norm of a number.
Note that the return type is the same as template parameter.
Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator*= | ( | const Hypercomplex< T, dim > & | H | ) |
Multiplication-Assignment operator.
[in] | H | existing class instance |
Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator+= | ( | const Hypercomplex< T, dim > & | H | ) |
Addition-Assignment operator.
[in] | H | existing class instance |
Hypercomplex< T, dim > Hypercomplex< T, dim >::operator- |
Create an additive inverse of a given number.
Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator-= | ( | const Hypercomplex< T, dim > & | H | ) |
Subtraction-Assignment operator.
[in] | H | existing class instance |
Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator/= | ( | const Hypercomplex< T, dim > & | H | ) |
Division-Assignment operator.
[in] | H | existing class instance |
|
inline |
Assignment operator.
[in] | H | existing class instance |
|
inline |
Access operator (non-const)
[in] | i | index for the element to access |
Note that the return type is the same as template parameter.
|
inline |
Access operator (const)
[in] | i | index for the element to access |
Note that the return type is the same as template parameter.
Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator^= | ( | const uint64_t | x | ) |
Power-Assignment operator.
[in] | x | positive integer |
|
inline |
Create a complex conjugate.