SymEngine::GaloisField Class Reference
+ Inheritance diagram for SymEngine::GaloisField:
+ Collaboration diagram for SymEngine::GaloisField:

Public Types

typedef vec_integer_class::const_iterator iterator
 
typedef vec_integer_class::const_reverse_iterator reverse_iterator
 
- Public Types inherited from SymEngine::UNonExprPoly< Container, Poly, Cf >
typedef Cf coef_type
 
- Public Types inherited from SymEngine::UPolyBase< Container, Poly >
typedef Container container_type
 

Public Member Functions

virtual void accept (Visitor &v) const
 
virtual void accept (EvalRealDoubleVisitorFinal &v) const
 
 GaloisField (const RCP< const Basic > &var, GaloisFieldDict &&dict)
 Constructor of GaloisField class.
 
bool is_canonical (const GaloisFieldDict &dict) const
 
hash_t __hash__ () const
 
int compare (const Basic &o) const
 
integer_class eval (const integer_class &x) const
 
vec_integer_class multieval (const vec_integer_class &v) const
 
iterator begin () const
 
iterator end () const
 
reverse_iterator obegin () const
 
reverse_iterator oend () const
 
integer_class get_coeff (unsigned int x) const
 
virtual vec_basic get_args () const
 Returns the list of arguments.
 
const std::vector< integer_class > & get_dict () const
 
int size () const
 
- Public Member Functions inherited from SymEngine::UIntPolyBase< GaloisFieldDict, GaloisField >
 UIntPolyBase (const RCP< const Basic > &var, GaloisFieldDict &&container)
 
RCP< const Basicas_symbolic () const
 
- Public Member Functions inherited from SymEngine::UNonExprPoly< Container, Poly, Cf >
 UNonExprPoly (const RCP< const Basic > &var, Container &&container)
 
virtual Cf eval (const Cf &x) const =0
 
std::vector< Cf > multieval (const std::vector< Cf > &v) const
 
int get_degree () const
 
Cf get_lc () const
 
- Public Member Functions inherited from SymEngine::UPolyBase< Container, Poly >
 UPolyBase (const RCP< const Basic > &var, Container &&container)
 
bool __eq__ (const Basic &o) const
 
const RCP< const Basic > & get_var () const
 
const Container & get_poly () const
 
vec_basic get_args () const
 Returns the list of arguments.
 
- Public Member Functions inherited from SymEngine::Basic
TypeID get_type_code () const
 
 Basic ()
 Constructor.
 
 Basic (const Basic &)=delete
 Delete the copy constructor and assignment.
 
Basicoperator= (const Basic &)=delete
 Assignment operator in continuation with above.
 
 Basic (Basic &&)=delete
 Delete the move constructor and assignment.
 
Basicoperator= (Basic &&)=delete
 Assignment operator in continuation with above.
 
hash_t hash () const
 
bool __neq__ (const Basic &o) const
 true if this is not equal to o. More...
 
int __cmp__ (const Basic &o) const
 Comparison operator.
 
std::string __str__ () const
 
RCP< const Basicsubs (const map_basic_basic &subs_dict) const
 Substitutes 'subs_dict' into 'self'.
 
RCP< const Basicxreplace (const map_basic_basic &subs_dict) const
 
virtual RCP< const Basicexpand_as_exp () const
 expands the special function in terms of exp function
 
RCP< const Basicdiff (const RCP< const Symbol > &x, bool cache=true) const
 
- Public Member Functions inherited from SymEngine::EnableRCPFromThis< Basic >
RCP< Basicrcp_from_this ()
 Get RCP<T> pointer to self (it will cast the pointer to T)
 
RCP< const Basicrcp_from_this () const
 Get RCP<const T> pointer to self (it will cast the pointer to const T)
 
RCP< const T2 > rcp_from_this_cast () const
 Get RCP<T2> pointer to self (it will cast the pointer to T2)
 
unsigned int use_count () const
 

Static Public Member Functions

static RCP< const GaloisFieldfrom_dict (const RCP< const Basic > &var, GaloisFieldDict &&d)
 
static RCP< const GaloisFieldfrom_vec (const RCP< const Basic > &var, const std::vector< integer_class > &v, const integer_class &modulo)
 
static RCP< const GaloisFieldfrom_uintpoly (const UIntPoly &a, const integer_class &modulo)
 
- Static Public Member Functions inherited from SymEngine::UNonExprPoly< Container, Poly, Cf >
static RCP< const Poly > from_dict (const RCP< const Basic > &var, std::map< unsigned, Cf > &&d)
 
- Static Public Member Functions inherited from SymEngine::UPolyBase< Container, Poly >
static RCP< const Poly > from_container (const RCP< const Basic > &var, Container &&d)
 

Static Public Attributes

static const TypeID type_code_id = SYMENGINE_GALOISFIELD
 

Additional Inherited Members

- Data Fields inherited from SymEngine::Basic
TypeID type_code_
 

Detailed Description

Definition at line 547 of file fields.h.

Member Function Documentation

◆ __hash__()

hash_t SymEngine::GaloisField::__hash__ ( ) const
virtual
Returns
size of the hash

Implements SymEngine::UPolyBase< Container, Poly >.

Definition at line 28 of file fields.cpp.

29 {
30  hash_t seed = SYMENGINE_GALOISFIELD;
31 
32  seed += get_var()->hash();
33  for (const auto &it : get_poly().dict_) {
34  hash_t temp = SYMENGINE_GALOISFIELD;
35  hash_combine<hash_t>(temp, mp_get_si(it));
36  seed += temp;
37  }
38  return seed;
39 }

◆ compare()

int SymEngine::GaloisField::compare ( const Basic o) const
virtual
Returns
-1,0 or 1 after comparing

Implements SymEngine::UPolyBase< Container, Poly >.

Definition at line 41 of file fields.cpp.

42 {
43  const GaloisField &s = down_cast<const GaloisField &>(o);
44 
45  if (get_poly().size() != s.get_poly().size())
46  return (get_poly().size() < s.get_poly().size()) ? -1 : 1;
47 
48  int cmp = unified_compare(get_var(), s.get_var());
49  if (cmp != 0)
50  return cmp;
51 
52  cmp = unified_compare(get_poly().modulo_, s.get_poly().modulo_);
53  if (cmp != 0)
54  return cmp;
55 
56  return unified_compare(get_poly().dict_, s.get_poly().dict_);
57 }
GaloisField(const RCP< const Basic > &var, GaloisFieldDict &&dict)
Constructor of GaloisField class.
Definition: fields.cpp:10
int unified_compare(const T &a, const T &b)
Definition: dict.h:205

◆ is_canonical()

bool SymEngine::GaloisField::is_canonical ( const GaloisFieldDict dict) const
Returns
true if canonical

Definition at line 17 of file fields.cpp.

18 {
19  // Check if dictionary contains terms with coeffienct 0
20  if (dict.modulo_ <= integer_class(0))
21  return false;
22  if (not dict.empty())
23  if (dict.dict_[dict.dict_.size() - 1] == integer_class(0))
24  return false;
25  return true;
26 }

Field Documentation

◆ type_code_id

const TypeID SymEngine::GaloisField::type_code_id = SYMENGINE_GALOISFIELD
static

Type_code_id shared by all instances

Definition at line 550 of file fields.h.


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