コード例 #1
0
 inline field_polynomial& field_polynomial::operator%=(const unsigned int& power)
 {
    if (poly_.size() >= power)
    {
       poly_.resize(power,field_element(field_,0));
       simplify(*this);
    }
    return *this;
 }
コード例 #2
0
 inline field_polynomial::field_polynomial(const field& gfield, const unsigned int& degree, field_element element[])
 : field_(const_cast<field&>(gfield))
 {
    poly_.reserve(256);
    if (element != NULL)
    {
       /*
          It is assumed that element is an array of field elements
          with size/element count of degree + 1.
       */
       for (unsigned int i = 0; i <= degree; ++i)
       {
          poly_.push_back(element[i]);
       }
    }
    else
       poly_.resize(degree + 1,field_element(field_,0));
 }
コード例 #3
0
      inline field_polynomial& field_polynomial::operator<<=(const unsigned int& n)
      {
         if (poly_.size() > 0)
         {
            size_t initial_size = poly_.size();
            poly_.resize(poly_.size() + n, field_element(field_,0));

            for (size_t i = initial_size - 1; static_cast<int>(i) >= 0; --i)
            {
               poly_[i + n] = poly_[i];
            }

            for (unsigned int i = 0; i < n; ++i)
            {
               poly_[i] = 0;
            }
         }
         return *this;
      }
コード例 #4
0
 inline void field_polynomial::set_degree(const unsigned int& x)
 {
    poly_.resize(x - 1,field_element(field_,0));
 }
コード例 #5
0
 inline field_polynomial::field_polynomial(const field& gfield, const unsigned int& degree)
 : field_(const_cast<field&>(gfield))
 {
    poly_.reserve(256);
    poly_.resize(degree + 1,field_element(field_,0));
 }
コード例 #6
0
	field_element operator*(const field_element &v) const { return field_element(*this) *= v; }