polynomial< C, V > Class Template Reference

#include <polynomial.hpp>

List of all members.

Public Member Functions

Static Public Member Functions

Friends


Detailed Description

template<typename C, typename V = typename polynomial_variant_helper< C >::PV>
class mmx::polynomial< C, V >

Definition at line 89 of file polynomial.hpp.


Constructor & Destructor Documentation

polynomial (  )  [inline]

Definition at line 102 of file polynomial.hpp.

00102                        {
00103     nat l= aligned_size<C,V> (0);
00104     rep= new Polynomial_rep (mmx_new<C> (l), 0, l, Format (no_format ()));
00105   }

polynomial ( const format< C > &  fm  )  [inline]

Definition at line 107 of file polynomial.hpp.

00107                                        {
00108     nat l= aligned_size<C,V> (0);
00109     rep= new Polynomial_rep (mmx_new<C> (l), 0, l, fm);
00110   }

polynomial ( const T &  x  )  [inline]

Definition at line 111 of file polynomial.hpp.

00111                                                       {
00112     nat l= aligned_size<C,V> (1);
00113     C c= as<C> (x);
00114     C* a= mmx_formatted_new<C> (l, get_format (c));
00115     a[0]= c;
00116     rep= new Polynomial_rep (a, 1, l, get_format (c));
00117     rep->normalize ();
00118   }

polynomial ( const polynomial< T, V > &  P  )  [inline]

Definition at line 121 of file polynomial.hpp.

00121                                         {
00122     Format fm= as<Format > (CF(P));
00123     nat l= aligned_size<C,V> (N(P));
00124     C* a= mmx_formatted_new<C> (l, fm);
00125     Pol::cast (a, seg (P), N(P));
00126     rep= new Polynomial_rep (a, N(P), l, fm);
00127     rep->normalize ();
00128   }

polynomial ( const polynomial< T, V > &  P,
const format< C > &  fm 
) [inline]

Definition at line 131 of file polynomial.hpp.

00131                                                           {
00132     nat l= aligned_size<C,V> (N(P));
00133     C* a= mmx_formatted_new<C> (l, fm);
00134     Pol::cast (a, seg (P), N(P));
00135     rep= new Polynomial_rep (a, N(P), l, fm);
00136     rep->normalize ();
00137   }

polynomial ( const C x,
nat  n 
) [inline]

Definition at line 138 of file polynomial.hpp.

00138                                  {
00139     nat l= aligned_size<C,V> (n+1);
00140     C* a= mmx_formatted_new<C> (l, get_format (x));
00141     Pol::clear (a, n);
00142     a[n]= x;
00143     rep= new Polynomial_rep (a, n+1, l, get_format (x));
00144     rep->normalize ();
00145   }

polynomial ( C a,
nat  n,
const format< C > &  fm 
) [inline]

Definition at line 146 of file polynomial.hpp.

00146                                                     {
00147     rep= new Polynomial_rep (a, n, fm);
00148   }

polynomial ( C a,
nat  n,
nat  l,
const format< C > &  fm 
) [inline]

Definition at line 149 of file polynomial.hpp.

00149                                                            {
00150     rep= new Polynomial_rep (a, n, l, fm);
00151   }

polynomial ( const vector< C > &  v  )  [inline]

Definition at line 152 of file polynomial.hpp.

00152                                   {
00153     nat l= aligned_size<C,V> (N(v));
00154     C* a= mmx_formatted_new<C> (l, CF(v));
00155     Pol::copy (a, seg (v), N(v));
00156     rep= new Polynomial_rep (a, N(v), l, CF(v));
00157     rep->normalize ();
00158   }

polynomial ( const iterator< C > &  it  )  [inline]

Definition at line 159 of file polynomial.hpp.

00159                                      {
00160     nat i, l=0;
00161     nat s= aligned_size<C,V> (0);
00162     C* a= mmx_formatted_new<C> (s, CF(it));
00163     rep= new Polynomial_rep (a, 0, s, CF(it));
00164     for (i=0; busy (it); i++, ++it) {
00165       if (i >= l) {
00166         l= max ((nat) 1, l<<1);
00167         rep->extend (l);
00168       }
00169       rep->a[i]= *it;
00170     }
00171     rep->normalize ();
00172   }


Member Function Documentation

static generic get_variable_name (  )  [inline, static]

Definition at line 96 of file polynomial.hpp.

Referenced by mmx::flatten(), and polynomial< L >::get_variable_name().

00096                                              {
00097     return S::get_variable_name (); }

polynomial< C, V > & operator*= ( const C c  )  [inline]

Definition at line 431 of file polynomial.hpp.

00431                                    {
00432   typedef implementation<polynomial_linear,V> Pol;
00433   secure ();
00434   Pol::mul_sc (rep->a, c, rep->n);
00435   rep->normalize ();
00436   return *this;
00437 }

polynomial< C, V > C polynomial< C, V > C V polynomial< C, V > & operator+= ( const polynomial< C, V > &  P  ) 

Definition at line 409 of file polynomial.hpp.

References mmx::extend(), mmx::N(), mmx::normalize(), and mmx::seg().

00409                                             {
00410   typedef implementation<polynomial_linear,V> Pol;
00411   secure ();
00412   nat n1= rep->n, n2= N(P);
00413   if (n1 < n2) rep -> extend (n2);
00414   Pol::add (rep->a, seg (P), n2);
00415   if (n1 == n2) rep -> normalize ();
00416   return *this;
00417 }

polynomial< C, V > & operator-= ( const polynomial< C, V > &  P  )  [inline]

Definition at line 420 of file polynomial.hpp.

References mmx::N(), and mmx::seg().

00420                                             {
00421   typedef implementation<polynomial_linear,V> Pol;
00422   secure ();
00423   nat n1= rep->n, n2= N(P);
00424   if (n1 < n2) rep->extend (n2);
00425   Pol::sub (rep->a, seg (P), n2);
00426   if (n1 == n2) rep->normalize ();
00427   return *this;
00428 }

polynomial< C, V > & operator/= ( const C c  )  [inline]

Definition at line 440 of file polynomial.hpp.

00440                                    {
00441   typedef implementation<polynomial_linear,V> Pol;
00442   secure ();
00443   Pol::div_sc (rep->a, c, rep->n);
00444   rep->normalize ();
00445   return *this;
00446 }

C operator[] ( nat  i  )  const [inline]

Definition at line 179 of file polynomial.hpp.

00179                                     {
00180     return i<rep->n? rep->a[i]: promote (0, CF(*this)); }

static void set_variable_name ( const generic &  x  )  [inline, static]

Definition at line 98 of file polynomial.hpp.

Referenced by polynomial< L >::set_variable_name().

00098                                                           {
00099     S::set_variable_name (x); }


Friends And Related Function Documentation

polynomial<C,V> copy ( const polynomial< C, V > &  P  )  [friend]

Definition at line 173 of file polynomial.hpp.

Referenced by polynomial< L >::polynomial().

00173                                                       {
00174     nat n= N(P), l= aligned_size<C,V> (n);
00175     C* r= mmx_formatted_new<C> (l, CF(P));
00176     Pol::copy (r, seg (P), n);
00177     return Polynomial (r, n, l, CF(P));
00178   }


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

Generated on 6 Dec 2012 for algebramix by  doxygen 1.6.1