Loading...
Searching...
No Matches
SymEngine::GaloisFieldDict Class Reference
+ Collaboration diagram for SymEngine::GaloisFieldDict:

Data Structures

struct  DictLess
 

Public Member Functions

 GaloisFieldDict (GaloisFieldDict &&other) SYMENGINE_NOEXCEPT
 
 GaloisFieldDict (const int &i, const integer_class &mod)
 
 GaloisFieldDict (const map_uint_mpz &p, const integer_class &mod)
 
 GaloisFieldDict (const integer_class &i, const integer_class &mod)
 
 GaloisFieldDict (const GaloisFieldDict &)=default
 
GaloisFieldDictoperator= (const GaloisFieldDict &)=default
 
void gf_div (const GaloisFieldDict &o, const Ptr< GaloisFieldDict > &quo, const Ptr< GaloisFieldDict > &rem) const
 
GaloisFieldDict gf_lshift (const integer_class n) const
 
void gf_rshift (const integer_class n, const Ptr< GaloisFieldDict > &quo, const Ptr< GaloisFieldDict > &rem) const
 
GaloisFieldDict gf_sqr () const
 
GaloisFieldDict gf_pow (const unsigned long n) const
 
void gf_monic (integer_class &res, const Ptr< GaloisFieldDict > &monic) const
 
GaloisFieldDict gf_gcd (const GaloisFieldDict &o) const
 
GaloisFieldDict gf_lcm (const GaloisFieldDict &o) const
 
GaloisFieldDict gf_diff () const
 
integer_class gf_eval (const integer_class &a) const
 
vec_integer_class gf_multi_eval (const vec_integer_class &v) const
 
bool gf_is_sqf () const
 
std::vector< std::pair< GaloisFieldDict, unsigned > > gf_sqf_list () const
 
GaloisFieldDict gf_sqf_part () const
 
GaloisFieldDict gf_compose_mod (const GaloisFieldDict &g, const GaloisFieldDict &h) const
 
std::vector< GaloisFieldDictgf_frobenius_monomial_base () const
 
GaloisFieldDict gf_pow_mod (const GaloisFieldDict &f, const unsigned long &n) const
 
GaloisFieldDict gf_frobenius_map (const GaloisFieldDict &g, const std::vector< GaloisFieldDict > &b) const
 
std::pair< GaloisFieldDict, GaloisFieldDictgf_trace_map (const GaloisFieldDict &a, const GaloisFieldDict &b, const GaloisFieldDict &c, const unsigned long &n) const
 
GaloisFieldDict _gf_trace_map (const GaloisFieldDict &f, const unsigned long &n, const std::vector< GaloisFieldDict > &b) const
 
std::vector< std::pair< GaloisFieldDict, unsigned > > gf_ddf_zassenhaus () const
 
GaloisFieldDict _gf_pow_pnm1d2 (const GaloisFieldDict &f, const unsigned &n, const std::vector< GaloisFieldDict > &b) const
 
GaloisFieldDict gf_random (const unsigned int &n_val, mp_randstate &state) const
 
std::set< GaloisFieldDict, DictLessgf_edf_zassenhaus (const unsigned &n) const
 
std::vector< std::pair< GaloisFieldDict, unsigned > > gf_ddf_shoup () const
 
std::set< GaloisFieldDict, DictLessgf_edf_shoup (const unsigned &n) const
 
std::set< GaloisFieldDict, DictLessgf_zassenhaus () const
 
std::set< GaloisFieldDict, DictLessgf_shoup () const
 
std::pair< integer_class, std::set< std::pair< GaloisFieldDict, unsigned >, DictLess > > gf_factor () const
 
GaloisFieldDictoperator= (GaloisFieldDict &&other) SYMENGINE_NOEXCEPT
 
GaloisFieldDictoperator+= (const GaloisFieldDict &other)
 
GaloisFieldDictoperator+= (const integer_class &other)
 
GaloisFieldDict operator- () const
 
GaloisFieldDictnegate ()
 
GaloisFieldDictoperator-= (const integer_class &other)
 
GaloisFieldDictoperator-= (const GaloisFieldDict &other)
 
GaloisFieldDictoperator*= (const integer_class &other)
 
GaloisFieldDictoperator*= (const GaloisFieldDict &other)
 
GaloisFieldDictoperator/= (const integer_class &other)
 
GaloisFieldDictoperator/= (const GaloisFieldDict &other)
 
GaloisFieldDictoperator%= (const integer_class &other)
 
GaloisFieldDictoperator%= (const GaloisFieldDict &other)
 
bool operator== (const GaloisFieldDict &other) const
 
bool operator!= (const GaloisFieldDict &other) const
 
size_t size () const
 
bool empty () const
 
unsigned degree () const
 
const std::vector< integer_class > & get_dict () const
 
void gf_istrip ()
 
bool is_one () const
 
integer_class get_coeff (unsigned int x) const
 

Static Public Member Functions

static GaloisFieldDict from_vec (const std::vector< integer_class > &v, const integer_class &modulo)
 
static GaloisFieldDict mul (const GaloisFieldDict &a, const GaloisFieldDict &b)
 
static GaloisFieldDict pow (const GaloisFieldDict &a, unsigned int p)
 

Data Fields

std::vector< integer_class > dict_
 
integer_class modulo_
 

Friends

template<typename T >
GaloisFieldDict operator+ (const GaloisFieldDict &a, const T &b)
 
template<typename T >
GaloisFieldDict operator- (const GaloisFieldDict &a, const T &b)
 
GaloisFieldDict operator* (const GaloisFieldDict &a, const GaloisFieldDict &b)
 
template<class T >
GaloisFieldDict operator/ (const GaloisFieldDict &a, const T &b)
 
template<class T >
GaloisFieldDict operator% (const GaloisFieldDict &a, const T &b)
 

Detailed Description

Definition at line 15 of file fields.h.

Constructor & Destructor Documentation

◆ GaloisFieldDict() [1/5]

SymEngine::GaloisFieldDict::GaloisFieldDict ( )
inline

Definition at line 40 of file fields.h.

40{}

◆ ~GaloisFieldDict()

SymEngine::GaloisFieldDict::~GaloisFieldDict ( )
inline

Definition at line 41 of file fields.h.

41{}

◆ GaloisFieldDict() [2/5]

SymEngine::GaloisFieldDict::GaloisFieldDict ( GaloisFieldDict &&  other)
inline

Definition at line 42 of file fields.h.

43 : dict_(std::move(other.dict_)),
44 modulo_(std::move(other.modulo_))
45 {
46 }
T move(T... args)

◆ GaloisFieldDict() [3/5]

SymEngine::GaloisFieldDict::GaloisFieldDict ( const int &  i,
const integer_class &  mod 
)

Definition at line 112 of file fields.cpp.

113 : modulo_(mod)
114{
115 integer_class temp;
116 mp_fdiv_r(temp, integer_class(i), modulo_);
117 if (temp != integer_class(0))
118 dict_.insert(dict_.begin(), temp);
119}
T begin(T... args)
T insert(T... args)
RCP< const Integer > mod(const Integer &n, const Integer &d)
modulo round toward zero
Definition: ntheory.cpp:66

◆ GaloisFieldDict() [4/5]

SymEngine::GaloisFieldDict::GaloisFieldDict ( const map_uint_mpz p,
const integer_class &  mod 
)

Definition at line 121 of file fields.cpp.

123 : modulo_(mod)
124{
125 if (p.size() != 0) {
126 dict_.resize(p.rbegin()->first + 1, integer_class(0));
127 for (auto &iter : p) {
128 integer_class temp;
129 mp_fdiv_r(temp, iter.second, modulo_);
130 dict_[iter.first] = temp;
131 }
132 gf_istrip();
133 }
134}
T resize(T... args)

◆ GaloisFieldDict() [5/5]

SymEngine::GaloisFieldDict::GaloisFieldDict ( const integer_class &  i,
const integer_class &  mod 
)

Definition at line 136 of file fields.cpp.

138 : modulo_(mod)
139{
140 integer_class temp;
141 mp_fdiv_r(temp, i, modulo_);
142 if (temp != integer_class(0))
143 dict_.insert(dict_.begin(), temp);
144}

Member Function Documentation

◆ _gf_pow_pnm1d2()

GaloisFieldDict SymEngine::GaloisFieldDict::_gf_pow_pnm1d2 ( const GaloisFieldDict f,
const unsigned &  n,
const std::vector< GaloisFieldDict > &  b 
) const

Definition at line 660 of file fields.cpp.

662{
663 GaloisFieldDict f_in(f);
664 f_in %= *this;
665 GaloisFieldDict h, r;
666 h = r = f_in;
667 for (unsigned i = 1; i < n; ++i) {
668 h = h.gf_frobenius_map(*this, b);
669 r *= h;
670 r %= *this;
671 }
672 auto res = gf_pow_mod(r, (mp_get_ui(modulo_) - 1) / 2);
673 return res;
674}

◆ _gf_trace_map()

GaloisFieldDict SymEngine::GaloisFieldDict::_gf_trace_map ( const GaloisFieldDict f,
const unsigned long &  n,
const std::vector< GaloisFieldDict > &  b 
) const

Definition at line 616 of file fields.cpp.

618{
619 GaloisFieldDict x = f % (*this);
620 auto h = f;
621 auto r = f;
622 for (unsigned i = 1; i < n; ++i) {
623 h = gf_frobenius_map(h, b);
624 r += h;
625 r %= (*this);
626 }
627 return r;
628}

◆ degree()

unsigned SymEngine::GaloisFieldDict::degree ( ) const
inline

Definition at line 517 of file fields.h.

518 {
519 if (dict_.empty())
520 return 0;
521 return numeric_cast<unsigned>(dict_.size()) - 1;
522 }
T empty(T... args)
T size(T... args)

◆ empty()

bool SymEngine::GaloisFieldDict::empty ( ) const
inline

Definition at line 512 of file fields.h.

513 {
514 return dict_.empty();
515 }

◆ from_vec()

GaloisFieldDict SymEngine::GaloisFieldDict::from_vec ( const std::vector< integer_class > &  v,
const integer_class &  modulo 
)
static

Definition at line 146 of file fields.cpp.

148{
149 GaloisFieldDict x;
150 x.modulo_ = modulo;
151 x.dict_.resize(v.size());
152 for (unsigned int i = 0; i < v.size(); ++i) {
153 integer_class a;
154 mp_fdiv_r(a, v[i], modulo);
155 x.dict_[i] = a;
156 }
157 x.gf_istrip();
158 return x;
159}

◆ get_coeff()

integer_class SymEngine::GaloisFieldDict::get_coeff ( unsigned int  x) const
inline

Definition at line 539 of file fields.h.

540 {
541 if (x <= degree())
542 return dict_[x];
543 return 0_z;
544 }

◆ get_dict()

const std::vector< integer_class > & SymEngine::GaloisFieldDict::get_dict ( ) const
inline

Definition at line 524 of file fields.h.

525 {
526 return dict_;
527 }

◆ gf_compose_mod()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_compose_mod ( const GaloisFieldDict g,
const GaloisFieldDict h 
) const

Definition at line 482 of file fields.cpp.

484{
485 if (g.modulo_ != h.modulo_)
486 throw SymEngineException("Error: field must be same.");
487 if (g.modulo_ != modulo_)
488 throw SymEngineException("Error: field must be same.");
489 if (g.dict_.size() == 0)
490 return g;
491 GaloisFieldDict out
492 = GaloisFieldDict::from_vec({*(g.dict_.rbegin())}, modulo_);
493 if (g.dict_.size() >= 2) {
494 for (auto i = g.dict_.size() - 2;; --i) {
495 out *= h;
496 out += g.dict_[i];
497 out %= (*this);
498 if (i == 0)
499 break;
500 }
501 }
502 return out;
503}

◆ gf_ddf_shoup()

std::vector< std::pair< GaloisFieldDict, unsigned > > SymEngine::GaloisFieldDict::gf_ddf_shoup ( ) const

Definition at line 729 of file fields.cpp.

730{
732 if (dict_.empty())
733 return factors;
734 GaloisFieldDict f(*this);
735 auto n = this->degree();
736 auto k = static_cast<unsigned>(std::ceil(std::sqrt(n / 2)));
737 auto b = gf_frobenius_monomial_base();
738 auto x = GaloisFieldDict::from_vec({0_z, 1_z}, modulo_);
739 auto h = x.gf_frobenius_map(f, b);
740
742 U.push_back(x);
743 U.push_back(h);
744 U.resize(k + 1);
745 for (unsigned i = 2; i <= k; ++i)
746 U[i] = U[i - 1].gf_frobenius_map(*this, b);
747 h = U[k];
748 U.resize(k);
750 V.push_back(h);
751 V.resize(k);
752 for (unsigned i = 1; i + 1 <= k; ++i)
753 V[i] = this->gf_compose_mod(V[i - 1], h);
754 for (unsigned i = 0; i < V.size(); i++) {
755 h = GaloisFieldDict::from_vec({1_z}, modulo_);
756 auto j = k - 1;
757 GaloisFieldDict g;
758 for (auto &u : U) {
759 g = V[i] - u;
760 h *= g;
761 h %= f;
762 }
763 g = f.gf_gcd(h);
764 f /= g;
765 for (auto rit = U.rbegin(); rit != U.rend(); ++rit) {
766 h = V[i] - (*rit);
767 auto F = g.gf_gcd(h);
768 if (not F.is_one()) {
769 unsigned temp = k * (i + 1) - j;
770 factors.push_back({F, temp});
771 }
772 g /= F;
773 --j;
774 }
775 }
776 if (not f.is_one())
777 factors.push_back({f, f.degree()});
778 return factors;
779}
T ceil(T... args)
T push_back(T... args)
T sqrt(T... args)

◆ gf_ddf_zassenhaus()

std::vector< std::pair< GaloisFieldDict, unsigned > > SymEngine::GaloisFieldDict::gf_ddf_zassenhaus ( ) const

Definition at line 631 of file fields.cpp.

632{
633 unsigned i = 1;
634 GaloisFieldDict f(*this);
635 GaloisFieldDict g = GaloisFieldDict::from_vec({0_z, 1_z}, modulo_);
636 GaloisFieldDict to_sub(g);
638
639 auto b = f.gf_frobenius_monomial_base();
640 while (2 * i <= f.degree()) {
641 g = g.gf_frobenius_map(f, b);
642
643 GaloisFieldDict h = f.gf_gcd(g - to_sub);
644
645 if (not h.is_one()) {
646 factors.push_back({h, i});
647 f /= h;
648 g %= f;
649 b = f.gf_frobenius_monomial_base();
650 }
651 ++i;
652 }
653 if (not(f.is_one() || f.empty())) {
654 factors.push_back({f, f.degree()});
655 }
656 return factors;
657}

◆ gf_diff()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_diff ( ) const

Definition at line 372 of file fields.cpp.

373{
374 auto df = degree();
375 GaloisFieldDict out = GaloisFieldDict({}, modulo_);
376 out.dict_.resize(df, integer_class(0));
377 for (unsigned i = 1; i <= df; i++) {
378 if (dict_[i] != integer_class(0)) {
379 out.dict_[i - 1] = i * dict_[i];
380 mp_fdiv_r(out.dict_[i - 1], out.dict_[i - 1], modulo_);
381 }
382 }
383 out.gf_istrip();
384 return out;
385}

◆ gf_div()

void SymEngine::GaloisFieldDict::gf_div ( const GaloisFieldDict o,
const Ptr< GaloisFieldDict > &  quo,
const Ptr< GaloisFieldDict > &  rem 
) const

Definition at line 209 of file fields.cpp.

212{
213 if (modulo_ != o.modulo_)
214 throw SymEngineException("Error: field must be same.");
215 if (o.dict_.empty())
216 throw DivisionByZeroError("ZeroDivisionError");
218 if (dict_.empty()) {
219 *quo = GaloisFieldDict::from_vec(dict_out, modulo_);
220 *rem = GaloisFieldDict::from_vec(dict_, modulo_);
221 return;
222 }
223 auto dict_divisor = o.dict_;
224 auto deg_dividend = this->degree();
225 auto deg_divisor = o.degree();
226 if (deg_dividend < deg_divisor) {
227 *quo = GaloisFieldDict::from_vec(dict_out, modulo_);
228 *rem = GaloisFieldDict::from_vec(dict_, modulo_);
229 } else {
230 dict_out = dict_;
231 integer_class inv;
232 mp_invert(inv, *(dict_divisor.rbegin()), modulo_);
233 integer_class coeff;
234 for (auto it = deg_dividend + 1; it-- != 0;) {
235 coeff = dict_out[it];
236 auto lb = deg_divisor + it > deg_dividend
237 ? deg_divisor + it - deg_dividend
238 : 0;
239 auto ub = std::min(it + 1, deg_divisor);
240 for (size_t j = lb; j < ub; ++j) {
241 mp_addmul(coeff, dict_out[it - j + deg_divisor],
242 -dict_divisor[j]);
243 }
244 if (it >= deg_divisor)
245 coeff *= inv;
246 mp_fdiv_r(coeff, coeff, modulo_);
247 dict_out[it] = coeff;
248 }
249 std::vector<integer_class> dict_rem, dict_quo;
250 dict_rem.resize(deg_divisor);
251 dict_quo.resize(deg_dividend - deg_divisor + 1);
252 for (unsigned it = 0; it < dict_out.size(); it++) {
253 if (it < deg_divisor)
254 dict_rem[it] = dict_out[it];
255 else
256 dict_quo[it - deg_divisor] = dict_out[it];
257 }
258 *quo = GaloisFieldDict::from_vec(dict_quo, modulo_);
259 *rem = GaloisFieldDict::from_vec(dict_rem, modulo_);
260 }
261}
T min(T... args)

◆ gf_edf_shoup()

std::set< GaloisFieldDict, GaloisFieldDict::DictLess > SymEngine::GaloisFieldDict::gf_edf_shoup ( const unsigned &  n) const

Definition at line 782 of file fields.cpp.

783{
784 auto N = this->degree();
786 if (N <= n) {
787 if (N != 0)
788 factors.insert(*this);
789 return factors;
790 }
791 auto x = GaloisFieldDict::from_vec({0_z, 1_z}, modulo_);
792 mp_randstate state;
793 auto r = gf_random(N - 1, state);
794 if (modulo_ == 2_z) {
795 auto h = gf_pow_mod(x, mp_get_ui(modulo_));
796 auto H = gf_trace_map(r, h, x, n - 1).second;
797 auto h1 = gf_gcd(H);
798 auto h2 = (*this) / h1;
799 factors = h1.gf_edf_shoup(n);
800 auto temp = h2.gf_edf_shoup(n);
801 factors.insert(temp.begin(), temp.end());
802 } else {
803 auto b = gf_frobenius_monomial_base();
804 auto H = _gf_trace_map(r, n, b);
805 auto h = gf_pow_mod(H, (mp_get_ui(modulo_) - 1) / 2);
806 auto h1 = gf_gcd(h);
807 auto h2 = gf_gcd(h - 1_z);
808 auto h3 = (*this) / (h1 * h2);
809 factors = h1.gf_edf_shoup(n);
810 auto temp = h2.gf_edf_shoup(n);
811 factors.insert(temp.begin(), temp.end());
812 temp = h3.gf_edf_shoup(n);
813 factors.insert(temp.begin(), temp.end());
814 }
815 return factors;
816}

◆ gf_edf_zassenhaus()

std::set< GaloisFieldDict, GaloisFieldDict::DictLess > SymEngine::GaloisFieldDict::gf_edf_zassenhaus ( const unsigned &  n) const

Definition at line 688 of file fields.cpp.

689{
691 factors.insert(*this);
692 if (this->degree() <= n)
693 return factors;
694
695 auto N = this->degree() / n;
696
698 if (modulo_ != 2_z)
699 b = this->gf_frobenius_monomial_base();
700 mp_randstate state;
701 while (factors.size() < N) {
702 auto r = gf_random(2 * n - 1, state);
703 GaloisFieldDict g;
704 if (modulo_ == 2_z) {
705 GaloisFieldDict h = r;
706 unsigned ub = 1 << (n * N - 1);
707 for (unsigned i = 0; i < ub; ++i) {
708 r = gf_pow_mod(r, 2);
709 h += r;
710 }
711 g = this->gf_gcd(h);
712 } else {
713 GaloisFieldDict h = _gf_pow_pnm1d2(r, n, b);
714 h -= 1_z;
715 g = this->gf_gcd(h);
716 }
717
718 if (!g.is_one() and g != (*this)) {
719 factors = g.gf_edf_zassenhaus(n);
720 auto to_add = ((*this) / g).gf_edf_zassenhaus(n);
721 if (not to_add.empty())
722 factors.insert(to_add.begin(), to_add.end());
723 }
724 }
725 return factors;
726}

◆ gf_eval()

integer_class SymEngine::GaloisFieldDict::gf_eval ( const integer_class &  a) const

Definition at line 387 of file fields.cpp.

388{
389 integer_class res = 0_z;
390 for (auto rit = dict_.rbegin(); rit != dict_.rend(); ++rit) {
391 res *= a;
392 res += (*rit);
393 res %= modulo_;
394 }
395 return res;
396}
T rbegin(T... args)
T rend(T... args)

◆ gf_factor()

std::pair< integer_class, std::set< std::pair< GaloisFieldDict, unsigned >, GaloisFieldDict::DictLess > > SymEngine::GaloisFieldDict::gf_factor ( ) const

Definition at line 844 of file fields.cpp.

845{
846 integer_class lc;
848 GaloisFieldDict monic;
849 gf_monic(lc, outArg(monic));
850 if (monic.degree() < 1)
851 return std::make_pair(lc, factors);
853 = monic.gf_sqf_list();
854 for (auto a : sqf_list) {
855 auto temp = (a.first).gf_zassenhaus();
856 for (auto f : temp)
857 factors.insert({f, a.second});
858 }
859 return std::make_pair(lc, factors);
860}
T make_pair(T... args)

◆ gf_frobenius_map()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_frobenius_map ( const GaloisFieldDict g,
const std::vector< GaloisFieldDict > &  b 
) const

Definition at line 562 of file fields.cpp.

564{
565 if (modulo_ != g.modulo_)
566 throw SymEngineException("Error: field must be same.");
567 auto m = g.degree();
568 GaloisFieldDict temp_out(*this), out;
569 if (this->degree() >= m) {
570 temp_out %= g;
571 }
572 if (temp_out.empty()) {
573 return temp_out;
574 }
575 m = temp_out.degree();
576 out = GaloisFieldDict::from_vec({temp_out.dict_[0]}, modulo_);
577 for (unsigned i = 1; i <= m; ++i) {
578 auto v = b[i];
579 v *= temp_out.dict_[i];
580 out += v;
581 }
582 out.gf_istrip();
583 return out;
584}

◆ gf_frobenius_monomial_base()

std::vector< GaloisFieldDict > SymEngine::GaloisFieldDict::gf_frobenius_monomial_base ( ) const

Definition at line 536 of file fields.cpp.

537{
538 auto n = degree();
540 if (n == 0)
541 return b;
542 b.resize(n);
543 b[0] = GaloisFieldDict::from_vec({1_z}, modulo_);
544 GaloisFieldDict temp_out;
545 if (mp_get_ui(modulo_) < n) {
546 for (unsigned i = 1; i < n; ++i) {
547 b[i] = b[i - 1].gf_lshift(modulo_);
548 b[i] %= (*this);
549 }
550 } else if (n > 1) {
551 b[1] = gf_pow_mod(GaloisFieldDict::from_vec({0_z, 1_z}, modulo_),
552 mp_get_ui(modulo_));
553 for (unsigned i = 2; i < n; ++i) {
554 b[i] = b[i - 1] * b[1];
555 b[i] %= (*this);
556 }
557 }
558 return b;
559}

◆ gf_gcd()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_gcd ( const GaloisFieldDict o) const

Definition at line 340 of file fields.cpp.

341{
342 if (modulo_ != o.modulo_)
343 throw SymEngineException("Error: field must be same.");
344 GaloisFieldDict f = down_cast<const GaloisFieldDict &>(*this);
345 GaloisFieldDict g = o;
346 GaloisFieldDict temp_out;
347 while (not g.dict_.empty()) {
348 f %= g; // f, g = f % g, g
349 f.dict_.swap(g.dict_);
350 }
351 integer_class temp_LC;
352 f.gf_monic(temp_LC, outArg(f));
353 return f;
354}

◆ gf_is_sqf()

bool SymEngine::GaloisFieldDict::gf_is_sqf ( ) const

Definition at line 407 of file fields.cpp.

408{
409 if (dict_.empty())
410 return true;
411 integer_class LC;
412 GaloisFieldDict monic;
413 gf_monic(LC, outArg(monic));
414 monic = monic.gf_gcd(monic.gf_diff());
415 return monic.is_one();
416}

◆ gf_istrip()

void SymEngine::GaloisFieldDict::gf_istrip ( )

Definition at line 171 of file fields.cpp.

172{
173 for (auto i = dict_.size(); i-- != 0;) {
174 if (dict_[i] == integer_class(0))
175 dict_.pop_back();
176 else
177 break;
178 }
179}
T pop_back(T... args)

◆ gf_lcm()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_lcm ( const GaloisFieldDict o) const

Definition at line 356 of file fields.cpp.

357{
358 if (modulo_ != o.modulo_)
359 throw SymEngineException("Error: field must be same.");
360 if (dict_.empty())
361 return down_cast<const GaloisFieldDict &>(*this);
362 if (o.dict_.empty())
363 return o;
364 GaloisFieldDict out, temp_out;
365 out = o * (*this);
366 out /= gf_gcd(o);
367 integer_class temp_LC;
368 out.gf_monic(temp_LC, outArg(out));
369 return out;
370}

◆ gf_lshift()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_lshift ( const integer_class  n) const

Definition at line 263 of file fields.cpp.

264{
266 auto to_ret = GaloisFieldDict::from_vec(dict_out, modulo_);
267 if (!dict_.empty()) {
268 auto n_val = mp_get_ui(n);
269 to_ret.dict_.resize(n_val, integer_class(0));
270 to_ret.dict_.insert(to_ret.dict_.end(), dict_.begin(), dict_.end());
271 }
272 return to_ret;
273}
T end(T... args)

◆ gf_monic()

void SymEngine::GaloisFieldDict::gf_monic ( integer_class &  res,
const Ptr< GaloisFieldDict > &  monic 
) const

Definition at line 320 of file fields.cpp.

322{
323 *monic = down_cast<const GaloisFieldDict &>(*this);
324 if (dict_.empty()) {
325 res = integer_class(0);
326 } else {
327 res = *dict_.rbegin();
328 if (res != integer_class(1)) {
329 integer_class inv, temp;
330 mp_invert(inv, res, modulo_);
331 for (auto &iter : monic->dict_) {
332 temp = inv;
333 temp *= iter;
334 mp_fdiv_r(iter, temp, modulo_);
335 }
336 }
337 }
338}

◆ gf_multi_eval()

vec_integer_class SymEngine::GaloisFieldDict::gf_multi_eval ( const vec_integer_class v) const

Definition at line 399 of file fields.cpp.

400{
401 vec_integer_class res(v.size());
402 for (unsigned int i = 0; i < v.size(); ++i)
403 res[i] = gf_eval(v[i]);
404 return res;
405}

◆ gf_pow()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_pow ( const unsigned long  n) const

Definition at line 297 of file fields.cpp.

298{
299 if (n == 0) {
300 return GaloisFieldDict({integer_class(1)}, modulo_);
301 }
302 if (n == 1)
303 return down_cast<const GaloisFieldDict &>(*this);
304 if (n == 2)
305 return gf_sqr();
306 auto num = n;
307 GaloisFieldDict to_sq = down_cast<const GaloisFieldDict &>(*this);
308 GaloisFieldDict to_ret = GaloisFieldDict({integer_class(1)}, modulo_);
309 while (1) {
310 if (num & 1) {
311 to_ret *= to_sq;
312 }
313 num >>= 1;
314 if (num == 0)
315 return to_ret;
316 to_sq = to_sq.gf_sqr();
317 }
318}

◆ gf_pow_mod()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_pow_mod ( const GaloisFieldDict f,
const unsigned long &  n 
) const

Definition at line 505 of file fields.cpp.

507{
508 if (modulo_ != f.modulo_)
509 throw SymEngineException("Error: field must be same.");
510 if (n == 0)
511 return GaloisFieldDict::from_vec({1_z}, modulo_);
512 GaloisFieldDict in = f;
513 if (n == 1) {
514 return f % (*this);
515 }
516 if (n == 2) {
517 return f.gf_sqr() % (*this);
518 }
519 GaloisFieldDict h = GaloisFieldDict::from_vec({1_z}, modulo_);
520 auto mod = n;
521 while (true) {
522 if (mod & 1) {
523 h *= in;
524 h %= *this;
525 }
526 mod >>= 1;
527
528 if (mod == 0)
529 break;
530
531 in = in.gf_sqr() % *this;
532 }
533 return h;
534}

◆ gf_random()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_random ( const unsigned int &  n_val,
mp_randstate state 
) const

Definition at line 676 of file fields.cpp.

678{
679 std::vector<integer_class> v(n_val + 1);
680 for (unsigned i = 0; i < n_val; ++i) {
681 state.urandomint(v[i], modulo_);
682 }
683 v[n_val] = 1_z;
684 return GaloisFieldDict::from_vec(v, modulo_);
685}

◆ gf_rshift()

void SymEngine::GaloisFieldDict::gf_rshift ( const integer_class  n,
const Ptr< GaloisFieldDict > &  quo,
const Ptr< GaloisFieldDict > &  rem 
) const

Definition at line 275 of file fields.cpp.

278{
280 *quo = GaloisFieldDict::from_vec(dict_quo, modulo_);
281 auto n_val = mp_get_ui(n);
282 if (n_val < dict_.size()) {
283 quo->dict_.insert(quo->dict_.end(), dict_.begin() + n_val, dict_.end());
284 std::vector<integer_class> dict_rem(dict_.begin(),
285 dict_.begin() + n_val);
286 *rem = GaloisFieldDict::from_vec(dict_rem, modulo_);
287 } else {
288 *rem = down_cast<const GaloisFieldDict &>(*this);
289 }
290}

◆ gf_shoup()

std::set< GaloisFieldDict, GaloisFieldDict::DictLess > SymEngine::GaloisFieldDict::gf_shoup ( ) const

Definition at line 831 of file fields.cpp.

832{
834 auto temp1 = gf_ddf_shoup();
835 for (auto &f : temp1) {
836 auto temp2 = f.first.gf_edf_shoup(f.second);
837 factors.insert(temp2.begin(), temp2.end());
838 }
839 return factors;
840}

◆ gf_sqf_list()

std::vector< std::pair< GaloisFieldDict, unsigned > > SymEngine::GaloisFieldDict::gf_sqf_list ( ) const

Definition at line 419 of file fields.cpp.

420{
422 if (degree() < 1)
423 return vec_out;
424 unsigned n = 1;
425 // This cast is okay, because the multiplicities are unsigned
426 unsigned r = numeric_cast<unsigned>(mp_get_ui(modulo_));
427 bool sqf = false;
428 integer_class LC;
429 GaloisFieldDict f;
430 gf_monic(LC, outArg(f));
431 while (true) {
432 GaloisFieldDict F = f.gf_diff();
433 if (not F.dict_.empty()) {
434 GaloisFieldDict g = f.gf_gcd(F);
435 GaloisFieldDict h = f / g;
436
437 unsigned i = 1;
438
439 while (not h.is_one()) {
440 GaloisFieldDict G = h.gf_gcd(g);
441 GaloisFieldDict H = h / G;
442
443 if (H.degree() > 0)
444 vec_out.push_back({H, i * n});
445
446 ++i;
447 g /= G;
448 h = G;
449 }
450 if (g.is_one())
451 sqf = true;
452 else
453 f = g;
454 }
455 if (not sqf) {
456 auto deg = f.degree();
457 auto d = deg / r;
458 GaloisFieldDict temp = f;
459 for (unsigned int i = 0; i <= d; ++i) {
460 f.dict_[d - i] = temp.dict_[deg - i * r];
461 }
462 n *= r;
463 f.dict_.resize(d + 1);
464 f.gf_istrip();
465 } else
466 break;
467 }
468 return vec_out;
469}

◆ gf_sqf_part()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_sqf_part ( ) const

Definition at line 471 of file fields.cpp.

472{
473 auto sqf = gf_sqf_list();
474 GaloisFieldDict g = GaloisFieldDict::from_vec({1_z}, modulo_);
475
476 for (auto &f : sqf)
477 g *= f.first;
478
479 return g;
480}

◆ gf_sqr()

GaloisFieldDict SymEngine::GaloisFieldDict::gf_sqr ( ) const

Definition at line 292 of file fields.cpp.

293{
294 return (*this * *this);
295}

◆ gf_trace_map()

std::pair< GaloisFieldDict, GaloisFieldDict > SymEngine::GaloisFieldDict::gf_trace_map ( const GaloisFieldDict a,
const GaloisFieldDict b,
const GaloisFieldDict c,
const unsigned long &  n 
) const

Definition at line 586 of file fields.cpp.

589{
590 unsigned long n_val(n);
591 auto u = this->gf_compose_mod(a, b);
592 GaloisFieldDict v(b), U, V;
593 if (n_val & 1) {
594 U = a + u;
595 V = b;
596 } else {
597 U = a;
598 V = c;
599 }
600 n_val >>= 1;
601 while (n_val) {
602 u += this->gf_compose_mod(u, v);
603 v = gf_compose_mod(v, v);
604
605 if (n_val & 1) {
606 auto temp = gf_compose_mod(u, V);
607 U += temp;
608 V = gf_compose_mod(v, V);
609 }
610 n_val >>= 1;
611 }
612 return std::make_pair(gf_compose_mod(a, V), U);
613}

◆ gf_zassenhaus()

std::set< GaloisFieldDict, GaloisFieldDict::DictLess > SymEngine::GaloisFieldDict::gf_zassenhaus ( ) const

Definition at line 819 of file fields.cpp.

820{
822 auto temp1 = gf_ddf_zassenhaus();
823 for (auto &f : temp1) {
824 auto temp2 = f.first.gf_edf_zassenhaus(f.second);
825 factors.insert(temp2.begin(), temp2.end());
826 }
827 return factors;
828}

◆ is_one()

bool SymEngine::GaloisFieldDict::is_one ( ) const
inline

Definition at line 531 of file fields.h.

532 {
533 if (dict_.size() == 1)
534 if (dict_[0] == integer_class(1))
535 return true;
536 return false;
537 }

◆ mul()

GaloisFieldDict SymEngine::GaloisFieldDict::mul ( const GaloisFieldDict a,
const GaloisFieldDict b 
)
static

Definition at line 181 of file fields.cpp.

183{
184 if (a.modulo_ != b.modulo_)
185 throw std::runtime_error("Error: field must be same.");
186 if (a.get_dict().empty())
187 return a;
188 if (b.get_dict().empty())
189 return b;
190
191 GaloisFieldDict p;
192 p.dict_.resize(a.degree() + b.degree() + 1, integer_class(0));
193 p.modulo_ = a.modulo_;
194 for (unsigned int i = 0; i <= a.degree(); i++)
195 for (unsigned int j = 0; j <= b.degree(); j++) {
196 auto temp = a.dict_[i];
197 temp *= b.dict_[j];
198 if (temp != integer_class(0)) {
199 auto t = p.dict_[i + j];
200 t += temp;
201 mp_fdiv_r(t, t, a.modulo_);
202 p.dict_[i + j] = t;
203 }
204 }
205 p.gf_istrip();
206 return p;
207}

◆ negate()

GaloisFieldDict & SymEngine::GaloisFieldDict::negate ( )

Definition at line 161 of file fields.cpp.

162{
163 for (auto &a : dict_) {
164 a *= -1;
165 if (a != 0_z)
166 a += modulo_;
167 }
168 return down_cast<GaloisFieldDict &>(*this);
169}

◆ operator!=()

bool SymEngine::GaloisFieldDict::operator!= ( const GaloisFieldDict other) const
inline

Definition at line 502 of file fields.h.

503 {
504 return not(*this == other);
505 }

◆ operator%=() [1/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator%= ( const GaloisFieldDict other)
inline

Definition at line 442 of file fields.h.

443 {
444 if (modulo_ != other.modulo_)
445 throw SymEngineException("Error: field must be same.");
446 auto dict_divisor = other.dict_;
447 if (dict_divisor.empty()) {
448 throw DivisionByZeroError("ZeroDivisionError");
449 }
450 if (dict_.empty())
451 return down_cast<GaloisFieldDict &>(*this);
452 integer_class inv;
453 mp_invert(inv, *(dict_divisor.rbegin()), modulo_);
454
455 // ! other is a just constant term
456 if (dict_divisor.size() == 1) {
457 dict_.clear();
458 return down_cast<GaloisFieldDict &>(*this);
459 }
461 size_t deg_dividend = this->degree();
462 size_t deg_divisor = other.degree();
463 if (deg_dividend < deg_divisor) {
464 return down_cast<GaloisFieldDict &>(*this);
465 }
466 dict_out.swap(dict_);
467 dict_.resize(deg_divisor);
468 integer_class coeff;
469 for (auto it = deg_dividend + 1; it-- != 0;) {
470 coeff = dict_out[it];
471 auto lb = deg_divisor + it > deg_dividend
472 ? deg_divisor + it - deg_dividend
473 : 0;
474 auto ub = std::min(it + 1, deg_divisor);
475 for (size_t j = lb; j < ub; ++j) {
476 mp_addmul(coeff, dict_out[it - j + deg_divisor],
477 -dict_divisor[j]);
478 }
479 if (it >= deg_divisor) {
480 coeff *= inv;
481 mp_fdiv_r(coeff, coeff, modulo_);
482 dict_out[it] = coeff;
483 } else {
484 mp_fdiv_r(coeff, coeff, modulo_);
485 dict_out[it] = dict_[it] = coeff;
486 }
487 }
488 gf_istrip();
489 return down_cast<GaloisFieldDict &>(*this);
490 }
T clear(T... args)
T swap(T... args)

◆ operator%=() [2/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator%= ( const integer_class &  other)
inline

Definition at line 431 of file fields.h.

432 {
433 if (other == integer_class(0)) {
434 throw DivisionByZeroError("ZeroDivisionError");
435 }
436 if (dict_.empty())
437 return down_cast<GaloisFieldDict &>(*this);
438 dict_.clear();
439 return down_cast<GaloisFieldDict &>(*this);
440 }

◆ operator*=() [1/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator*= ( const GaloisFieldDict other)
inline

Definition at line 314 of file fields.h.

315 {
316 if (modulo_ != other.modulo_)
317 throw SymEngineException("Error: field must be same.");
318 if (dict_.empty())
319 return down_cast<GaloisFieldDict &>(*this);
320
321 auto o_dict = other.dict_;
322 if (o_dict.empty()) {
323 dict_.clear();
324 return down_cast<GaloisFieldDict &>(*this);
325 }
326
327 // ! other is a just constant term
328 if (o_dict.size() == 1) {
329 for (auto &arg : dict_) {
330 if (arg != integer_class(0)) {
331 arg *= o_dict[0];
332 mp_fdiv_r(arg, arg, modulo_);
333 }
334 }
335 gf_istrip();
336 return down_cast<GaloisFieldDict &>(*this);
337 }
338 // mul will return a stripped dict
339 GaloisFieldDict res
340 = GaloisFieldDict::mul(down_cast<GaloisFieldDict &>(*this), other);
341 res.dict_.swap(this->dict_);
342 return down_cast<GaloisFieldDict &>(*this);
343 }

◆ operator*=() [2/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator*= ( const integer_class &  other)
inline

Definition at line 294 of file fields.h.

295 {
296 if (dict_.empty())
297 return down_cast<GaloisFieldDict &>(*this);
298
299 if (other == integer_class(0)) {
300 dict_.clear();
301 return down_cast<GaloisFieldDict &>(*this);
302 }
303
304 for (auto &arg : dict_) {
305 if (arg != integer_class(0)) {
306 arg *= other;
307 mp_fdiv_r(arg, arg, modulo_);
308 }
309 }
310 gf_istrip();
311 return down_cast<GaloisFieldDict &>(*this);
312 }

◆ operator+=() [1/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator+= ( const GaloisFieldDict other)
inline

Definition at line 164 of file fields.h.

165 {
166 if (modulo_ != other.modulo_)
167 throw SymEngineException("Error: field must be same.");
168 if (other.dict_.size() == 0)
169 return down_cast<GaloisFieldDict &>(*this);
170 if (this->dict_.size() == 0) {
171 *this = other;
172 return down_cast<GaloisFieldDict &>(*this);
173 }
174 if (other.dict_.size() < this->dict_.size()) {
175 for (unsigned int i = 0; i < other.dict_.size(); i++) {
176 integer_class temp;
177 temp += dict_[i];
178 temp += other.dict_[i];
179 if (temp != integer_class(0)) {
180 mp_fdiv_r(temp, temp, modulo_);
181 }
182 dict_[i] = temp;
183 }
184 } else {
185 for (unsigned int i = 0; i < dict_.size(); i++) {
186 integer_class temp;
187 temp += dict_[i];
188 temp += other.dict_[i];
189 if (temp != integer_class(0)) {
190 mp_fdiv_r(temp, temp, modulo_);
191 }
192 dict_[i] = temp;
193 }
194 if (other.dict_.size() == this->dict_.size())
195 gf_istrip();
196 else
197 dict_.insert(dict_.end(), other.dict_.begin() + dict_.size(),
198 other.dict_.end());
199 }
200 return down_cast<GaloisFieldDict &>(*this);
201 }

◆ operator+=() [2/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator+= ( const integer_class &  other)
inline

Definition at line 203 of file fields.h.

204 {
205 if (dict_.empty() or other == integer_class(0))
206 return down_cast<GaloisFieldDict &>(*this);
207 integer_class temp = dict_[0] + other;
208 mp_fdiv_r(temp, temp, modulo_);
209 dict_[0] = temp;
210 if (dict_.size() == 1)
211 gf_istrip();
212 return down_cast<GaloisFieldDict &>(*this);
213 }

◆ operator-()

GaloisFieldDict SymEngine::GaloisFieldDict::operator- ( ) const
inline

Definition at line 222 of file fields.h.

223 {
224 GaloisFieldDict o(*this);
225 for (auto &a : o.dict_) {
226 a *= -1;
227 if (a != 0_z)
228 a += modulo_;
229 }
230 return o;
231 }

◆ operator-=() [1/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator-= ( const GaloisFieldDict other)
inline

Definition at line 240 of file fields.h.

241 {
242 if (modulo_ != other.modulo_)
243 throw SymEngineException("Error: field must be same.");
244 if (other.dict_.size() == 0)
245 return down_cast<GaloisFieldDict &>(*this);
246 if (this->dict_.size() == 0) {
247 *this = -other;
248 return down_cast<GaloisFieldDict &>(*this);
249 }
250 if (other.dict_.size() < this->dict_.size()) {
251 for (unsigned int i = 0; i < other.dict_.size(); i++) {
252 integer_class temp;
253 temp += dict_[i];
254 temp -= other.dict_[i];
255 if (temp != integer_class(0)) {
256 mp_fdiv_r(temp, temp, modulo_);
257 }
258 dict_[i] = temp;
259 }
260 } else {
261 for (unsigned int i = 0; i < dict_.size(); i++) {
262 integer_class temp;
263 temp += dict_[i];
264 temp -= other.dict_[i];
265 if (temp != integer_class(0)) {
266 mp_fdiv_r(temp, temp, modulo_);
267 }
268 dict_[i] = temp;
269 }
270 if (other.dict_.size() == this->dict_.size())
271 gf_istrip();
272 else {
273 auto orig_size = dict_.size();
274 dict_.resize(other.dict_.size());
275 for (auto i = orig_size; i < other.dict_.size(); i++) {
276 dict_[i] = -other.dict_[i];
277 if (dict_[i] != 0_z)
278 dict_[i] += modulo_;
279 }
280 }
281 }
282 return down_cast<GaloisFieldDict &>(*this);
283 }

◆ operator-=() [2/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator-= ( const integer_class &  other)
inline

Definition at line 235 of file fields.h.

236 {
237 return *this += (-1 * other);
238 }

◆ operator/=() [1/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator/= ( const GaloisFieldDict other)
inline

Definition at line 372 of file fields.h.

373 {
374 if (modulo_ != other.modulo_)
375 throw SymEngineException("Error: field must be same.");
376 auto dict_divisor = other.dict_;
377 if (dict_divisor.empty()) {
378 throw DivisionByZeroError("ZeroDivisionError");
379 }
380 if (dict_.empty())
381 return down_cast<GaloisFieldDict &>(*this);
382 integer_class inv;
383 mp_invert(inv, *(dict_divisor.rbegin()), modulo_);
384
385 // ! other is a just constant term
386 if (dict_divisor.size() == 1) {
387 for (auto &iter : dict_) {
388 if (iter != 0) {
389 iter *= inv;
390 mp_fdiv_r(iter, iter, modulo_);
391 }
392 }
393 return down_cast<GaloisFieldDict &>(*this);
394 }
396 size_t deg_dividend = this->degree();
397 size_t deg_divisor = other.degree();
398 if (deg_dividend < deg_divisor) {
399 dict_.clear();
400 return down_cast<GaloisFieldDict &>(*this);
401 }
402 dict_out.swap(dict_);
403 dict_.resize(deg_dividend - deg_divisor + 1);
404 integer_class coeff;
405 for (auto riter = deg_dividend; riter >= deg_divisor; --riter) {
406 coeff = dict_out[riter];
407 auto lb = deg_divisor + riter > deg_dividend
408 ? deg_divisor + riter - deg_dividend
409 : 0;
410 auto ub = std::min(riter + 1, deg_divisor);
411 for (auto j = lb; j < ub; ++j) {
412 mp_addmul(coeff, dict_out[riter - j + deg_divisor],
413 -dict_divisor[j]);
414 }
415 coeff *= inv;
416 mp_fdiv_r(coeff, coeff, modulo_);
417 dict_out[riter] = dict_[riter - deg_divisor] = coeff;
418 }
419 gf_istrip();
420 return down_cast<GaloisFieldDict &>(*this);
421 }

◆ operator/=() [2/2]

GaloisFieldDict & SymEngine::GaloisFieldDict::operator/= ( const integer_class &  other)
inline

Definition at line 353 of file fields.h.

354 {
355 if (other == integer_class(0)) {
356 throw DivisionByZeroError("ZeroDivisionError");
357 }
358 if (dict_.empty())
359 return down_cast<GaloisFieldDict &>(*this);
360 integer_class inv;
361 mp_invert(inv, other, modulo_);
362 for (auto &arg : dict_) {
363 if (arg != integer_class(0)) {
364 arg *= inv;
365 mp_fdiv_r(arg, arg, modulo_);
366 }
367 }
368 gf_istrip();
369 return down_cast<GaloisFieldDict &>(*this);
370 }

◆ operator=()

GaloisFieldDict & SymEngine::GaloisFieldDict::operator= ( GaloisFieldDict &&  other)
inline

Definition at line 147 of file fields.h.

148 {
149 if (this != &other) {
150 dict_ = std::move(other.dict_);
151 modulo_ = std::move(other.modulo_);
152 }
153 return down_cast<GaloisFieldDict &>(*this);
154 }

◆ operator==()

bool SymEngine::GaloisFieldDict::operator== ( const GaloisFieldDict other) const
inline

Definition at line 497 of file fields.h.

498 {
499 return dict_ == other.dict_ and modulo_ == other.modulo_;
500 }

◆ pow()

static GaloisFieldDict SymEngine::GaloisFieldDict::pow ( const GaloisFieldDict a,
unsigned int  p 
)
inlinestatic

Definition at line 492 of file fields.h.

493 {
494 return a.gf_pow(p);
495 }

◆ size()

size_t SymEngine::GaloisFieldDict::size ( ) const
inline

Definition at line 507 of file fields.h.

508 {
509 return dict_.size();
510 }

Friends And Related Function Documentation

◆ operator%

template<class T >
GaloisFieldDict operator% ( const GaloisFieldDict a,
const T &  b 
)
friend

Definition at line 424 of file fields.h.

425 {
426 GaloisFieldDict c = a;
427 c %= b;
428 return c;
429 }

◆ operator*

GaloisFieldDict operator* ( const GaloisFieldDict a,
const GaloisFieldDict b 
)
friend

Definition at line 288 of file fields.h.

290 {
291 return GaloisFieldDict::mul(a, b);
292 }

◆ operator+

template<typename T >
GaloisFieldDict operator+ ( const GaloisFieldDict a,
const T &  b 
)
friend

Definition at line 157 of file fields.h.

158 {
159 GaloisFieldDict c = a;
160 c += b;
161 return c;
162 }

◆ operator-

template<typename T >
GaloisFieldDict operator- ( const GaloisFieldDict a,
const T &  b 
)
friend

Definition at line 216 of file fields.h.

217 {
218 GaloisFieldDict c = a;
219 c -= b;
220 return c;
221 }

◆ operator/

template<class T >
GaloisFieldDict operator/ ( const GaloisFieldDict a,
const T &  b 
)
friend

Definition at line 346 of file fields.h.

347 {
348 GaloisFieldDict c = a;
349 c /= b;
350 return c;
351 }

Field Documentation

◆ dict_

std::vector<integer_class> SymEngine::GaloisFieldDict::dict_

Definition at line 18 of file fields.h.

◆ modulo_

integer_class SymEngine::GaloisFieldDict::modulo_

Definition at line 19 of file fields.h.


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