diff --git a/docs/DoxygenLayout.xml b/docs/DoxygenLayout.xml index bf8fa24..6d31a54 100644 --- a/docs/DoxygenLayout.xml +++ b/docs/DoxygenLayout.xml @@ -5,6 +5,7 @@ + diff --git a/docs/html/_hypercomplex_8hpp.html b/docs/html/_hypercomplex_8hpp.html index a96bbc0..b421ca0 100644 --- a/docs/html/_hypercomplex_8hpp.html +++ b/docs/html/_hypercomplex_8hpp.html @@ -83,12 +83,12 @@
Hypercomplex.hpp File Reference
-
#include <mpfr.h>
-#include <cassert>
+
#include <cassert>
#include <cmath>
#include <iostream>
#include <stdexcept>
@@ -100,172 +100,123 @@ Classes class  Hypercomplex< T, dim >   -class  Hypercomplex< mpfr_t, dim > -  class  Hypercomplex< Polynomial< MaxDeg >, dim >   + + + + +

+Macros

+#define USEMPFR   0
 Compile-time flag to include MPFR class specialisation (default: false).
 
- + - + - + - + - + - - - - - + + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - - - - - + + + + + - + - + - + - + - + - + @@ -277,7 +228,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

Functions

template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
bool operator== (const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
 Equality operator. More...
 
template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
bool operator!= (const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
 Inequality operator. More...
 
template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
Hypercomplex< T, dim > operator+ (const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
 Addition operator. More...
 
template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
Hypercomplex< T, dim > operator- (const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
 Subtraction operator. More...
 
template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
Hypercomplex< T, dim > operator* (const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
 Multiplication operator. More...
 
template<typename T , const unsigned int dim>
Hypercomplex< T, dim > operator^ (const Hypercomplex< T, dim > &H, const unsigned int x)
 Power operator. More...
 
template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
Hypercomplex< T, dim > operator^ (const Hypercomplex< T, dim > &H, const uint64_t x)
 Power operator. More...
 
template<typename T , const uint64_t dim>
Hypercomplex< T, dim > operator/ (const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
 Division operator. More...
 
template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
std::ostream & operator<< (std::ostream &os, const Hypercomplex< T, dim > &H)
 Print operator. More...
 
template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
Hypercomplex< T, dim > Re (const Hypercomplex< T, dim > &H)
 Real part of a hypercomplex number. More...
 
template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
Hypercomplex< T, dim > Im (const Hypercomplex< T, dim > &H)
 Imaginary part of a hypercomplex number. More...
 
template<typename T , const unsigned int dim>
template<typename T , const uint64_t dim>
Hypercomplex< T, dim > exp (const Hypercomplex< T, dim > &H)
 Exponentiation operation on a hypercomplex number. More...
 
unsigned int get_mpfr_precision ()
 Getter for the global precision of the MPFR variables. More...
 
void set_mpfr_precision (unsigned int n)
 Setter for the global precision of the MPFR variables. More...
 
-void clear_mpfr_memory ()
 Wrapper for MPFR memory cleanup.
 
template<const unsigned int dim>
bool operator== (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Equality operator. More...
 
template<const unsigned int dim>
bool operator!= (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Inequality operator. More...
 
template<const unsigned int dim>
Hypercomplex< mpfr_t, dim > operator+ (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Addition operator. More...
 
template<const unsigned int dim>
Hypercomplex< mpfr_t, dim > operator- (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Subtraction operator. More...
 
template<const unsigned int dim>
Hypercomplex< mpfr_t, dim > operator* (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Multiplication operator. More...
 
template<const unsigned int dim>
Hypercomplex< mpfr_t, dim > operator^ (const Hypercomplex< mpfr_t, dim > &H, const unsigned int x)
 Power operator. More...
 
template<const unsigned int dim>
Hypercomplex< mpfr_t, dim > operator/ (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Division operator. More...
 
template<const unsigned int dim>
std::ostream & operator<< (std::ostream &os, const Hypercomplex< mpfr_t, dim > &H)
 Print operator. More...
 
template<const unsigned int dim>
Hypercomplex< mpfr_t, dim > Re (const Hypercomplex< mpfr_t, dim > &H)
 Real part of a hypercomplex number. More...
 
template<const unsigned int dim>
Hypercomplex< mpfr_t, dim > Im (const Hypercomplex< mpfr_t, dim > &H)
 Imaginary part of a hypercomplex number. More...
 
template<const unsigned int dim>
Hypercomplex< mpfr_t, dim > exp (const Hypercomplex< mpfr_t, dim > &H)
 Exponentiation operation on a hypercomplex number. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
bool operator== (const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2)
 Equality operator. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
bool operator!= (const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2)
 Inequality operator. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > operator+ (const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2)
 Addition operator. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > operator- (const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2)
 Subtraction operator. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
std::ostream & operator<< (std::ostream &os, const Hypercomplex< Polynomial< MaxDeg >, dim > &H)
 Print operator. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > operator* (const int64_t &x, const Hypercomplex< Polynomial< MaxDeg >, dim > &H)
 Scalar-Multiplication operator. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > operator% (const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod)
 Modular reduction operator. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > operator* (const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2)
 Multiplication operator. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
Hypercomplex< Polynomial< MaxDeg >, dim > operator^ (const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const unsigned int x)
 Power operator. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > operator^ (const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const uint64_t x)
 Power operator. More...
 
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > Re (const Hypercomplex< Polynomial< MaxDeg >, dim > &H)
 Real part of a hypercomplex number. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > Im (const Hypercomplex< Polynomial< MaxDeg >, dim > &H)
 Imaginary part of a hypercomplex number. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
void CenteredLift (Hypercomplex< Polynomial< MaxDeg >, dim > *H, const int64_t &mod)
 Center-lift hypercomplex elements in a modular quotient ring. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > RingInverse (const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod)
 Hypercomplex inverse in a modular quotient ring. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > PUBLICKEY (const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &G, const int64_t &q)
 Generate public key of the cryptosystem. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > ENCRYPT (const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const Hypercomplex< Polynomial< MaxDeg >, dim > &M, const Hypercomplex< Polynomial< MaxDeg >, dim > &PHI, const int64_t &p, const int64_t &q)
 Encrypt a message via the cryptosystem. More...
 
template<const unsigned int MaxDeg, const unsigned int dim>
template<const uint64_t MaxDeg, const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > DECRYPT (const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &E, const int64_t &p, const int64_t &q)
 Decrypt a message via the cryptosystem. More...
 
@@ -316,7 +267,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

void CenteredLift
@@ -370,7 +321,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

Hypercomplex< Polynomial< MaxDeg >, dim > DECRYPT
@@ -423,44 +374,15 @@

Returns
new class instance
- - -
-

◆ exp() [1/2]

- -
-
-
-template<const unsigned int dim>
-
Hypercomplex< Polynomial< MaxDeg >, dim > ENCRYPT
- - - - - - - -
Hypercomplex< mpfr_t, dim > exp (const Hypercomplex< mpfr_t, dim > & H)
-
- -

Exponentiation operation on a hypercomplex number.

-
Parameters
- - -
[in]Hexisting class instance
-
-
-
Returns
new class instance
-
-

◆ exp() [2/2]

+

◆ exp()

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
@@ -481,64 +403,15 @@

Returns
new class instance
- - -
-

◆ get_mpfr_precision()

- -
-
-

Hypercomplex< T, dim > exp
- - - - - - -
unsigned int get_mpfr_precision ()
-
- -

Getter for the global precision of the MPFR variables.

-
Returns
precision in bits
- -
-
- -

◆ Im() [1/3]

- -
-
-
-template<const unsigned int dim>
- - - - - - - - -
Hypercomplex< mpfr_t, dim > Im (const Hypercomplex< mpfr_t, dim > & H)
-
- -

Imaginary part of a hypercomplex number.

-
Parameters
- - -
[in]Hexisting class instance
-
-
-
Returns
new class instance
-
-

◆ Im() [2/3]

+

◆ Im() [1/2]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -562,12 +435,12 @@

-

◆ Im() [3/3]

+

◆ Im() [2/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< Polynomial< MaxDeg >, dim > Im
@@ -588,55 +461,15 @@

Returns
new class instance
- - -
-

◆ operator!=() [1/3]

- -
-
-
-template<const unsigned int dim>
-

Hypercomplex< T, dim > Im
- - - - - - - - - - - - - - - - - -
bool operator!= (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
-
- -

Inequality operator.

-
Parameters
- - - -
[in]H1LHS operand
[in]H2RHS operand
-
-
-
Returns
boolean value after the comparison
-
-

◆ operator!=() [2/3]

+

◆ operator!=() [1/2]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -671,12 +504,12 @@

-

◆ operator!=() [3/3]

+

◆ operator!=() [2/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

bool operator!=
@@ -716,7 +549,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

bool operator!=
@@ -748,55 +581,15 @@

Returns
new class instance
- - -
-

◆ operator*() [1/4]

- -
-
-
-template<const unsigned int dim>
-
Hypercomplex< Polynomial< MaxDeg >, dim > operator%
- - - - - - - - - - - - - - - - - -
Hypercomplex< mpfr_t, dim > operator* (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
-
- -

Multiplication operator.

-
Parameters
- - - -
[in]H1LHS operand
[in]H2RHS operand
-
-
-
Returns
new class instance
-
-

◆ operator*() [2/4]

+

◆ operator*() [1/3]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -831,12 +624,12 @@

-

◆ operator*() [3/4]

+

◆ operator*() [2/3]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< Polynomial< MaxDeg >, dim > operator*
@@ -871,12 +664,12 @@

-

◆ operator*() [4/4]

+

◆ operator*() [3/3]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

Hypercomplex< T, dim > operator*
@@ -908,55 +701,15 @@

Returns
new class instance
- - -
-

◆ operator+() [1/3]

- -
-
-
-template<const unsigned int dim>
-

Hypercomplex< Polynomial< MaxDeg >, dim > operator*
- - - - - - - - - - - - - - - - - -
Hypercomplex< mpfr_t, dim > operator+ (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
-
- -

Addition operator.

-
Parameters
- - - -
[in]H1LHS operand
[in]H2RHS operand
-
-
-
Returns
new class instance
-
-

◆ operator+() [2/3]

+

◆ operator+() [1/2]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -991,12 +744,12 @@

-

◆ operator+() [3/3]

+

◆ operator+() [2/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< Polynomial< MaxDeg >, dim > operator+
@@ -1028,55 +781,15 @@

Returns
new class instance
- - -
-

◆ operator-() [1/3]

- -
-
-
-template<const unsigned int dim>
-

Hypercomplex< T, dim > operator+
- - - - - - - - - - - - - - - - - -
Hypercomplex< mpfr_t, dim > operator- (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
-
- -

Subtraction operator.

-
Parameters
- - - -
[in]H1LHS operand
[in]H2RHS operand
-
-
-
Returns
new class instance
-
-

◆ operator-() [2/3]

+

◆ operator-() [1/2]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -1111,12 +824,12 @@

-

◆ operator-() [3/3]

+

◆ operator-() [2/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< Polynomial< MaxDeg >, dim > operator-
@@ -1148,55 +861,15 @@

Returns
new class instance
- - -
-

◆ operator/() [1/2]

- -
-
-
-template<const unsigned int dim>
-

Hypercomplex< T, dim > operator-
- - - - - - - - - - - - - - - - - -
Hypercomplex< mpfr_t, dim > operator/ (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
-
- -

Division operator.

-
Parameters
- - - -
[in]H1LHS operand
[in]H2RHS operand
-
-
-
Returns
new class instance
-
-

◆ operator/() [2/2]

+

◆ operator/()

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
@@ -1228,55 +901,15 @@

Returns
new class instance
- - -
-

◆ operator<<() [1/3]

- -
-
-
-template<const unsigned int dim>
-

Hypercomplex< T, dim > operator/
- - - - - - - - - - - - - - - - - -
std::ostream & operator<< (std::ostream & os,
const Hypercomplex< mpfr_t, dim > & H 
)
-
- -

Print operator.

-
Parameters
- - - -
[in,out]osoutput stream
[in]Hexisting class instance
-
-
-
Returns
output stream
-
-

◆ operator<<() [2/3]

+

◆ operator<<() [1/2]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -1311,12 +944,12 @@

-

◆ operator<<() [3/3]

+

◆ operator<<() [2/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

std::ostream & operator<<
@@ -1348,55 +981,15 @@

Returns
output stream
- - -
-

◆ operator==() [1/3]

- -
-
-
-template<const unsigned int dim>
-

std::ostream & operator<<
- - - - - - - - - - - - - - - - - -
bool operator== (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
-
- -

Equality operator.

-
Parameters
- - - -
[in]H1LHS operand
[in]H2RHS operand
-
-
-
Returns
boolean value after the comparison
-
-

◆ operator==() [2/3]

+

◆ operator==() [1/2]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -1431,12 +1024,12 @@

-

◆ operator==() [3/3]

+

◆ operator==() [2/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

bool operator==
@@ -1470,53 +1063,13 @@

-

◆ operator^() [1/3]

+ +

◆ operator^() [1/2]

-template<const unsigned int dim>
-

bool operator==
- - - - - - - - - - - - - - - - - -
Hypercomplex< mpfr_t, dim > operator^ (const Hypercomplex< mpfr_t, dim > & H,
const unsigned int x 
)
-
- -

Power operator.

-
Parameters
- - - -
[in]HLHS operand
[in]xRHS operand
-
-
-
Returns
new class instance
- -
- - -

◆ operator^() [2/3]

- -
-
-
-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -1527,7 +1080,7 @@

- + @@ -1550,13 +1103,13 @@

-

◆ operator^() [3/3]

+ +

◆ operator^() [2/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
Hypercomplex< Polynomial< MaxDeg >, dim > operator^ const unsigned int const uint64_t  x 
@@ -1567,7 +1120,7 @@

- + @@ -1596,7 +1149,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

Hypercomplex< T, dim > operator^ const unsigned int const uint64_t  x 
@@ -1635,44 +1188,15 @@

Returns
new class instance
- - -
-

◆ Re() [1/3]

- -
-
-
-template<const unsigned int dim>
-
Hypercomplex< Polynomial< MaxDeg >, dim > PUBLICKEY
- - - - - - - -
Hypercomplex< mpfr_t, dim > Re (const Hypercomplex< mpfr_t, dim > & H)
-
- -

Real part of a hypercomplex number.

-
Parameters
- - -
[in]Hexisting class instance
-
-
-
Returns
new class instance
-
-

◆ Re() [2/3]

+

◆ Re() [1/2]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -1696,12 +1220,12 @@

-

◆ Re() [3/3]

+

◆ Re() [2/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< Polynomial< MaxDeg >, dim > Re
@@ -1730,7 +1254,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

Hypercomplex< T, dim > Re
@@ -1762,32 +1286,6 @@

Returns
new class instance
- - -
-

◆ set_mpfr_precision()

- -
-
-
Hypercomplex< Polynomial< MaxDeg >, dim > RingInverse
- - - - - - - -
void set_mpfr_precision (unsigned int n)
-
- -

Setter for the global precision of the MPFR variables.

-
Parameters
- - -
[in]npositive integer (precision in bits)
-
-
-
diff --git a/docs/html/_hypercomplex_8hpp_source.html b/docs/html/_hypercomplex_8hpp_source.html index 30f5411..2e1e8b7 100644 --- a/docs/html/_hypercomplex_8hpp_source.html +++ b/docs/html/_hypercomplex_8hpp_source.html @@ -103,1478 +103,1007 @@
18#ifndef HYPERCOMPLEX_HYPERCOMPLEX_HPP_
19#define HYPERCOMPLEX_HYPERCOMPLEX_HPP_
20
-
21#include <mpfr.h>
-
22#include <cassert>
-
23#include <cmath>
-
24#include <iostream>
-
25#include <stdexcept>
-
26#include "./Polynomial.hpp"
-
27
-
28/*
-
29###############################################################################
-
30#
-
31# Header section
-
32#
-
33###############################################################################
-
34*/
-
35
-
38template <typename T, const unsigned int dim>
- -
40 private:
-
41 T* arr = new T[dim]; // NOLINT
-
42 static inline uint64_t** baseprodabs;
-
43 static inline bool** baseprodpos;
+
21// Conditional MPFR inclusion
+
22#ifndef USEMPFR
+
25#define USEMPFR 0
+
26#endif
+
27#if USEMPFR
+
28#include <mpfr.h>
+
29#endif
+
30
+
31#include <cassert>
+
32#include <cmath>
+
33#include <iostream>
+
34#include <stdexcept>
+
35#include "./Polynomial.hpp"
+
36
+
37/*
+
38###############################################################################
+
39#
+
40# Header section
+
41#
+
42###############################################################################
+
43*/
44
-
45 public:
-
48 static void init() {
-
49 int64_t** M = new int64_t*[dim];
-
50 for (unsigned int i = 0; i < dim; i++) M[i] = new int64_t[dim];
-
51 M[0][0] = 1;
-
52 unsigned int n = 1;
-
53 while (n != dim) {
-
54 for (unsigned int i=0; i < n; i++) {
-
55 for (unsigned int j=0; j < n; j++) {
-
56 M[i][n+j] = M[j][i] > 0 ? M[j][i] + n : M[j][i] - n;
-
57 M[i+n][j] = M[i][j] > 0 ? M[i][j] + n : M[i][j] - n;
-
58 M[i+n][j] = M[i+n][j] * (j ? -1 : 1);
-
59 M[i+n][j+n] = -M[j][i] * (j ? -1 : 1);
-
60 }
-
61 }
-
62 n *= 2;
-
63 }
-
64 baseprodabs = new uint64_t*[dim];
-
65 baseprodpos = new bool*[dim];
-
66 for (unsigned int i = 0; i < dim; i++) {
-
67 baseprodabs[i] = new uint64_t[dim];
-
68 baseprodpos[i] = new bool[dim];
-
69 }
-
70 for (unsigned int i=0; i < dim; i++) {
-
71 for (unsigned int j=0; j < dim; j++) {
-
72 baseprodabs[i][j] = std::abs(M[i][j]) - 1;
-
73 baseprodpos[i][j] = (0 < M[i][j]);
-
74 }
-
75 }
-
76 for (unsigned int i = 0; i < dim; i++) {
-
77 delete[] M[i];
+
47template <typename T, const uint64_t dim>
+ +
49 private:
+
50 T* arr = new T[dim]; // NOLINT
+
51 static inline uint64_t** baseprodabs;
+
52 static inline bool** baseprodpos;
+
53
+
54 public:
+
57 static void init() {
+
58 int64_t** M = new int64_t*[dim];
+
59 for (uint64_t i = 0; i < dim; i++) M[i] = new int64_t[dim];
+
60 M[0][0] = 1;
+
61 uint64_t n = 1;
+
62 while (n != dim) {
+
63 for (uint64_t i=0; i < n; i++) {
+
64 for (uint64_t j=0; j < n; j++) {
+
65 M[i][n+j] = M[j][i] > 0 ? M[j][i] + n : M[j][i] - n;
+
66 M[i+n][j] = M[i][j] > 0 ? M[i][j] + n : M[i][j] - n;
+
67 M[i+n][j] = M[i+n][j] * (j ? -1 : 1);
+
68 M[i+n][j+n] = -M[j][i] * (j ? -1 : 1);
+
69 }
+
70 }
+
71 n *= 2;
+
72 }
+
73 baseprodabs = new uint64_t*[dim];
+
74 baseprodpos = new bool*[dim];
+
75 for (uint64_t i = 0; i < dim; i++) {
+
76 baseprodabs[i] = new uint64_t[dim];
+
77 baseprodpos[i] = new bool[dim];
78 }
-
79 delete[] M;
-
80 }
-
81
-
84 static void clear() {
-
85 for (unsigned int i = 0; i < dim; i++) {
-
86 delete[] baseprodabs[i];
-
87 delete[] baseprodpos[i];
-
88 }
-
89 delete[] baseprodabs;
-
90 delete[] baseprodpos;
-
91 }
-
92
- -
99 const Hypercomplex &H1,
-
100 const Hypercomplex &H2
-
101 ) {
-
102 T temp[dim]; // NOLINT
-
103 for (unsigned int i=0; i < dim; i++) temp[i] = T();
-
104 for (unsigned int i=0; i < dim; i++) {
-
105 for (unsigned int j=0; j < dim; j++) {
-
106 if (Hypercomplex::baseprodpos[i][j]) {
-
107 temp[Hypercomplex::baseprodabs[i][j]] =
-
108 temp[Hypercomplex::baseprodabs[i][j]] + H1[i] * H2[j];
-
109 } else {
-
110 temp[Hypercomplex::baseprodabs[i][j]] =
-
111 temp[Hypercomplex::baseprodabs[i][j]] - H1[i] * H2[j];
-
112 }
-
113 }
-
114 }
-
115 Hypercomplex H(temp);
-
116 return H;
-
117 }
-
118
-
126 explicit Hypercomplex(const T* ARR);
+
79 for (uint64_t i=0; i < dim; i++) {
+
80 for (uint64_t j=0; j < dim; j++) {
+
81 baseprodabs[i][j] = std::abs(M[i][j]) - 1;
+
82 baseprodpos[i][j] = (0 < M[i][j]);
+
83 }
+
84 }
+
85 for (uint64_t i = 0; i < dim; i++) {
+
86 delete[] M[i];
+
87 }
+
88 delete[] M;
+
89 }
+
90
+
93 static void clear() {
+
94 for (uint64_t i = 0; i < dim; i++) {
+
95 delete[] baseprodabs[i];
+
96 delete[] baseprodpos[i];
+
97 }
+
98 delete[] baseprodabs;
+
99 delete[] baseprodpos;
+
100 }
+
101
+ +
108 const Hypercomplex &H1,
+
109 const Hypercomplex &H2
+
110 ) {
+
111 T temp[dim]; // NOLINT
+
112 for (uint64_t i=0; i < dim; i++) temp[i] = T();
+
113 for (uint64_t i=0; i < dim; i++) {
+
114 for (uint64_t j=0; j < dim; j++) {
+
115 if (Hypercomplex::baseprodpos[i][j]) {
+
116 temp[Hypercomplex::baseprodabs[i][j]] =
+
117 temp[Hypercomplex::baseprodabs[i][j]] + H1[i] * H2[j];
+
118 } else {
+
119 temp[Hypercomplex::baseprodabs[i][j]] =
+
120 temp[Hypercomplex::baseprodabs[i][j]] - H1[i] * H2[j];
+
121 }
+
122 }
+
123 }
+
124 Hypercomplex H(temp);
+
125 return H;
+
126 }
127
-
135 Hypercomplex(const Hypercomplex &H);
+
135 explicit Hypercomplex(const T* ARR);
136
-
137 Hypercomplex() = delete;
-
138
- -
140
-
144 unsigned int _() const { return dim; }
+
144 Hypercomplex(const Hypercomplex &H);
145
-
152 T norm() const;
-
153
-
157 Hypercomplex inv() const;
-
158
-
165 template <const unsigned int newdim>
- +
146 Hypercomplex() = delete;
+
147
+ +
149
+
153 uint64_t _() const { return dim; }
+
154
+
161 T norm() const;
+
162
+
166 Hypercomplex inv() const;
167
-
171 Hypercomplex operator~ () const;
-
172
-
176 Hypercomplex operator- () const;
-
177
- -
183
-
191 T const & operator[] (const unsigned int i) const;
+
174 template <const uint64_t newdim>
+ +
176
+
180 Hypercomplex operator~ () const;
+
181
+
185 Hypercomplex operator- () const;
+
186
+
192
-
200 T & operator[] (const unsigned int i);
+
200 T const & operator[] (const uint64_t i) const;
201
- -
207
- -
213
- -
219
-
224 Hypercomplex& operator^= (const unsigned int x);
-
225
- -
231};
-
232
-
238template <typename T, const unsigned int dim>
-
239bool operator== (
-
240 const Hypercomplex<T, dim> &H1,
-
241 const Hypercomplex<T, dim> &H2
-
242);
-
243
-
249template <typename T, const unsigned int dim>
-
250bool operator!= (
-
251 const Hypercomplex<T, dim> &H1,
-
252 const Hypercomplex<T, dim> &H2
-
253);
-
254
-
260template <typename T, const unsigned int dim>
- -
262 const Hypercomplex<T, dim> &H1,
-
263 const Hypercomplex<T, dim> &H2
-
264);
-
265
-
271template <typename T, const unsigned int dim>
- -
273 const Hypercomplex<T, dim> &H1,
-
274 const Hypercomplex<T, dim> &H2
-
275);
-
276
-
282template <typename T, const unsigned int dim>
- -
284 const Hypercomplex<T, dim> &H1,
-
285 const Hypercomplex<T, dim> &H2
-
286);
-
287
-
293template <typename T, const unsigned int dim>
- -
295 const Hypercomplex<T, dim> &H,
-
296 const unsigned int x
-
297);
-
298
-
304template <typename T, const unsigned int dim>
- -
306 const Hypercomplex<T, dim> &H1,
-
307 const Hypercomplex<T, dim> &H2
-
308);
-
309
-
315template <typename T, const unsigned int dim>
-
316std::ostream& operator<< (std::ostream &os, const Hypercomplex<T, dim> &H);
-
317
-
322template <typename T, const unsigned int dim>
- -
324
-
329template <typename T, const unsigned int dim>
- -
331
-
336template <typename T, const unsigned int dim>
- -
338
-
339/*
-
340###############################################################################
-
341#
-
342# Implementation section
-
343#
-
344###############################################################################
-
345*/
-
346
-
347// Hypercomplex main constructor
-
348template <typename T, const unsigned int dim>
- -
350 if (dim == 0) {
-
351 delete[] arr;
-
352 throw std::invalid_argument("invalid dimension");
-
353 }
-
354 if ((dim & (dim - 1)) != 0) {
-
355 delete[] arr;
-
356 throw std::invalid_argument("invalid dimension");
-
357 }
-
358 for (unsigned int i=0; i < dim; i++) arr[i] = ARR[i];
-
359}
-
360
-
361// Hypercomplex copy constructor
-
362template <typename T, const unsigned int dim>
- -
364 for (unsigned int i=0; i < dim; i++) arr[i] = H[i];
-
365}
-
366
-
367// Hypercomplex destructor
-
368template <typename T, const unsigned int dim>
- -
370 delete[] arr;
-
371}
-
372
-
373// calculate norm of the number
-
374template <typename T, const unsigned int dim>
- -
376 T result = T();
-
377 for (unsigned int i=0; i < dim; i++) result += arr[i] * arr[i];
-
378 return sqrt(result);
-
379}
-
380
-
381// calculate inverse of the number
-
382template <typename T, const unsigned int dim>
- -
384 T zero = T();
-
385 T norm = (*this).norm();
-
386 if (norm == zero) {
-
387 throw std::invalid_argument("division by zero");
-
388 } else {
-
389 T temparr[dim]; // NOLINT
-
390 temparr[0] = arr[0] / (norm * norm);
-
391 for (unsigned int i=1; i < dim; i++)
-
392 temparr[i] = -arr[i] / (norm * norm);
-
393 Hypercomplex<T, dim> H(temparr);
-
394 return H;
-
395 }
-
396}
-
397
-
398// cast object to a higher dimension
-
399template <typename T, const unsigned int dim>
-
400template <const unsigned int newdim>
- -
402 if (newdim <= dim) throw std::invalid_argument("invalid dimension");
-
403 T temparr[newdim]; // NOLINT
-
404 for (unsigned int i=0; i < dim; i++) temparr[i] = arr[i];
-
405 for (unsigned int i=dim; i < newdim; i++) temparr[i] = 0;
-
406 Hypercomplex<T, newdim> H(temparr);
-
407 return H;
-
408}
-
409
-
410// overloaded ~ operator
-
411template <typename T, const unsigned int dim>
- -
413 T temparr[dim]; // NOLINT
-
414 temparr[0] = arr[0];
-
415 for (unsigned int i=1; i < dim; i++) temparr[i] = -arr[i];
-
416 Hypercomplex<T, dim> H(temparr);
-
417 return H;
-
418}
-
419
-
420// overloaded - unary operator
-
421template <typename T, const unsigned int dim>
- -
423 T temparr[dim]; // NOLINT
-
424 for (unsigned int i=0; i < dim; i++) temparr[i] = -arr[i];
+
209 T & operator[] (const uint64_t i);
+
210
+ +
216
+ +
222
+ +
228
+
233 Hypercomplex& operator^= (const uint64_t x);
+
234
+ +
240};
+
241
+
247template <typename T, const uint64_t dim>
+
248bool operator== (
+
249 const Hypercomplex<T, dim> &H1,
+
250 const Hypercomplex<T, dim> &H2
+
251);
+
252
+
258template <typename T, const uint64_t dim>
+
259bool operator!= (
+
260 const Hypercomplex<T, dim> &H1,
+
261 const Hypercomplex<T, dim> &H2
+
262);
+
263
+
269template <typename T, const uint64_t dim>
+ +
271 const Hypercomplex<T, dim> &H1,
+
272 const Hypercomplex<T, dim> &H2
+
273);
+
274
+
280template <typename T, const uint64_t dim>
+ +
282 const Hypercomplex<T, dim> &H1,
+
283 const Hypercomplex<T, dim> &H2
+
284);
+
285
+
291template <typename T, const uint64_t dim>
+ +
293 const Hypercomplex<T, dim> &H1,
+
294 const Hypercomplex<T, dim> &H2
+
295);
+
296
+
302template <typename T, const uint64_t dim>
+ +
304 const Hypercomplex<T, dim> &H,
+
305 const uint64_t x
+
306);
+
307
+
313template <typename T, const uint64_t dim>
+ +
315 const Hypercomplex<T, dim> &H1,
+
316 const Hypercomplex<T, dim> &H2
+
317);
+
318
+
324template <typename T, const uint64_t dim>
+
325std::ostream& operator<< (std::ostream &os, const Hypercomplex<T, dim> &H);
+
326
+
331template <typename T, const uint64_t dim>
+ +
333
+
338template <typename T, const uint64_t dim>
+ +
340
+
345template <typename T, const uint64_t dim>
+ +
347
+
348/*
+
349###############################################################################
+
350#
+
351# Implementation section
+
352#
+
353###############################################################################
+
354*/
+
355
+
356// Hypercomplex main constructor
+
357template <typename T, const uint64_t dim>
+ +
359 if (dim == 0) {
+
360 delete[] arr;
+
361 throw std::invalid_argument("invalid dimension");
+
362 }
+
363 if ((dim & (dim - 1)) != 0) {
+
364 delete[] arr;
+
365 throw std::invalid_argument("invalid dimension");
+
366 }
+
367 for (uint64_t i=0; i < dim; i++) arr[i] = ARR[i];
+
368}
+
369
+
370// Hypercomplex copy constructor
+
371template <typename T, const uint64_t dim>
+ +
373 for (uint64_t i=0; i < dim; i++) arr[i] = H[i];
+
374}
+
375
+
376// Hypercomplex destructor
+
377template <typename T, const uint64_t dim>
+ +
379 delete[] arr;
+
380}
+
381
+
382// calculate norm of the number
+
383template <typename T, const uint64_t dim>
+ +
385 T result = T();
+
386 for (uint64_t i=0; i < dim; i++) result += arr[i] * arr[i];
+
387 return sqrt(result);
+
388}
+
389
+
390// calculate inverse of the number
+
391template <typename T, const uint64_t dim>
+ +
393 T zero = T();
+
394 T norm = (*this).norm();
+
395 if (norm == zero) {
+
396 throw std::invalid_argument("division by zero");
+
397 } else {
+
398 T temparr[dim]; // NOLINT
+
399 temparr[0] = arr[0] / (norm * norm);
+
400 for (uint64_t i=1; i < dim; i++)
+
401 temparr[i] = -arr[i] / (norm * norm);
+
402 Hypercomplex<T, dim> H(temparr);
+
403 return H;
+
404 }
+
405}
+
406
+
407// cast object to a higher dimension
+
408template <typename T, const uint64_t dim>
+
409template <const uint64_t newdim>
+ +
411 if (newdim <= dim) throw std::invalid_argument("invalid dimension");
+
412 T temparr[newdim]; // NOLINT
+
413 for (uint64_t i=0; i < dim; i++) temparr[i] = arr[i];
+
414 for (uint64_t i=dim; i < newdim; i++) temparr[i] = 0;
+
415 Hypercomplex<T, newdim> H(temparr);
+
416 return H;
+
417}
+
418
+
419// overloaded ~ operator
+
420template <typename T, const uint64_t dim>
+ +
422 T temparr[dim]; // NOLINT
+
423 temparr[0] = arr[0];
+
424 for (uint64_t i=1; i < dim; i++) temparr[i] = -arr[i];
425 Hypercomplex<T, dim> H(temparr);
426 return H;
427}
428
-
429// overloaded = operator
-
430template <typename T, const unsigned int dim>
- -
432 const Hypercomplex &H
-
433) {
-
434 // self-assignment guard
-
435 if (this == &H) return *this;
-
436 // reassign
-
437 for (unsigned int i=0; i < dim; i++) arr[i] = H[i];
-
438 // return the existing object so we can chain this operator
-
439 return *this;
-
440}
-
441
-
442// overloaded [] operator (const)
-
443template <typename T, const unsigned int dim>
-
444inline T const & Hypercomplex<T, dim>::operator[](const unsigned int i) const {
-
445 assert(0 <= i && i < dim);
-
446 return arr[i];
-
447}
-
448
-
449// overloaded [] operator (non-const)
-
450template <typename T, const unsigned int dim>
-
451inline T & Hypercomplex<T, dim>::operator[](const unsigned int i) {
-
452 assert(0 <= i && i < dim);
-
453 return arr[i];
-
454}
-
455
-
456// overloaded == operator
-
457template <typename T, const unsigned int dim>
- -
459 const Hypercomplex<T, dim> &H1,
-
460 const Hypercomplex<T, dim> &H2
-
461) {
-
462 for (unsigned int i=0; i < dim; i++) {
-
463 if (H1[i] != H2[i]) return false;
-
464 }
-
465 return true;
-
466}
-
467
-
468// overloaded != operator
-
469template <typename T, const unsigned int dim>
- -
471 const Hypercomplex<T, dim> &H1,
-
472 const Hypercomplex<T, dim> &H2
-
473) {
-
474 return !(H1 == H2);
+
429// overloaded - unary operator
+
430template <typename T, const uint64_t dim>
+ +
432 T temparr[dim]; // NOLINT
+
433 for (uint64_t i=0; i < dim; i++) temparr[i] = -arr[i];
+
434 Hypercomplex<T, dim> H(temparr);
+
435 return H;
+
436}
+
437
+
438// overloaded = operator
+
439template <typename T, const uint64_t dim>
+ +
441 const Hypercomplex &H
+
442) {
+
443 // self-assignment guard
+
444 if (this == &H) return *this;
+
445 // reassign
+
446 for (uint64_t i=0; i < dim; i++) arr[i] = H[i];
+
447 // return the existing object so we can chain this operator
+
448 return *this;
+
449}
+
450
+
451// overloaded [] operator (const)
+
452template <typename T, const uint64_t dim>
+
453inline T const & Hypercomplex<T, dim>::operator[](const uint64_t i) const {
+
454 assert(0 <= i && i < dim);
+
455 return arr[i];
+
456}
+
457
+
458// overloaded [] operator (non-const)
+
459template <typename T, const uint64_t dim>
+
460inline T & Hypercomplex<T, dim>::operator[](const uint64_t i) {
+
461 assert(0 <= i && i < dim);
+
462 return arr[i];
+
463}
+
464
+
465// overloaded == operator
+
466template <typename T, const uint64_t dim>
+ +
468 const Hypercomplex<T, dim> &H1,
+
469 const Hypercomplex<T, dim> &H2
+
470) {
+
471 for (uint64_t i=0; i < dim; i++) {
+
472 if (H1[i] != H2[i]) return false;
+
473 }
+
474 return true;
475}
476
-
477// overloaded + binary operator
-
478template <typename T, const unsigned int dim>
- +
477// overloaded != operator
+
478template <typename T, const uint64_t dim>
+
480 const Hypercomplex<T, dim> &H1,
481 const Hypercomplex<T, dim> &H2
482) {
-
483 T temparr[dim]; // NOLINT
-
484 for (unsigned int i=0; i < dim; i++) temparr[i] = H1[i] + H2[i];
-
485 Hypercomplex<T, dim> H(temparr);
-
486 return H;
-
487}
-
488
-
489// overloaded - binary operator
-
490template <typename T, const unsigned int dim>
- -
492 const Hypercomplex<T, dim> &H1,
-
493 const Hypercomplex<T, dim> &H2
-
494) {
-
495 T temparr[dim]; // NOLINT
-
496 for (unsigned int i=0; i < dim; i++) temparr[i] = H1[i] - H2[i];
-
497 Hypercomplex<T, dim> H(temparr);
-
498 return H;
-
499}
-
500
-
501// overloaded * binary operator
-
502template <typename T, const unsigned int dim>
- -
504 const Hypercomplex<T, dim> &H1,
-
505 const Hypercomplex<T, dim> &H2
-
506) {
-
507 // recursion base:
-
508 if constexpr (dim == 1) {
-
509 T temparr[] = { H1[0] * H2[0] };
-
510 Hypercomplex<T, 1> H_(temparr);
-
511 return H_;
-
512 // recursion step:
-
513 } else {
-
514 // shared objects:
-
515 const unsigned int halfd = dim / 2;
-
516 T temparr[dim]; // NOLINT
-
517 // construct helper objects:
-
518 for (unsigned int i=0; i < halfd; i++) temparr[i] = H1[i];
-
519 Hypercomplex<T, halfd> H1a(temparr);
-
520 for (unsigned int i=0; i < halfd; i++) temparr[i] = H1[i+halfd];
-
521 Hypercomplex<T, halfd> H1b(temparr);
-
522 for (unsigned int i=0; i < halfd; i++) temparr[i] = H2[i];
-
523 Hypercomplex<T, halfd> H2a(temparr);
-
524 for (unsigned int i=0; i < halfd; i++) temparr[i] = H2[i+halfd];
-
525 Hypercomplex<T, halfd> H2b(temparr);
-
526 // multiply recursively:
-
527 Hypercomplex<T, halfd> H1a2a = H1a * H2a;
-
528 Hypercomplex<T, halfd> H2b_1b = ~H2b * H1b;
-
529 Hypercomplex<T, halfd> H2b1a = H2b * H1a;
-
530 Hypercomplex<T, halfd> H1b2a_ = H1b * ~H2a;
-
531 // construct the final object
-
532 Hypercomplex<T, halfd> Ha = H1a2a - H2b_1b;
-
533 Hypercomplex<T, halfd> Hb = H2b1a + H1b2a_;
-
534 for (unsigned int i=0; i < halfd; i++) temparr[i] = Ha[i];
-
535 for (unsigned int i=0; i < halfd; i++) temparr[i+halfd] = Hb[i];
-
536 Hypercomplex<T, dim> H(temparr);
-
537 return H;
-
538 }
-
539}
-
540
-
541// overloaded ^ binary operator
-
542template <typename T, const unsigned int dim>
- -
544 const Hypercomplex<T, dim> &H,
-
545 const unsigned int x
-
546) {
-
547 if (!(x)) {
-
548 throw std::invalid_argument("zero is not a valid argument");
-
549 } else {
- -
551 for (unsigned int i=0; i < x-1; i++) Hx *= H;
-
552 return Hx;
-
553 }
-
554}
-
555
-
556// overloaded / binary operator
-
557template <typename T, const unsigned int dim>
- -
559 const Hypercomplex<T, dim> &H1,
-
560 const Hypercomplex<T, dim> &H2
-
561) {
-
562 // division H1 / H2 is implemented as H1 * 1/H2
-
563 Hypercomplex<T, dim> H = H1 * H2.inv();
-
564 return(H);
-
565}
-
566
-
567// overloaded += operator
-
568template <typename T, const unsigned int dim>
- -
570 const Hypercomplex<T, dim> &H
-
571) {
-
572 Hypercomplex<T, dim> result = (*this) + H;
-
573 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
574 return *this;
-
575}
-
576
-
577// overloaded -= operator
-
578template <typename T, const unsigned int dim>
- -
580 const Hypercomplex<T, dim> &H
-
581) {
-
582 Hypercomplex<T, dim> result = (*this) - H;
-
583 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
584 return *this;
-
585}
-
586
-
587// overloaded *= operator
-
588template <typename T, const unsigned int dim>
- -
590 const Hypercomplex<T, dim> &H
-
591) {
-
592 Hypercomplex<T, dim> result = (*this) * H;
-
593 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
594 return *this;
-
595}
-
596
-
597// overloaded ^= operator
-
598template <typename T, const unsigned int dim>
- -
600 const unsigned int x
-
601) {
-
602 Hypercomplex<T, dim> result = (*this) ^ x;
-
603 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
604 return *this;
-
605}
-
606
-
607// overloaded /= operator
-
608template <typename T, const unsigned int dim>
- -
610 const Hypercomplex<T, dim> &H
-
611) {
-
612 Hypercomplex<T, dim> result = (*this) / H;
-
613 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
614 return *this;
-
615}
-
616
-
617// overload << operator
-
618template <typename T, const unsigned int dim>
-
619std::ostream& operator<< (std::ostream &os, const Hypercomplex<T, dim> &H) {
-
620 for (unsigned int i=0; i < dim - 1; i++) os << H[i] << " ";
-
621 os << H[dim - 1];
-
622 return os;
-
623}
-
624
-
625// return the real part of the number
-
626template <typename T, const unsigned int dim>
- -
628 Hypercomplex<T, dim> result = H;
-
629 for (unsigned int i=1; i < dim; i++) result[i] = T();
-
630 return result;
-
631}
-
632
-
633// return the imaginary part of the number
-
634template <typename T, const unsigned int dim>
- -
636 Hypercomplex<T, dim> result = H;
-
637 result[0] = T();
-
638 return result;
-
639}
-
640
-
641// calculate e^H
-
642template <typename T, const unsigned int dim>
- -
644 Hypercomplex<T, dim> result = Im(H);
-
645 T zero = T();
-
646 T norm = result.norm();
-
647 if (norm == zero) {
-
648 result[0] = exp(H[0]);
-
649 for (unsigned int i=1; i < dim; i++) result[i] = zero;
-
650 } else {
-
651 T sinv_v = sin(norm) / norm;
-
652 for (unsigned int i=0; i < dim; i++) result[i] *= sinv_v;
-
653 result[0] += cos(norm);
-
654 for (unsigned int i=0; i < dim; i++) result[i] *= exp(H[0]);
-
655 }
-
656 return result;
-
657}
-
658
-
659/*
-
660###############################################################################
-
661#
-
662# Explicit template specialisation & function overloading for mpfr_t type
-
663#
-
664###############################################################################
-
665*/
-
666
-
667static unsigned int MPFR_global_precision;
-
668
-
672unsigned int get_mpfr_precision() {
-
673 return MPFR_global_precision;
-
674}
+
483 return !(H1 == H2);
+
484}
+
485
+
486// overloaded + binary operator
+
487template <typename T, const uint64_t dim>
+ +
489 const Hypercomplex<T, dim> &H1,
+
490 const Hypercomplex<T, dim> &H2
+
491) {
+
492 T temparr[dim]; // NOLINT
+
493 for (uint64_t i=0; i < dim; i++) temparr[i] = H1[i] + H2[i];
+
494 Hypercomplex<T, dim> H(temparr);
+
495 return H;
+
496}
+
497
+
498// overloaded - binary operator
+
499template <typename T, const uint64_t dim>
+ +
501 const Hypercomplex<T, dim> &H1,
+
502 const Hypercomplex<T, dim> &H2
+
503) {
+
504 T temparr[dim]; // NOLINT
+
505 for (uint64_t i=0; i < dim; i++) temparr[i] = H1[i] - H2[i];
+
506 Hypercomplex<T, dim> H(temparr);
+
507 return H;
+
508}
+
509
+
510// overloaded * binary operator
+
511template <typename T, const uint64_t dim>
+ +
513 const Hypercomplex<T, dim> &H1,
+
514 const Hypercomplex<T, dim> &H2
+
515) {
+
516 // recursion base:
+
517 if constexpr (dim == 1) {
+
518 T temparr[] = { H1[0] * H2[0] };
+
519 Hypercomplex<T, 1> H_(temparr);
+
520 return H_;
+
521 // recursion step:
+
522 } else {
+
523 // shared objects:
+
524 const uint64_t halfd = dim / 2;
+
525 T temparr[dim]; // NOLINT
+
526 // construct helper objects:
+
527 for (uint64_t i=0; i < halfd; i++) temparr[i] = H1[i];
+
528 Hypercomplex<T, halfd> H1a(temparr);
+
529 for (uint64_t i=0; i < halfd; i++) temparr[i] = H1[i+halfd];
+
530 Hypercomplex<T, halfd> H1b(temparr);
+
531 for (uint64_t i=0; i < halfd; i++) temparr[i] = H2[i];
+
532 Hypercomplex<T, halfd> H2a(temparr);
+
533 for (uint64_t i=0; i < halfd; i++) temparr[i] = H2[i+halfd];
+
534 Hypercomplex<T, halfd> H2b(temparr);
+
535 // multiply recursively:
+
536 Hypercomplex<T, halfd> H1a2a = H1a * H2a;
+
537 Hypercomplex<T, halfd> H2b_1b = ~H2b * H1b;
+
538 Hypercomplex<T, halfd> H2b1a = H2b * H1a;
+
539 Hypercomplex<T, halfd> H1b2a_ = H1b * ~H2a;
+
540 // construct the final object
+
541 Hypercomplex<T, halfd> Ha = H1a2a - H2b_1b;
+
542 Hypercomplex<T, halfd> Hb = H2b1a + H1b2a_;
+
543 for (uint64_t i=0; i < halfd; i++) temparr[i] = Ha[i];
+
544 for (uint64_t i=0; i < halfd; i++) temparr[i+halfd] = Hb[i];
+
545 Hypercomplex<T, dim> H(temparr);
+
546 return H;
+
547 }
+
548}
+
549
+
550// overloaded ^ binary operator
+
551template <typename T, const uint64_t dim>
+ +
553 const Hypercomplex<T, dim> &H,
+
554 const uint64_t x
+
555) {
+
556 if (!(x)) {
+
557 throw std::invalid_argument("zero is not a valid argument");
+
558 } else {
+ +
560 for (uint64_t i=0; i < x-1; i++) Hx *= H;
+
561 return Hx;
+
562 }
+
563}
+
564
+
565// overloaded / binary operator
+
566template <typename T, const uint64_t dim>
+ +
568 const Hypercomplex<T, dim> &H1,
+
569 const Hypercomplex<T, dim> &H2
+
570) {
+
571 // division H1 / H2 is implemented as H1 * 1/H2
+
572 Hypercomplex<T, dim> H = H1 * H2.inv();
+
573 return(H);
+
574}
+
575
+
576// overloaded += operator
+
577template <typename T, const uint64_t dim>
+ +
579 const Hypercomplex<T, dim> &H
+
580) {
+
581 Hypercomplex<T, dim> result = (*this) + H;
+
582 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
583 return *this;
+
584}
+
585
+
586// overloaded -= operator
+
587template <typename T, const uint64_t dim>
+ +
589 const Hypercomplex<T, dim> &H
+
590) {
+
591 Hypercomplex<T, dim> result = (*this) - H;
+
592 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
593 return *this;
+
594}
+
595
+
596// overloaded *= operator
+
597template <typename T, const uint64_t dim>
+ +
599 const Hypercomplex<T, dim> &H
+
600) {
+
601 Hypercomplex<T, dim> result = (*this) * H;
+
602 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
603 return *this;
+
604}
+
605
+
606// overloaded ^= operator
+
607template <typename T, const uint64_t dim>
+ +
609 const uint64_t x
+
610) {
+
611 Hypercomplex<T, dim> result = (*this) ^ x;
+
612 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
613 return *this;
+
614}
+
615
+
616// overloaded /= operator
+
617template <typename T, const uint64_t dim>
+ +
619 const Hypercomplex<T, dim> &H
+
620) {
+
621 Hypercomplex<T, dim> result = (*this) / H;
+
622 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
623 return *this;
+
624}
+
625
+
626// overload << operator
+
627template <typename T, const uint64_t dim>
+
628std::ostream& operator<< (std::ostream &os, const Hypercomplex<T, dim> &H) {
+
629 for (uint64_t i=0; i < dim - 1; i++) os << H[i] << " ";
+
630 os << H[dim - 1];
+
631 return os;
+
632}
+
633
+
634// return the real part of the number
+
635template <typename T, const uint64_t dim>
+ +
637 Hypercomplex<T, dim> result = H;
+
638 for (uint64_t i=1; i < dim; i++) result[i] = T();
+
639 return result;
+
640}
+
641
+
642// return the imaginary part of the number
+
643template <typename T, const uint64_t dim>
+ +
645 Hypercomplex<T, dim> result = H;
+
646 result[0] = T();
+
647 return result;
+
648}
+
649
+
650// calculate e^H
+
651template <typename T, const uint64_t dim>
+ +
653 Hypercomplex<T, dim> result = Im(H);
+
654 T zero = T();
+
655 T norm = result.norm();
+
656 if (norm == zero) {
+
657 result[0] = exp(H[0]);
+
658 for (uint64_t i=1; i < dim; i++) result[i] = zero;
+
659 } else {
+
660 T sinv_v = sin(norm) / norm;
+
661 for (uint64_t i=0; i < dim; i++) result[i] *= sinv_v;
+
662 result[0] += cos(norm);
+
663 for (uint64_t i=0; i < dim; i++) result[i] *= exp(H[0]);
+
664 }
+
665 return result;
+
666}
+
667
+
668/*
+
669###############################################################################
+
670#
+
671# Explicit template specialisation for Polynomial class
+
672#
+
673###############################################################################
+
674*/
675
-
679void set_mpfr_precision(unsigned int n) {
-
680 MPFR_global_precision = n;
-
681}
-
682
- -
686 mpfr_free_cache();
-
687 assert(!mpfr_mp_memory_cleanup());
-
688}
-
689
-
692template <const unsigned int dim>
-
693class Hypercomplex<mpfr_t, dim> {
-
694 private:
-
695 mpfr_t* arr = new mpfr_t[dim]; // NOLINT
-
696 static inline uint64_t** baseprodabs;
-
697 static inline bool** baseprodpos;
-
698
-
699 public:
-
702 static void init() {
-
703 int64_t** M = new int64_t*[dim];
-
704 for (unsigned int i = 0; i < dim; i++) M[i] = new int64_t[dim];
-
705 M[0][0] = 1;
-
706 unsigned int n = 1;
-
707 while (n != dim) {
-
708 for (unsigned int i=0; i < n; i++) {
-
709 for (unsigned int j=0; j < n; j++) {
-
710 M[i][n+j] = M[j][i] > 0 ? M[j][i] + n : M[j][i] - n;
-
711 M[i+n][j] = M[i][j] > 0 ? M[i][j] + n : M[i][j] - n;
-
712 M[i+n][j] = M[i+n][j] * (j ? -1 : 1);
-
713 M[i+n][j+n] = -M[j][i] * (j ? -1 : 1);
-
714 }
-
715 }
-
716 n *= 2;
-
717 }
-
718 baseprodabs = new uint64_t*[dim];
-
719 baseprodpos = new bool*[dim];
-
720 for (unsigned int i = 0; i < dim; i++) {
-
721 baseprodabs[i] = new uint64_t[dim];
-
722 baseprodpos[i] = new bool[dim];
-
723 }
-
724 for (unsigned int i=0; i < dim; i++) {
-
725 for (unsigned int j=0; j < dim; j++) {
-
726 baseprodabs[i][j] = std::abs(M[i][j]) - 1;
-
727 baseprodpos[i][j] = (0 < M[i][j]);
-
728 }
-
729 }
-
730 for (unsigned int i = 0; i < dim; i++) {
-
731 delete[] M[i];
-
732 }
-
733 delete[] M;
-
734 }
-
735
-
738 static void clear() {
-
739 for (unsigned int i = 0; i < dim; i++) {
-
740 delete[] baseprodabs[i];
-
741 delete[] baseprodpos[i];
-
742 }
-
743 delete[] baseprodabs;
-
744 delete[] baseprodpos;
-
745 }
-
746
- -
753 const Hypercomplex &H1,
-
754 const Hypercomplex &H2
-
755 ) {
-
756 mpfr_t prod;
-
757 mpfr_init2(prod, MPFR_global_precision);
-
758 mpfr_t temparr[dim]; // NOLINT
-
759 for (unsigned int i=0; i < dim; i++)
-
760 mpfr_init2(temparr[i], MPFR_global_precision);
-
761 for (unsigned int i=0; i < dim; i++) mpfr_set_zero(temparr[i], 0);
-
762 for (unsigned int i=0; i < dim; i++) {
-
763 for (unsigned int j=0; j < dim; j++) {
-
764 mpfr_mul(prod, H1[i], H2[j], MPFR_RNDN);
-
765 if (Hypercomplex::baseprodpos[i][j]) {
-
766 mpfr_add(
-
767 temparr[Hypercomplex::baseprodabs[i][j]],
-
768 temparr[Hypercomplex::baseprodabs[i][j]],
-
769 prod,
-
770 MPFR_RNDN);
-
771 } else {
-
772 mpfr_sub(
-
773 temparr[Hypercomplex::baseprodabs[i][j]],
-
774 temparr[Hypercomplex::baseprodabs[i][j]],
-
775 prod,
-
776 MPFR_RNDN);
-
777 }
-
778 }
-
779 }
-
780 Hypercomplex H(temparr);
-
781 for (unsigned int i=0; i < dim; i++) mpfr_clear(temparr[i]);
-
782 mpfr_clear(prod);
-
783 return H;
+
678template <const uint64_t MaxDeg, const uint64_t dim>
+
679class Hypercomplex<Polynomial<MaxDeg>, dim> {
+
680 private:
+ +
682 static inline uint64_t** baseprodabs;
+
683 static inline bool** baseprodpos;
+
684
+
685 public:
+
688 static void init() {
+
689 int64_t** M = new int64_t*[dim];
+
690 for (uint64_t i = 0; i < dim; i++) M[i] = new int64_t[dim];
+
691 M[0][0] = 1;
+
692 uint64_t n = 1;
+
693 while (n != dim) {
+
694 for (uint64_t i=0; i < n; i++) {
+
695 for (uint64_t j=0; j < n; j++) {
+
696 M[i][n+j] = M[j][i] > 0 ? M[j][i] + n : M[j][i] - n;
+
697 M[i+n][j] = M[i][j] > 0 ? M[i][j] + n : M[i][j] - n;
+
698 M[i+n][j] = M[i+n][j] * (j ? -1 : 1);
+
699 M[i+n][j+n] = -M[j][i] * (j ? -1 : 1);
+
700 }
+
701 }
+
702 n *= 2;
+
703 }
+
704 baseprodabs = new uint64_t*[dim];
+
705 baseprodpos = new bool*[dim];
+
706 for (uint64_t i = 0; i < dim; i++) {
+
707 baseprodabs[i] = new uint64_t[dim];
+
708 baseprodpos[i] = new bool[dim];
+
709 }
+
710 for (uint64_t i=0; i < dim; i++) {
+
711 for (uint64_t j=0; j < dim; j++) {
+
712 baseprodabs[i][j] = std::abs(M[i][j]) - 1;
+
713 baseprodpos[i][j] = (0 < M[i][j]);
+
714 }
+
715 }
+
716 for (uint64_t i = 0; i < dim; i++) {
+
717 delete[] M[i];
+
718 }
+
719 delete[] M;
+
720 }
+
721
+
724 static void clear() {
+
725 for (uint64_t i = 0; i < dim; i++) {
+
726 delete[] baseprodabs[i];
+
727 delete[] baseprodpos[i];
+
728 }
+
729 delete[] baseprodabs;
+
730 delete[] baseprodpos;
+
731 }
+
732
+ +
739 const Hypercomplex &H1,
+
740 const Hypercomplex &H2
+
741 ) {
+
742 Polynomial<MaxDeg> temp[dim];
+
743 for (uint64_t i=0; i < dim; i++) {
+
744 for (uint64_t j=0; j < dim; j++) {
+
745 if (Hypercomplex::baseprodpos[i][j]) {
+
746 temp[Hypercomplex::baseprodabs[i][j]] =
+
747 temp[Hypercomplex::baseprodabs[i][j]] + H1[i] * H2[j];
+
748 } else {
+
749 temp[Hypercomplex::baseprodabs[i][j]] =
+
750 temp[Hypercomplex::baseprodabs[i][j]] - H1[i] * H2[j];
+
751 }
+
752 }
+
753 }
+ +
755 return H;
+
756 }
+
757
+
764 explicit Hypercomplex(const Polynomial<MaxDeg>* ARR) {
+
765 if (dim == 0) {
+
766 delete[] arr;
+
767 throw std::invalid_argument("invalid dimension");
+
768 }
+
769 if ((dim & (dim - 1)) != 0) {
+
770 delete[] arr;
+
771 throw std::invalid_argument("invalid dimension");
+
772 }
+
773 for (uint64_t i=0; i < dim; i++) arr[i] = ARR[i];
+
774 }
+
775
+ +
783 for (uint64_t i=0; i < dim; i++) arr[i] = H[i];
784 }
785
-
792 explicit Hypercomplex(const mpfr_t* ARR) {
-
793 if (dim == 0) {
-
794 delete[] arr;
-
795 throw std::invalid_argument("invalid dimension");
-
796 }
-
797 if ((dim & (dim - 1)) != 0) {
-
798 delete[] arr;
-
799 throw std::invalid_argument("invalid dimension");
-
800 }
-
801 for (unsigned int i=0; i < dim; i++)
-
802 mpfr_init2(arr[i], MPFR_global_precision);
-
803 for (unsigned int i=0; i < dim; i++)
-
804 mpfr_set(arr[i], ARR[i], MPFR_RNDN);
-
805 }
-
806
- -
814 for (unsigned int i=0; i < dim; i++)
-
815 mpfr_init2(arr[i], MPFR_global_precision);
-
816 for (unsigned int i=0; i < dim; i++)
-
817 mpfr_set(arr[i], H[i], MPFR_RNDN);
-
818 }
-
819
-
820 Hypercomplex() = delete;
-
821
-
822 ~Hypercomplex() {
-
823 for (unsigned int i=0; i < dim; i++) mpfr_clear(arr[i]);
-
824 delete[] arr;
-
825 }
-
826
-
830 unsigned int _() const { return dim; }
-
831
-
841 int norm(mpfr_t norm) const {
-
842 mpfr_t temp;
-
843 mpfr_init2(temp, MPFR_global_precision);
-
844 mpfr_set_zero(norm, 0);
-
845 for (unsigned int i=0; i < dim; i++) {
-
846 mpfr_mul(temp, arr[i], arr[i], MPFR_RNDN);
-
847 mpfr_add(norm, norm, temp, MPFR_RNDN);
-
848 }
-
849 mpfr_sqrt(norm, norm, MPFR_RNDN);
-
850 mpfr_clear(temp);
-
851 return 0;
-
852 }
-
853
- -
858 mpfr_t zero, norm;
-
859 mpfr_init2(zero, MPFR_global_precision);
-
860 mpfr_init2(norm, MPFR_global_precision);
-
861 mpfr_set_zero(zero, 0);
-
862 (*this).norm(norm);
-
863 if (mpfr_equal_p(norm, zero)) {
-
864 mpfr_clear(zero);
-
865 mpfr_clear(norm);
-
866 throw std::invalid_argument("division by zero");
-
867 } else {
-
868 mpfr_t temparr[dim]; // NOLINT
-
869 for (unsigned int i=0; i < dim; i++)
-
870 mpfr_init2(temparr[i], MPFR_global_precision);
-
871 mpfr_mul(norm, norm, norm, MPFR_RNDN);
-
872 mpfr_div(temparr[0], arr[0], norm, MPFR_RNDN);
-
873 for (unsigned int i=1; i < dim; i++) {
-
874 mpfr_div(temparr[i], arr[i], norm, MPFR_RNDN);
-
875 mpfr_sub(temparr[i], zero, temparr[i], MPFR_RNDN);
-
876 }
-
877 Hypercomplex<mpfr_t, dim> H(temparr);
-
878 mpfr_clear(zero);
-
879 mpfr_clear(norm);
-
880 for (unsigned int i=0; i < dim; i++) mpfr_clear(temparr[i]);
-
881 return H;
-
882 }
-
883 }
-
884
-
891 template <const unsigned int newdim>
- -
893 if (newdim <= dim) throw std::invalid_argument("invalid dimension");
-
894 mpfr_t temparr[newdim]; // NOLINT
-
895 for (unsigned int i=0; i < newdim; i++)
-
896 mpfr_init2(temparr[i], MPFR_global_precision);
-
897 for (unsigned int i=0; i < dim; i++)
-
898 mpfr_set(temparr[i], arr[i], MPFR_RNDN);
-
899 for (unsigned int i=dim; i < newdim; i++) mpfr_set_zero(temparr[i], 0);
- -
901 for (unsigned int i=0; i < newdim; i++) mpfr_clear(temparr[i]);
-
902 return H;
-
903 }
-
904
- -
909 mpfr_t zero;
-
910 mpfr_init2(zero, MPFR_global_precision);
-
911 mpfr_set_zero(zero, 0);
-
912 mpfr_t temparr[dim]; // NOLINT
-
913 for (unsigned int i=0; i < dim; i++)
-
914 mpfr_init2(temparr[i], MPFR_global_precision);
-
915 mpfr_set(temparr[0], arr[0], MPFR_RNDN);
-
916 for (unsigned int i=1; i < dim; i++)
-
917 mpfr_sub(temparr[i], zero, arr[i], MPFR_RNDN);
-
918 Hypercomplex<mpfr_t, dim> H(temparr);
-
919 for (unsigned int i=0; i < dim; i++) mpfr_clear(temparr[i]);
-
920 mpfr_clear(zero);
-
921 return H;
-
922 }
-
923
- -
928 mpfr_t zero;
-
929 mpfr_init2(zero, MPFR_global_precision);
-
930 mpfr_set_zero(zero, 0);
-
931 mpfr_t temparr[dim]; // NOLINT
-
932 for (unsigned int i=0; i < dim; i++)
-
933 mpfr_init2(temparr[i], MPFR_global_precision);
-
934 for (unsigned int i=0; i < dim; i++)
-
935 mpfr_sub(temparr[i], zero, arr[i], MPFR_RNDN);
-
936 Hypercomplex<mpfr_t, dim> H(temparr);
-
937 for (unsigned int i=0; i < dim; i++) mpfr_clear(temparr[i]);
-
938 mpfr_clear(zero);
-
939 return H;
-
940 }
-
941
- -
947 if (this == &H) return *this;
-
948 for (unsigned int i=0; i < dim; i++)
-
949 mpfr_set(arr[i], H[i], MPFR_RNDN);
-
950 return *this;
-
951 }
-
952
-
957 mpfr_t const & operator[] (const unsigned int i) const {
-
958 assert(0 <= i && i < dim);
-
959 return arr[i];
-
960 }
-
961
-
966 mpfr_t & operator[] (const unsigned int i) {
-
967 assert(0 <= i && i < dim);
-
968 return arr[i];
-
969 }
-
970
- -
976 Hypercomplex<mpfr_t, dim> result = (*this) + H;
-
977 for (unsigned int i=0; i < dim; i++)
-
978 mpfr_set((*this)[i], result[i], MPFR_RNDN);
-
979 return *this;
-
980 }
-
981
- -
987 Hypercomplex<mpfr_t, dim> result = (*this) - H;
-
988 for (unsigned int i=0; i < dim; i++)
-
989 mpfr_set((*this)[i], result[i], MPFR_RNDN);
-
990 return *this;
-
991 }
-
992
- -
998 Hypercomplex<mpfr_t, dim> result = (*this) * H;
-
999 for (unsigned int i=0; i < dim; i++)
-
1000 mpfr_set((*this)[i], result[i], MPFR_RNDN);
-
1001 return *this;
-
1002 }
-
1003
-
1008 Hypercomplex& operator^= (const unsigned int x) {
-
1009 Hypercomplex<mpfr_t, dim> result = (*this) ^ x;
-
1010 for (unsigned int i=0; i < dim; i++)
-
1011 mpfr_set((*this)[i], result[i], MPFR_RNDN);
-
1012 return *this;
-
1013 }
-
1014
- -
1020 Hypercomplex<mpfr_t, dim> result = (*this) / H;
-
1021 for (unsigned int i=0; i < dim; i++)
-
1022 mpfr_set((*this)[i], result[i], MPFR_RNDN);
-
1023 return *this;
-
1024 }
-
1025};
-
1026
-
1032template <const unsigned int dim>
- -
1034 const Hypercomplex<mpfr_t, dim> &H1,
- -
1036) {
-
1037 for (unsigned int i=0; i < dim; i++) {
-
1038 if (!mpfr_equal_p(H1[i], H2[i])) return false;
-
1039 }
-
1040 return true;
-
1041}
-
1042
-
1048template <const unsigned int dim>
- -
1050 const Hypercomplex<mpfr_t, dim> &H1,
- -
1052) {
-
1053 return !(H1 == H2);
-
1054}
-
1055
-
1061template <const unsigned int dim>
- -
1063 const Hypercomplex<mpfr_t, dim> &H1,
- -
1065) {
-
1066 mpfr_t temparr[dim]; // NOLINT
-
1067 for (unsigned int i=0; i < dim; i++)
-
1068 mpfr_init2(temparr[i], MPFR_global_precision);
-
1069 for (unsigned int i=0; i < dim; i++)
-
1070 mpfr_add(temparr[i], H1[i], H2[i], MPFR_RNDN);
-
1071 Hypercomplex<mpfr_t, dim> H(temparr);
-
1072 for (unsigned int i=0; i < dim; i++) mpfr_clear(temparr[i]);
-
1073 return H;
-
1074}
-
1075
-
1081template <const unsigned int dim>
- -
1083 const Hypercomplex<mpfr_t, dim> &H1,
- -
1085) {
-
1086 mpfr_t temparr[dim]; // NOLINT
-
1087 for (unsigned int i=0; i < dim; i++)
-
1088 mpfr_init2(temparr[i], MPFR_global_precision);
-
1089 for (unsigned int i=0; i < dim; i++)
-
1090 mpfr_sub(temparr[i], H1[i], H2[i], MPFR_RNDN);
-
1091 Hypercomplex<mpfr_t, dim> H(temparr);
-
1092 for (unsigned int i=0; i < dim; i++) mpfr_clear(temparr[i]);
-
1093 return H;
-
1094}
-
1095
-
1101template <const unsigned int dim>
- -
1103 const Hypercomplex<mpfr_t, dim> &H1,
- -
1105) {
-
1106 // recursion base:
-
1107 if constexpr (dim == 1) {
-
1108 mpfr_t result;
-
1109 mpfr_init2(result, MPFR_global_precision);
-
1110 mpfr_mul(result, H1[0], H2[0], MPFR_RNDN);
-
1111 mpfr_t temparr[1];
-
1112 mpfr_init2(temparr[0], MPFR_global_precision);
-
1113 mpfr_set(temparr[0], result, MPFR_RNDN);
-
1114 Hypercomplex<mpfr_t, 1> H_(temparr);
-
1115 mpfr_clear(result);
-
1116 mpfr_clear(temparr[0]);
-
1117 return H_;
-
1118 // recursion step:
-
1119 } else {
-
1120 // shared objects:
-
1121 const unsigned int halfd = dim / 2;
-
1122 mpfr_t temparr[dim]; // NOLINT
-
1123 for (unsigned int i=0; i < dim; i++)
-
1124 mpfr_init2(temparr[i], MPFR_global_precision);
-
1125 // construct helper objects:
-
1126 for (unsigned int i=0; i < halfd; i++)
-
1127 mpfr_set(temparr[i], H1[i], MPFR_RNDN);
-
1128 Hypercomplex<mpfr_t, halfd> H1a(temparr);
-
1129 for (unsigned int i=0; i < halfd; i++)
-
1130 mpfr_set(temparr[i], H1[i+halfd], MPFR_RNDN);
-
1131 Hypercomplex<mpfr_t, halfd> H1b(temparr);
-
1132 for (unsigned int i=0; i < halfd; i++)
-
1133 mpfr_set(temparr[i], H2[i], MPFR_RNDN);
-
1134 Hypercomplex<mpfr_t, halfd> H2a(temparr);
-
1135 for (unsigned int i=0; i < halfd; i++)
-
1136 mpfr_set(temparr[i], H2[i+halfd], MPFR_RNDN);
-
1137 Hypercomplex<mpfr_t, halfd> H2b(temparr);
-
1138 // multiply recursively:
-
1139 Hypercomplex<mpfr_t, halfd> H1a2a = H1a * H2a;
-
1140 Hypercomplex<mpfr_t, halfd> H2b_1b = ~H2b * H1b;
-
1141 Hypercomplex<mpfr_t, halfd> H2b1a = H2b * H1a;
-
1142 Hypercomplex<mpfr_t, halfd> H1b2a_ = H1b * ~H2a;
-
1143 // construct the final object
-
1144 Hypercomplex<mpfr_t, halfd> Ha = H1a2a - H2b_1b;
-
1145 Hypercomplex<mpfr_t, halfd> Hb = H2b1a + H1b2a_;
-
1146 for (unsigned int i=0; i < halfd; i++)
-
1147 mpfr_set(temparr[i], Ha[i], MPFR_RNDN);
-
1148 for (unsigned int i=0; i < halfd; i++)
-
1149 mpfr_set(temparr[i+halfd], Hb[i], MPFR_RNDN);
-
1150 Hypercomplex<mpfr_t, dim> H(temparr);
-
1151 for (unsigned int i=0; i < dim; i++) mpfr_clear(temparr[i]);
-
1152 return H;
-
1153 }
-
1154}
-
1155
-
1161template <const unsigned int dim>
- - -
1164 const unsigned int x
-
1165) {
-
1166 if (!(x)) {
-
1167 throw std::invalid_argument("zero is not a valid argument");
-
1168 } else {
- -
1170 for (unsigned int i=0; i < x-1; i++) Hx *= H;
-
1171 return Hx;
-
1172 }
-
1173}
-
1174
-
1180template <const unsigned int dim>
- -
1182 const Hypercomplex<mpfr_t, dim> &H1,
- -
1184) {
-
1185 Hypercomplex<mpfr_t, dim> H = H1 * H2.inv();
-
1186 return(H);
-
1187}
-
1188
-
1194template <const unsigned int dim>
-
1195std::ostream& operator<<(
-
1196 std::ostream &os,
- -
1198) {
-
1199 mpfr_exp_t exponent = 0;
-
1200 char* outstr;
-
1201 for (unsigned int i=0; i < dim - 1; i++) {
-
1202 outstr = mpfr_get_str(NULL, &exponent, 10, 0, H[i], MPFR_RNDN);
-
1203 os << outstr << "E" << exponent << " ";
-
1204 mpfr_free_str(outstr);
-
1205 }
-
1206 outstr = mpfr_get_str(NULL, &exponent, 10, 0, H[dim - 1], MPFR_RNDN);
-
1207 os << outstr << "E" << exponent;
-
1208 mpfr_free_str(outstr);
-
1209 return os;
-
1210}
-
1211
-
1216template <const unsigned int dim>
- -
1218 Hypercomplex<mpfr_t, dim> result = H;
-
1219 for (unsigned int i=1; i < dim; i++) mpfr_set_zero(result[i], 0);
-
1220 return result;
-
1221}
-
1222
-
1227template <const unsigned int dim>
- -
1229 Hypercomplex<mpfr_t, dim> result = H;
-
1230 mpfr_set_zero(result[0], 0);
-
1231 return result;
-
1232}
-
1233
-
1238template <const unsigned int dim>
- -
1240 Hypercomplex<mpfr_t, dim> result = Im(H);
-
1241 mpfr_t zero, norm, expreal;
-
1242 mpfr_init2(zero, MPFR_global_precision);
-
1243 mpfr_init2(norm, MPFR_global_precision);
-
1244 mpfr_init2(expreal, MPFR_global_precision);
-
1245 mpfr_set_zero(zero, 0);
-
1246 result.norm(norm);
-
1247 mpfr_exp(expreal, H[0], MPFR_RNDN);
-
1248
-
1249 if (mpfr_equal_p(norm, zero)) {
-
1250 mpfr_set(result[0], expreal, MPFR_RNDN);
-
1251 for (unsigned int i=1; i < dim; i++) mpfr_set_zero(result[i], 0);
-
1252 } else {
-
1253 mpfr_t sinv_v;
-
1254 mpfr_init2(sinv_v, MPFR_global_precision);
-
1255 mpfr_sin(sinv_v, norm, MPFR_RNDN);
-
1256 mpfr_div(sinv_v, sinv_v, norm, MPFR_RNDN);
-
1257 for (unsigned int i=0; i < dim; i++) {
-
1258 mpfr_mul(result[i], result[i], sinv_v, MPFR_RNDN);
-
1259 }
-
1260 mpfr_cos(norm, norm, MPFR_RNDN);
-
1261 mpfr_add(result[0], result[0], norm, MPFR_RNDN);
-
1262 for (unsigned int i=0; i < dim; i++) {
-
1263 mpfr_mul(result[i], result[i], expreal, MPFR_RNDN);
-
1264 }
-
1265 mpfr_clear(sinv_v);
-
1266 }
-
1267 mpfr_clear(zero);
-
1268 mpfr_clear(norm);
-
1269 mpfr_clear(expreal);
-
1270 return result;
+
786 Hypercomplex() = delete;
+
787
+
788 ~Hypercomplex() {
+
789 delete[] arr;
+
790 }
+
791
+
795 uint64_t _() const { return dim; }
+
796
+
797 #ifndef DOXYGEN_SHOULD_SKIP_THIS
+
798 Polynomial<MaxDeg> norm() = delete;
+
799 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
800
+ +
805 Polynomial<MaxDeg> norm2;
+
806 for (uint64_t i=0; i < dim; i++) {
+
807 norm2 = norm2 + arr[i] * arr[i];
+
808 }
+
809 return norm2;
+
810 }
+
811
+
818 template <const uint64_t newdim>
+ +
820 if (newdim <= dim) throw std::invalid_argument("invalid dimension");
+
821 Polynomial<MaxDeg> temparr[newdim];
+ +
823 for (uint64_t i=0; i < dim; i++) temparr[i] = arr[i];
+
824 for (uint64_t i=dim; i < newdim; i++) temparr[i] = zero;
+
825 Hypercomplex<Polynomial<MaxDeg>, newdim> H(temparr);
+
826 return H;
+
827 }
+
828
+
833 Polynomial<MaxDeg> const & operator[] (const uint64_t i) const {
+
834 assert(0 <= i && i < dim);
+
835 return arr[i];
+
836 }
+
837
+
842 Polynomial<MaxDeg> & operator[] (const uint64_t i) {
+
843 assert(0 <= i && i < dim);
+
844 return arr[i];
+
845 }
+
846
+ +
851 Polynomial<MaxDeg> temparr[dim];
+
852 temparr[0] = arr[0];
+
853 for (uint64_t i=1; i < dim; i++) temparr[i] = -arr[i];
+
854 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
+
855 return H;
+
856 }
+
857
+ +
862 Polynomial<MaxDeg> temparr[dim];
+
863 for (uint64_t i=0; i < dim; i++) temparr[i] = -arr[i];
+
864 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
+
865 return H;
+
866 }
+
867
+ +
873 if (this == &H) return *this;
+
874 for (uint64_t i=0; i < dim; i++) arr[i] = H[i];
+
875 return *this;
+
876 }
+
877
+ +
883 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) + H;
+
884 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
885 return *this;
+
886 }
+
887
+ +
893 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) - H;
+
894 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
895 return *this;
+
896 }
+
897
+
902 Hypercomplex& operator*= (const int64_t &x) {
+
903 // scalar-polynomial multiplication is commutative
+
904 Hypercomplex<Polynomial<MaxDeg>, dim> result = x * (*this);
+
905 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
906 return *this;
+
907 }
+
908
+
913 Hypercomplex& operator%= (const int64_t &mod) {
+
914 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) % mod;
+
915 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
916 return *this;
+
917 }
+
918
+ +
924 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) * H;
+
925 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
926 return *this;
+
927 }
+
928
+
933 Hypercomplex& operator^= (const uint64_t x) {
+
934 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) ^ x;
+
935 for (uint64_t i=0; i < dim; i++) (*this)[i] = result[i];
+
936 return *this;
+
937 }
+
938
+
939 #ifndef DOXYGEN_SHOULD_SKIP_THIS
+
940 Hypercomplex& operator/= (const Hypercomplex &H) = delete;
+
941 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
942};
+
943
+
949template <const uint64_t MaxDeg, const uint64_t dim>
+ +
951 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
+
952 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
+
953) {
+
954 for (uint64_t i=0; i < dim; i++) {
+
955 if (H1[i] != H2[i]) return false;
+
956 }
+
957 return true;
+
958}
+
959
+
965template <const uint64_t MaxDeg, const uint64_t dim>
+ +
967 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
+
968 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
+
969) {
+
970 return !(H1 == H2);
+
971}
+
972
+
978template <const uint64_t MaxDeg, const uint64_t dim>
+ +
980 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
+
981 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
+
982) {
+
983 Polynomial<MaxDeg> temparr[dim];
+
984 for (uint64_t i=0; i < dim; i++) temparr[i] = H1[i] + H2[i];
+
985 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
+
986 return H;
+
987}
+
988
+
994template <const uint64_t MaxDeg, const uint64_t dim>
+ +
996 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
+
997 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
+
998) {
+
999 Polynomial<MaxDeg> temparr[dim];
+
1000 for (uint64_t i=0; i < dim; i++) temparr[i] = H1[i] - H2[i];
+
1001 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
+
1002 return H;
+
1003}
+
1004
+
1005// forbid / binary operator
+
1006#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
1007template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1009 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
+
1010 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
+
1011) = delete;
+
1012#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
1013
+
1019template <const uint64_t MaxDeg, const uint64_t dim>
+
1020std::ostream& operator<<(
+
1021 std::ostream &os,
+
1022 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
+
1023) {
+
1024 for (uint64_t i=0; i < dim - 1; i++) os << H[i] << std::endl;
+
1025 os << H[dim - 1];
+
1026 return os;
+
1027}
+
1028
+
1034template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1036 const int64_t &x,
+
1037 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
+
1038) {
+
1039 Polynomial<MaxDeg> temparr[dim];
+
1040 for (uint64_t i=0; i < dim; i++) temparr[i] = x * H[i];
+
1041 Hypercomplex<Polynomial<MaxDeg>, dim> h(temparr);
+
1042 return h;
+
1043}
+
1044
+
1050template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1052 const Hypercomplex<Polynomial<MaxDeg>, dim> &H,
+
1053 const int64_t &mod
+
1054) {
+
1055 Polynomial<MaxDeg> temparr[dim];
+
1056 for (uint64_t i=0; i < dim; i++) temparr[i] = H[i] % mod;
+
1057 Hypercomplex<Polynomial<MaxDeg>, dim> h(temparr);
+
1058 return h;
+
1059}
+
1060
+
1066template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1068 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
+
1069 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
+
1070) {
+
1071 // recursion base:
+
1072 if constexpr (dim == 1) {
+
1073 Polynomial<MaxDeg> temparr[] = { H1[0] * H2[0] };
+
1074 Hypercomplex<Polynomial<MaxDeg>, 1> H_(temparr);
+
1075 return H_;
+
1076 // recursion step:
+
1077 } else {
+
1078 // shared objects:
+
1079 const uint64_t halfd = dim / 2;
+
1080 Polynomial<MaxDeg> temparr[dim];
+
1081 // construct helper objects:
+
1082 for (uint64_t i=0; i < halfd; i++) temparr[i] = H1[i];
+
1083 Hypercomplex<Polynomial<MaxDeg>, halfd> H1a(temparr);
+
1084 for (uint64_t i=0; i < halfd; i++) temparr[i] = H1[i+halfd];
+
1085 Hypercomplex<Polynomial<MaxDeg>, halfd> H1b(temparr);
+
1086 for (uint64_t i=0; i < halfd; i++) temparr[i] = H2[i];
+
1087 Hypercomplex<Polynomial<MaxDeg>, halfd> H2a(temparr);
+
1088 for (uint64_t i=0; i < halfd; i++) temparr[i] = H2[i+halfd];
+
1089 Hypercomplex<Polynomial<MaxDeg>, halfd> H2b(temparr);
+
1090 // multiply recursively:
+
1091 Hypercomplex<Polynomial<MaxDeg>, halfd> H1a2a = H1a * H2a;
+
1092 Hypercomplex<Polynomial<MaxDeg>, halfd> H2b_1b = ~H2b * H1b;
+
1093 Hypercomplex<Polynomial<MaxDeg>, halfd> H2b1a = H2b * H1a;
+
1094 Hypercomplex<Polynomial<MaxDeg>, halfd> H1b2a_ = H1b * ~H2a;
+
1095 // construct the final object
+
1096 Hypercomplex<Polynomial<MaxDeg>, halfd> Ha = H1a2a - H2b_1b;
+
1097 Hypercomplex<Polynomial<MaxDeg>, halfd> Hb = H2b1a + H1b2a_;
+
1098 for (uint64_t i=0; i < halfd; i++) temparr[i] = Ha[i];
+
1099 for (uint64_t i=0; i < halfd; i++) temparr[i+halfd] = Hb[i];
+
1100 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
+
1101 return H;
+
1102 }
+
1103}
+
1104
+
1110template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1112 const Hypercomplex<Polynomial<MaxDeg>, dim> &H,
+
1113 const uint64_t x
+
1114) {
+
1115 if (!(x)) {
+
1116 throw std::invalid_argument("zero is not a valid argument");
+
1117 } else {
+ +
1119 for (uint64_t i=0; i < x-1; i++) Hx = Hx * H;
+
1120 return Hx;
+
1121 }
+
1122}
+
1123
+
1128template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1130 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
+
1131) {
+
1132 Hypercomplex<Polynomial<MaxDeg>, dim> result = H;
+
1133 for (uint64_t i=1; i < dim; i++) result[i] = Polynomial<MaxDeg>();
+
1134 return result;
+
1135}
+
1136
+
1141template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1143 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
+
1144) {
+
1145 Hypercomplex<Polynomial<MaxDeg>, dim> result = H;
+
1146 result[0] = Polynomial<MaxDeg>();
+
1147 return result;
+
1148}
+
1149
+
1150// forbid e^H
+
1151#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
1152template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1154 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
+
1155) = delete;
+
1156#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
1157
+
1162template <const uint64_t MaxDeg, const uint64_t dim>
+ + +
1165 const int64_t &mod
+
1166) {
+
1167 for (uint64_t i=0; i < dim; i++) CenteredLift(&(*H)[i], mod);
+
1168}
+
1169
+
1175template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1177 const Hypercomplex<Polynomial<MaxDeg>, dim> &H,
+
1178 const int64_t &mod
+
1179) {
+
1180 Polynomial<MaxDeg> ringnorm2 = H.norm2() % mod;
+
1181 Polynomial<MaxDeg> ringinverse = RingInverse(ringnorm2, mod);
+
1182 Polynomial<MaxDeg> temparr[dim];
+
1183 temparr[0] = H[0] * ringinverse % mod;
+
1184 for (uint64_t i=1; i < dim; i++)
+
1185 temparr[i] = -H[i] * ringinverse % mod;
+
1186 Hypercomplex<Polynomial<MaxDeg>, dim> Hinv(temparr);
+
1187 // validate the inverse:
+
1188 Polynomial<MaxDeg> zero;
+
1189 Polynomial<MaxDeg> unity;
+
1190 unity[0] = 1;
+
1191 Hypercomplex<Polynomial<MaxDeg>, dim> result = (H * Hinv) % mod;
+
1192 assert(result[0] == unity);
+
1193 for (uint64_t i=1; i < dim; i++) assert(result[i] == zero);
+
1194 //
+
1195 return Hinv;
+
1196}
+
1197
+
1198/*
+
1199###############################################################################
+
1200#
+
1201# Cryptographic functions for Hypercomplex<Polynomial> specialisation
+
1202#
+
1203###############################################################################
+
1204*/
+
1205
+
1212template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1214 const Hypercomplex<Polynomial<MaxDeg>, dim> &F,
+
1215 const Hypercomplex<Polynomial<MaxDeg>, dim> &G,
+
1216 const int64_t &q
+
1217) {
+
1218 Hypercomplex<Polynomial<MaxDeg>, dim> invFq = RingInverse(F, q);
+ +
1220 H = Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(invFq, G) % q;
+
1221 return H;
+
1222}
+
1223
+
1232template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1234 const Hypercomplex<Polynomial<MaxDeg>, dim> &H,
+
1235 const Hypercomplex<Polynomial<MaxDeg>, dim> &M,
+
1236 const Hypercomplex<Polynomial<MaxDeg>, dim> &PHI,
+
1237 const int64_t &p,
+
1238 const int64_t &q
+
1239) {
+ +
1241 E = (p * Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(H, PHI) + M) % q;
+
1242 return E;
+
1243}
+
1244
+
1252template <const uint64_t MaxDeg, const uint64_t dim>
+ +
1254 const Hypercomplex<Polynomial<MaxDeg>, dim> &F,
+
1255 const Hypercomplex<Polynomial<MaxDeg>, dim> &E,
+
1256 const int64_t &p,
+
1257 const int64_t &q
+
1258) {
+
1259 Hypercomplex<Polynomial<MaxDeg>, dim> invFp = RingInverse(F, p);
+ +
1261 A = Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(
+
1262 Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(F, E), F) % q;
+
1263 CenteredLift(&A, q);
+
1264 Hypercomplex<Polynomial<MaxDeg>, dim> B = A % p;
+ +
1266 C = Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(
+
1267 invFp,
+
1268 Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(B, invFp)) % p;
+
1269 CenteredLift(&C, p);
+
1270 return C;
1271}
1272
-
1273/*
-
1274###############################################################################
-
1275#
-
1276# Explicit template specialisation for Polynomial class
-
1277#
-
1278###############################################################################
-
1279*/
-
1280
-
1283template <const unsigned int MaxDeg, const unsigned int dim>
-
1284class Hypercomplex<Polynomial<MaxDeg>, dim> {
-
1285 private:
-
1286 Polynomial<MaxDeg>* arr = new Polynomial<MaxDeg>[dim];
-
1287 static inline uint64_t** baseprodabs;
-
1288 static inline bool** baseprodpos;
-
1289
-
1290 public:
-
1293 static void init() {
-
1294 int64_t** M = new int64_t*[dim];
-
1295 for (unsigned int i = 0; i < dim; i++) M[i] = new int64_t[dim];
-
1296 M[0][0] = 1;
-
1297 unsigned int n = 1;
-
1298 while (n != dim) {
-
1299 for (unsigned int i=0; i < n; i++) {
-
1300 for (unsigned int j=0; j < n; j++) {
-
1301 M[i][n+j] = M[j][i] > 0 ? M[j][i] + n : M[j][i] - n;
-
1302 M[i+n][j] = M[i][j] > 0 ? M[i][j] + n : M[i][j] - n;
-
1303 M[i+n][j] = M[i+n][j] * (j ? -1 : 1);
-
1304 M[i+n][j+n] = -M[j][i] * (j ? -1 : 1);
-
1305 }
-
1306 }
-
1307 n *= 2;
-
1308 }
-
1309 baseprodabs = new uint64_t*[dim];
-
1310 baseprodpos = new bool*[dim];
-
1311 for (unsigned int i = 0; i < dim; i++) {
-
1312 baseprodabs[i] = new uint64_t[dim];
-
1313 baseprodpos[i] = new bool[dim];
-
1314 }
-
1315 for (unsigned int i=0; i < dim; i++) {
-
1316 for (unsigned int j=0; j < dim; j++) {
-
1317 baseprodabs[i][j] = std::abs(M[i][j]) - 1;
-
1318 baseprodpos[i][j] = (0 < M[i][j]);
-
1319 }
-
1320 }
-
1321 for (unsigned int i = 0; i < dim; i++) {
-
1322 delete[] M[i];
-
1323 }
-
1324 delete[] M;
-
1325 }
-
1326
-
1329 static void clear() {
-
1330 for (unsigned int i = 0; i < dim; i++) {
-
1331 delete[] baseprodabs[i];
-
1332 delete[] baseprodpos[i];
-
1333 }
-
1334 delete[] baseprodabs;
-
1335 delete[] baseprodpos;
-
1336 }
-
1337
- -
1344 const Hypercomplex &H1,
-
1345 const Hypercomplex &H2
-
1346 ) {
-
1347 Polynomial<MaxDeg> temp[dim];
-
1348 for (unsigned int i=0; i < dim; i++) {
-
1349 for (unsigned int j=0; j < dim; j++) {
-
1350 if (Hypercomplex::baseprodpos[i][j]) {
-
1351 temp[Hypercomplex::baseprodabs[i][j]] =
-
1352 temp[Hypercomplex::baseprodabs[i][j]] + H1[i] * H2[j];
-
1353 } else {
-
1354 temp[Hypercomplex::baseprodabs[i][j]] =
-
1355 temp[Hypercomplex::baseprodabs[i][j]] - H1[i] * H2[j];
-
1356 }
-
1357 }
-
1358 }
-
1359 Hypercomplex<Polynomial<MaxDeg>, dim> H(temp);
-
1360 return H;
-
1361 }
-
1362
-
1369 explicit Hypercomplex(const Polynomial<MaxDeg>* ARR) {
-
1370 if (dim == 0) {
-
1371 delete[] arr;
-
1372 throw std::invalid_argument("invalid dimension");
-
1373 }
-
1374 if ((dim & (dim - 1)) != 0) {
-
1375 delete[] arr;
-
1376 throw std::invalid_argument("invalid dimension");
-
1377 }
-
1378 for (unsigned int i=0; i < dim; i++) arr[i] = ARR[i];
-
1379 }
-
1380
- -
1388 for (unsigned int i=0; i < dim; i++) arr[i] = H[i];
-
1389 }
-
1390
-
1391 Hypercomplex() = delete;
-
1392
-
1393 ~Hypercomplex() {
-
1394 delete[] arr;
-
1395 }
-
1396
-
1400 unsigned int _() const { return dim; }
-
1401
-
1402 #ifndef DOXYGEN_SHOULD_SKIP_THIS
-
1403 Polynomial<MaxDeg> norm() = delete;
-
1404 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
1405
- -
1410 Polynomial<MaxDeg> norm2;
-
1411 for (unsigned int i=0; i < dim; i++) {
-
1412 norm2 = norm2 + arr[i] * arr[i];
-
1413 }
-
1414 return norm2;
-
1415 }
-
1416
-
1423 template <const unsigned int newdim>
- -
1425 if (newdim <= dim) throw std::invalid_argument("invalid dimension");
-
1426 Polynomial<MaxDeg> temparr[newdim];
-
1427 Polynomial<MaxDeg> zero;
-
1428 for (unsigned int i=0; i < dim; i++) temparr[i] = arr[i];
-
1429 for (unsigned int i=dim; i < newdim; i++) temparr[i] = zero;
-
1430 Hypercomplex<Polynomial<MaxDeg>, newdim> H(temparr);
-
1431 return H;
-
1432 }
-
1433
-
1438 Polynomial<MaxDeg> const & operator[] (const unsigned int i) const {
-
1439 assert(0 <= i && i < dim);
-
1440 return arr[i];
-
1441 }
-
1442
-
1447 Polynomial<MaxDeg> & operator[] (const unsigned int i) {
-
1448 assert(0 <= i && i < dim);
-
1449 return arr[i];
-
1450 }
-
1451
- -
1456 Polynomial<MaxDeg> temparr[dim];
-
1457 temparr[0] = arr[0];
-
1458 for (unsigned int i=1; i < dim; i++) temparr[i] = -arr[i];
-
1459 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
-
1460 return H;
-
1461 }
-
1462
- -
1467 Polynomial<MaxDeg> temparr[dim];
-
1468 for (unsigned int i=0; i < dim; i++) temparr[i] = -arr[i];
-
1469 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
-
1470 return H;
-
1471 }
-
1472
- -
1478 if (this == &H) return *this;
-
1479 for (unsigned int i=0; i < dim; i++) arr[i] = H[i];
-
1480 return *this;
-
1481 }
-
1482
- -
1488 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) + H;
-
1489 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
1490 return *this;
-
1491 }
-
1492
- -
1498 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) - H;
-
1499 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
1500 return *this;
-
1501 }
-
1502
-
1507 Hypercomplex& operator*= (const int64_t &x) {
-
1508 // scalar-polynomial multiplication is commutative
-
1509 Hypercomplex<Polynomial<MaxDeg>, dim> result = x * (*this);
-
1510 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
1511 return *this;
-
1512 }
-
1513
-
1518 Hypercomplex& operator%= (const int64_t &mod) {
-
1519 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) % mod;
-
1520 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
1521 return *this;
-
1522 }
-
1523
- -
1529 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) * H;
-
1530 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
1531 return *this;
-
1532 }
-
1533
-
1538 Hypercomplex& operator^= (const unsigned int x) {
-
1539 Hypercomplex<Polynomial<MaxDeg>, dim> result = (*this) ^ x;
-
1540 for (unsigned int i=0; i < dim; i++) (*this)[i] = result[i];
-
1541 return *this;
-
1542 }
-
1543
-
1544 #ifndef DOXYGEN_SHOULD_SKIP_THIS
-
1545 Hypercomplex& operator/= (const Hypercomplex &H) = delete;
-
1546 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
1547};
-
1548
-
1554template <const unsigned int MaxDeg, const unsigned int dim>
- -
1556 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
-
1557 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
-
1558) {
-
1559 for (unsigned int i=0; i < dim; i++) {
-
1560 if (H1[i] != H2[i]) return false;
-
1561 }
-
1562 return true;
-
1563}
-
1564
-
1570template <const unsigned int MaxDeg, const unsigned int dim>
- -
1572 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
-
1573 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
-
1574) {
-
1575 return !(H1 == H2);
-
1576}
-
1577
-
1583template <const unsigned int MaxDeg, const unsigned int dim>
- -
1585 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
-
1586 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
-
1587) {
-
1588 Polynomial<MaxDeg> temparr[dim];
-
1589 for (unsigned int i=0; i < dim; i++) temparr[i] = H1[i] + H2[i];
-
1590 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
-
1591 return H;
-
1592}
-
1593
-
1599template <const unsigned int MaxDeg, const unsigned int dim>
- -
1601 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
-
1602 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
-
1603) {
-
1604 Polynomial<MaxDeg> temparr[dim];
-
1605 for (unsigned int i=0; i < dim; i++) temparr[i] = H1[i] - H2[i];
-
1606 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
-
1607 return H;
-
1608}
-
1609
-
1610// forbid / binary operator
-
1611#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
1612template <const unsigned int MaxDeg, const unsigned int dim>
- -
1614 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
-
1615 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
-
1616) = delete;
-
1617#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
1618
-
1624template <const unsigned int MaxDeg, const unsigned int dim>
-
1625std::ostream& operator<<(
-
1626 std::ostream &os,
-
1627 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
-
1628) {
-
1629 for (unsigned int i=0; i < dim - 1; i++) os << H[i] << std::endl;
-
1630 os << H[dim - 1];
-
1631 return os;
-
1632}
-
1633
-
1639template <const unsigned int MaxDeg, const unsigned int dim>
- -
1641 const int64_t &x,
-
1642 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
-
1643) {
-
1644 Polynomial<MaxDeg> temparr[dim];
-
1645 for (unsigned int i=0; i < dim; i++) temparr[i] = x * H[i];
-
1646 Hypercomplex<Polynomial<MaxDeg>, dim> h(temparr);
-
1647 return h;
-
1648}
-
1649
-
1655template <const unsigned int MaxDeg, const unsigned int dim>
- -
1657 const Hypercomplex<Polynomial<MaxDeg>, dim> &H,
-
1658 const int64_t &mod
-
1659) {
-
1660 Polynomial<MaxDeg> temparr[dim];
-
1661 for (unsigned int i=0; i < dim; i++) temparr[i] = H[i] % mod;
-
1662 Hypercomplex<Polynomial<MaxDeg>, dim> h(temparr);
-
1663 return h;
-
1664}
-
1665
-
1671template <const unsigned int MaxDeg, const unsigned int dim>
- -
1673 const Hypercomplex<Polynomial<MaxDeg>, dim> &H1,
-
1674 const Hypercomplex<Polynomial<MaxDeg>, dim> &H2
-
1675) {
-
1676 // recursion base:
-
1677 if constexpr (dim == 1) {
-
1678 Polynomial<MaxDeg> temparr[] = { H1[0] * H2[0] };
-
1679 Hypercomplex<Polynomial<MaxDeg>, 1> H_(temparr);
-
1680 return H_;
-
1681 // recursion step:
-
1682 } else {
-
1683 // shared objects:
-
1684 const unsigned int halfd = dim / 2;
-
1685 Polynomial<MaxDeg> temparr[dim];
-
1686 // construct helper objects:
-
1687 for (unsigned int i=0; i < halfd; i++) temparr[i] = H1[i];
-
1688 Hypercomplex<Polynomial<MaxDeg>, halfd> H1a(temparr);
-
1689 for (unsigned int i=0; i < halfd; i++) temparr[i] = H1[i+halfd];
-
1690 Hypercomplex<Polynomial<MaxDeg>, halfd> H1b(temparr);
-
1691 for (unsigned int i=0; i < halfd; i++) temparr[i] = H2[i];
-
1692 Hypercomplex<Polynomial<MaxDeg>, halfd> H2a(temparr);
-
1693 for (unsigned int i=0; i < halfd; i++) temparr[i] = H2[i+halfd];
-
1694 Hypercomplex<Polynomial<MaxDeg>, halfd> H2b(temparr);
-
1695 // multiply recursively:
-
1696 Hypercomplex<Polynomial<MaxDeg>, halfd> H1a2a = H1a * H2a;
-
1697 Hypercomplex<Polynomial<MaxDeg>, halfd> H2b_1b = ~H2b * H1b;
-
1698 Hypercomplex<Polynomial<MaxDeg>, halfd> H2b1a = H2b * H1a;
-
1699 Hypercomplex<Polynomial<MaxDeg>, halfd> H1b2a_ = H1b * ~H2a;
-
1700 // construct the final object
-
1701 Hypercomplex<Polynomial<MaxDeg>, halfd> Ha = H1a2a - H2b_1b;
-
1702 Hypercomplex<Polynomial<MaxDeg>, halfd> Hb = H2b1a + H1b2a_;
-
1703 for (unsigned int i=0; i < halfd; i++) temparr[i] = Ha[i];
-
1704 for (unsigned int i=0; i < halfd; i++) temparr[i+halfd] = Hb[i];
-
1705 Hypercomplex<Polynomial<MaxDeg>, dim> H(temparr);
-
1706 return H;
-
1707 }
-
1708}
-
1709
-
1715template <const unsigned int MaxDeg, const unsigned int dim>
- -
1717 const Hypercomplex<Polynomial<MaxDeg>, dim> &H,
-
1718 const unsigned int x
-
1719) {
-
1720 if (!(x)) {
-
1721 throw std::invalid_argument("zero is not a valid argument");
-
1722 } else {
- -
1724 for (unsigned int i=0; i < x-1; i++) Hx = Hx * H;
-
1725 return Hx;
-
1726 }
-
1727}
-
1728
-
1733template <const unsigned int MaxDeg, const unsigned int dim>
- -
1735 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
-
1736) {
-
1737 Hypercomplex<Polynomial<MaxDeg>, dim> result = H;
-
1738 for (unsigned int i=1; i < dim; i++) result[i] = Polynomial<MaxDeg>();
-
1739 return result;
-
1740}
-
1741
-
1746template <const unsigned int MaxDeg, const unsigned int dim>
- -
1748 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
-
1749) {
-
1750 Hypercomplex<Polynomial<MaxDeg>, dim> result = H;
-
1751 result[0] = Polynomial<MaxDeg>();
-
1752 return result;
-
1753}
-
1754
-
1755// forbid e^H
-
1756#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
1757template <const unsigned int MaxDeg, const unsigned int dim>
- -
1759 const Hypercomplex<Polynomial<MaxDeg>, dim> &H
-
1760) = delete;
-
1761#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
1762
-
1767template <const unsigned int MaxDeg, const unsigned int dim>
- - -
1770 const int64_t &mod
-
1771) {
-
1772 for (unsigned int i=0; i < dim; i++) CenteredLift(&(*H)[i], mod);
-
1773}
-
1774
-
1780template <const unsigned int MaxDeg, const unsigned int dim>
- -
1782 const Hypercomplex<Polynomial<MaxDeg>, dim> &H,
-
1783 const int64_t &mod
-
1784) {
-
1785 Polynomial<MaxDeg> ringnorm2 = H.norm2() % mod;
-
1786 Polynomial<MaxDeg> ringinverse = RingInverse(ringnorm2, mod);
-
1787 Polynomial<MaxDeg> temparr[dim];
-
1788 temparr[0] = H[0] * ringinverse % mod;
-
1789 for (unsigned int i=1; i < dim; i++)
-
1790 temparr[i] = -H[i] * ringinverse % mod;
-
1791 Hypercomplex<Polynomial<MaxDeg>, dim> Hinv(temparr);
-
1792 // validate the inverse:
-
1793 Polynomial<MaxDeg> zero;
-
1794 Polynomial<MaxDeg> unity;
-
1795 unity[0] = 1;
-
1796 Hypercomplex<Polynomial<MaxDeg>, dim> result = (H * Hinv) % mod;
-
1797 assert(result[0] == unity);
-
1798 for (unsigned int i=1; i < dim; i++) assert(result[i] == zero);
-
1799 //
-
1800 return Hinv;
-
1801}
-
1802
-
1803/*
-
1804###############################################################################
-
1805#
-
1806# Cryptographic functions for Hypercomplex<Polynomial> specialisation
-
1807#
-
1808###############################################################################
-
1809*/
-
1810
-
1817template <const unsigned int MaxDeg, const unsigned int dim>
- -
1819 const Hypercomplex<Polynomial<MaxDeg>, dim> &F,
-
1820 const Hypercomplex<Polynomial<MaxDeg>, dim> &G,
-
1821 const int64_t &q
-
1822) {
-
1823 Hypercomplex<Polynomial<MaxDeg>, dim> invFq = RingInverse(F, q);
- -
1825 H = Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(invFq, G) % q;
-
1826 return H;
-
1827}
-
1828
-
1837template <const unsigned int MaxDeg, const unsigned int dim>
- -
1839 const Hypercomplex<Polynomial<MaxDeg>, dim> &H,
-
1840 const Hypercomplex<Polynomial<MaxDeg>, dim> &M,
-
1841 const Hypercomplex<Polynomial<MaxDeg>, dim> &PHI,
-
1842 const int64_t &p,
-
1843 const int64_t &q
-
1844) {
- -
1846 E = (p * Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(H, PHI) + M) % q;
-
1847 return E;
-
1848}
-
1849
-
1857template <const unsigned int MaxDeg, const unsigned int dim>
- -
1859 const Hypercomplex<Polynomial<MaxDeg>, dim> &F,
-
1860 const Hypercomplex<Polynomial<MaxDeg>, dim> &E,
-
1861 const int64_t &p,
-
1862 const int64_t &q
-
1863) {
-
1864 Hypercomplex<Polynomial<MaxDeg>, dim> invFp = RingInverse(F, p);
- -
1866 A = Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(
-
1867 Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(F, E), F) % q;
-
1868 CenteredLift(&A, q);
-
1869 Hypercomplex<Polynomial<MaxDeg>, dim> B = A % p;
- -
1871 C = Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(
-
1872 invFp,
-
1873 Hypercomplex<Polynomial<MaxDeg>, dim>::MUL(B, invFp)) % p;
-
1874 CenteredLift(&C, p);
-
1875 return C;
-
1876}
-
1877
-
1878#endif // HYPERCOMPLEX_HYPERCOMPLEX_HPP_
-
Hypercomplex< T, dim > operator-(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Subtraction operator.
Definition: Hypercomplex.hpp:491
-
void set_mpfr_precision(unsigned int n)
Setter for the global precision of the MPFR variables.
Definition: Hypercomplex.hpp:679
-
Hypercomplex< T, dim > Re(const Hypercomplex< T, dim > &H)
Real part of a hypercomplex number.
Definition: Hypercomplex.hpp:627
-
Hypercomplex< Polynomial< MaxDeg >, dim > DECRYPT(const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &E, const int64_t &p, const int64_t &q)
Decrypt a message via the cryptosystem.
Definition: Hypercomplex.hpp:1858
-
bool operator==(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Equality operator.
Definition: Hypercomplex.hpp:458
-
bool operator!=(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Inequality operator.
Definition: Hypercomplex.hpp:470
-
void clear_mpfr_memory()
Wrapper for MPFR memory cleanup.
Definition: Hypercomplex.hpp:685
-
Hypercomplex< T, dim > operator+(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Addition operator.
Definition: Hypercomplex.hpp:479
-
Hypercomplex< Polynomial< MaxDeg >, dim > PUBLICKEY(const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &G, const int64_t &q)
Generate public key of the cryptosystem.
Definition: Hypercomplex.hpp:1818
-
Hypercomplex< Polynomial< MaxDeg >, dim > RingInverse(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod)
Hypercomplex inverse in a modular quotient ring.
Definition: Hypercomplex.hpp:1781
-
Hypercomplex< Polynomial< MaxDeg >, dim > ENCRYPT(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const Hypercomplex< Polynomial< MaxDeg >, dim > &M, const Hypercomplex< Polynomial< MaxDeg >, dim > &PHI, const int64_t &p, const int64_t &q)
Encrypt a message via the cryptosystem.
Definition: Hypercomplex.hpp:1838
-
void CenteredLift(Hypercomplex< Polynomial< MaxDeg >, dim > *H, const int64_t &mod)
Center-lift hypercomplex elements in a modular quotient ring.
Definition: Hypercomplex.hpp:1768
-
Hypercomplex< T, dim > operator*(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Multiplication operator.
Definition: Hypercomplex.hpp:503
-
unsigned int get_mpfr_precision()
Getter for the global precision of the MPFR variables.
Definition: Hypercomplex.hpp:672
-
std::ostream & operator<<(std::ostream &os, const Hypercomplex< T, dim > &H)
Print operator.
Definition: Hypercomplex.hpp:619
-
Hypercomplex< T, dim > Im(const Hypercomplex< T, dim > &H)
Imaginary part of a hypercomplex number.
Definition: Hypercomplex.hpp:635
-
Hypercomplex< Polynomial< MaxDeg >, dim > operator%(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod)
Modular reduction operator.
Definition: Hypercomplex.hpp:1656
-
Hypercomplex< T, dim > exp(const Hypercomplex< T, dim > &H)
Exponentiation operation on a hypercomplex number.
Definition: Hypercomplex.hpp:643
-
Hypercomplex< T, dim > operator/(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Division operator.
Definition: Hypercomplex.hpp:558
-
Hypercomplex< T, dim > operator^(const Hypercomplex< T, dim > &H, const unsigned int x)
Power operator.
Definition: Hypercomplex.hpp:543
+
1273#if USEMPFR
+
1274// Include MPFR-dedicated class specialisation
+
1275#include "./Hypercomplex_MPFR.hpp"
+
1276#endif
+
1277
+
1278#endif // HYPERCOMPLEX_HYPERCOMPLEX_HPP_
+
Hypercomplex< T, dim > operator-(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Subtraction operator.
Definition: Hypercomplex.hpp:500
+
Hypercomplex< T, dim > Re(const Hypercomplex< T, dim > &H)
Real part of a hypercomplex number.
Definition: Hypercomplex.hpp:636
+
Hypercomplex< Polynomial< MaxDeg >, dim > DECRYPT(const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &E, const int64_t &p, const int64_t &q)
Decrypt a message via the cryptosystem.
Definition: Hypercomplex.hpp:1253
+
bool operator==(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Equality operator.
Definition: Hypercomplex.hpp:467
+
bool operator!=(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Inequality operator.
Definition: Hypercomplex.hpp:479
+
Hypercomplex< T, dim > operator+(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Addition operator.
Definition: Hypercomplex.hpp:488
+
Hypercomplex< Polynomial< MaxDeg >, dim > PUBLICKEY(const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &G, const int64_t &q)
Generate public key of the cryptosystem.
Definition: Hypercomplex.hpp:1213
+
Hypercomplex< Polynomial< MaxDeg >, dim > RingInverse(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod)
Hypercomplex inverse in a modular quotient ring.
Definition: Hypercomplex.hpp:1176
+
Hypercomplex< Polynomial< MaxDeg >, dim > ENCRYPT(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const Hypercomplex< Polynomial< MaxDeg >, dim > &M, const Hypercomplex< Polynomial< MaxDeg >, dim > &PHI, const int64_t &p, const int64_t &q)
Encrypt a message via the cryptosystem.
Definition: Hypercomplex.hpp:1233
+
void CenteredLift(Hypercomplex< Polynomial< MaxDeg >, dim > *H, const int64_t &mod)
Center-lift hypercomplex elements in a modular quotient ring.
Definition: Hypercomplex.hpp:1163
+
Hypercomplex< T, dim > operator*(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Multiplication operator.
Definition: Hypercomplex.hpp:512
+
std::ostream & operator<<(std::ostream &os, const Hypercomplex< T, dim > &H)
Print operator.
Definition: Hypercomplex.hpp:628
+
Hypercomplex< T, dim > operator^(const Hypercomplex< T, dim > &H, const uint64_t x)
Power operator.
Definition: Hypercomplex.hpp:552
+
Hypercomplex< T, dim > Im(const Hypercomplex< T, dim > &H)
Imaginary part of a hypercomplex number.
Definition: Hypercomplex.hpp:644
+
Hypercomplex< Polynomial< MaxDeg >, dim > operator%(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod)
Modular reduction operator.
Definition: Hypercomplex.hpp:1051
+
Hypercomplex< T, dim > exp(const Hypercomplex< T, dim > &H)
Exponentiation operation on a hypercomplex number.
Definition: Hypercomplex.hpp:652
+
Hypercomplex< T, dim > operator/(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2)
Division operator.
Definition: Hypercomplex.hpp:567
+ -
static void init()
Basis multiplication table initialiser.
Definition: Hypercomplex.hpp:1293
-
Hypercomplex(const Polynomial< MaxDeg > *ARR)
This is the main constructor.
Definition: Hypercomplex.hpp:1369
-
Hypercomplex< Polynomial< MaxDeg >, newdim > expand() const
Cast a number into a higher dimension.
Definition: Hypercomplex.hpp:1424
-
static void clear()
Cleanup function: free all memory.
Definition: Hypercomplex.hpp:1329
-
static Hypercomplex MUL(const Hypercomplex &H1, const Hypercomplex &H2)
Optimised multiplication function.
Definition: Hypercomplex.hpp:1343
-
unsigned int _() const
Dimensionality getter.
Definition: Hypercomplex.hpp:1400
-
Hypercomplex(const Hypercomplex &H)
This is the copy constructor.
Definition: Hypercomplex.hpp:1387
-
Polynomial< MaxDeg > norm2() const
Calculate squared Euclidean norm of a number.
Definition: Hypercomplex.hpp:1409
-
static void clear()
Cleanup function: free all memory.
Definition: Hypercomplex.hpp:738
-
Hypercomplex(const Hypercomplex &H)
This is the copy constructor.
Definition: Hypercomplex.hpp:813
-
Hypercomplex inv() const
Calculate inverse of a given number.
Definition: Hypercomplex.hpp:857
-
unsigned int _() const
Dimensionality getter.
Definition: Hypercomplex.hpp:830
-
int norm(mpfr_t norm) const
Calculate Euclidean norm of a number.
Definition: Hypercomplex.hpp:841
-
Hypercomplex(const mpfr_t *ARR)
This is the main constructor.
Definition: Hypercomplex.hpp:792
-
Hypercomplex< mpfr_t, newdim > expand() const
Cast a number into a higher dimension.
Definition: Hypercomplex.hpp:892
-
static Hypercomplex MUL(const Hypercomplex &H1, const Hypercomplex &H2)
Optimised multiplication function.
Definition: Hypercomplex.hpp:752
-
static void init()
Basis multiplication table initialiser.
Definition: Hypercomplex.hpp:702
-
Definition: Hypercomplex.hpp:39
-
static void init()
Basis multiplication table initialiser.
Definition: Hypercomplex.hpp:48
-
Hypercomplex & operator+=(const Hypercomplex &H)
Addition-Assignment operator.
Definition: Hypercomplex.hpp:569
-
Hypercomplex operator~() const
Create a complex conjugate.
Definition: Hypercomplex.hpp:412
-
Hypercomplex & operator/=(const Hypercomplex &H)
Division-Assignment operator.
Definition: Hypercomplex.hpp:609
-
Hypercomplex & operator=(const Hypercomplex &H)
Assignment operator.
Definition: Hypercomplex.hpp:431
-
T norm() const
Calculate Euclidean norm of a number.
Definition: Hypercomplex.hpp:375
-
unsigned int _() const
Dimensionality getter.
Definition: Hypercomplex.hpp:144
-
static Hypercomplex MUL(const Hypercomplex &H1, const Hypercomplex &H2)
Optimised multiplication function.
Definition: Hypercomplex.hpp:98
-
Hypercomplex operator-() const
Create an additive inverse of a given number.
Definition: Hypercomplex.hpp:422
-
Hypercomplex & operator^=(const unsigned int x)
Power-Assignment operator.
Definition: Hypercomplex.hpp:599
-
Hypercomplex & operator*=(const Hypercomplex &H)
Multiplication-Assignment operator.
Definition: Hypercomplex.hpp:589
-
Hypercomplex & operator-=(const Hypercomplex &H)
Subtraction-Assignment operator.
Definition: Hypercomplex.hpp:579
-
static void clear()
Cleanup function: free all memory.
Definition: Hypercomplex.hpp:84
-
T const & operator[](const unsigned int i) const
Access operator (const)
Definition: Hypercomplex.hpp:444
-
Hypercomplex inv() const
Calculate inverse of a given number.
Definition: Hypercomplex.hpp:383
-
Hypercomplex< T, newdim > expand() const
Cast a number into a higher dimension.
Definition: Hypercomplex.hpp:401
+
static void init()
Basis multiplication table initialiser.
Definition: Hypercomplex.hpp:688
+
Hypercomplex(const Polynomial< MaxDeg > *ARR)
This is the main constructor.
Definition: Hypercomplex.hpp:764
+
Hypercomplex< Polynomial< MaxDeg >, newdim > expand() const
Cast a number into a higher dimension.
Definition: Hypercomplex.hpp:819
+
static void clear()
Cleanup function: free all memory.
Definition: Hypercomplex.hpp:724
+
static Hypercomplex MUL(const Hypercomplex &H1, const Hypercomplex &H2)
Optimised multiplication function.
Definition: Hypercomplex.hpp:738
+
uint64_t _() const
Dimensionality getter.
Definition: Hypercomplex.hpp:795
+
Hypercomplex(const Hypercomplex &H)
This is the copy constructor.
Definition: Hypercomplex.hpp:782
+
Polynomial< MaxDeg > norm2() const
Calculate squared Euclidean norm of a number.
Definition: Hypercomplex.hpp:804
+
Definition: Hypercomplex.hpp:48
+
Hypercomplex & operator^=(const uint64_t x)
Power-Assignment operator.
Definition: Hypercomplex.hpp:608
+
static void init()
Basis multiplication table initialiser.
Definition: Hypercomplex.hpp:57
+
Hypercomplex & operator+=(const Hypercomplex &H)
Addition-Assignment operator.
Definition: Hypercomplex.hpp:578
+
Hypercomplex operator~() const
Create a complex conjugate.
Definition: Hypercomplex.hpp:421
+
Hypercomplex & operator/=(const Hypercomplex &H)
Division-Assignment operator.
Definition: Hypercomplex.hpp:618
+
Hypercomplex & operator=(const Hypercomplex &H)
Assignment operator.
Definition: Hypercomplex.hpp:440
+
T norm() const
Calculate Euclidean norm of a number.
Definition: Hypercomplex.hpp:384
+
T const & operator[](const uint64_t i) const
Access operator (const)
Definition: Hypercomplex.hpp:453
+
static Hypercomplex MUL(const Hypercomplex &H1, const Hypercomplex &H2)
Optimised multiplication function.
Definition: Hypercomplex.hpp:107
+
uint64_t _() const
Dimensionality getter.
Definition: Hypercomplex.hpp:153
+
Hypercomplex operator-() const
Create an additive inverse of a given number.
Definition: Hypercomplex.hpp:431
+
Hypercomplex & operator*=(const Hypercomplex &H)
Multiplication-Assignment operator.
Definition: Hypercomplex.hpp:598
+
Hypercomplex & operator-=(const Hypercomplex &H)
Subtraction-Assignment operator.
Definition: Hypercomplex.hpp:588
+
static void clear()
Cleanup function: free all memory.
Definition: Hypercomplex.hpp:93
+
Hypercomplex inv() const
Calculate inverse of a given number.
Definition: Hypercomplex.hpp:392
+
Hypercomplex< T, newdim > expand() const
Cast a number into a higher dimension.
Definition: Hypercomplex.hpp:410
Definition: Polynomial.hpp:41
diff --git a/docs/html/_hypercomplex___m_p_f_r_8hpp.html b/docs/html/_hypercomplex___m_p_f_r_8hpp.html new file mode 100644 index 0000000..f28c5be --- /dev/null +++ b/docs/html/_hypercomplex___m_p_f_r_8hpp.html @@ -0,0 +1,616 @@ + + + + + + + +Hypercomplex: hypercomplex/Hypercomplex_MPFR.hpp File Reference + + + + + + + + + + + +
+
+ + + + + + +
+
Hypercomplex +
+
Abstract & fast header-only C++ template library for lattice-based cryptosystems in high-dimensional algebras
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+ +
Hypercomplex_MPFR.hpp File Reference
+
+
+
#include "./Hypercomplex.hpp"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  Hypercomplex< mpfr_t, dim >
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

uint64_t get_mpfr_precision ()
 Getter for the global precision of the MPFR variables. More...
 
void set_mpfr_precision (uint64_t n)
 Setter for the global precision of the MPFR variables. More...
 
+void clear_mpfr_memory ()
 Wrapper for MPFR memory cleanup.
 
template<const uint64_t dim>
bool operator== (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Equality operator. More...
 
template<const uint64_t dim>
bool operator!= (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Inequality operator. More...
 
template<const uint64_t dim>
Hypercomplex< mpfr_t, dim > operator+ (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Addition operator. More...
 
template<const uint64_t dim>
Hypercomplex< mpfr_t, dim > operator- (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Subtraction operator. More...
 
template<const uint64_t dim>
Hypercomplex< mpfr_t, dim > operator* (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Multiplication operator. More...
 
template<const uint64_t dim>
Hypercomplex< mpfr_t, dim > operator^ (const Hypercomplex< mpfr_t, dim > &H, const uint64_t x)
 Power operator. More...
 
template<const uint64_t dim>
Hypercomplex< mpfr_t, dim > operator/ (const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
 Division operator. More...
 
template<const uint64_t dim>
std::ostream & operator<< (std::ostream &os, const Hypercomplex< mpfr_t, dim > &H)
 Print operator. More...
 
template<const uint64_t dim>
Hypercomplex< mpfr_t, dim > Re (const Hypercomplex< mpfr_t, dim > &H)
 Real part of a hypercomplex number. More...
 
template<const uint64_t dim>
Hypercomplex< mpfr_t, dim > Im (const Hypercomplex< mpfr_t, dim > &H)
 Imaginary part of a hypercomplex number. More...
 
template<const uint64_t dim>
Hypercomplex< mpfr_t, dim > exp (const Hypercomplex< mpfr_t, dim > &H)
 Exponentiation operation on a hypercomplex number. More...
 
+

Function Documentation

+ +

◆ exp()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + +
Hypercomplex< mpfr_t, dim > exp (const Hypercomplex< mpfr_t, dim > & H)
+
+ +

Exponentiation operation on a hypercomplex number.

+
Parameters
+ + +
[in]Hexisting class instance
+
+
+
Returns
new class instance
+ +
+
+ +

◆ get_mpfr_precision()

+ +
+
+ + + + + + + +
uint64_t get_mpfr_precision ()
+
+ +

Getter for the global precision of the MPFR variables.

+
Returns
precision in bits
+ +
+
+ +

◆ Im()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + +
Hypercomplex< mpfr_t, dim > Im (const Hypercomplex< mpfr_t, dim > & H)
+
+ +

Imaginary part of a hypercomplex number.

+
Parameters
+ + +
[in]Hexisting class instance
+
+
+
Returns
new class instance
+ +
+
+ +

◆ operator!=()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + + + + + + + + + + + +
bool operator!= (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
+
+ +

Inequality operator.

+
Parameters
+ + + +
[in]H1LHS operand
[in]H2RHS operand
+
+
+
Returns
boolean value after the comparison
+ +
+
+ +

◆ operator*()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + + + + + + + + + + + +
Hypercomplex< mpfr_t, dim > operator* (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
+
+ +

Multiplication operator.

+
Parameters
+ + + +
[in]H1LHS operand
[in]H2RHS operand
+
+
+
Returns
new class instance
+ +
+
+ +

◆ operator+()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + + + + + + + + + + + +
Hypercomplex< mpfr_t, dim > operator+ (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
+
+ +

Addition operator.

+
Parameters
+ + + +
[in]H1LHS operand
[in]H2RHS operand
+
+
+
Returns
new class instance
+ +
+
+ +

◆ operator-()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + + + + + + + + + + + +
Hypercomplex< mpfr_t, dim > operator- (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
+
+ +

Subtraction operator.

+
Parameters
+ + + +
[in]H1LHS operand
[in]H2RHS operand
+
+
+
Returns
new class instance
+ +
+
+ +

◆ operator/()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + + + + + + + + + + + +
Hypercomplex< mpfr_t, dim > operator/ (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
+
+ +

Division operator.

+
Parameters
+ + + +
[in]H1LHS operand
[in]H2RHS operand
+
+
+
Returns
new class instance
+ +
+
+ +

◆ operator<<()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + + + + + + + + + + + +
std::ostream & operator<< (std::ostream & os,
const Hypercomplex< mpfr_t, dim > & H 
)
+
+ +

Print operator.

+
Parameters
+ + + +
[in,out]osoutput stream
[in]Hexisting class instance
+
+
+
Returns
output stream
+ +
+
+ +

◆ operator==()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + + + + + + + + + + + +
bool operator== (const Hypercomplex< mpfr_t, dim > & H1,
const Hypercomplex< mpfr_t, dim > & H2 
)
+
+ +

Equality operator.

+
Parameters
+ + + +
[in]H1LHS operand
[in]H2RHS operand
+
+
+
Returns
boolean value after the comparison
+ +
+
+ +

◆ operator^()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + + + + + + + + + + + +
Hypercomplex< mpfr_t, dim > operator^ (const Hypercomplex< mpfr_t, dim > & H,
const uint64_t x 
)
+
+ +

Power operator.

+
Parameters
+ + + +
[in]HLHS operand
[in]xRHS operand
+
+
+
Returns
new class instance
+ +
+
+ +

◆ Re()

+ +
+
+
+template<const uint64_t dim>
+ + + + + + + + +
Hypercomplex< mpfr_t, dim > Re (const Hypercomplex< mpfr_t, dim > & H)
+
+ +

Real part of a hypercomplex number.

+
Parameters
+ + +
[in]Hexisting class instance
+
+
+
Returns
new class instance
+ +
+
+ +

◆ set_mpfr_precision()

+ +
+
+ + + + + + + + +
void set_mpfr_precision (uint64_t n)
+
+ +

Setter for the global precision of the MPFR variables.

+
Parameters
+ + +
[in]npositive integer (precision in bits)
+
+
+ +
+
+
+ + + + diff --git a/docs/html/_hypercomplex___m_p_f_r_8hpp_source.html b/docs/html/_hypercomplex___m_p_f_r_8hpp_source.html new file mode 100644 index 0000000..3a27906 --- /dev/null +++ b/docs/html/_hypercomplex___m_p_f_r_8hpp_source.html @@ -0,0 +1,616 @@ + + + + + + + +Hypercomplex: hypercomplex/Hypercomplex_MPFR.hpp Source File + + + + + + + + + + + +
+
+ + + + + + +
+
Hypercomplex +
+
Abstract & fast header-only C++ template library for lattice-based cryptosystems in high-dimensional algebras
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
Hypercomplex_MPFR.hpp
+
+
+Go to the documentation of this file.
1// Copyright 2020 <Maciek Bak>
+
3/*
+
4###############################################################################
+
5#
+
6# Hypercomplex header-only library.
+
7# Explicit template specialisation & function overloading for mpfr_t type
+
8#
+
9# AUTHOR: Maciek_Bak
+
10# AFFILIATION: Department_of_Mathematics_City_University_of_London
+
11# CONTACT: wsciekly.maciek@gmail.com
+
12# CREATED: 05-08-2023
+
13# LICENSE: Apache 2.0
+
14#
+
15###############################################################################
+
16*/
+
17
+
18// mark that we included this library
+
19#ifndef HYPERCOMPLEX_HYPERCOMPLEX_MPFR_HPP_
+
20#define HYPERCOMPLEX_HYPERCOMPLEX_MPFR_HPP_
+
21
+
22#include "./Hypercomplex.hpp"
+
23
+
24static uint64_t MPFR_global_precision;
+
25
+ +
30 return MPFR_global_precision;
+
31}
+
32
+
36void set_mpfr_precision(uint64_t n) {
+
37 MPFR_global_precision = n;
+
38}
+
39
+ +
43 mpfr_free_cache();
+
44 assert(!mpfr_mp_memory_cleanup());
+
45}
+
46
+
49template <const uint64_t dim>
+
50class Hypercomplex<mpfr_t, dim> {
+
51 private:
+
52 mpfr_t* arr = new mpfr_t[dim]; // NOLINT
+
53 static inline uint64_t** baseprodabs;
+
54 static inline bool** baseprodpos;
+
55
+
56 public:
+
59 static void init() {
+
60 int64_t** M = new int64_t*[dim];
+
61 for (uint64_t i = 0; i < dim; i++) M[i] = new int64_t[dim];
+
62 M[0][0] = 1;
+
63 uint64_t n = 1;
+
64 while (n != dim) {
+
65 for (uint64_t i=0; i < n; i++) {
+
66 for (uint64_t j=0; j < n; j++) {
+
67 M[i][n+j] = M[j][i] > 0 ? M[j][i] + n : M[j][i] - n;
+
68 M[i+n][j] = M[i][j] > 0 ? M[i][j] + n : M[i][j] - n;
+
69 M[i+n][j] = M[i+n][j] * (j ? -1 : 1);
+
70 M[i+n][j+n] = -M[j][i] * (j ? -1 : 1);
+
71 }
+
72 }
+
73 n *= 2;
+
74 }
+
75 baseprodabs = new uint64_t*[dim];
+
76 baseprodpos = new bool*[dim];
+
77 for (uint64_t i = 0; i < dim; i++) {
+
78 baseprodabs[i] = new uint64_t[dim];
+
79 baseprodpos[i] = new bool[dim];
+
80 }
+
81 for (uint64_t i=0; i < dim; i++) {
+
82 for (uint64_t j=0; j < dim; j++) {
+
83 baseprodabs[i][j] = std::abs(M[i][j]) - 1;
+
84 baseprodpos[i][j] = (0 < M[i][j]);
+
85 }
+
86 }
+
87 for (uint64_t i = 0; i < dim; i++) {
+
88 delete[] M[i];
+
89 }
+
90 delete[] M;
+
91 }
+
92
+
95 static void clear() {
+
96 for (uint64_t i = 0; i < dim; i++) {
+
97 delete[] baseprodabs[i];
+
98 delete[] baseprodpos[i];
+
99 }
+
100 delete[] baseprodabs;
+
101 delete[] baseprodpos;
+
102 }
+
103
+ +
110 const Hypercomplex &H1,
+
111 const Hypercomplex &H2
+
112 ) {
+
113 mpfr_t prod;
+
114 mpfr_init2(prod, MPFR_global_precision);
+
115 mpfr_t temparr[dim]; // NOLINT
+
116 for (uint64_t i=0; i < dim; i++)
+
117 mpfr_init2(temparr[i], MPFR_global_precision);
+
118 for (uint64_t i=0; i < dim; i++) mpfr_set_zero(temparr[i], 0);
+
119 for (uint64_t i=0; i < dim; i++) {
+
120 for (uint64_t j=0; j < dim; j++) {
+
121 mpfr_mul(prod, H1[i], H2[j], MPFR_RNDN);
+
122 if (Hypercomplex::baseprodpos[i][j]) {
+
123 mpfr_add(
+
124 temparr[Hypercomplex::baseprodabs[i][j]],
+
125 temparr[Hypercomplex::baseprodabs[i][j]],
+
126 prod,
+
127 MPFR_RNDN);
+
128 } else {
+
129 mpfr_sub(
+
130 temparr[Hypercomplex::baseprodabs[i][j]],
+
131 temparr[Hypercomplex::baseprodabs[i][j]],
+
132 prod,
+
133 MPFR_RNDN);
+
134 }
+
135 }
+
136 }
+
137 Hypercomplex H(temparr);
+
138 for (uint64_t i=0; i < dim; i++) mpfr_clear(temparr[i]);
+
139 mpfr_clear(prod);
+
140 return H;
+
141 }
+
142
+
149 explicit Hypercomplex(const mpfr_t* ARR) {
+
150 if (dim == 0) {
+
151 delete[] arr;
+
152 throw std::invalid_argument("invalid dimension");
+
153 }
+
154 if ((dim & (dim - 1)) != 0) {
+
155 delete[] arr;
+
156 throw std::invalid_argument("invalid dimension");
+
157 }
+
158 for (uint64_t i=0; i < dim; i++)
+
159 mpfr_init2(arr[i], MPFR_global_precision);
+
160 for (uint64_t i=0; i < dim; i++)
+
161 mpfr_set(arr[i], ARR[i], MPFR_RNDN);
+
162 }
+
163
+ +
171 for (uint64_t i=0; i < dim; i++)
+
172 mpfr_init2(arr[i], MPFR_global_precision);
+
173 for (uint64_t i=0; i < dim; i++)
+
174 mpfr_set(arr[i], H[i], MPFR_RNDN);
+
175 }
+
176
+
177 Hypercomplex() = delete;
+
178
+
179 ~Hypercomplex() {
+
180 for (uint64_t i=0; i < dim; i++) mpfr_clear(arr[i]);
+
181 delete[] arr;
+
182 }
+
183
+
187 uint64_t _() const { return dim; }
+
188
+
198 int32_t norm(mpfr_t norm) const {
+
199 mpfr_t temp;
+
200 mpfr_init2(temp, MPFR_global_precision);
+
201 mpfr_set_zero(norm, 0);
+
202 for (uint64_t i=0; i < dim; i++) {
+
203 mpfr_mul(temp, arr[i], arr[i], MPFR_RNDN);
+
204 mpfr_add(norm, norm, temp, MPFR_RNDN);
+
205 }
+
206 mpfr_sqrt(norm, norm, MPFR_RNDN);
+
207 mpfr_clear(temp);
+
208 return 0;
+
209 }
+
210
+ +
215 mpfr_t zero, norm;
+
216 mpfr_init2(zero, MPFR_global_precision);
+
217 mpfr_init2(norm, MPFR_global_precision);
+
218 mpfr_set_zero(zero, 0);
+
219 (*this).norm(norm);
+
220 if (mpfr_equal_p(norm, zero)) {
+
221 mpfr_clear(zero);
+
222 mpfr_clear(norm);
+
223 throw std::invalid_argument("division by zero");
+
224 } else {
+
225 mpfr_t temparr[dim]; // NOLINT
+
226 for (uint64_t i=0; i < dim; i++)
+
227 mpfr_init2(temparr[i], MPFR_global_precision);
+
228 mpfr_mul(norm, norm, norm, MPFR_RNDN);
+
229 mpfr_div(temparr[0], arr[0], norm, MPFR_RNDN);
+
230 for (uint64_t i=1; i < dim; i++) {
+
231 mpfr_div(temparr[i], arr[i], norm, MPFR_RNDN);
+
232 mpfr_sub(temparr[i], zero, temparr[i], MPFR_RNDN);
+
233 }
+
234 Hypercomplex<mpfr_t, dim> H(temparr);
+
235 mpfr_clear(zero);
+
236 mpfr_clear(norm);
+
237 for (uint64_t i=0; i < dim; i++) mpfr_clear(temparr[i]);
+
238 return H;
+
239 }
+
240 }
+
241
+
248 template <const uint64_t newdim>
+ +
250 if (newdim <= dim) throw std::invalid_argument("invalid dimension");
+
251 mpfr_t temparr[newdim]; // NOLINT
+
252 for (uint64_t i=0; i < newdim; i++)
+
253 mpfr_init2(temparr[i], MPFR_global_precision);
+
254 for (uint64_t i=0; i < dim; i++)
+
255 mpfr_set(temparr[i], arr[i], MPFR_RNDN);
+
256 for (uint64_t i=dim; i < newdim; i++) mpfr_set_zero(temparr[i], 0);
+ +
258 for (uint64_t i=0; i < newdim; i++) mpfr_clear(temparr[i]);
+
259 return H;
+
260 }
+
261
+ +
266 mpfr_t zero;
+
267 mpfr_init2(zero, MPFR_global_precision);
+
268 mpfr_set_zero(zero, 0);
+
269 mpfr_t temparr[dim]; // NOLINT
+
270 for (uint64_t i=0; i < dim; i++)
+
271 mpfr_init2(temparr[i], MPFR_global_precision);
+
272 mpfr_set(temparr[0], arr[0], MPFR_RNDN);
+
273 for (uint64_t i=1; i < dim; i++)
+
274 mpfr_sub(temparr[i], zero, arr[i], MPFR_RNDN);
+
275 Hypercomplex<mpfr_t, dim> H(temparr);
+
276 for (uint64_t i=0; i < dim; i++) mpfr_clear(temparr[i]);
+
277 mpfr_clear(zero);
+
278 return H;
+
279 }
+
280
+ +
285 mpfr_t zero;
+
286 mpfr_init2(zero, MPFR_global_precision);
+
287 mpfr_set_zero(zero, 0);
+
288 mpfr_t temparr[dim]; // NOLINT
+
289 for (uint64_t i=0; i < dim; i++)
+
290 mpfr_init2(temparr[i], MPFR_global_precision);
+
291 for (uint64_t i=0; i < dim; i++)
+
292 mpfr_sub(temparr[i], zero, arr[i], MPFR_RNDN);
+
293 Hypercomplex<mpfr_t, dim> H(temparr);
+
294 for (uint64_t i=0; i < dim; i++) mpfr_clear(temparr[i]);
+
295 mpfr_clear(zero);
+
296 return H;
+
297 }
+
298
+ +
304 if (this == &H) return *this;
+
305 for (uint64_t i=0; i < dim; i++)
+
306 mpfr_set(arr[i], H[i], MPFR_RNDN);
+
307 return *this;
+
308 }
+
309
+
314 mpfr_t const & operator[] (const uint64_t i) const {
+
315 assert(0 <= i && i < dim);
+
316 return arr[i];
+
317 }
+
318
+
323 mpfr_t & operator[] (const uint64_t i) {
+
324 assert(0 <= i && i < dim);
+
325 return arr[i];
+
326 }
+
327
+ +
333 Hypercomplex<mpfr_t, dim> result = (*this) + H;
+
334 for (uint64_t i=0; i < dim; i++)
+
335 mpfr_set((*this)[i], result[i], MPFR_RNDN);
+
336 return *this;
+
337 }
+
338
+ +
344 Hypercomplex<mpfr_t, dim> result = (*this) - H;
+
345 for (uint64_t i=0; i < dim; i++)
+
346 mpfr_set((*this)[i], result[i], MPFR_RNDN);
+
347 return *this;
+
348 }
+
349
+ +
355 Hypercomplex<mpfr_t, dim> result = (*this) * H;
+
356 for (uint64_t i=0; i < dim; i++)
+
357 mpfr_set((*this)[i], result[i], MPFR_RNDN);
+
358 return *this;
+
359 }
+
360
+
365 Hypercomplex& operator^= (const uint64_t x) {
+
366 Hypercomplex<mpfr_t, dim> result = (*this) ^ x;
+
367 for (uint64_t i=0; i < dim; i++)
+
368 mpfr_set((*this)[i], result[i], MPFR_RNDN);
+
369 return *this;
+
370 }
+
371
+ +
377 Hypercomplex<mpfr_t, dim> result = (*this) / H;
+
378 for (uint64_t i=0; i < dim; i++)
+
379 mpfr_set((*this)[i], result[i], MPFR_RNDN);
+
380 return *this;
+
381 }
+
382};
+
383
+
389template <const uint64_t dim>
+ + + +
393) {
+
394 for (uint64_t i=0; i < dim; i++) {
+
395 if (!mpfr_equal_p(H1[i], H2[i])) return false;
+
396 }
+
397 return true;
+
398}
+
399
+
405template <const uint64_t dim>
+ + + +
409) {
+
410 return !(H1 == H2);
+
411}
+
412
+
418template <const uint64_t dim>
+ + + +
422) {
+
423 mpfr_t temparr[dim]; // NOLINT
+
424 for (uint64_t i=0; i < dim; i++)
+
425 mpfr_init2(temparr[i], MPFR_global_precision);
+
426 for (uint64_t i=0; i < dim; i++)
+
427 mpfr_add(temparr[i], H1[i], H2[i], MPFR_RNDN);
+
428 Hypercomplex<mpfr_t, dim> H(temparr);
+
429 for (uint64_t i=0; i < dim; i++) mpfr_clear(temparr[i]);
+
430 return H;
+
431}
+
432
+
438template <const uint64_t dim>
+ + + +
442) {
+
443 mpfr_t temparr[dim]; // NOLINT
+
444 for (uint64_t i=0; i < dim; i++)
+
445 mpfr_init2(temparr[i], MPFR_global_precision);
+
446 for (uint64_t i=0; i < dim; i++)
+
447 mpfr_sub(temparr[i], H1[i], H2[i], MPFR_RNDN);
+
448 Hypercomplex<mpfr_t, dim> H(temparr);
+
449 for (uint64_t i=0; i < dim; i++) mpfr_clear(temparr[i]);
+
450 return H;
+
451}
+
452
+
458template <const uint64_t dim>
+ + + +
462) {
+
463 // recursion base:
+
464 if constexpr (dim == 1) {
+
465 mpfr_t result;
+
466 mpfr_init2(result, MPFR_global_precision);
+
467 mpfr_mul(result, H1[0], H2[0], MPFR_RNDN);
+
468 mpfr_t temparr[1];
+
469 mpfr_init2(temparr[0], MPFR_global_precision);
+
470 mpfr_set(temparr[0], result, MPFR_RNDN);
+
471 Hypercomplex<mpfr_t, 1> H_(temparr);
+
472 mpfr_clear(result);
+
473 mpfr_clear(temparr[0]);
+
474 return H_;
+
475 // recursion step:
+
476 } else {
+
477 // shared objects:
+
478 const uint64_t halfd = dim / 2;
+
479 mpfr_t temparr[dim]; // NOLINT
+
480 for (uint64_t i=0; i < dim; i++)
+
481 mpfr_init2(temparr[i], MPFR_global_precision);
+
482 // construct helper objects:
+
483 for (uint64_t i=0; i < halfd; i++)
+
484 mpfr_set(temparr[i], H1[i], MPFR_RNDN);
+
485 Hypercomplex<mpfr_t, halfd> H1a(temparr);
+
486 for (uint64_t i=0; i < halfd; i++)
+
487 mpfr_set(temparr[i], H1[i+halfd], MPFR_RNDN);
+
488 Hypercomplex<mpfr_t, halfd> H1b(temparr);
+
489 for (uint64_t i=0; i < halfd; i++)
+
490 mpfr_set(temparr[i], H2[i], MPFR_RNDN);
+
491 Hypercomplex<mpfr_t, halfd> H2a(temparr);
+
492 for (uint64_t i=0; i < halfd; i++)
+
493 mpfr_set(temparr[i], H2[i+halfd], MPFR_RNDN);
+
494 Hypercomplex<mpfr_t, halfd> H2b(temparr);
+
495 // multiply recursively:
+
496 Hypercomplex<mpfr_t, halfd> H1a2a = H1a * H2a;
+
497 Hypercomplex<mpfr_t, halfd> H2b_1b = ~H2b * H1b;
+
498 Hypercomplex<mpfr_t, halfd> H2b1a = H2b * H1a;
+
499 Hypercomplex<mpfr_t, halfd> H1b2a_ = H1b * ~H2a;
+
500 // construct the final object
+
501 Hypercomplex<mpfr_t, halfd> Ha = H1a2a - H2b_1b;
+
502 Hypercomplex<mpfr_t, halfd> Hb = H2b1a + H1b2a_;
+
503 for (uint64_t i=0; i < halfd; i++)
+
504 mpfr_set(temparr[i], Ha[i], MPFR_RNDN);
+
505 for (uint64_t i=0; i < halfd; i++)
+
506 mpfr_set(temparr[i+halfd], Hb[i], MPFR_RNDN);
+
507 Hypercomplex<mpfr_t, dim> H(temparr);
+
508 for (uint64_t i=0; i < dim; i++) mpfr_clear(temparr[i]);
+
509 return H;
+
510 }
+
511}
+
512
+
518template <const uint64_t dim>
+ + +
521 const uint64_t x
+
522) {
+
523 if (!(x)) {
+
524 throw std::invalid_argument("zero is not a valid argument");
+
525 } else {
+ +
527 for (uint64_t i=0; i < x-1; i++) Hx *= H;
+
528 return Hx;
+
529 }
+
530}
+
531
+
537template <const uint64_t dim>
+ + + +
541) {
+
542 Hypercomplex<mpfr_t, dim> H = H1 * H2.inv();
+
543 return(H);
+
544}
+
545
+
551template <const uint64_t dim>
+
552std::ostream& operator<<(
+
553 std::ostream &os,
+ +
555) {
+
556 mpfr_exp_t exponent = 0;
+
557 char* outstr;
+
558 for (uint64_t i=0; i < dim - 1; i++) {
+
559 outstr = mpfr_get_str(NULL, &exponent, 10, 0, H[i], MPFR_RNDN);
+
560 os << outstr << "E" << exponent << " ";
+
561 mpfr_free_str(outstr);
+
562 }
+
563 outstr = mpfr_get_str(NULL, &exponent, 10, 0, H[dim - 1], MPFR_RNDN);
+
564 os << outstr << "E" << exponent;
+
565 mpfr_free_str(outstr);
+
566 return os;
+
567}
+
568
+
573template <const uint64_t dim>
+ +
575 Hypercomplex<mpfr_t, dim> result = H;
+
576 for (uint64_t i=1; i < dim; i++) mpfr_set_zero(result[i], 0);
+
577 return result;
+
578}
+
579
+
584template <const uint64_t dim>
+ +
586 Hypercomplex<mpfr_t, dim> result = H;
+
587 mpfr_set_zero(result[0], 0);
+
588 return result;
+
589}
+
590
+
595template <const uint64_t dim>
+ +
597 Hypercomplex<mpfr_t, dim> result = Im(H);
+
598 mpfr_t zero, norm, expreal;
+
599 mpfr_init2(zero, MPFR_global_precision);
+
600 mpfr_init2(norm, MPFR_global_precision);
+
601 mpfr_init2(expreal, MPFR_global_precision);
+
602 mpfr_set_zero(zero, 0);
+
603 result.norm(norm);
+
604 mpfr_exp(expreal, H[0], MPFR_RNDN);
+
605
+
606 if (mpfr_equal_p(norm, zero)) {
+
607 mpfr_set(result[0], expreal, MPFR_RNDN);
+
608 for (uint64_t i=1; i < dim; i++) mpfr_set_zero(result[i], 0);
+
609 } else {
+
610 mpfr_t sinv_v;
+
611 mpfr_init2(sinv_v, MPFR_global_precision);
+
612 mpfr_sin(sinv_v, norm, MPFR_RNDN);
+
613 mpfr_div(sinv_v, sinv_v, norm, MPFR_RNDN);
+
614 for (uint64_t i=0; i < dim; i++) {
+
615 mpfr_mul(result[i], result[i], sinv_v, MPFR_RNDN);
+
616 }
+
617 mpfr_cos(norm, norm, MPFR_RNDN);
+
618 mpfr_add(result[0], result[0], norm, MPFR_RNDN);
+
619 for (uint64_t i=0; i < dim; i++) {
+
620 mpfr_mul(result[i], result[i], expreal, MPFR_RNDN);
+
621 }
+
622 mpfr_clear(sinv_v);
+
623 }
+
624 mpfr_clear(zero);
+
625 mpfr_clear(norm);
+
626 mpfr_clear(expreal);
+
627 return result;
+
628}
+
629
+
630#endif // HYPERCOMPLEX_HYPERCOMPLEX_MPFR_HPP_
+ +
std::ostream & operator<<(std::ostream &os, const Hypercomplex< mpfr_t, dim > &H)
Print operator.
Definition: Hypercomplex_MPFR.hpp:552
+
uint64_t get_mpfr_precision()
Getter for the global precision of the MPFR variables.
Definition: Hypercomplex_MPFR.hpp:29
+
Hypercomplex< mpfr_t, dim > Re(const Hypercomplex< mpfr_t, dim > &H)
Real part of a hypercomplex number.
Definition: Hypercomplex_MPFR.hpp:574
+
void clear_mpfr_memory()
Wrapper for MPFR memory cleanup.
Definition: Hypercomplex_MPFR.hpp:42
+
bool operator!=(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
Inequality operator.
Definition: Hypercomplex_MPFR.hpp:406
+
bool operator==(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
Equality operator.
Definition: Hypercomplex_MPFR.hpp:390
+
Hypercomplex< mpfr_t, dim > operator/(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
Division operator.
Definition: Hypercomplex_MPFR.hpp:538
+
Hypercomplex< mpfr_t, dim > exp(const Hypercomplex< mpfr_t, dim > &H)
Exponentiation operation on a hypercomplex number.
Definition: Hypercomplex_MPFR.hpp:596
+
void set_mpfr_precision(uint64_t n)
Setter for the global precision of the MPFR variables.
Definition: Hypercomplex_MPFR.hpp:36
+
Hypercomplex< mpfr_t, dim > operator+(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
Addition operator.
Definition: Hypercomplex_MPFR.hpp:419
+
Hypercomplex< mpfr_t, dim > Im(const Hypercomplex< mpfr_t, dim > &H)
Imaginary part of a hypercomplex number.
Definition: Hypercomplex_MPFR.hpp:585
+
Hypercomplex< mpfr_t, dim > operator-(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
Subtraction operator.
Definition: Hypercomplex_MPFR.hpp:439
+
Hypercomplex< mpfr_t, dim > operator^(const Hypercomplex< mpfr_t, dim > &H, const uint64_t x)
Power operator.
Definition: Hypercomplex_MPFR.hpp:519
+
Hypercomplex< mpfr_t, dim > operator*(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2)
Multiplication operator.
Definition: Hypercomplex_MPFR.hpp:459
+
static void clear()
Cleanup function: free all memory.
Definition: Hypercomplex_MPFR.hpp:95
+
Hypercomplex(const Hypercomplex &H)
This is the copy constructor.
Definition: Hypercomplex_MPFR.hpp:170
+
Hypercomplex inv() const
Calculate inverse of a given number.
Definition: Hypercomplex_MPFR.hpp:214
+
Hypercomplex(const mpfr_t *ARR)
This is the main constructor.
Definition: Hypercomplex_MPFR.hpp:149
+
Hypercomplex< mpfr_t, newdim > expand() const
Cast a number into a higher dimension.
Definition: Hypercomplex_MPFR.hpp:249
+
static Hypercomplex MUL(const Hypercomplex &H1, const Hypercomplex &H2)
Optimised multiplication function.
Definition: Hypercomplex_MPFR.hpp:109
+
static void init()
Basis multiplication table initialiser.
Definition: Hypercomplex_MPFR.hpp:59
+
int32_t norm(mpfr_t norm) const
Calculate Euclidean norm of a number.
Definition: Hypercomplex_MPFR.hpp:198
+
uint64_t _() const
Dimensionality getter.
Definition: Hypercomplex_MPFR.hpp:187
+
Definition: Hypercomplex.hpp:48
+
Hypercomplex & operator^=(const uint64_t x)
Power-Assignment operator.
Definition: Hypercomplex.hpp:608
+
Hypercomplex & operator+=(const Hypercomplex &H)
Addition-Assignment operator.
Definition: Hypercomplex.hpp:578
+
Hypercomplex operator~() const
Create a complex conjugate.
Definition: Hypercomplex.hpp:421
+
Hypercomplex & operator/=(const Hypercomplex &H)
Division-Assignment operator.
Definition: Hypercomplex.hpp:618
+
Hypercomplex & operator=(const Hypercomplex &H)
Assignment operator.
Definition: Hypercomplex.hpp:440
+
T norm() const
Calculate Euclidean norm of a number.
Definition: Hypercomplex.hpp:384
+
T const & operator[](const uint64_t i) const
Access operator (const)
Definition: Hypercomplex.hpp:453
+
Hypercomplex operator-() const
Create an additive inverse of a given number.
Definition: Hypercomplex.hpp:431
+
Hypercomplex & operator*=(const Hypercomplex &H)
Multiplication-Assignment operator.
Definition: Hypercomplex.hpp:598
+
Hypercomplex & operator-=(const Hypercomplex &H)
Subtraction-Assignment operator.
Definition: Hypercomplex.hpp:588
+
Hypercomplex inv() const
Calculate inverse of a given number.
Definition: Hypercomplex.hpp:392
+
+ + + + diff --git a/docs/html/_polynomial_8hpp.html b/docs/html/_polynomial_8hpp.html index d0bb2e7..179be77 100644 --- a/docs/html/_polynomial_8hpp.html +++ b/docs/html/_polynomial_8hpp.html @@ -102,43 +102,43 @@ int64_t RingInverse (const int64_t x, const int64_t mod)  Integer multiplicative inverse in a modular ring. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> bool operator== (const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2)  Equality operator. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> bool operator!= (const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2)  Inequality operator. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> std::ostream & operator<< (std::ostream &os, const Polynomial< MaxDeg > &P)  Print operator. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> Polynomial< MaxDeg > operator* (const int64_t x, const Polynomial< MaxDeg > &P)  Multiplication-by-scalar operator. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> Polynomial< MaxDeg > operator+ (const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2)  Addition operator. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> Polynomial< MaxDeg > operator- (const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2)  Subtraction operator. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> Polynomial< MaxDeg > operator* (const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2)  Convolution multiplication in a polynomial quotient ring operator. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> Polynomial< MaxDeg > operator% (const Polynomial< MaxDeg > &P, const int64_t x)  Coefficient reduction modulo a scalar. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> void CenteredLift (Polynomial< MaxDeg > *P, const int64_t mod)  Center-lift polynomial in a modular quotient ring. More...
  -template<const unsigned int MaxDeg> +template<const uint64_t MaxDeg> Polynomial< MaxDeg > RingInverse (const Polynomial< MaxDeg > &P, const int64_t &mod)  Inverse polynomial in a modular quotient ring. More...
  @@ -150,7 +150,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>
@@ -189,7 +189,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

void CenteredLift
@@ -229,7 +229,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

bool operator!=
@@ -269,7 +269,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

Polynomial< MaxDeg > operator%
@@ -309,7 +309,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

Polynomial< MaxDeg > operator*
@@ -349,7 +349,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

Polynomial< MaxDeg > operator*
@@ -389,7 +389,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

Polynomial< MaxDeg > operator+
@@ -429,7 +429,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

Polynomial< MaxDeg > operator-
@@ -469,7 +469,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

std::ostream & operator<<
@@ -547,7 +547,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

bool operator==
diff --git a/docs/html/_polynomial_8hpp_source.html b/docs/html/_polynomial_8hpp_source.html index 620ea05..6fde3f0 100644 --- a/docs/html/_polynomial_8hpp_source.html +++ b/docs/html/_polynomial_8hpp_source.html @@ -109,28 +109,28 @@
29int64_t RingInverse(const int64_t x, const int64_t mod) {
30 int64_t y = x % mod;
31 if (y < 0) y += mod;
-
32 for (unsigned int i=1; i < mod; i++) {
+
32 for (uint64_t i=1; i < mod; i++) {
33 if ((y*i) % mod == 1) return i;
34 }
35 throw std::invalid_argument("non-invertible element");
36}
37
-
40template <const unsigned int MaxDeg>
+
40template <const uint64_t MaxDeg>
42 private:
43 int64_t* coefficients = new int64_t[MaxDeg+1];
44
45 public:
52 explicit Polynomial(const int64_t* arr) {
-
53 for (unsigned int i=0; i <= MaxDeg; i++) coefficients[i] = arr[i];
+
53 for (uint64_t i=0; i <= MaxDeg; i++) coefficients[i] = arr[i];
54 }
55
-
63 for (unsigned int i=0; i <= MaxDeg; i++) coefficients[i] = P[i];
+
63 for (uint64_t i=0; i <= MaxDeg; i++) coefficients[i] = P[i];
64 }
65
-
72 for (unsigned int i=0; i <= MaxDeg; i++) coefficients[i] = 0;
+
72 for (uint64_t i=0; i <= MaxDeg; i++) coefficients[i] = 0;
73 }
74
75 ~Polynomial() {
@@ -141,41 +141,41 @@
84 // self-assignment guard
85 if (this == &P) return *this;
86 // reassign
-
87 for (unsigned int i=0; i <= MaxDeg; i++) coefficients[i] = P[i];
+
87 for (uint64_t i=0; i <= MaxDeg; i++) coefficients[i] = P[i];
88 // return the existing object so we can chain this operator
89 return *this;
90 }
91
96 int64_t temparr[MaxDeg+1];
-
97 for (unsigned int i=0; i <= MaxDeg; i++) temparr[i] = -coefficients[i];
+
97 for (uint64_t i=0; i <= MaxDeg; i++) temparr[i] = -coefficients[i];
98 Polynomial<MaxDeg> P(temparr);
99 return P;
100 }
101
-
106 int64_t const & operator[](const unsigned int i) const {
+
106 int64_t const & operator[](const uint64_t i) const {
107 assert(0 <= i && i <= MaxDeg);
108 return coefficients[i];
109 }
110
-
115 int64_t & operator[](const unsigned int i) {
+
115 int64_t & operator[](const uint64_t i) {
116 assert(0 <= i && i <= MaxDeg);
117 return coefficients[i];
118 }
119};
120
-
126template <const unsigned int MaxDeg>
+
126template <const uint64_t MaxDeg>
128 const Polynomial<MaxDeg> &P1,
129 const Polynomial<MaxDeg> &P2
130) {
-
131 for (unsigned int i=0; i <= MaxDeg; i++) {
+
131 for (uint64_t i=0; i <= MaxDeg; i++) {
132 if (P1[i] != P2[i]) return false;
133 }
134 return true;
135}
136
-
142template <const unsigned int MaxDeg>
+
142template <const uint64_t MaxDeg>
144 const Polynomial<MaxDeg> &P1,
145 const Polynomial<MaxDeg> &P2
@@ -183,65 +183,65 @@
147 return !(P1 == P2);
148}
149
-
155template <const unsigned int MaxDeg>
+
155template <const uint64_t MaxDeg>
156std::ostream& operator<< (std::ostream &os, const Polynomial<MaxDeg> &P) {
-
157 for (unsigned int i=0; i < MaxDeg; i++) os << P[i] << ",";
+
157 for (uint64_t i=0; i < MaxDeg; i++) os << P[i] << ",";
158 os << P[MaxDeg];
159 return os;
160}
161
-
167template <const unsigned int MaxDeg>
+
167template <const uint64_t MaxDeg>
169 int64_t temparr[MaxDeg+1];
-
170 for (unsigned int i=0; i <= MaxDeg; i++) temparr[i] = P[i] * x;
+
170 for (uint64_t i=0; i <= MaxDeg; i++) temparr[i] = P[i] * x;
171 Polynomial<MaxDeg> p(temparr);
172 return p;
173}
174
-
180template <const unsigned int MaxDeg>
+
180template <const uint64_t MaxDeg>
182 const Polynomial<MaxDeg> &P1,
183 const Polynomial<MaxDeg> &P2
184) {
185 int64_t temparr[MaxDeg+1];
-
186 for (unsigned int i=0; i <= MaxDeg; i++) temparr[i] = P1[i] + P2[i];
+
186 for (uint64_t i=0; i <= MaxDeg; i++) temparr[i] = P1[i] + P2[i];
187 Polynomial<MaxDeg> p(temparr);
188 return p;
189}
190
-
196template <const unsigned int MaxDeg>
+
196template <const uint64_t MaxDeg>
198 const Polynomial<MaxDeg> &P1,
199 const Polynomial<MaxDeg> &P2
200) {
201 int64_t temparr[MaxDeg+1];
-
202 for (unsigned int i=0; i <= MaxDeg; i++) temparr[i] = P1[i] - P2[i];
+
202 for (uint64_t i=0; i <= MaxDeg; i++) temparr[i] = P1[i] - P2[i];
203 Polynomial<MaxDeg> p(temparr);
204 return p;
205}
206
-
212template <const unsigned int MaxDeg>
+
212template <const uint64_t MaxDeg>
214 const Polynomial<MaxDeg> &P1,
215 const Polynomial<MaxDeg> &P2
216) {
217 int64_t prod[2*MaxDeg+1];
218 int64_t conv[MaxDeg+1];
-
219 for (unsigned int i=0; i < 2*MaxDeg+1; i++) prod[i] = 0;
-
220 for (unsigned int i=0; i <= MaxDeg; i++) conv[i] = 0;
-
221 for (unsigned int i=0; i <= MaxDeg; i++) {
-
222 for (unsigned int j=0; j <= MaxDeg; j++)
+
219 for (uint64_t i=0; i < 2*MaxDeg+1; i++) prod[i] = 0;
+
220 for (uint64_t i=0; i <= MaxDeg; i++) conv[i] = 0;
+
221 for (uint64_t i=0; i <= MaxDeg; i++) {
+
222 for (uint64_t j=0; j <= MaxDeg; j++)
223 prod[i+j] += P1[i]*P2[j];
224 }
-
225 for (unsigned int i=0; i < 2*MaxDeg+1; i++) conv[i%(MaxDeg+1)] += prod[i];
+
225 for (uint64_t i=0; i < 2*MaxDeg+1; i++) conv[i%(MaxDeg+1)] += prod[i];
226 Polynomial<MaxDeg> p(conv);
227 return p;
228}
229
-
235template <const unsigned int MaxDeg>
+
235template <const uint64_t MaxDeg>
237 int64_t temparr[MaxDeg+1];
-
238 for (unsigned int i=0; i <= MaxDeg; i++) {
+
238 for (uint64_t i=0; i <= MaxDeg; i++) {
239 temparr[i] = P[i] % x;
240 if (temparr[i] < 0) temparr[i] += x;
241 }
@@ -249,11 +249,11 @@
243 return p;
244}
245
-
250template <const unsigned int MaxDeg>
+
250template <const uint64_t MaxDeg>
251void CenteredLift(Polynomial<MaxDeg> *P, const int64_t mod) {
252 int64_t lower = -mod/2;
253 int64_t upper = mod/2;
-
254 for (unsigned int i = 0; i <= MaxDeg; i++) {
+
254 for (uint64_t i = 0; i <= MaxDeg; i++) {
255 if (mod % 2) { // odd: <lower, upper>
256 if ((*P)[i] < lower) (*P)[i] = (*P)[i] + mod;
257 if ((*P)[i] > upper) (*P)[i] = (*P)[i] - mod;
@@ -264,7 +264,7 @@
262 }
263}
264
-
270template <const unsigned int MaxDeg>
+
270template <const uint64_t MaxDeg>
272 const Polynomial<MaxDeg> &P,
273 const int64_t &mod
@@ -284,11 +284,11 @@
288 r[0] = mod-1;
289 r[MaxDeg+1] = 1;
-
290 unsigned int deg_r = MaxDeg+1;
-
291 for (unsigned int i=0; i <= MaxDeg; i++) temp[i] = P_[i];
+
290 uint64_t deg_r = MaxDeg+1;
+
291 for (uint64_t i=0; i <= MaxDeg; i++) temp[i] = P_[i];
292 Polynomial<MaxDeg+1> newr(temp);
-
293 unsigned int deg_newr = 0;
-
294 for (unsigned int i=0; i <= MaxDeg+1; i++) {
+
293 uint64_t deg_newr = 0;
+
294 for (uint64_t i=0; i <= MaxDeg+1; i++) {
295 if (newr[i]) deg_newr = i;
296 }
297
@@ -296,15 +296,15 @@
299 while (deg_newr > 0) {
300 // division loop
301 while (deg_r >= deg_newr) {
-
302 for (unsigned int i=0; i <= MaxDeg+1; i++) temp[i] = 0;
-
303 for (unsigned int i=0; i <= deg_newr; i++)
+
302 for (uint64_t i=0; i <= MaxDeg+1; i++) temp[i] = 0;
+
303 for (uint64_t i=0; i <= deg_newr; i++)
304 temp[i + deg_r - deg_newr] = newr[i];
305 q[deg_r - deg_newr] =
306 (r[deg_r] * RingInverse(temp[deg_r], mod)) % mod;
-
307 for (unsigned int i=0; i <= deg_r; i++)
+
307 for (uint64_t i=0; i <= deg_r; i++)
308 temp[i] = (temp[i] * q[deg_r - deg_newr]) % mod;
309 temp = temp % mod;
-
310 for (unsigned int i=0; i <= deg_r; i++) r[i] = r[i] - temp[i];
+
310 for (uint64_t i=0; i <= deg_r; i++) r[i] = r[i] - temp[i];
311 r = r % mod;
312 deg_r -= 1;
313 }
@@ -319,11 +319,11 @@
322 t = temp;
323
324 // reset variables:
-
325 for (unsigned int i=0; i <= MaxDeg+1; i++) q[i] = 0;
-
326 for (unsigned int i=0; i <= MaxDeg+1; i++) {
+
325 for (uint64_t i=0; i <= MaxDeg+1; i++) q[i] = 0;
+
326 for (uint64_t i=0; i <= MaxDeg+1; i++) {
327 if (newr[i]) deg_newr = i;
328 }
-
329 for (unsigned int i=0; i <= MaxDeg+1; i++) {
+
329 for (uint64_t i=0; i <= MaxDeg+1; i++) {
330 if (r[i]) deg_r = i;
331 }
332 }
@@ -334,7 +334,7 @@
337 // construct the inverse polynomial
338 int64_t multiplier = RingInverse(newr[0], mod);
339 Polynomial<MaxDeg> inverse;
-
340 for (unsigned int i=0; i <= MaxDeg; i++) inverse[i] = newt[i];
+
340 for (uint64_t i=0; i <= MaxDeg; i++) inverse[i] = newt[i];
341 inverse = (multiplier * inverse) % mod;
342
343 // test: P * 1/P == 1
@@ -357,12 +357,12 @@
Polynomial< MaxDeg > operator%(const Polynomial< MaxDeg > &P, const int64_t x)
Coefficient reduction modulo a scalar.
Definition: Polynomial.hpp:236
Definition: Polynomial.hpp:41
Polynomial()
This is the default constructor.
Definition: Polynomial.hpp:71
-
int64_t const & operator[](const unsigned int i) const
Access operator (const)
Definition: Polynomial.hpp:106
-
int64_t & operator[](const unsigned int i)
Access operator (non-const)
Definition: Polynomial.hpp:115
Polynomial operator-() const
Create an additive inverse of a given polynomial.
Definition: Polynomial.hpp:95
Polynomial(const Polynomial &P)
This is the copy constructor.
Definition: Polynomial.hpp:62
Polynomial(const int64_t *arr)
This is the main constructor.
Definition: Polynomial.hpp:52
+
int64_t const & operator[](const uint64_t i) const
Access operator (const)
Definition: Polynomial.hpp:106
Polynomial & operator=(const Polynomial &P)
Assignment operator.
Definition: Polynomial.hpp:83
+
int64_t & operator[](const uint64_t i)
Access operator (non-const)
Definition: Polynomial.hpp:115
Polynomial< MaxDeg > RingInverse
- + @@ -99,9 +99,9 @@ - - - + + +
_() constHypercomplex< T, dim >inline
_() constHypercomplex< T, dim >inline
clear()Hypercomplex< T, dim >inlinestatic
expand() constHypercomplex< T, dim >
Hypercomplex(const T *ARR)Hypercomplex< T, dim >explicit
operator-=(const Hypercomplex &H)Hypercomplex< T, dim >
operator/=(const Hypercomplex &H)Hypercomplex< T, dim >
operator=(const Hypercomplex &H)Hypercomplex< T, dim >inline
operator[](const unsigned int i) constHypercomplex< T, dim >inline
operator[](const unsigned int i)Hypercomplex< T, dim >inline
operator^=(const unsigned int x)Hypercomplex< T, dim >
operator[](const uint64_t i) constHypercomplex< T, dim >inline
operator[](const uint64_t i)Hypercomplex< T, dim >inline
operator^=(const uint64_t x)Hypercomplex< T, dim >
operator~() constHypercomplex< T, dim >inline
~Hypercomplex() (defined in Hypercomplex< T, dim >)Hypercomplex< T, dim >
diff --git a/docs/html/class_hypercomplex.html b/docs/html/class_hypercomplex.html index 68361a1..da6add6 100644 --- a/docs/html/class_hypercomplex.html +++ b/docs/html/class_hypercomplex.html @@ -95,16 +95,16 @@  Hypercomplex (const Hypercomplex &H)  This is the copy constructor. More...
  -unsigned int _ () const - Dimensionality getter. 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 unsigned int newdim> +template<const uint64_t newdim> Hypercomplex< T, newdim > expand () const  Cast a number into a higher dimension. More...
  @@ -117,12 +117,12 @@ Hypercomplexoperator= (const Hypercomplex &H)  Assignment operator. More...
  -T const & operator[] (const unsigned int i) const - Access operator (const) More...
-  -T & operator[] (const unsigned int i) - Access operator (non-const) More...
-  +T const & operator[] (const uint64_t i) const + Access operator (const) More...
+  +T & operator[] (const uint64_t i) + Access operator (non-const) More...
Hypercomplexoperator+= (const Hypercomplex &H)  Addition-Assignment operator. More...
  @@ -132,9 +132,9 @@ Hypercomplexoperator*= (const Hypercomplex &H)  Multiplication-Assignment operator. More...
  -Hypercomplexoperator^= (const unsigned int x) - Power-Assignment operator. More...
-  +Hypercomplexoperator^= (const uint64_t x) + Power-Assignment operator. More...
Hypercomplexoperator/= (const Hypercomplex &H)  Division-Assignment operator. More...
  @@ -154,7 +154,7 @@  

Detailed Description

-
template<typename T, const unsigned int dim>
+
template<typename T, const uint64_t dim>
class Hypercomplex< T, dim >

Main class of the library

Constructor & Destructor Documentation

@@ -163,7 +163,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
@@ -203,7 +203,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
@@ -230,19 +230,19 @@

Member Function Documentation

- -

◆ _()

+ +

◆ _()

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
Hypercomplex< T, dim >::Hypercomplex
- + @@ -266,9 +266,9 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
-template<const unsigned int newdim>
+template<const uint64_t newdim>

unsigned int Hypercomplex< T, dim >::_ uint64_t Hypercomplex< T, dim >::_ ( ) const
@@ -288,7 +288,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< T, newdim > Hypercomplex< T, dim >::expand
@@ -307,7 +307,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< T, dim > Hypercomplex< T, dim >::inv
@@ -355,7 +355,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
@@ -383,7 +383,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
@@ -412,7 +412,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator*=
@@ -441,7 +441,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator+=
@@ -460,7 +460,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< T, dim > Hypercomplex< T, dim >::operator-
@@ -489,7 +489,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator-=
@@ -518,7 +518,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator/=
@@ -549,13 +549,13 @@

-

◆ operator[]() [1/2]

+ +

◆ operator[]() [1/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>
- + @@ -587,13 +587,13 @@

-

◆ operator[]() [2/2]

+ +

◆ operator[]() [2/2]

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

@@ -563,7 +563,7 @@

T & Hypercomplex< T, dim >::operator[]

(const unsigned int const uint64_t  i)
- + @@ -625,18 +625,18 @@

-

◆ operator^=()

+ +

◆ operator^=()

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

@@ -601,7 +601,7 @@

T const & Hypercomplex< T, dim >::operator[]

(const unsigned int const uint64_t  i) const
- + @@ -660,7 +660,7 @@

-template<typename T , const unsigned int dim>
+template<typename T , const uint64_t dim>

Hypercomplex< T, dim > & Hypercomplex< T, dim >::operator^= (const unsigned int const uint64_t  x)
- - - + + + - + - - - - - - + + + + + + @@ -135,9 +135,9 @@ - - - + + +
diff --git a/docs/html/class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4-members.html b/docs/html/class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4-members.html index 70cec96..8da8cd6 100644 --- a/docs/html/class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4-members.html +++ b/docs/html/class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4-members.html @@ -83,7 +83,7 @@

This is the complete list of members for Hypercomplex< Polynomial< MaxDeg >, dim >, including all inherited members.

- + @@ -99,9 +99,9 @@ - - - + + +
_() constHypercomplex< Polynomial< MaxDeg >, dim >inline
_() constHypercomplex< Polynomial< MaxDeg >, dim >inline
clear()Hypercomplex< Polynomial< MaxDeg >, dim >inlinestatic
expand() constHypercomplex< Polynomial< MaxDeg >, dim >inline
Hypercomplex(const Polynomial< MaxDeg > *ARR)Hypercomplex< Polynomial< MaxDeg >, dim >inlineexplicit
operator-() constHypercomplex< Polynomial< MaxDeg >, dim >inline
operator-=(const Hypercomplex &H)Hypercomplex< Polynomial< MaxDeg >, dim >inline
operator=(const Hypercomplex &H)Hypercomplex< Polynomial< MaxDeg >, dim >inline
operator[](const unsigned int i) constHypercomplex< Polynomial< MaxDeg >, dim >inline
operator[](const unsigned int i)Hypercomplex< Polynomial< MaxDeg >, dim >inline
operator^=(const unsigned int x)Hypercomplex< Polynomial< MaxDeg >, dim >inline
operator[](const uint64_t i) constHypercomplex< Polynomial< MaxDeg >, dim >inline
operator[](const uint64_t i)Hypercomplex< Polynomial< MaxDeg >, dim >inline
operator^=(const uint64_t x)Hypercomplex< Polynomial< MaxDeg >, dim >inline
operator~() constHypercomplex< Polynomial< MaxDeg >, dim >inline
~Hypercomplex() (defined in Hypercomplex< Polynomial< MaxDeg >, dim >)Hypercomplex< Polynomial< MaxDeg >, dim >inline
diff --git a/docs/html/class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html b/docs/html/class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html index 4a561f6..90b88f2 100644 --- a/docs/html/class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html +++ b/docs/html/class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html @@ -95,22 +95,22 @@
 Hypercomplex (const Hypercomplex &H)
 This is the copy constructor. More...
 
unsigned int _ () const
 Dimensionality getter. More...
 
uint64_t _ () const
 Dimensionality getter. More...
 
Polynomial< MaxDeg > norm2 () const
 Calculate squared Euclidean norm of a number. More...
 
template<const unsigned int newdim>
template<const uint64_t newdim>
Hypercomplex< Polynomial< MaxDeg >, newdim > expand () const
 Cast a number into a higher dimension. More...
 
Polynomial< MaxDeg > const & operator[] (const unsigned int i) const
 Access operator (const) More...
 
Polynomial< MaxDeg > & operator[] (const unsigned int i)
 Access operator (non-const) More...
 
Polynomial< MaxDeg > const & operator[] (const uint64_t i) const
 Access operator (const) More...
 
Polynomial< MaxDeg > & operator[] (const uint64_t i)
 Access operator (non-const) More...
 
Hypercomplex operator~ () const
 Create a complex conjugate. More...
 
Hypercomplexoperator*= (const Hypercomplex &H)
 Multiplication-Assignment operator. More...
 
Hypercomplexoperator^= (const unsigned int x)
 Power-Assignment operator. More...
 
Hypercomplexoperator^= (const uint64_t x)
 Power-Assignment operator. More...
 
@@ -154,7 +154,7 @@

Static Public Member Functions

 

Detailed Description

-
template<const unsigned int MaxDeg, const unsigned int dim>
+
template<const uint64_t MaxDeg, const uint64_t dim>
class Hypercomplex< Polynomial< MaxDeg >, dim >

Partial specialisation of the main class for polynomial operations

Constructor & Destructor Documentation

@@ -163,7 +163,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -202,7 +202,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -236,19 +236,19 @@

Member Function Documentation

- -

◆ _()

+ +

◆ _()

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
- + @@ -272,9 +272,9 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
-template<const unsigned int newdim>
+template<const uint64_t newdim>

unsigned int Hypercomplex< Polynomial< MaxDeg >, dim >::_ uint64_t Hypercomplex< Polynomial< MaxDeg >, dim >::_ ( ) const
@@ -305,7 +305,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -353,7 +353,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -383,7 +383,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -420,7 +420,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -457,7 +457,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -494,7 +494,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -531,7 +531,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -561,7 +561,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -598,7 +598,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
@@ -629,13 +629,13 @@

-

◆ operator[]() [1/2]

+ +

◆ operator[]() [1/2]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>
- + @@ -666,13 +666,13 @@

-

◆ operator[]() [2/2]

+ +

◆ operator[]() [2/2]

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

@@ -643,7 +643,7 @@

Polynomial< MaxDeg > & Hypercomplex< Polynomial< MaxDeg >, dim >::operator[]

(const unsigned int const uint64_t  i)
- + @@ -703,13 +703,13 @@

-

◆ operator^=()

+ +

◆ operator^=()

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

@@ -680,7 +680,7 @@

Polynomial< MaxDeg > const & Hypercomplex< Polynomial< MaxDeg >, dim >::operator[]

(const unsigned int const uint64_t  i) const
- + @@ -746,7 +746,7 @@

-template<const unsigned int MaxDeg, const unsigned int dim>
+template<const uint64_t MaxDeg, const uint64_t dim>

@@ -717,7 +717,7 @@

Hypercomplex & Hypercomplex< Polynomial< MaxDeg >, dim >::operator^=

(const unsigned int const uint64_t  x)
diff --git a/docs/html/class_hypercomplex_3_01mpfr__t_00_01dim_01_4-members.html b/docs/html/class_hypercomplex_3_01mpfr__t_00_01dim_01_4-members.html index 123c8a1..b4d3306 100644 --- a/docs/html/class_hypercomplex_3_01mpfr__t_00_01dim_01_4-members.html +++ b/docs/html/class_hypercomplex_3_01mpfr__t_00_01dim_01_4-members.html @@ -83,7 +83,7 @@

This is the complete list of members for Hypercomplex< mpfr_t, dim >, including all inherited members.

- + @@ -92,16 +92,16 @@ - + - - - + + +
_() constHypercomplex< mpfr_t, dim >inline
_() constHypercomplex< mpfr_t, dim >inline
clear()Hypercomplex< mpfr_t, dim >inlinestatic
expand() constHypercomplex< mpfr_t, dim >inline
Hypercomplex(const mpfr_t *ARR)Hypercomplex< mpfr_t, dim >inlineexplicit
init()Hypercomplex< mpfr_t, dim >inlinestatic
inv() constHypercomplex< mpfr_t, dim >inline
MUL(const Hypercomplex &H1, const Hypercomplex &H2)Hypercomplex< mpfr_t, dim >inlinestatic
norm(mpfr_t norm) constHypercomplex< mpfr_t, dim >inline
norm(mpfr_t norm) constHypercomplex< mpfr_t, dim >inline
operator*=(const Hypercomplex &H)Hypercomplex< mpfr_t, dim >inline
operator+=(const Hypercomplex &H)Hypercomplex< mpfr_t, dim >inline
operator-() constHypercomplex< mpfr_t, dim >inline
operator-=(const Hypercomplex &H)Hypercomplex< mpfr_t, dim >inline
operator/=(const Hypercomplex &H)Hypercomplex< mpfr_t, dim >inline
operator=(const Hypercomplex &H)Hypercomplex< mpfr_t, dim >inline
operator[](const unsigned int i) constHypercomplex< mpfr_t, dim >inline
operator[](const unsigned int i)Hypercomplex< mpfr_t, dim >inline
operator^=(const unsigned int x)Hypercomplex< mpfr_t, dim >inline
operator[](const uint64_t i) constHypercomplex< mpfr_t, dim >inline
operator[](const uint64_t i)Hypercomplex< mpfr_t, dim >inline
operator^=(const uint64_t x)Hypercomplex< mpfr_t, dim >inline
operator~() constHypercomplex< mpfr_t, dim >inline
~Hypercomplex() (defined in Hypercomplex< mpfr_t, dim >)Hypercomplex< mpfr_t, dim >inline
diff --git a/docs/html/class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html b/docs/html/class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html index 13a9f2d..8ca5e22 100644 --- a/docs/html/class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html +++ b/docs/html/class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html @@ -85,7 +85,7 @@
-

#include <Hypercomplex.hpp>

+

#include <Hypercomplex_MPFR.hpp>

@@ -95,16 +95,16 @@ - - - - - - + + + + + + - + @@ -117,12 +117,12 @@ - - - - - - + + + + + + @@ -132,9 +132,9 @@ - - - + + + @@ -154,7 +154,7 @@

Public Member Functions

 Hypercomplex (const Hypercomplex &H)
 This is the copy constructor. More...
 
unsigned int _ () const
 Dimensionality getter. More...
 
int norm (mpfr_t norm) const
 Calculate Euclidean norm of a number. More...
 
uint64_t _ () const
 Dimensionality getter. More...
 
int32_t norm (mpfr_t norm) const
 Calculate Euclidean norm of a number. More...
 
Hypercomplex inv () const
 Calculate inverse of a given number. More...
 
template<const unsigned int newdim>
template<const uint64_t newdim>
Hypercomplex< mpfr_t, newdim > expand () const
 Cast a number into a higher dimension. More...
 
Hypercomplexoperator= (const Hypercomplex &H)
 Assignment operator. More...
 
mpfr_t const & operator[] (const unsigned int i) const
 Access operator (const) More...
 
mpfr_t & operator[] (const unsigned int i)
 Access operator (non-const) More...
 
mpfr_t const & operator[] (const uint64_t i) const
 Access operator (const) More...
 
mpfr_t & operator[] (const uint64_t i)
 Access operator (non-const) More...
 
Hypercomplexoperator+= (const Hypercomplex &H)
 Addition-Assignment operator. More...
 
Hypercomplexoperator*= (const Hypercomplex &H)
 Multiplication-Assignment operator. More...
 
Hypercomplexoperator^= (const unsigned int x)
 Power-Assignment operator. More...
 
Hypercomplexoperator^= (const uint64_t x)
 Power-Assignment operator. More...
 
Hypercomplexoperator/= (const Hypercomplex &H)
 Division-Assignment operator. More...
 
 

Detailed Description

-
template<const unsigned int dim>
+
template<const uint64_t dim>
class Hypercomplex< mpfr_t, dim >

Partial specialisation of the main class for high precision

Constructor & Destructor Documentation

@@ -163,7 +163,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
@@ -202,7 +202,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
@@ -236,19 +236,19 @@

Member Function Documentation

- -

◆ _()

+ +

◆ _()

-template<const unsigned int dim>
+template<const uint64_t dim>
- + @@ -272,9 +272,9 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
-template<const unsigned int newdim>
+template<const uint64_t newdim>

unsigned int Hypercomplex< mpfr_t, dim >::_ uint64_t Hypercomplex< mpfr_t, dim >::_ ( ) const
@@ -305,7 +305,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
@@ -335,7 +335,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
@@ -377,19 +377,19 @@

-

◆ norm()

+ +

◆ norm()

-template<const unsigned int dim>
+template<const uint64_t dim>
- + @@ -421,7 +421,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>

int Hypercomplex< mpfr_t, dim >::norm int32_t Hypercomplex< mpfr_t, dim >::norm ( mpfr_t  norm)
@@ -458,7 +458,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
@@ -495,7 +495,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
@@ -525,7 +525,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
@@ -562,7 +562,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
@@ -599,7 +599,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>
@@ -630,13 +630,13 @@

-

◆ operator[]() [1/2]

+ +

◆ operator[]() [1/2]

-template<const unsigned int dim>
+template<const uint64_t dim>
- + @@ -667,13 +667,13 @@

-

◆ operator[]() [2/2]

+ +

◆ operator[]() [2/2]

-template<const unsigned int dim>
+template<const uint64_t dim>

@@ -644,7 +644,7 @@

mpfr_t & Hypercomplex< mpfr_t, dim >::operator[]

(const unsigned int const uint64_t  i)
- + @@ -704,13 +704,13 @@

-

◆ operator^=()

+ +

◆ operator^=()

-template<const unsigned int dim>
+template<const uint64_t dim>

@@ -681,7 +681,7 @@

mpfr_t const & Hypercomplex< mpfr_t, dim >::operator[]

(const unsigned int const uint64_t  i) const
- + @@ -747,7 +747,7 @@

-template<const unsigned int dim>
+template<const uint64_t dim>

@@ -718,7 +718,7 @@

Hypercomplex & Hypercomplex< mpfr_t, dim >::operator^=

(const unsigned int const uint64_t  x)
diff --git a/docs/html/class_polynomial-members.html b/docs/html/class_polynomial-members.html index e5119ef..7d2b4b3 100644 --- a/docs/html/class_polynomial-members.html +++ b/docs/html/class_polynomial-members.html @@ -85,8 +85,8 @@ - - + + diff --git a/docs/html/class_polynomial.html b/docs/html/class_polynomial.html index fedf896..85ed01e 100644 --- a/docs/html/class_polynomial.html +++ b/docs/html/class_polynomial.html @@ -103,15 +103,15 @@ - - - - - - + + + + + +
operator-() constPolynomial< MaxDeg >inline
operator=(const Polynomial &P)Polynomial< MaxDeg >inline
operator[](const unsigned int i) constPolynomial< MaxDeg >inline
operator[](const unsigned int i)Polynomial< MaxDeg >inline
operator[](const uint64_t i) constPolynomial< MaxDeg >inline
operator[](const uint64_t i)Polynomial< MaxDeg >inline
Polynomial(const int64_t *arr)Polynomial< MaxDeg >inlineexplicit
Polynomial(const Polynomial &P)Polynomial< MaxDeg >inline
Polynomial()Polynomial< MaxDeg >inline
Polynomial operator- () const
 Create an additive inverse of a given polynomial. More...
 
int64_t const & operator[] (const unsigned int i) const
 Access operator (const) More...
 
int64_t & operator[] (const unsigned int i)
 Access operator (non-const) More...
 
int64_t const & operator[] (const uint64_t i) const
 Access operator (const) More...
 
int64_t & operator[] (const uint64_t i)
 Access operator (non-const) More...
 

Detailed Description

-
template<const unsigned int MaxDeg>
+
template<const uint64_t MaxDeg>
class Polynomial< MaxDeg >

Helper class for polynomials

Constructor & Destructor Documentation

@@ -120,7 +120,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>
@@ -159,7 +159,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>
@@ -198,7 +198,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>
@@ -231,7 +231,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>
@@ -261,7 +261,7 @@

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>
@@ -292,13 +292,13 @@

-

◆ operator[]() [1/2]

+ +

◆ operator[]() [1/2]

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>
- + @@ -329,13 +329,13 @@

-

◆ operator[]() [2/2]

+ +

◆ operator[]() [2/2]

-template<const unsigned int MaxDeg>
+template<const uint64_t MaxDeg>

@@ -306,7 +306,7 @@

int64_t & Polynomial< MaxDeg >::operator[]

(const unsigned int const uint64_t  i)
- + diff --git a/docs/html/dir_fc26623859613a57d3173c26376afd4c.html b/docs/html/dir_fc26623859613a57d3173c26376afd4c.html index 7c8ce5d..c0dc527 100644 --- a/docs/html/dir_fc26623859613a57d3173c26376afd4c.html +++ b/docs/html/dir_fc26623859613a57d3173c26376afd4c.html @@ -89,6 +89,8 @@ Files + +
@@ -343,7 +343,7 @@

int64_t const & Polynomial< MaxDeg >::operator[]

(const unsigned int const uint64_t  i) const
file  Hypercomplex.hpp [code]
 
file  Hypercomplex_MPFR.hpp [code]
 
file  Polynomial.hpp [code]
 
diff --git a/docs/html/index.html b/docs/html/index.html index 1872471..834483b 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -82,19 +82,20 @@

The following library aims to deliver a simple method to construct hypercomplex numbers from any of the Cayley-Dickson algebras. It supports calculations in an arbitrary-precise arithmetic as well as encryption/decryption procedures for public-key lattice-based cryptosystems in high-dimensional algebras of truncated polynomial rings. The library is dedicated mostly to computational mathematicians and computational scientists whose focus is (post-quantum) cryptography and precise computation. As a header-only C++ template code it's greatest advantage is the combination of speed, generic programming and convenience for the end user, making it well suited for wide range of computationally challenging projects.

Installation

-

As a prerequisite it is essential to install the MPFR library first. This should be rather straightforward with the following commands:

# Linux (apt-get package manager)
+

The following is a header-only library, meaning that the easiest way to use it is to copy the core hpp files alongside your main program and include it into the code with the directive:

Remember to specify a proper langauge standard and optimisation level for the compiler, as in the command below:

g++ -O2 --std=c++17 main.cpp -o main
+

For computations based on high precision arithmetics it is essential to install the MPFR library first. This should be rather straightforward with the following commands:

# Linux (apt-get package manager)
sudo apt-get update -y
sudo apt-get install -y libmpfr-dev
# macOS (Homebrew package manager)
brew update
brew install mpfr
-

The following is a header-only library, meaning that the easiest way to use it is to copy the core hpp file alongside the main program and include it into the code with the directive:

Remember to specify a proper langauge standard for the compiler as well as linking with GNU MP and GNU MPFR libraries, as in the command below:

g++ -O2 --std=c++17 test.cpp -o test -lmpfr -lgmp
+

It is then essential to provide a preprocessor macro specifying the use of this library at the compile time as well as linking with GNU MP and GNU MPFR as in the command below:

g++ -O2 -DUSEMPFR=1 --std=c++17 main.cpp -o main -lmpfr -lgmp

Alternatively, if you work with conda environments this library is installable with:

conda install -c angrymaciek hypercomplex

However, please note that during compilation time it might be necessary to provide additional flags which point to the headers and other libs for the linker.

-

The command above would be adjusted to:

g++ -O2 --std=c++17 -I$CONDA_PREFIX/include -L$CONDA_PREFIX/lib test.cpp -o test -lmpfr -lgmp
+

The command above would be adjusted to:

g++ -O2 -DUSEMPFR=1 --std=c++17 -I$CONDA_PREFIX/include -L$CONDA_PREFIX/lib main.cpp -o main -lmpfr -lgmp

Brief overview

The following section demonstrates general functionality and behaviour of the library. For the full unit test suite please refer to this file.

@@ -109,7 +110,7 @@

double arr2[4] = {-2.0,-4.0,-6.0,0.0};
std::cout << "H2 = " << H2 << std::endl;
-
Definition: Hypercomplex.hpp:39
+
Definition: Hypercomplex.hpp:48

The code above results in:

H1 = 1 0 -0.5 5
H2 = -2 -4 -6 0

For every hypercomplex number we may extract its' real as well as imaginary part:

@@ -117,8 +118,8 @@

\(Im(H) := (0, H^{(1)}, H^{(2)}, H^{(3)}, \dotsc)\)

Therefore the commands:

std::cout << "Re(H1) = " << Re(H1) << std::endl;
std::cout << "Im(H1) = " << Im(H1) << std::endl;
-
Hypercomplex< T, dim > Re(const Hypercomplex< T, dim > &H)
Real part of a hypercomplex number.
Definition: Hypercomplex.hpp:627
-
Hypercomplex< T, dim > Im(const Hypercomplex< T, dim > &H)
Imaginary part of a hypercomplex number.
Definition: Hypercomplex.hpp:635
+
Hypercomplex< T, dim > Re(const Hypercomplex< T, dim > &H)
Real part of a hypercomplex number.
Definition: Hypercomplex.hpp:636
+
Hypercomplex< T, dim > Im(const Hypercomplex< T, dim > &H)
Imaginary part of a hypercomplex number.
Definition: Hypercomplex.hpp:644

yield:

Re(H1) = 1 0 0 0
Im(H1) = 0 0 -0.5 5

In case you already forgot what the dimensionality of our objects is, don't worry - we got your back. Asking the right questions...

@@ -162,22 +163,22 @@

\(e^H = e^{Re(H)+Im(H)} := e^{Re(H)} \times (cos||Im(H)||_2 + \frac{Im(H)}{||Im(H)||_2} \times sin||Im(H)||_2)\)

Regardless of the algebra hypercomplex numbers in the equation above are multiplied by scalars, therefore associativity and commutativity still holds for these formulas. For that reason the exponentiation function is highly optimized, implemented efficiently with as few operations and variables as possible.

Finally, we validate it with:

std::cout << "e^H1 = " << exp(H1) << std::endl;
-
Hypercomplex< T, dim > exp(const Hypercomplex< T, dim > &H)
Exponentiation operation on a hypercomplex number.
Definition: Hypercomplex.hpp:643
+
Hypercomplex< T, dim > exp(const Hypercomplex< T, dim > &H)
Exponentiation operation on a hypercomplex number.
Definition: Hypercomplex.hpp:652

and get:

e^H1 = 0.83583 -0 0.257375 -2.57375

Arbitrary-precision arithmetic

Calculations on MPFR types are availabla via partial template specialisation (meaning that the hpp file already includes the necessary header and the user should not include it again). It is strongly advised to read the library manual beforehand (sections 1 and 4 as a must-read). Please do not mix this library with another MPFR-dependant code in the same translation unit.

-

We start with setting a global precision for all objects.

-
void set_mpfr_precision(unsigned int n)
Setter for the global precision of the MPFR variables.
Definition: Hypercomplex.hpp:679
+

We start with setting a global precision for all objects.

+
void set_mpfr_precision(uint64_t n)
Setter for the global precision of the MPFR variables.
Definition: Hypercomplex_MPFR.hpp:36

What follows is an initialization of 8 MPFR variables in a single array:

mpfr_t A[8];
-
mpfr_init2(A[0], get_mpfr_precision());
-
mpfr_init2(A[1], get_mpfr_precision());
-
mpfr_init2(A[2], get_mpfr_precision());
-
mpfr_init2(A[3], get_mpfr_precision());
-
mpfr_init2(A[4], get_mpfr_precision());
-
mpfr_init2(A[5], get_mpfr_precision());
-
mpfr_init2(A[6], get_mpfr_precision());
-
mpfr_init2(A[7], get_mpfr_precision());
+
mpfr_init2(A[0], get_mpfr_precision());
+
mpfr_init2(A[1], get_mpfr_precision());
+
mpfr_init2(A[2], get_mpfr_precision());
+
mpfr_init2(A[3], get_mpfr_precision());
+
mpfr_init2(A[4], get_mpfr_precision());
+
mpfr_init2(A[5], get_mpfr_precision());
+
mpfr_init2(A[6], get_mpfr_precision());
+
mpfr_init2(A[7], get_mpfr_precision());
mpfr_set_d(A[0], 1.5, MPFR_RNDN);
mpfr_set_d(A[1], 2.5, MPFR_RNDN);
mpfr_set_d(A[2], 0.0, MPFR_RNDN);
@@ -186,7 +187,7 @@

mpfr_set_d(A[5], -0.5, MPFR_RNDN);
mpfr_set_d(A[6], -0.5, MPFR_RNDN);
mpfr_set_d(A[7], -1.5, MPFR_RNDN);
-
unsigned int get_mpfr_precision()
Getter for the global precision of the MPFR variables.
Definition: Hypercomplex.hpp:672
+
uint64_t get_mpfr_precision()
Getter for the global precision of the MPFR variables.
Definition: Hypercomplex_MPFR.hpp:29

Let us create an octonion composed of these numbers:

To print the first element of our number after raising it to the 30-th power we need to use library specific function:

std::cout << "Hx^30 = ";
mpfr_out_str(stdout, 10, 0, (Hx^30)[0], MPFR_RNDN);
@@ -200,8 +201,8 @@

mpfr_clear(A[5]);
mpfr_clear(A[6]);
mpfr_clear(A[7]);
-

Also, following that, to call a wrapper function which cleans all internally-reserved memory:

-
void clear_mpfr_memory()
Wrapper for MPFR memory cleanup.
Definition: Hypercomplex.hpp:685
+

Also, following that, to call a wrapper function which cleans all internally-reserved memory:

+
void clear_mpfr_memory()
Wrapper for MPFR memory cleanup.
Definition: Hypercomplex_MPFR.hpp:42

All the code specified up to this point may be executed upon compilation of this source code.

Cryptographic Application

@@ -239,10 +240,10 @@

# DECRYPTION
-
Hypercomplex< Polynomial< MaxDeg >, dim > DECRYPT(const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &E, const int64_t &p, const int64_t &q)
Decrypt a message via the cryptosystem.
Definition: Hypercomplex.hpp:1858
-
Hypercomplex< Polynomial< MaxDeg >, dim > PUBLICKEY(const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &G, const int64_t &q)
Generate public key of the cryptosystem.
Definition: Hypercomplex.hpp:1818
-
Hypercomplex< Polynomial< MaxDeg >, dim > ENCRYPT(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const Hypercomplex< Polynomial< MaxDeg >, dim > &M, const Hypercomplex< Polynomial< MaxDeg >, dim > &PHI, const int64_t &p, const int64_t &q)
Encrypt a message via the cryptosystem.
Definition: Hypercomplex.hpp:1838
-
void CenteredLift(Hypercomplex< Polynomial< MaxDeg >, dim > *H, const int64_t &mod)
Center-lift hypercomplex elements in a modular quotient ring.
Definition: Hypercomplex.hpp:1768
+
Hypercomplex< Polynomial< MaxDeg >, dim > DECRYPT(const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &E, const int64_t &p, const int64_t &q)
Decrypt a message via the cryptosystem.
Definition: Hypercomplex.hpp:1253
+
Hypercomplex< Polynomial< MaxDeg >, dim > PUBLICKEY(const Hypercomplex< Polynomial< MaxDeg >, dim > &F, const Hypercomplex< Polynomial< MaxDeg >, dim > &G, const int64_t &q)
Generate public key of the cryptosystem.
Definition: Hypercomplex.hpp:1213
+
Hypercomplex< Polynomial< MaxDeg >, dim > ENCRYPT(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const Hypercomplex< Polynomial< MaxDeg >, dim > &M, const Hypercomplex< Polynomial< MaxDeg >, dim > &PHI, const int64_t &p, const int64_t &q)
Encrypt a message via the cryptosystem.
Definition: Hypercomplex.hpp:1233
+
void CenteredLift(Hypercomplex< Polynomial< MaxDeg >, dim > *H, const int64_t &mod)
Center-lift hypercomplex elements in a modular quotient ring.
Definition: Hypercomplex.hpp:1163

Remarkably, for a cryptosystem based on an algebra of \(D \geq 16\) dimensions \(F\) needs to contain at most one \( x_i \in R | x_i \neq 0\). This is because sedonions (and higher) are not associative, thus the decryption process will only be possible for a specific, reduced subset of private keys.

Cryptographic applications of Hypercomplex have been extensively tested in the test case: Cryptosystem based on Cayley-Dickson Algebras of the following file.

All tests underlying Figure 1 in the publication are available here.

diff --git a/docs/html/menudata.js b/docs/html/menudata.js index 2b1bb3b..3219ded 100644 --- a/docs/html/menudata.js +++ b/docs/html/menudata.js @@ -26,4 +26,5 @@ var menudata={children:[ {text:"Main Page",url:"index.html"}, {text:"File Reference",url:"usergroup0.html",children:[ {text:"Hypercomplex",url:"_hypercomplex_8hpp.html"}, +{text:"Hypercomplex_MPFR",url:"_hypercomplex___m_p_f_r_8hpp.html"}, {text:"Polynomial",url:"_polynomial_8hpp.html"}]}]} diff --git a/docs/html/search/all_0.js b/docs/html/search/all_0.js index 3baeb44..c89ad34 100644 --- a/docs/html/search/all_0.js +++ b/docs/html/search/all_0.js @@ -1,4 +1,4 @@ var searchData= [ - ['_5f_0',['_',['../class_hypercomplex.html#a931145bb1261d4e753ab8038ee3e5e6a',1,'Hypercomplex::_()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a84fc4d493202fb660e96cf45bb0cbcf0',1,'Hypercomplex< mpfr_t, dim >::_()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#abffec6723a0be263401a7f9f85480816',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::_()']]] + ['_5f_0',['_',['../class_hypercomplex.html#a9bd63af8d583aedac22a99dbf88d7844',1,'Hypercomplex::_()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ab9f02efa183110a3d8aafb710ecc056e',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::_()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#af4fef1008e64d63163cface4abc1ac09',1,'Hypercomplex< mpfr_t, dim >::_()']]] ]; diff --git a/docs/html/search/all_1.js b/docs/html/search/all_1.js index 56d869a..c656e99 100644 --- a/docs/html/search/all_1.js +++ b/docs/html/search/all_1.js @@ -1,6 +1,6 @@ var searchData= [ ['centeredlift_0',['CenteredLift',['../_hypercomplex_8hpp.html#a9318240e82fe8b403697464a1fffad66',1,'CenteredLift(Hypercomplex< Polynomial< MaxDeg >, dim > *H, const int64_t &mod): Hypercomplex.hpp'],['../_polynomial_8hpp.html#a947a92ea5edd042a91568b97821bfd47',1,'CenteredLift(Polynomial< MaxDeg > *P, const int64_t mod): Polynomial.hpp']]], - ['clear_1',['clear',['../class_hypercomplex.html#ac1c9386db6f8fff67bff899c6d4218cc',1,'Hypercomplex::clear()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a2b34b54d55a847d7cc03bacc66b7c76b',1,'Hypercomplex< mpfr_t, dim >::clear()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#aa2e383cf7b1969efa3f0fbf23f9f950a',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::clear()']]], - ['clear_5fmpfr_5fmemory_2',['clear_mpfr_memory',['../_hypercomplex_8hpp.html#a5214ea26b252ebf7b5e10d153df22ef4',1,'Hypercomplex.hpp']]] + ['clear_1',['clear',['../class_hypercomplex.html#ac1c9386db6f8fff67bff899c6d4218cc',1,'Hypercomplex::clear()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#aa2e383cf7b1969efa3f0fbf23f9f950a',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::clear()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a2b34b54d55a847d7cc03bacc66b7c76b',1,'Hypercomplex< mpfr_t, dim >::clear()']]], + ['clear_5fmpfr_5fmemory_2',['clear_mpfr_memory',['../_hypercomplex___m_p_f_r_8hpp.html#a5214ea26b252ebf7b5e10d153df22ef4',1,'Hypercomplex_MPFR.hpp']]] ]; diff --git a/docs/html/search/all_3.js b/docs/html/search/all_3.js index ddfa914..f18eaa2 100644 --- a/docs/html/search/all_3.js +++ b/docs/html/search/all_3.js @@ -1,6 +1,6 @@ var searchData= [ ['encrypt_0',['ENCRYPT',['../_hypercomplex_8hpp.html#a838b097d48a6ea322263177a2abfdc3f',1,'Hypercomplex.hpp']]], - ['exp_1',['exp',['../_hypercomplex_8hpp.html#acefdb8c35a0c89587789edc830ffa282',1,'exp(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a827feec4f775a7f77b8c8fe741db71e8',1,'exp(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex.hpp']]], - ['expand_2',['expand',['../class_hypercomplex.html#af1113f6be945317a45a652821538763a',1,'Hypercomplex::expand()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ab27c393e108c09e55b10f1624b4e0363',1,'Hypercomplex< mpfr_t, dim >::expand()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a266b7181c6357a663fc8143f0400d2b2',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::expand()']]] + ['exp_1',['exp',['../_hypercomplex_8hpp.html#acefdb8c35a0c89587789edc830ffa282',1,'exp(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a827feec4f775a7f77b8c8fe741db71e8',1,'exp(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex_MPFR.hpp']]], + ['expand_2',['expand',['../class_hypercomplex.html#af1113f6be945317a45a652821538763a',1,'Hypercomplex::expand()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a266b7181c6357a663fc8143f0400d2b2',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::expand()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ab27c393e108c09e55b10f1624b4e0363',1,'Hypercomplex< mpfr_t, dim >::expand()']]] ]; diff --git a/docs/html/search/all_4.js b/docs/html/search/all_4.js index 7c05672..433060e 100644 --- a/docs/html/search/all_4.js +++ b/docs/html/search/all_4.js @@ -1,4 +1,4 @@ var searchData= [ - ['get_5fmpfr_5fprecision_0',['get_mpfr_precision',['../_hypercomplex_8hpp.html#aa327dde3d41d1e300e035e14b996fd82',1,'Hypercomplex.hpp']]] + ['get_5fmpfr_5fprecision_0',['get_mpfr_precision',['../_hypercomplex___m_p_f_r_8hpp.html#a28f29287f2710d597953c495f686fd37',1,'Hypercomplex_MPFR.hpp']]] ]; diff --git a/docs/html/search/all_5.js b/docs/html/search/all_5.js index 88ad574..0af9179 100644 --- a/docs/html/search/all_5.js +++ b/docs/html/search/all_5.js @@ -1,7 +1,8 @@ var searchData= [ - ['hypercomplex_0',['Hypercomplex',['../class_hypercomplex.html',1,'Hypercomplex< T, dim >'],['../class_hypercomplex.html#a8a9c8fc7c1ee12410d67538f02761ea0',1,'Hypercomplex::Hypercomplex(const T *ARR)'],['../class_hypercomplex.html#a146953255d128ab90770fa034bbf3253',1,'Hypercomplex::Hypercomplex(const Hypercomplex &H)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#aa4e422dfb2633dbb931cbf340d82c523',1,'Hypercomplex< mpfr_t, dim >::Hypercomplex(const mpfr_t *ARR)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a3f5af9da94ca759c7061cddd8b66a395',1,'Hypercomplex< mpfr_t, dim >::Hypercomplex(const Hypercomplex &H)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a120bed19c4d7f1301de95b5b24353cb8',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::Hypercomplex(const Polynomial< MaxDeg > *ARR)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#acb360c4f4e122db359489f73abf6de00',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::Hypercomplex(const Hypercomplex &H)']]], + ['hypercomplex_0',['Hypercomplex',['../class_hypercomplex.html',1,'Hypercomplex< T, dim >'],['../class_hypercomplex.html#a8a9c8fc7c1ee12410d67538f02761ea0',1,'Hypercomplex::Hypercomplex(const T *ARR)'],['../class_hypercomplex.html#a146953255d128ab90770fa034bbf3253',1,'Hypercomplex::Hypercomplex(const Hypercomplex &H)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a120bed19c4d7f1301de95b5b24353cb8',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::Hypercomplex(const Polynomial< MaxDeg > *ARR)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#acb360c4f4e122db359489f73abf6de00',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::Hypercomplex(const Hypercomplex &H)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#aa4e422dfb2633dbb931cbf340d82c523',1,'Hypercomplex< mpfr_t, dim >::Hypercomplex(const mpfr_t *ARR)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a3f5af9da94ca759c7061cddd8b66a395',1,'Hypercomplex< mpfr_t, dim >::Hypercomplex(const Hypercomplex &H)']]], ['hypercomplex_2ehpp_1',['Hypercomplex.hpp',['../_hypercomplex_8hpp.html',1,'']]], ['hypercomplex_3c_20mpfr_5ft_2c_20dim_20_3e_2',['Hypercomplex< mpfr_t, dim >',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html',1,'']]], - ['hypercomplex_3c_20polynomial_3c_20maxdeg_20_3e_2c_20dim_20_3e_3',['Hypercomplex< Polynomial< MaxDeg >, dim >',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html',1,'']]] + ['hypercomplex_3c_20polynomial_3c_20maxdeg_20_3e_2c_20dim_20_3e_3',['Hypercomplex< Polynomial< MaxDeg >, dim >',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html',1,'']]], + ['hypercomplex_5fmpfr_2ehpp_4',['Hypercomplex_MPFR.hpp',['../_hypercomplex___m_p_f_r_8hpp.html',1,'']]] ]; diff --git a/docs/html/search/all_6.js b/docs/html/search/all_6.js index 0c4e22c..7065640 100644 --- a/docs/html/search/all_6.js +++ b/docs/html/search/all_6.js @@ -1,6 +1,6 @@ var searchData= [ - ['im_0',['Im',['../_hypercomplex_8hpp.html#ab232dad8df7b0f66c9cc201bca82f9a5',1,'Im(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ab4e6a3251ab8dd6894d34b717c2c997e',1,'Im(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae07b855ec5c6944b87c6ff2b63295677',1,'Im(const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp']]], - ['init_1',['init',['../class_hypercomplex.html#a15291cd83909b370a2cc9b7af07332a2',1,'Hypercomplex::init()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ad13e2c8f4b662670e6f0b218cb8b83ed',1,'Hypercomplex< mpfr_t, dim >::init()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a082192bdd1ae6714a8d04dc955306c43',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::init()']]], + ['im_0',['Im',['../_hypercomplex_8hpp.html#ab232dad8df7b0f66c9cc201bca82f9a5',1,'Im(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae07b855ec5c6944b87c6ff2b63295677',1,'Im(const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#ab4e6a3251ab8dd6894d34b717c2c997e',1,'Im(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex_MPFR.hpp']]], + ['init_1',['init',['../class_hypercomplex.html#a15291cd83909b370a2cc9b7af07332a2',1,'Hypercomplex::init()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a082192bdd1ae6714a8d04dc955306c43',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::init()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ad13e2c8f4b662670e6f0b218cb8b83ed',1,'Hypercomplex< mpfr_t, dim >::init()']]], ['inv_2',['inv',['../class_hypercomplex.html#adb578e6896d59943d9168928009fe562',1,'Hypercomplex::inv()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a463b637e17efc7b910e5bc8638d9d0aa',1,'Hypercomplex< mpfr_t, dim >::inv()']]] ]; diff --git a/docs/html/search/all_7.js b/docs/html/search/all_7.js index 52b35d8..ae627de 100644 --- a/docs/html/search/all_7.js +++ b/docs/html/search/all_7.js @@ -1,4 +1,4 @@ var searchData= [ - ['mul_0',['MUL',['../class_hypercomplex.html#a9b0cc11c9b24add2a6261d74812ac575',1,'Hypercomplex::MUL()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#abaafe74a85379789e921341299853717',1,'Hypercomplex< mpfr_t, dim >::MUL()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ab96d985a07cd0b5c51fa87644012bc2d',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::MUL()']]] + ['mul_0',['MUL',['../class_hypercomplex.html#a9b0cc11c9b24add2a6261d74812ac575',1,'Hypercomplex::MUL()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ab96d985a07cd0b5c51fa87644012bc2d',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::MUL()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#abaafe74a85379789e921341299853717',1,'Hypercomplex< mpfr_t, dim >::MUL()']]] ]; diff --git a/docs/html/search/all_8.js b/docs/html/search/all_8.js index 5e43da4..f8163fa 100644 --- a/docs/html/search/all_8.js +++ b/docs/html/search/all_8.js @@ -1,6 +1,6 @@ var searchData= [ - ['norm_0',['norm',['../class_hypercomplex.html#a70212f34de74fef9911eae4bf0b94364',1,'Hypercomplex::norm()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#aa371a5a4aef3655e8b9e5ff06c069f8d',1,'Hypercomplex< mpfr_t, dim >::norm()']]], + ['norm_0',['norm',['../class_hypercomplex.html#a70212f34de74fef9911eae4bf0b94364',1,'Hypercomplex::norm()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ae6e770552a2a9fe8d0fa1efc86459ff8',1,'Hypercomplex< mpfr_t, dim >::norm()']]], ['norm2_1',['norm2',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ace48510f4cad039eaf2a6ddbe9415baf',1,'Hypercomplex< Polynomial< MaxDeg >, dim >']]], ['notitle_2',['notitle',['../index.html',1,'']]] ]; diff --git a/docs/html/search/all_9.js b/docs/html/search/all_9.js index 64c8d7a..58be4c9 100644 --- a/docs/html/search/all_9.js +++ b/docs/html/search/all_9.js @@ -1,21 +1,21 @@ var searchData= [ - ['operator_21_3d_0',['operator!=',['../_hypercomplex_8hpp.html#a3861eb71b7adacb3382064e32039da4c',1,'operator!=(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a6a723f659badf410e3f9b6e372bc12da',1,'operator!=(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#adae0fc224a78cec59e2a4b13451bded6',1,'operator!=(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#aa5bc05fb2661093163b44bfdb2f07db6',1,'operator!=(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_21_3d_0',['operator!=',['../_hypercomplex_8hpp.html#a3861eb71b7adacb3382064e32039da4c',1,'operator!=(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#adae0fc224a78cec59e2a4b13451bded6',1,'operator!=(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a6a723f659badf410e3f9b6e372bc12da',1,'operator!=(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#aa5bc05fb2661093163b44bfdb2f07db6',1,'operator!=(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], ['operator_25_1',['operator%',['../_hypercomplex_8hpp.html#ac646b4775b851916bac22a833b322322',1,'operator%(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod): Hypercomplex.hpp'],['../_polynomial_8hpp.html#af487fd9106ac42a95572f44669c8bdd2',1,'operator%(const Polynomial< MaxDeg > &P, const int64_t x): Polynomial.hpp']]], ['operator_25_3d_2',['operator%=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#afdd3cd93c8de1d1222d7d1f0a4ca38a0',1,'Hypercomplex< Polynomial< MaxDeg >, dim >']]], - ['operator_2a_3',['operator*',['../_hypercomplex_8hpp.html#a9e70c8ff6fe4ec8fd37842d48a48ea3f',1,'operator*(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#af4eb688419691e7f1c8c3291bd1af087',1,'operator*(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a0b72103099b76a2f24d17f619d91cb2b',1,'operator*(const int64_t &x, const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a66ff37e491ea850493085779b3dc70b6',1,'operator*(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#ada08bad24346623f552dd5483b3b2b44',1,'operator*(const int64_t x, const Polynomial< MaxDeg > &P): Polynomial.hpp'],['../_polynomial_8hpp.html#a5b98895946924af3819a4de97bed579e',1,'operator*(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], - ['operator_2a_3d_4',['operator*=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#accfdaa6a9f2e08ed6056230f413456ef',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator*=(const Hypercomplex &H)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a390e0a98a9dedeb67e9d9236e1f68b6c',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator*=(const int64_t &x)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a49b0d2db97e254991b5fa3eb3a8140b2',1,'Hypercomplex< mpfr_t, dim >::operator*=()'],['../class_hypercomplex.html#abcbab8fe23748ba0e42dcc8acfed2597',1,'Hypercomplex::operator*=()']]], - ['operator_2b_5',['operator+',['../_hypercomplex_8hpp.html#a5ae27680fff72f3f84dee8eca7e4d265',1,'operator+(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#aa156e4c1b865cee227a801ec1ed2d90f',1,'operator+(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ad8c7be3ef5e8c112c9e29a9fecf60a9d',1,'operator+(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#a775a48e6b08ae2950870cdd5106d1235',1,'operator+(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], - ['operator_2b_3d_6',['operator+=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a908ec3833e7922f60c7b2fab06453525',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator+=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a45073786485c9879a10bcc49c9625976',1,'Hypercomplex< mpfr_t, dim >::operator+=()'],['../class_hypercomplex.html#a26f1239812d18d6396826ef53ebb2f52',1,'Hypercomplex::operator+=(const Hypercomplex &H)']]], - ['operator_2d_7',['operator-',['../class_hypercomplex.html#aa23c83df7db4b36f5b9252c12b3f431f',1,'Hypercomplex::operator-()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a291b67e054b97b36d1776c295e47a659',1,'Hypercomplex< mpfr_t, dim >::operator-()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a763f98c9b114d89ac8f8e8f1d5d5b731',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator-()'],['../class_polynomial.html#a63d435f5b4017a2439803abb9bab27b9',1,'Polynomial::operator-()'],['../_hypercomplex_8hpp.html#a05bea0c8db8be9b4d5f2c3e8ae36c28c',1,'operator-(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae0f84940c641bc790419054d38953651',1,'operator-(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae71e40fe09be5bd1457590ce65a4daac',1,'operator-(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#a756820e0ec0f934daca2246fdbd8f071',1,'operator-(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], - ['operator_2d_3d_8',['operator-=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a164a0a845b57d47783840d3efeef52b5',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator-=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#adfc23e80db712bcd161c9c002bad5f21',1,'Hypercomplex< mpfr_t, dim >::operator-=()'],['../class_hypercomplex.html#abf95f932bbd5639e52cb85c52bc3b461',1,'Hypercomplex::operator-=()']]], - ['operator_2f_9',['operator/',['../_hypercomplex_8hpp.html#afa30e28932e237dda881212dc294f0b3',1,'operator/(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a80f7f3684b19ab34ff47a9d7c4f0c307',1,'operator/(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp']]], + ['operator_2a_3',['operator*',['../_hypercomplex_8hpp.html#a9e70c8ff6fe4ec8fd37842d48a48ea3f',1,'operator*(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a0b72103099b76a2f24d17f619d91cb2b',1,'operator*(const int64_t &x, const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a66ff37e491ea850493085779b3dc70b6',1,'operator*(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#af4eb688419691e7f1c8c3291bd1af087',1,'operator*(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#ada08bad24346623f552dd5483b3b2b44',1,'operator*(const int64_t x, const Polynomial< MaxDeg > &P): Polynomial.hpp'],['../_polynomial_8hpp.html#a5b98895946924af3819a4de97bed579e',1,'operator*(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_2a_3d_4',['operator*=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a49b0d2db97e254991b5fa3eb3a8140b2',1,'Hypercomplex< mpfr_t, dim >::operator*=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#accfdaa6a9f2e08ed6056230f413456ef',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator*=(const Hypercomplex &H)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a390e0a98a9dedeb67e9d9236e1f68b6c',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator*=(const int64_t &x)'],['../class_hypercomplex.html#abcbab8fe23748ba0e42dcc8acfed2597',1,'Hypercomplex::operator*=()']]], + ['operator_2b_5',['operator+',['../_hypercomplex_8hpp.html#a5ae27680fff72f3f84dee8eca7e4d265',1,'operator+(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ad8c7be3ef5e8c112c9e29a9fecf60a9d',1,'operator+(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#aa156e4c1b865cee227a801ec1ed2d90f',1,'operator+(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#a775a48e6b08ae2950870cdd5106d1235',1,'operator+(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_2b_3d_6',['operator+=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a45073786485c9879a10bcc49c9625976',1,'Hypercomplex< mpfr_t, dim >::operator+=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a908ec3833e7922f60c7b2fab06453525',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator+=()'],['../class_hypercomplex.html#a26f1239812d18d6396826ef53ebb2f52',1,'Hypercomplex::operator+=(const Hypercomplex &H)']]], + ['operator_2d_7',['operator-',['../class_hypercomplex.html#aa23c83df7db4b36f5b9252c12b3f431f',1,'Hypercomplex::operator-()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a763f98c9b114d89ac8f8e8f1d5d5b731',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator-()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a291b67e054b97b36d1776c295e47a659',1,'Hypercomplex< mpfr_t, dim >::operator-()'],['../class_polynomial.html#a63d435f5b4017a2439803abb9bab27b9',1,'Polynomial::operator-()'],['../_hypercomplex_8hpp.html#a05bea0c8db8be9b4d5f2c3e8ae36c28c',1,'operator-(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae71e40fe09be5bd1457590ce65a4daac',1,'operator-(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#ae0f84940c641bc790419054d38953651',1,'operator-(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#a756820e0ec0f934daca2246fdbd8f071',1,'operator-(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_2d_3d_8',['operator-=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#adfc23e80db712bcd161c9c002bad5f21',1,'Hypercomplex< mpfr_t, dim >::operator-=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a164a0a845b57d47783840d3efeef52b5',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator-=()'],['../class_hypercomplex.html#abf95f932bbd5639e52cb85c52bc3b461',1,'Hypercomplex::operator-=()']]], + ['operator_2f_9',['operator/',['../_hypercomplex_8hpp.html#afa30e28932e237dda881212dc294f0b3',1,'operator/(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a80f7f3684b19ab34ff47a9d7c4f0c307',1,'operator/(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp']]], ['operator_2f_3d_10',['operator/=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a0c6f82232587461d8c2d428aca1fd55c',1,'Hypercomplex< mpfr_t, dim >::operator/=()'],['../class_hypercomplex.html#a5693f454f81d59fbd951aa111bcd8843',1,'Hypercomplex::operator/=()']]], - ['operator_3c_3c_11',['operator<<',['../_polynomial_8hpp.html#a1259d353e8e4d57bf2342b46f238f5c5',1,'operator<<(std::ostream &os, const Polynomial< MaxDeg > &P): Polynomial.hpp'],['../_hypercomplex_8hpp.html#aacfc2c8f773ebd5f5f77015ddaf9fa3d',1,'operator<<(std::ostream &os, const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a1d1ea12368015b50da86eb0db28fad44',1,'operator<<(std::ostream &os, const Hypercomplex< mpfr_t, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a713344696cd9727037289f7eba60752b',1,'operator<<(std::ostream &os, const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp']]], - ['operator_3d_12',['operator=',['../class_hypercomplex.html#a624e410d1a0ab9a4332c4e7a2d25c906',1,'Hypercomplex::operator=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#acd1aa62d9cac7435a490a779a27d9ec3',1,'Hypercomplex< mpfr_t, dim >::operator=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a0b9b9bc2f0973a9e2ce7eb3d35d22d81',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator=()'],['../class_polynomial.html#ace51411fa33baaaf127fadc5f6e59bb9',1,'Polynomial::operator=()']]], - ['operator_3d_3d_13',['operator==',['../_hypercomplex_8hpp.html#a29619ebaa017a1a612e767372c88a465',1,'operator==(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a713f745bfe5e132c0d983dad66ee7525',1,'operator==(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a51b43fd451b61779e760958bed4dd098',1,'operator==(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#ab39eb7534930ff0adc53ded03c96679b',1,'operator==(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], - ['operator_5b_5d_14',['operator[]',['../class_polynomial.html#a3fbc2b909192f3d288aaf43e6b155be6',1,'Polynomial::operator[](const unsigned int i)'],['../class_polynomial.html#a3cd44d51da4a73ea65f3fe3e145f28a4',1,'Polynomial::operator[](const unsigned int i) const'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ad70da845dccf8b1a761f656710301b90',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator[](const unsigned int i)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#abe34e68589020dd26d5840042380d84e',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator[](const unsigned int i) const'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a3cf236650dec739791ea9b511db04e93',1,'Hypercomplex< mpfr_t, dim >::operator[](const unsigned int i)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a07ce8d864d940059fe97226929ad77a5',1,'Hypercomplex< mpfr_t, dim >::operator[](const unsigned int i) const'],['../class_hypercomplex.html#a86f23069820144174d5823f823d60b64',1,'Hypercomplex::operator[](const unsigned int i)'],['../class_hypercomplex.html#ac71bfc11dc8d0bc00599d713525dbbbe',1,'Hypercomplex::operator[](const unsigned int i) const']]], - ['operator_5e_15',['operator^',['../_hypercomplex_8hpp.html#afe46cd63286dda5c5e303d21e32693e7',1,'operator^(const Hypercomplex< T, dim > &H, const unsigned int x): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a3e315a3e419487367fe7121d7db9dd74',1,'operator^(const Hypercomplex< mpfr_t, dim > &H, const unsigned int x): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#acab9f383bcdf2ea5875cb00d27460403',1,'operator^(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const unsigned int x): Hypercomplex.hpp']]], - ['operator_5e_3d_16',['operator^=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ae1daeab9372b2370525eb8394fbec229',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator^=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a26689eb66e9a88faa92234be71e8d1b9',1,'Hypercomplex< mpfr_t, dim >::operator^=()'],['../class_hypercomplex.html#ab457bf64eb58a7ba5e3bd9597bcffe69',1,'Hypercomplex::operator^=()']]], - ['operator_7e_17',['operator~',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a48eaed7824620e097ea4ed894d2ee3f6',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator~()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a8dd14e593925483bc6d984e5cee760ac',1,'Hypercomplex< mpfr_t, dim >::operator~()'],['../class_hypercomplex.html#a4938c4346ff5e8a7befe77457d8ce6d5',1,'Hypercomplex::operator~()']]] + ['operator_3c_3c_11',['operator<<',['../_polynomial_8hpp.html#a1259d353e8e4d57bf2342b46f238f5c5',1,'operator<<(std::ostream &os, const Polynomial< MaxDeg > &P): Polynomial.hpp'],['../_hypercomplex_8hpp.html#aacfc2c8f773ebd5f5f77015ddaf9fa3d',1,'operator<<(std::ostream &os, const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a713344696cd9727037289f7eba60752b',1,'operator<<(std::ostream &os, const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a1d1ea12368015b50da86eb0db28fad44',1,'operator<<(std::ostream &os, const Hypercomplex< mpfr_t, dim > &H): Hypercomplex_MPFR.hpp']]], + ['operator_3d_12',['operator=',['../class_hypercomplex.html#a624e410d1a0ab9a4332c4e7a2d25c906',1,'Hypercomplex::operator=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a0b9b9bc2f0973a9e2ce7eb3d35d22d81',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#acd1aa62d9cac7435a490a779a27d9ec3',1,'Hypercomplex< mpfr_t, dim >::operator=()'],['../class_polynomial.html#ace51411fa33baaaf127fadc5f6e59bb9',1,'Polynomial::operator=()']]], + ['operator_3d_3d_13',['operator==',['../_hypercomplex_8hpp.html#a29619ebaa017a1a612e767372c88a465',1,'operator==(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a51b43fd451b61779e760958bed4dd098',1,'operator==(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a713f745bfe5e132c0d983dad66ee7525',1,'operator==(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#ab39eb7534930ff0adc53ded03c96679b',1,'operator==(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_5b_5d_14',['operator[]',['../class_polynomial.html#aeab7252128f262a78fd7a08a36d8647c',1,'Polynomial::operator[](const uint64_t i)'],['../class_polynomial.html#abf62a29e534dad5e6f40324a7a670a77',1,'Polynomial::operator[](const uint64_t i) const'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a0ecfa30234081f0ae1efd3487f5bd633',1,'Hypercomplex< mpfr_t, dim >::operator[](const uint64_t i)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a42a9cc568def1c58122ed66c2d2e8002',1,'Hypercomplex< mpfr_t, dim >::operator[](const uint64_t i) const'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ab39f4c50536934edaee4b2ebc23bd1bf',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator[](const uint64_t i)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ac61b220696fae6a0abdf35cdb6fb3f88',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator[](const uint64_t i) const'],['../class_hypercomplex.html#a5d87ca155fa718ea411b963cea0ec390',1,'Hypercomplex::operator[](const uint64_t i)'],['../class_hypercomplex.html#a877ef66675b43032fd3cbc2a6e78bda5',1,'Hypercomplex::operator[](const uint64_t i) const']]], + ['operator_5e_15',['operator^',['../_hypercomplex_8hpp.html#aaf80e9c5a551658b614a8ac6419f0baa',1,'operator^(const Hypercomplex< T, dim > &H, const uint64_t x): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#aa25445b1168b333b524094c117835211',1,'operator^(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const uint64_t x): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#af104cdb3150ecb754ab08a36aa70943b',1,'operator^(const Hypercomplex< mpfr_t, dim > &H, const uint64_t x): Hypercomplex_MPFR.hpp']]], + ['operator_5e_3d_16',['operator^=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ae93cb49d786e0999c911cf5c6ec39591',1,'Hypercomplex< mpfr_t, dim >::operator^=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ae3040d42bbe027931764aa905c9604a4',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator^=()'],['../class_hypercomplex.html#a05162276e6cd3f552a6a81cf10cf109c',1,'Hypercomplex::operator^=()']]], + ['operator_7e_17',['operator~',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a8dd14e593925483bc6d984e5cee760ac',1,'Hypercomplex< mpfr_t, dim >::operator~()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a48eaed7824620e097ea4ed894d2ee3f6',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator~()'],['../class_hypercomplex.html#a4938c4346ff5e8a7befe77457d8ce6d5',1,'Hypercomplex::operator~()']]] ]; diff --git a/docs/html/search/all_b.js b/docs/html/search/all_b.js index c631f42..01d1a01 100644 --- a/docs/html/search/all_b.js +++ b/docs/html/search/all_b.js @@ -1,5 +1,5 @@ var searchData= [ - ['re_0',['Re',['../_hypercomplex_8hpp.html#a141e88ed6b5c9bf20a877928bff456e0',1,'Re(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a368875d32cefaf3a2aa813e6348fea31',1,'Re(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#af301b05435d58b3dc10927f2fbc4758d',1,'Re(const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp']]], + ['re_0',['Re',['../_hypercomplex_8hpp.html#a141e88ed6b5c9bf20a877928bff456e0',1,'Re(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#af301b05435d58b3dc10927f2fbc4758d',1,'Re(const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a368875d32cefaf3a2aa813e6348fea31',1,'Re(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex_MPFR.hpp']]], ['ringinverse_1',['RingInverse',['../_hypercomplex_8hpp.html#a6da81d59a31f57a8534146cf8abec61d',1,'RingInverse(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod): Hypercomplex.hpp'],['../_polynomial_8hpp.html#a1dd3a3950d63574bd47995c9429256e2',1,'RingInverse(const int64_t x, const int64_t mod): Polynomial.hpp'],['../_polynomial_8hpp.html#a4416945734f6b3cab026aa3baa51e4fe',1,'RingInverse(const Polynomial< MaxDeg > &P, const int64_t &mod): Polynomial.hpp']]] ]; diff --git a/docs/html/search/all_c.js b/docs/html/search/all_c.js index 5eb2ae2..9a68b5f 100644 --- a/docs/html/search/all_c.js +++ b/docs/html/search/all_c.js @@ -1,4 +1,4 @@ var searchData= [ - ['set_5fmpfr_5fprecision_0',['set_mpfr_precision',['../_hypercomplex_8hpp.html#a0d24a46323a0a313a012f2c74cc112a8',1,'Hypercomplex.hpp']]] + ['set_5fmpfr_5fprecision_0',['set_mpfr_precision',['../_hypercomplex___m_p_f_r_8hpp.html#a87e255563ccdfe35cefc1624b8178c93',1,'Hypercomplex_MPFR.hpp']]] ]; diff --git a/docs/html/search/all_d.js b/docs/html/search/all_d.js new file mode 100644 index 0000000..a6402b3 --- /dev/null +++ b/docs/html/search/all_d.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['usempfr_0',['USEMPFR',['../_hypercomplex_8hpp.html#a8f7aad7bdf78ee205405390a22de8799',1,'Hypercomplex.hpp']]] +]; diff --git a/docs/html/search/defines_0.js b/docs/html/search/defines_0.js new file mode 100644 index 0000000..a6402b3 --- /dev/null +++ b/docs/html/search/defines_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['usempfr_0',['USEMPFR',['../_hypercomplex_8hpp.html#a8f7aad7bdf78ee205405390a22de8799',1,'Hypercomplex.hpp']]] +]; diff --git a/docs/html/search/files_0.js b/docs/html/search/files_0.js index e9a83c8..9a608aa 100644 --- a/docs/html/search/files_0.js +++ b/docs/html/search/files_0.js @@ -1,4 +1,5 @@ var searchData= [ - ['hypercomplex_2ehpp_0',['Hypercomplex.hpp',['../_hypercomplex_8hpp.html',1,'']]] + ['hypercomplex_2ehpp_0',['Hypercomplex.hpp',['../_hypercomplex_8hpp.html',1,'']]], + ['hypercomplex_5fmpfr_2ehpp_1',['Hypercomplex_MPFR.hpp',['../_hypercomplex___m_p_f_r_8hpp.html',1,'']]] ]; diff --git a/docs/html/search/functions_0.js b/docs/html/search/functions_0.js index 3baeb44..c89ad34 100644 --- a/docs/html/search/functions_0.js +++ b/docs/html/search/functions_0.js @@ -1,4 +1,4 @@ var searchData= [ - ['_5f_0',['_',['../class_hypercomplex.html#a931145bb1261d4e753ab8038ee3e5e6a',1,'Hypercomplex::_()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a84fc4d493202fb660e96cf45bb0cbcf0',1,'Hypercomplex< mpfr_t, dim >::_()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#abffec6723a0be263401a7f9f85480816',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::_()']]] + ['_5f_0',['_',['../class_hypercomplex.html#a9bd63af8d583aedac22a99dbf88d7844',1,'Hypercomplex::_()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ab9f02efa183110a3d8aafb710ecc056e',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::_()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#af4fef1008e64d63163cface4abc1ac09',1,'Hypercomplex< mpfr_t, dim >::_()']]] ]; diff --git a/docs/html/search/functions_1.js b/docs/html/search/functions_1.js index 56d869a..c656e99 100644 --- a/docs/html/search/functions_1.js +++ b/docs/html/search/functions_1.js @@ -1,6 +1,6 @@ var searchData= [ ['centeredlift_0',['CenteredLift',['../_hypercomplex_8hpp.html#a9318240e82fe8b403697464a1fffad66',1,'CenteredLift(Hypercomplex< Polynomial< MaxDeg >, dim > *H, const int64_t &mod): Hypercomplex.hpp'],['../_polynomial_8hpp.html#a947a92ea5edd042a91568b97821bfd47',1,'CenteredLift(Polynomial< MaxDeg > *P, const int64_t mod): Polynomial.hpp']]], - ['clear_1',['clear',['../class_hypercomplex.html#ac1c9386db6f8fff67bff899c6d4218cc',1,'Hypercomplex::clear()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a2b34b54d55a847d7cc03bacc66b7c76b',1,'Hypercomplex< mpfr_t, dim >::clear()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#aa2e383cf7b1969efa3f0fbf23f9f950a',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::clear()']]], - ['clear_5fmpfr_5fmemory_2',['clear_mpfr_memory',['../_hypercomplex_8hpp.html#a5214ea26b252ebf7b5e10d153df22ef4',1,'Hypercomplex.hpp']]] + ['clear_1',['clear',['../class_hypercomplex.html#ac1c9386db6f8fff67bff899c6d4218cc',1,'Hypercomplex::clear()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#aa2e383cf7b1969efa3f0fbf23f9f950a',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::clear()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a2b34b54d55a847d7cc03bacc66b7c76b',1,'Hypercomplex< mpfr_t, dim >::clear()']]], + ['clear_5fmpfr_5fmemory_2',['clear_mpfr_memory',['../_hypercomplex___m_p_f_r_8hpp.html#a5214ea26b252ebf7b5e10d153df22ef4',1,'Hypercomplex_MPFR.hpp']]] ]; diff --git a/docs/html/search/functions_3.js b/docs/html/search/functions_3.js index ddfa914..f18eaa2 100644 --- a/docs/html/search/functions_3.js +++ b/docs/html/search/functions_3.js @@ -1,6 +1,6 @@ var searchData= [ ['encrypt_0',['ENCRYPT',['../_hypercomplex_8hpp.html#a838b097d48a6ea322263177a2abfdc3f',1,'Hypercomplex.hpp']]], - ['exp_1',['exp',['../_hypercomplex_8hpp.html#acefdb8c35a0c89587789edc830ffa282',1,'exp(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a827feec4f775a7f77b8c8fe741db71e8',1,'exp(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex.hpp']]], - ['expand_2',['expand',['../class_hypercomplex.html#af1113f6be945317a45a652821538763a',1,'Hypercomplex::expand()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ab27c393e108c09e55b10f1624b4e0363',1,'Hypercomplex< mpfr_t, dim >::expand()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a266b7181c6357a663fc8143f0400d2b2',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::expand()']]] + ['exp_1',['exp',['../_hypercomplex_8hpp.html#acefdb8c35a0c89587789edc830ffa282',1,'exp(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a827feec4f775a7f77b8c8fe741db71e8',1,'exp(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex_MPFR.hpp']]], + ['expand_2',['expand',['../class_hypercomplex.html#af1113f6be945317a45a652821538763a',1,'Hypercomplex::expand()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a266b7181c6357a663fc8143f0400d2b2',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::expand()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ab27c393e108c09e55b10f1624b4e0363',1,'Hypercomplex< mpfr_t, dim >::expand()']]] ]; diff --git a/docs/html/search/functions_4.js b/docs/html/search/functions_4.js index 7c05672..433060e 100644 --- a/docs/html/search/functions_4.js +++ b/docs/html/search/functions_4.js @@ -1,4 +1,4 @@ var searchData= [ - ['get_5fmpfr_5fprecision_0',['get_mpfr_precision',['../_hypercomplex_8hpp.html#aa327dde3d41d1e300e035e14b996fd82',1,'Hypercomplex.hpp']]] + ['get_5fmpfr_5fprecision_0',['get_mpfr_precision',['../_hypercomplex___m_p_f_r_8hpp.html#a28f29287f2710d597953c495f686fd37',1,'Hypercomplex_MPFR.hpp']]] ]; diff --git a/docs/html/search/functions_5.js b/docs/html/search/functions_5.js index 2d1f838..1aa7311 100644 --- a/docs/html/search/functions_5.js +++ b/docs/html/search/functions_5.js @@ -1,4 +1,4 @@ var searchData= [ - ['hypercomplex_0',['Hypercomplex',['../class_hypercomplex.html#a8a9c8fc7c1ee12410d67538f02761ea0',1,'Hypercomplex::Hypercomplex(const T *ARR)'],['../class_hypercomplex.html#a146953255d128ab90770fa034bbf3253',1,'Hypercomplex::Hypercomplex(const Hypercomplex &H)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#aa4e422dfb2633dbb931cbf340d82c523',1,'Hypercomplex< mpfr_t, dim >::Hypercomplex(const mpfr_t *ARR)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a3f5af9da94ca759c7061cddd8b66a395',1,'Hypercomplex< mpfr_t, dim >::Hypercomplex(const Hypercomplex &H)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a120bed19c4d7f1301de95b5b24353cb8',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::Hypercomplex(const Polynomial< MaxDeg > *ARR)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#acb360c4f4e122db359489f73abf6de00',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::Hypercomplex(const Hypercomplex &H)']]] + ['hypercomplex_0',['Hypercomplex',['../class_hypercomplex.html#a8a9c8fc7c1ee12410d67538f02761ea0',1,'Hypercomplex::Hypercomplex(const T *ARR)'],['../class_hypercomplex.html#a146953255d128ab90770fa034bbf3253',1,'Hypercomplex::Hypercomplex(const Hypercomplex &H)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a120bed19c4d7f1301de95b5b24353cb8',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::Hypercomplex(const Polynomial< MaxDeg > *ARR)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#acb360c4f4e122db359489f73abf6de00',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::Hypercomplex(const Hypercomplex &H)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#aa4e422dfb2633dbb931cbf340d82c523',1,'Hypercomplex< mpfr_t, dim >::Hypercomplex(const mpfr_t *ARR)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a3f5af9da94ca759c7061cddd8b66a395',1,'Hypercomplex< mpfr_t, dim >::Hypercomplex(const Hypercomplex &H)']]] ]; diff --git a/docs/html/search/functions_6.js b/docs/html/search/functions_6.js index 0c4e22c..7065640 100644 --- a/docs/html/search/functions_6.js +++ b/docs/html/search/functions_6.js @@ -1,6 +1,6 @@ var searchData= [ - ['im_0',['Im',['../_hypercomplex_8hpp.html#ab232dad8df7b0f66c9cc201bca82f9a5',1,'Im(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ab4e6a3251ab8dd6894d34b717c2c997e',1,'Im(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae07b855ec5c6944b87c6ff2b63295677',1,'Im(const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp']]], - ['init_1',['init',['../class_hypercomplex.html#a15291cd83909b370a2cc9b7af07332a2',1,'Hypercomplex::init()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ad13e2c8f4b662670e6f0b218cb8b83ed',1,'Hypercomplex< mpfr_t, dim >::init()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a082192bdd1ae6714a8d04dc955306c43',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::init()']]], + ['im_0',['Im',['../_hypercomplex_8hpp.html#ab232dad8df7b0f66c9cc201bca82f9a5',1,'Im(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae07b855ec5c6944b87c6ff2b63295677',1,'Im(const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#ab4e6a3251ab8dd6894d34b717c2c997e',1,'Im(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex_MPFR.hpp']]], + ['init_1',['init',['../class_hypercomplex.html#a15291cd83909b370a2cc9b7af07332a2',1,'Hypercomplex::init()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a082192bdd1ae6714a8d04dc955306c43',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::init()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ad13e2c8f4b662670e6f0b218cb8b83ed',1,'Hypercomplex< mpfr_t, dim >::init()']]], ['inv_2',['inv',['../class_hypercomplex.html#adb578e6896d59943d9168928009fe562',1,'Hypercomplex::inv()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a463b637e17efc7b910e5bc8638d9d0aa',1,'Hypercomplex< mpfr_t, dim >::inv()']]] ]; diff --git a/docs/html/search/functions_7.js b/docs/html/search/functions_7.js index 52b35d8..ae627de 100644 --- a/docs/html/search/functions_7.js +++ b/docs/html/search/functions_7.js @@ -1,4 +1,4 @@ var searchData= [ - ['mul_0',['MUL',['../class_hypercomplex.html#a9b0cc11c9b24add2a6261d74812ac575',1,'Hypercomplex::MUL()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#abaafe74a85379789e921341299853717',1,'Hypercomplex< mpfr_t, dim >::MUL()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ab96d985a07cd0b5c51fa87644012bc2d',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::MUL()']]] + ['mul_0',['MUL',['../class_hypercomplex.html#a9b0cc11c9b24add2a6261d74812ac575',1,'Hypercomplex::MUL()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ab96d985a07cd0b5c51fa87644012bc2d',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::MUL()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#abaafe74a85379789e921341299853717',1,'Hypercomplex< mpfr_t, dim >::MUL()']]] ]; diff --git a/docs/html/search/functions_8.js b/docs/html/search/functions_8.js index 1073134..66a60cb 100644 --- a/docs/html/search/functions_8.js +++ b/docs/html/search/functions_8.js @@ -1,5 +1,5 @@ var searchData= [ - ['norm_0',['norm',['../class_hypercomplex.html#a70212f34de74fef9911eae4bf0b94364',1,'Hypercomplex::norm()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#aa371a5a4aef3655e8b9e5ff06c069f8d',1,'Hypercomplex< mpfr_t, dim >::norm()']]], + ['norm_0',['norm',['../class_hypercomplex.html#a70212f34de74fef9911eae4bf0b94364',1,'Hypercomplex::norm()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ae6e770552a2a9fe8d0fa1efc86459ff8',1,'Hypercomplex< mpfr_t, dim >::norm()']]], ['norm2_1',['norm2',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ace48510f4cad039eaf2a6ddbe9415baf',1,'Hypercomplex< Polynomial< MaxDeg >, dim >']]] ]; diff --git a/docs/html/search/functions_9.js b/docs/html/search/functions_9.js index 64c8d7a..58be4c9 100644 --- a/docs/html/search/functions_9.js +++ b/docs/html/search/functions_9.js @@ -1,21 +1,21 @@ var searchData= [ - ['operator_21_3d_0',['operator!=',['../_hypercomplex_8hpp.html#a3861eb71b7adacb3382064e32039da4c',1,'operator!=(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a6a723f659badf410e3f9b6e372bc12da',1,'operator!=(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#adae0fc224a78cec59e2a4b13451bded6',1,'operator!=(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#aa5bc05fb2661093163b44bfdb2f07db6',1,'operator!=(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_21_3d_0',['operator!=',['../_hypercomplex_8hpp.html#a3861eb71b7adacb3382064e32039da4c',1,'operator!=(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#adae0fc224a78cec59e2a4b13451bded6',1,'operator!=(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a6a723f659badf410e3f9b6e372bc12da',1,'operator!=(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#aa5bc05fb2661093163b44bfdb2f07db6',1,'operator!=(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], ['operator_25_1',['operator%',['../_hypercomplex_8hpp.html#ac646b4775b851916bac22a833b322322',1,'operator%(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod): Hypercomplex.hpp'],['../_polynomial_8hpp.html#af487fd9106ac42a95572f44669c8bdd2',1,'operator%(const Polynomial< MaxDeg > &P, const int64_t x): Polynomial.hpp']]], ['operator_25_3d_2',['operator%=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#afdd3cd93c8de1d1222d7d1f0a4ca38a0',1,'Hypercomplex< Polynomial< MaxDeg >, dim >']]], - ['operator_2a_3',['operator*',['../_hypercomplex_8hpp.html#a9e70c8ff6fe4ec8fd37842d48a48ea3f',1,'operator*(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#af4eb688419691e7f1c8c3291bd1af087',1,'operator*(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a0b72103099b76a2f24d17f619d91cb2b',1,'operator*(const int64_t &x, const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a66ff37e491ea850493085779b3dc70b6',1,'operator*(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#ada08bad24346623f552dd5483b3b2b44',1,'operator*(const int64_t x, const Polynomial< MaxDeg > &P): Polynomial.hpp'],['../_polynomial_8hpp.html#a5b98895946924af3819a4de97bed579e',1,'operator*(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], - ['operator_2a_3d_4',['operator*=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#accfdaa6a9f2e08ed6056230f413456ef',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator*=(const Hypercomplex &H)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a390e0a98a9dedeb67e9d9236e1f68b6c',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator*=(const int64_t &x)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a49b0d2db97e254991b5fa3eb3a8140b2',1,'Hypercomplex< mpfr_t, dim >::operator*=()'],['../class_hypercomplex.html#abcbab8fe23748ba0e42dcc8acfed2597',1,'Hypercomplex::operator*=()']]], - ['operator_2b_5',['operator+',['../_hypercomplex_8hpp.html#a5ae27680fff72f3f84dee8eca7e4d265',1,'operator+(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#aa156e4c1b865cee227a801ec1ed2d90f',1,'operator+(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ad8c7be3ef5e8c112c9e29a9fecf60a9d',1,'operator+(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#a775a48e6b08ae2950870cdd5106d1235',1,'operator+(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], - ['operator_2b_3d_6',['operator+=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a908ec3833e7922f60c7b2fab06453525',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator+=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a45073786485c9879a10bcc49c9625976',1,'Hypercomplex< mpfr_t, dim >::operator+=()'],['../class_hypercomplex.html#a26f1239812d18d6396826ef53ebb2f52',1,'Hypercomplex::operator+=(const Hypercomplex &H)']]], - ['operator_2d_7',['operator-',['../class_hypercomplex.html#aa23c83df7db4b36f5b9252c12b3f431f',1,'Hypercomplex::operator-()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a291b67e054b97b36d1776c295e47a659',1,'Hypercomplex< mpfr_t, dim >::operator-()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a763f98c9b114d89ac8f8e8f1d5d5b731',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator-()'],['../class_polynomial.html#a63d435f5b4017a2439803abb9bab27b9',1,'Polynomial::operator-()'],['../_hypercomplex_8hpp.html#a05bea0c8db8be9b4d5f2c3e8ae36c28c',1,'operator-(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae0f84940c641bc790419054d38953651',1,'operator-(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae71e40fe09be5bd1457590ce65a4daac',1,'operator-(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#a756820e0ec0f934daca2246fdbd8f071',1,'operator-(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], - ['operator_2d_3d_8',['operator-=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a164a0a845b57d47783840d3efeef52b5',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator-=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#adfc23e80db712bcd161c9c002bad5f21',1,'Hypercomplex< mpfr_t, dim >::operator-=()'],['../class_hypercomplex.html#abf95f932bbd5639e52cb85c52bc3b461',1,'Hypercomplex::operator-=()']]], - ['operator_2f_9',['operator/',['../_hypercomplex_8hpp.html#afa30e28932e237dda881212dc294f0b3',1,'operator/(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a80f7f3684b19ab34ff47a9d7c4f0c307',1,'operator/(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp']]], + ['operator_2a_3',['operator*',['../_hypercomplex_8hpp.html#a9e70c8ff6fe4ec8fd37842d48a48ea3f',1,'operator*(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a0b72103099b76a2f24d17f619d91cb2b',1,'operator*(const int64_t &x, const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a66ff37e491ea850493085779b3dc70b6',1,'operator*(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#af4eb688419691e7f1c8c3291bd1af087',1,'operator*(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#ada08bad24346623f552dd5483b3b2b44',1,'operator*(const int64_t x, const Polynomial< MaxDeg > &P): Polynomial.hpp'],['../_polynomial_8hpp.html#a5b98895946924af3819a4de97bed579e',1,'operator*(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_2a_3d_4',['operator*=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a49b0d2db97e254991b5fa3eb3a8140b2',1,'Hypercomplex< mpfr_t, dim >::operator*=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#accfdaa6a9f2e08ed6056230f413456ef',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator*=(const Hypercomplex &H)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a390e0a98a9dedeb67e9d9236e1f68b6c',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator*=(const int64_t &x)'],['../class_hypercomplex.html#abcbab8fe23748ba0e42dcc8acfed2597',1,'Hypercomplex::operator*=()']]], + ['operator_2b_5',['operator+',['../_hypercomplex_8hpp.html#a5ae27680fff72f3f84dee8eca7e4d265',1,'operator+(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ad8c7be3ef5e8c112c9e29a9fecf60a9d',1,'operator+(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#aa156e4c1b865cee227a801ec1ed2d90f',1,'operator+(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#a775a48e6b08ae2950870cdd5106d1235',1,'operator+(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_2b_3d_6',['operator+=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a45073786485c9879a10bcc49c9625976',1,'Hypercomplex< mpfr_t, dim >::operator+=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a908ec3833e7922f60c7b2fab06453525',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator+=()'],['../class_hypercomplex.html#a26f1239812d18d6396826ef53ebb2f52',1,'Hypercomplex::operator+=(const Hypercomplex &H)']]], + ['operator_2d_7',['operator-',['../class_hypercomplex.html#aa23c83df7db4b36f5b9252c12b3f431f',1,'Hypercomplex::operator-()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a763f98c9b114d89ac8f8e8f1d5d5b731',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator-()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a291b67e054b97b36d1776c295e47a659',1,'Hypercomplex< mpfr_t, dim >::operator-()'],['../class_polynomial.html#a63d435f5b4017a2439803abb9bab27b9',1,'Polynomial::operator-()'],['../_hypercomplex_8hpp.html#a05bea0c8db8be9b4d5f2c3e8ae36c28c',1,'operator-(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#ae71e40fe09be5bd1457590ce65a4daac',1,'operator-(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#ae0f84940c641bc790419054d38953651',1,'operator-(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#a756820e0ec0f934daca2246fdbd8f071',1,'operator-(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_2d_3d_8',['operator-=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#adfc23e80db712bcd161c9c002bad5f21',1,'Hypercomplex< mpfr_t, dim >::operator-=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a164a0a845b57d47783840d3efeef52b5',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator-=()'],['../class_hypercomplex.html#abf95f932bbd5639e52cb85c52bc3b461',1,'Hypercomplex::operator-=()']]], + ['operator_2f_9',['operator/',['../_hypercomplex_8hpp.html#afa30e28932e237dda881212dc294f0b3',1,'operator/(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a80f7f3684b19ab34ff47a9d7c4f0c307',1,'operator/(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp']]], ['operator_2f_3d_10',['operator/=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a0c6f82232587461d8c2d428aca1fd55c',1,'Hypercomplex< mpfr_t, dim >::operator/=()'],['../class_hypercomplex.html#a5693f454f81d59fbd951aa111bcd8843',1,'Hypercomplex::operator/=()']]], - ['operator_3c_3c_11',['operator<<',['../_polynomial_8hpp.html#a1259d353e8e4d57bf2342b46f238f5c5',1,'operator<<(std::ostream &os, const Polynomial< MaxDeg > &P): Polynomial.hpp'],['../_hypercomplex_8hpp.html#aacfc2c8f773ebd5f5f77015ddaf9fa3d',1,'operator<<(std::ostream &os, const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a1d1ea12368015b50da86eb0db28fad44',1,'operator<<(std::ostream &os, const Hypercomplex< mpfr_t, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a713344696cd9727037289f7eba60752b',1,'operator<<(std::ostream &os, const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp']]], - ['operator_3d_12',['operator=',['../class_hypercomplex.html#a624e410d1a0ab9a4332c4e7a2d25c906',1,'Hypercomplex::operator=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#acd1aa62d9cac7435a490a779a27d9ec3',1,'Hypercomplex< mpfr_t, dim >::operator=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a0b9b9bc2f0973a9e2ce7eb3d35d22d81',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator=()'],['../class_polynomial.html#ace51411fa33baaaf127fadc5f6e59bb9',1,'Polynomial::operator=()']]], - ['operator_3d_3d_13',['operator==',['../_hypercomplex_8hpp.html#a29619ebaa017a1a612e767372c88a465',1,'operator==(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a713f745bfe5e132c0d983dad66ee7525',1,'operator==(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a51b43fd451b61779e760958bed4dd098',1,'operator==(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_polynomial_8hpp.html#ab39eb7534930ff0adc53ded03c96679b',1,'operator==(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], - ['operator_5b_5d_14',['operator[]',['../class_polynomial.html#a3fbc2b909192f3d288aaf43e6b155be6',1,'Polynomial::operator[](const unsigned int i)'],['../class_polynomial.html#a3cd44d51da4a73ea65f3fe3e145f28a4',1,'Polynomial::operator[](const unsigned int i) const'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ad70da845dccf8b1a761f656710301b90',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator[](const unsigned int i)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#abe34e68589020dd26d5840042380d84e',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator[](const unsigned int i) const'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a3cf236650dec739791ea9b511db04e93',1,'Hypercomplex< mpfr_t, dim >::operator[](const unsigned int i)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a07ce8d864d940059fe97226929ad77a5',1,'Hypercomplex< mpfr_t, dim >::operator[](const unsigned int i) const'],['../class_hypercomplex.html#a86f23069820144174d5823f823d60b64',1,'Hypercomplex::operator[](const unsigned int i)'],['../class_hypercomplex.html#ac71bfc11dc8d0bc00599d713525dbbbe',1,'Hypercomplex::operator[](const unsigned int i) const']]], - ['operator_5e_15',['operator^',['../_hypercomplex_8hpp.html#afe46cd63286dda5c5e303d21e32693e7',1,'operator^(const Hypercomplex< T, dim > &H, const unsigned int x): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a3e315a3e419487367fe7121d7db9dd74',1,'operator^(const Hypercomplex< mpfr_t, dim > &H, const unsigned int x): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#acab9f383bcdf2ea5875cb00d27460403',1,'operator^(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const unsigned int x): Hypercomplex.hpp']]], - ['operator_5e_3d_16',['operator^=',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ae1daeab9372b2370525eb8394fbec229',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator^=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a26689eb66e9a88faa92234be71e8d1b9',1,'Hypercomplex< mpfr_t, dim >::operator^=()'],['../class_hypercomplex.html#ab457bf64eb58a7ba5e3bd9597bcffe69',1,'Hypercomplex::operator^=()']]], - ['operator_7e_17',['operator~',['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a48eaed7824620e097ea4ed894d2ee3f6',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator~()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a8dd14e593925483bc6d984e5cee760ac',1,'Hypercomplex< mpfr_t, dim >::operator~()'],['../class_hypercomplex.html#a4938c4346ff5e8a7befe77457d8ce6d5',1,'Hypercomplex::operator~()']]] + ['operator_3c_3c_11',['operator<<',['../_polynomial_8hpp.html#a1259d353e8e4d57bf2342b46f238f5c5',1,'operator<<(std::ostream &os, const Polynomial< MaxDeg > &P): Polynomial.hpp'],['../_hypercomplex_8hpp.html#aacfc2c8f773ebd5f5f77015ddaf9fa3d',1,'operator<<(std::ostream &os, const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a713344696cd9727037289f7eba60752b',1,'operator<<(std::ostream &os, const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a1d1ea12368015b50da86eb0db28fad44',1,'operator<<(std::ostream &os, const Hypercomplex< mpfr_t, dim > &H): Hypercomplex_MPFR.hpp']]], + ['operator_3d_12',['operator=',['../class_hypercomplex.html#a624e410d1a0ab9a4332c4e7a2d25c906',1,'Hypercomplex::operator=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a0b9b9bc2f0973a9e2ce7eb3d35d22d81',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator=()'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#acd1aa62d9cac7435a490a779a27d9ec3',1,'Hypercomplex< mpfr_t, dim >::operator=()'],['../class_polynomial.html#ace51411fa33baaaf127fadc5f6e59bb9',1,'Polynomial::operator=()']]], + ['operator_3d_3d_13',['operator==',['../_hypercomplex_8hpp.html#a29619ebaa017a1a612e767372c88a465',1,'operator==(const Hypercomplex< T, dim > &H1, const Hypercomplex< T, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a51b43fd451b61779e760958bed4dd098',1,'operator==(const Hypercomplex< Polynomial< MaxDeg >, dim > &H1, const Hypercomplex< Polynomial< MaxDeg >, dim > &H2): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a713f745bfe5e132c0d983dad66ee7525',1,'operator==(const Hypercomplex< mpfr_t, dim > &H1, const Hypercomplex< mpfr_t, dim > &H2): Hypercomplex_MPFR.hpp'],['../_polynomial_8hpp.html#ab39eb7534930ff0adc53ded03c96679b',1,'operator==(const Polynomial< MaxDeg > &P1, const Polynomial< MaxDeg > &P2): Polynomial.hpp']]], + ['operator_5b_5d_14',['operator[]',['../class_polynomial.html#aeab7252128f262a78fd7a08a36d8647c',1,'Polynomial::operator[](const uint64_t i)'],['../class_polynomial.html#abf62a29e534dad5e6f40324a7a670a77',1,'Polynomial::operator[](const uint64_t i) const'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a0ecfa30234081f0ae1efd3487f5bd633',1,'Hypercomplex< mpfr_t, dim >::operator[](const uint64_t i)'],['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a42a9cc568def1c58122ed66c2d2e8002',1,'Hypercomplex< mpfr_t, dim >::operator[](const uint64_t i) const'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ab39f4c50536934edaee4b2ebc23bd1bf',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator[](const uint64_t i)'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ac61b220696fae6a0abdf35cdb6fb3f88',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator[](const uint64_t i) const'],['../class_hypercomplex.html#a5d87ca155fa718ea411b963cea0ec390',1,'Hypercomplex::operator[](const uint64_t i)'],['../class_hypercomplex.html#a877ef66675b43032fd3cbc2a6e78bda5',1,'Hypercomplex::operator[](const uint64_t i) const']]], + ['operator_5e_15',['operator^',['../_hypercomplex_8hpp.html#aaf80e9c5a551658b614a8ac6419f0baa',1,'operator^(const Hypercomplex< T, dim > &H, const uint64_t x): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#aa25445b1168b333b524094c117835211',1,'operator^(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const uint64_t x): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#af104cdb3150ecb754ab08a36aa70943b',1,'operator^(const Hypercomplex< mpfr_t, dim > &H, const uint64_t x): Hypercomplex_MPFR.hpp']]], + ['operator_5e_3d_16',['operator^=',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#ae93cb49d786e0999c911cf5c6ec39591',1,'Hypercomplex< mpfr_t, dim >::operator^=()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#ae3040d42bbe027931764aa905c9604a4',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator^=()'],['../class_hypercomplex.html#a05162276e6cd3f552a6a81cf10cf109c',1,'Hypercomplex::operator^=()']]], + ['operator_7e_17',['operator~',['../class_hypercomplex_3_01mpfr__t_00_01dim_01_4.html#a8dd14e593925483bc6d984e5cee760ac',1,'Hypercomplex< mpfr_t, dim >::operator~()'],['../class_hypercomplex_3_01_polynomial_3_01_max_deg_01_4_00_01dim_01_4.html#a48eaed7824620e097ea4ed894d2ee3f6',1,'Hypercomplex< Polynomial< MaxDeg >, dim >::operator~()'],['../class_hypercomplex.html#a4938c4346ff5e8a7befe77457d8ce6d5',1,'Hypercomplex::operator~()']]] ]; diff --git a/docs/html/search/functions_b.js b/docs/html/search/functions_b.js index c631f42..01d1a01 100644 --- a/docs/html/search/functions_b.js +++ b/docs/html/search/functions_b.js @@ -1,5 +1,5 @@ var searchData= [ - ['re_0',['Re',['../_hypercomplex_8hpp.html#a141e88ed6b5c9bf20a877928bff456e0',1,'Re(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#a368875d32cefaf3a2aa813e6348fea31',1,'Re(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#af301b05435d58b3dc10927f2fbc4758d',1,'Re(const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp']]], + ['re_0',['Re',['../_hypercomplex_8hpp.html#a141e88ed6b5c9bf20a877928bff456e0',1,'Re(const Hypercomplex< T, dim > &H): Hypercomplex.hpp'],['../_hypercomplex_8hpp.html#af301b05435d58b3dc10927f2fbc4758d',1,'Re(const Hypercomplex< Polynomial< MaxDeg >, dim > &H): Hypercomplex.hpp'],['../_hypercomplex___m_p_f_r_8hpp.html#a368875d32cefaf3a2aa813e6348fea31',1,'Re(const Hypercomplex< mpfr_t, dim > &H): Hypercomplex_MPFR.hpp']]], ['ringinverse_1',['RingInverse',['../_hypercomplex_8hpp.html#a6da81d59a31f57a8534146cf8abec61d',1,'RingInverse(const Hypercomplex< Polynomial< MaxDeg >, dim > &H, const int64_t &mod): Hypercomplex.hpp'],['../_polynomial_8hpp.html#a1dd3a3950d63574bd47995c9429256e2',1,'RingInverse(const int64_t x, const int64_t mod): Polynomial.hpp'],['../_polynomial_8hpp.html#a4416945734f6b3cab026aa3baa51e4fe',1,'RingInverse(const Polynomial< MaxDeg > &P, const int64_t &mod): Polynomial.hpp']]] ]; diff --git a/docs/html/search/functions_c.js b/docs/html/search/functions_c.js index 5eb2ae2..9a68b5f 100644 --- a/docs/html/search/functions_c.js +++ b/docs/html/search/functions_c.js @@ -1,4 +1,4 @@ var searchData= [ - ['set_5fmpfr_5fprecision_0',['set_mpfr_precision',['../_hypercomplex_8hpp.html#a0d24a46323a0a313a012f2c74cc112a8',1,'Hypercomplex.hpp']]] + ['set_5fmpfr_5fprecision_0',['set_mpfr_precision',['../_hypercomplex___m_p_f_r_8hpp.html#a87e255563ccdfe35cefc1624b8178c93',1,'Hypercomplex_MPFR.hpp']]] ]; diff --git a/docs/html/search/searchdata.js b/docs/html/search/searchdata.js index e3af2f6..27e35c3 100644 --- a/docs/html/search/searchdata.js +++ b/docs/html/search/searchdata.js @@ -1,10 +1,11 @@ var indexSectionsWithContent = { - 0: "_cdeghimnoprs", + 0: "_cdeghimnoprsu", 1: "hp", 2: "hp", 3: "_cdeghimnoprs", - 4: "n" + 4: "u", + 5: "n" }; var indexSectionNames = @@ -13,7 +14,8 @@ var indexSectionNames = 1: "classes", 2: "files", 3: "functions", - 4: "pages" + 4: "defines", + 5: "pages" }; var indexSectionLabels = @@ -22,6 +24,7 @@ var indexSectionLabels = 1: "Classes", 2: "Files", 3: "Functions", - 4: "Pages" + 4: "Macros", + 5: "Pages" }; diff --git a/docs/html/usergroup0.html b/docs/html/usergroup0.html index 1d56a00..f42db40 100644 --- a/docs/html/usergroup0.html +++ b/docs/html/usergroup0.html @@ -82,6 +82,7 @@ diff --git a/docs/mainpage.dox b/docs/mainpage.dox index 7179753..5817259 100644 --- a/docs/mainpage.dox +++ b/docs/mainpage.dox @@ -16,7 +16,21 @@ * * \section install_sec Installation * - * As a prerequisite it is essential to install the + * The following is a _header-only_ library, meaning that the easiest way to use it + * is to copy the core _hpp_ files alongside your main program and include it into the code + * with the directive: + * \code{.cpp} + * #include "Hypercomplex.hpp" + * \endcode + * + * Remember to specify a proper langauge standard and optimisation level + * for the compiler, as in the command below: + * \code + * g++ -O2 --std=c++17 main.cpp -o main + * \endcode + * + * For computations based on high precision arithmetics + * it is essential to install the * MPFR library first. * This should be rather straightforward with the following commands: * \code @@ -29,20 +43,13 @@ * brew install mpfr * \endcode * - * The following is a _header-only_ library, meaning that the easiest way to use it - * is to copy the core _hpp_ file alongside the main program and include it into the code - * with the directive: - * \code{.cpp} - * #include "Hypercomplex.hpp" - * \endcode - * - * Remember to specify a proper langauge standard for the compiler as well as - * linking with _GNU MP_ and _GNU MPFR_ libraries, as in the command below: + * It is then essential to provide a preprocessor macro specifying the + * use of this library at the compile time as well as + * linking with _GNU MP_ and _GNU MPFR_ as in the command below: * \code - * g++ -O2 --std=c++17 test.cpp -o test -lmpfr -lgmp + * g++ -O2 -DUSEMPFR=1 --std=c++17 main.cpp -o main -lmpfr -lgmp * \endcode * - * * Alternatively, if you work with conda environments this library is installable with: * \code * conda install -c angrymaciek hypercomplex @@ -53,7 +60,7 @@ * * The command above would be adjusted to: * \code - * g++ -O2 --std=c++17 -I$CONDA_PREFIX/include -L$CONDA_PREFIX/lib test.cpp -o test -lmpfr -lgmp + * g++ -O2 -DUSEMPFR=1 --std=c++17 -I$CONDA_PREFIX/include -L$CONDA_PREFIX/lib main.cpp -o main -lmpfr -lgmp * \endcode * *