DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
DGtal::MPolynomial< n, TRing, TAlloc > Class Template Reference

#include <MPolynomial.h>

Inheritance diagram for DGtal::MPolynomial< n, TRing, TAlloc >:
Inheritance graph
[legend]
Collaboration diagram for DGtal::MPolynomial< n, TRing, TAlloc >:
Collaboration graph
[legend]

Public Types

typedef TRing Ring
typedef TAlloc Alloc
typedef MPolynomial< n-1, Ring,
Alloc
MPolyNM1
typedef IVector< MPolyNM1,
typename Alloc::template
rebind< MPolyNM1 >::other,(n > 
Storage
typedef Storage::Size Size

Public Member Functions

void normalize ()
 MPolynomial (const Alloc &allocator=Alloc())
 MPolynomial (const Ring &v, const Alloc &allocator=Alloc())
 MPolynomial (const MPolyNM1 &pdm1, const Alloc &allocator=Alloc())
template<typename Ring2 , typename Alloc2 >
 MPolynomial (const MPolynomial< n, Ring2, Alloc2 > &p, const Alloc &allocator=Alloc())
template<typename Ring2 , typename Alloc2 >
MPolynomialoperator= (const MPolynomial< n, Ring2, Alloc2 > &p)
void swap (MPolynomial &p)
Alloc getAllocator () const
int degree () const
const MPolyNM1leading () const
bool isZero () const
MPolyNM1operator[] (Size i)
const MPolyNM1operator[] (Size i) const
MPolynomialEvaluator< n, Ring,
Alloc, Ring
operator() (const Ring &x) const
template<typename Ring2 >
MPolynomialEvaluator< n, Ring,
Alloc, Ring2 > 
operator() (const Ring2 &x) const
MPolynomial operator* (const Ring &v) const
MPolynomial operator/ (const Ring &v) const
MPolynomialoperator*= (const MPolynomial &p)
MPolynomialoperator*= (const Ring &v)
MPolynomialoperator/= (const Ring &v)
MPolynomial operator- () const
MPolynomial operator+ (const MPolynomial &q) const
MPolynomial operator- (const MPolynomial &q) const
MPolynomialoperator+= (const MPolynomial &q)
MPolynomialoperator-= (const MPolynomial &q)
MPolynomial operator+ (const MPolyNM1 &q) const
MPolynomial operator- (const MPolyNM1 &q) const
MPolynomial operator+ (const Ring &v) const
MPolynomial operator- (const Ring &v) const
MPolynomialoperator+= (const MPolyNM1 &q)
MPolynomialoperator-= (const MPolyNM1 &q)
MPolynomialoperator+= (const Ring &v)
MPolynomialoperator-= (const Ring &v)
MPolynomial operator* (const MPolynomial &p) const
bool operator== (const MPolynomial &q) const
bool operator!= (const MPolynomial &q) const
bool operator== (const Ring &v) const
bool operator!= (const Ring &v) const
void selfDisplay (std::ostream &s, int N=n) const
bool isValid () const

Private Member Functions

 MPolynomial (bool, Size s, const Alloc &)

Private Attributes

Storage myValue

Static Private Attributes

static MPolyNM1 myZeroPolynomial

Friends

class MPolynomialDerivativeComputer
class MPolynomialEvaluator
class MPolynomialEvaluatorImpl
void euclidDiv (const MPolynomial< 1, TRing, TAlloc > &, const MPolynomial< 1, TRing, TAlloc > &, MPolynomial< 1, TRing, TAlloc > &, MPolynomial< 1, TRing, TAlloc > &)
MPolynomial operator* (const Ring &v, const MPolynomial &p)

Detailed Description

template<int n, typename TRing, class TAlloc>
class DGtal::MPolynomial< n, TRing, TAlloc >

Aim: Represents a multivariate polynomial, i.e. an element of \( K[X_0, ..., X_{n-1}] \), where K is some ring or field.

Description of template class 'MPolynomial'

Monomials are products of power of variables, like xy^2z^3. Polynomials in n variables are constructed recursively with polynomials in n - 1 variables.

There is a specialization for polynomials with no indeterminates, i.e. constants.

See also:
dgtal_multivariate_polynomial
Template Parameters:
nthe number of variables or indeterminates.
TRingthe type chosen for the polynomial, defines also the type of the coefficents (generally int, float or double).
TAllocis an allocator for TRing, for example std::allocator<TRing>; this is also the default parameter. Usually this parameter does not needs to be changed.

This class is a backport from Spielwiese.

Author:
Felix Fontein (felix.nosp@m.@fon.nosp@m.tein..nosp@m.de), University of Zurich, Switzerland
Examples:
math/polynomial-derivative.cpp, and math/polynomial2-derivative.cpp.

Definition at line 955 of file MPolynomial.h.


Member Typedef Documentation

template<int n, typename TRing, class TAlloc>
typedef TAlloc DGtal::MPolynomial< n, TRing, TAlloc >::Alloc

Definition at line 976 of file MPolynomial.h.

template<int n, typename TRing, class TAlloc>
typedef MPolynomial< n - 1, Ring, Alloc > DGtal::MPolynomial< n, TRing, TAlloc >::MPolyNM1

Definition at line 977 of file MPolynomial.h.

template<int n, typename TRing, class TAlloc>
typedef TRing DGtal::MPolynomial< n, TRing, TAlloc >::Ring

Definition at line 975 of file MPolynomial.h.

template<int n, typename TRing, class TAlloc>
typedef Storage::Size DGtal::MPolynomial< n, TRing, TAlloc >::Size

Definition at line 987 of file MPolynomial.h.

template<int n, typename TRing, class TAlloc>
typedef IVector< MPolyNM1, typename Alloc::template rebind<MPolyNM1 >::other, (n> DGtal::MPolynomial< n, TRing, TAlloc >::Storage

The type for the vector storing polynomials coefficients. For 0 or 1 variables, uses a standard vector, for more variables, uses a specific vector of pointers to polynomials, with adequate allocators. This is for efficiency purposes.

Definition at line 986 of file MPolynomial.h.


Constructor & Destructor Documentation

template<int n, typename TRing, class TAlloc>
DGtal::MPolynomial< n, TRing, TAlloc >::MPolynomial ( bool  ,
Size  s,
const Alloc  
)
inlineprivate
template<int n, typename TRing, class TAlloc>
DGtal::MPolynomial< n, TRing, TAlloc >::MPolynomial ( const Alloc allocator = Alloc())
inline

Constructs a zero polynomial

Definition at line 1036 of file MPolynomial.h.

: myValue( allocator )
{}
template<int n, typename TRing, class TAlloc>
DGtal::MPolynomial< n, TRing, TAlloc >::MPolynomial ( const Ring v,
const Alloc allocator = Alloc() 
)
inline

Constructs a constant polynomial with constant term v.

Definition at line 1043 of file MPolynomial.h.

: myValue( 1, MPolyNM1( v ), allocator )
{}
template<int n, typename TRing, class TAlloc>
DGtal::MPolynomial< n, TRing, TAlloc >::MPolynomial ( const MPolyNM1 pdm1,
const Alloc allocator = Alloc() 
)
inline

Constructs a polynomial of type MPolynomial<n, Ring> which is initialized with a polynomial of type MPolynomial<n-1, Ring>.

Definition at line 1051 of file MPolynomial.h.

: myValue( 1, pdm1 )
{}
template<int n, typename TRing, class TAlloc>
template<typename Ring2 , typename Alloc2 >
DGtal::MPolynomial< n, TRing, TAlloc >::MPolynomial ( const MPolynomial< n, Ring2, Alloc2 > &  p,
const Alloc allocator = Alloc() 
)
inline

Casts a polynomial of type MPolynomial<n, Ring2, Alloc2> to a polynomial of type MPolynomial<n, Ring, Alloc>.

Definition at line 1061 of file MPolynomial.h.

: myValue( p.degree() + 1, MPolyNM1(), allocator )
{
for ( Size i = 0; i < myValue.size(); ++i )
myValue[i] = p[i];
}

Member Function Documentation

template<int n, typename TRing, class TAlloc>
int DGtal::MPolynomial< n, TRing, TAlloc >::degree ( ) const
inline
template<int n, typename TRing, class TAlloc>
Alloc DGtal::MPolynomial< n, TRing, TAlloc >::getAllocator ( ) const
inline
template<int N, typename TRing , class TAlloc >
bool DGtal::MPolynomial< N, TRing, TAlloc >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Definition at line 61 of file MPolynomial.ih.

{
return true;
}
template<int n, typename TRing, class TAlloc>
bool DGtal::MPolynomial< n, TRing, TAlloc >::isZero ( ) const
inline

Tests whether this polynomial is the zero polynomial.

Definition at line 1128 of file MPolynomial.h.

Referenced by DGtal::gcd(), DGtal::MPolynomial< 3, Ring >::normalize(), DGtal::MPolynomial< 3, Ring >::operator*(), and DGtal::MPolynomial< 3, Ring >::selfDisplay().

{
return myValue.size() == 0;
}
template<int n, typename TRing, class TAlloc>
const MPolyNM1& DGtal::MPolynomial< n, TRing, TAlloc >::leading ( ) const
inline
Returns:
the leading term (of type MPolynomial<n-1, Ring>) of the first indeterminate. Returns 0 (of type MPolynomial<n-1, Ring>) in case of the zero polynomial.

Definition at line 1120 of file MPolynomial.h.

Referenced by DGtal::euclidDiv(), and DGtal::gcd().

{
}
template<int n, typename TRing, class TAlloc>
void DGtal::MPolynomial< n, TRing, TAlloc >::normalize ( )
inline
template<int n, typename TRing, class TAlloc>
bool DGtal::MPolynomial< n, TRing, TAlloc >::operator!= ( const MPolynomial< n, TRing, TAlloc > &  q) const
inline

Inequality operator.

Parameters:
qany polynomial of the same type as this.
Returns:
'true' iff this polynomial is different from q.

Definition at line 1496 of file MPolynomial.h.

{
return !(*this == q);
}
template<int n, typename TRing, class TAlloc>
bool DGtal::MPolynomial< n, TRing, TAlloc >::operator!= ( const Ring v) const
inline

Inequality operator with a constant.

Parameters:
vany value in the ring.
Returns:
'true' iff this polynomial is different from v.

Definition at line 1520 of file MPolynomial.h.

{
return !(*this == v);
}
template<int n, typename TRing, class TAlloc>
MPolynomialEvaluator<n, Ring, Alloc, Ring> DGtal::MPolynomial< n, TRing, TAlloc >::operator() ( const Ring x) const
inline

Evaluation in x.

Parameters:
xa value in the ring.
Returns:
a functor for performing this evaluation

Definition at line 1160 of file MPolynomial.h.

template<int n, typename TRing, class TAlloc>
template<typename Ring2 >
MPolynomialEvaluator<n, Ring, Alloc, Ring2> DGtal::MPolynomial< n, TRing, TAlloc >::operator() ( const Ring2 &  x) const
inline

Evaluation in x of type Ring2.

Template Parameters:
Ring2another ring (like a polynomial with less variables).
Parameters:
xa value in this ring.
Returns:
a functor for performing this evaluation

Definition at line 1174 of file MPolynomial.h.

template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator* ( const Ring v) const
inline

Multiply by constant.

Parameters:
vany value in the ring.
Returns:
the corresponding polynomial.

Definition at line 1187 of file MPolynomial.h.

{
MPolynomial r(*this);
for ( Size i = 0; i < myValue.size(); ++i )
r[i] *= v;
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator* ( const MPolynomial< n, TRing, TAlloc > &  p) const
inline

Multiplies the polynomial with another polynomial.

Parameters:
pany polynomial of the same type.
Returns:
the corresponding polynomial.
Todo:
Multiplication could be optimized for monovariate polynomials.

Definition at line 1458 of file MPolynomial.h.

{
int d = p.degree() + degree();
if (d < -1)
d = -1;
MPolynomial r( true, d + 1, getAllocator() );
if (!isZero() && !p.isZero())
for ( Size i = 0; i < r.myValue.size(); ++i )
for ( Size j = 0; j < myValue.size(); ++j )
if (i < j + p.myValue.size())
r[i] += myValue[j] * p[i - j];
r.normalize();
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator*= ( const MPolynomial< n, TRing, TAlloc > &  p)
inline

Self-multiplication by other polynomial.

Parameters:
pany polynomial of the same type.
Returns:
a reference to this.

Definition at line 1213 of file MPolynomial.h.

{
return *this = *this * p;
}
template<int n, typename TRing, class TAlloc>
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator*= ( const Ring v)
inline

Self-multiplication by a constant.

Parameters:
vany value in the ring.
Returns:
a reference to this.

Definition at line 1223 of file MPolynomial.h.

{
MPolynomial r( *this );
for ( Size i = 0; i < myValue.size(); ++i )
myValue[i] *= v;
return *this;
}
template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator+ ( const MPolynomial< n, TRing, TAlloc > &  q) const
inline

Computes the sum of two polynomials.

Parameters:
qany polynomial of this type.
Returns:
the corresponding polynomial.

Definition at line 1274 of file MPolynomial.h.

{
MPolynomial r(*this);
if (r.myValue.size() < q.myValue.size())
r.myValue.resize(q.myValue.size());
for ( Size i = 0; i < q.myValue.size(); ++i )
r[i] += q[i];
r.normalize();
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator+ ( const MPolyNM1 q) const
inline

Computes the sum of this polynomial with a polynomial with one less variable.

Parameters:
qany polynomial with n-1 indeterminates in the same ring.
Returns:
the corresponding polynomial.

Definition at line 1337 of file MPolynomial.h.

{
MPolynomial r(*this);
if (r.myValue.size() < 1)
r.myValue.resize(1);
r[0] += q;
r.normalize();
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator+ ( const Ring v) const
inline

Addition with a constant.

Parameters:
vany value in the ring.
Returns:
the corresponding polynomial.

Definition at line 1368 of file MPolynomial.h.

{
MPolynomial r(*this);
if (r.myValue.size() < 1)
r.myValue.resize(1);
r[0] += v;
r.normalize();
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator+= ( const MPolynomial< n, TRing, TAlloc > &  q)
inline

Adds q to this polynomial.

Parameters:
qany polynomial of this type.
Returns:
a reference to this.

Definition at line 1306 of file MPolynomial.h.

{
if (myValue.size() < q.myValue.size())
for ( Size i = 0; i < q.myValue.size(); ++i )
myValue[i] += q[i];
return *this;
}
template<int n, typename TRing, class TAlloc>
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator+= ( const MPolyNM1 q)
inline

Self-addition of this polynomial with a polynomial with one less variable.

Parameters:
qany polynomial with n-1 indeterminates in the same ring.
Returns:
a reference to this.

Definition at line 1399 of file MPolynomial.h.

{
if (myValue.size() < 1)
myValue[0] += q;
return *this;
}
template<int n, typename TRing, class TAlloc>
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator+= ( const Ring v)
inline

Self-addition of a constant.

Parameters:
vany value in the ring.
Returns:
a reference to this.

Definition at line 1428 of file MPolynomial.h.

{
if (myValue.size() < 1)
myValue[0] += v;
return *this;
}
template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator- ( ) const
inline
Returns:
the additive inverse of the polynomial.

Definition at line 1261 of file MPolynomial.h.

{
for ( Size i = 0; i < myValue.size(); ++i )
r[i] = -myValue[i];
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator- ( const MPolynomial< n, TRing, TAlloc > &  q) const
inline

Computes the difference of two polynomials.

Parameters:
qany polynomial of this type.
Returns:
the corresponding polynomial.

Definition at line 1290 of file MPolynomial.h.

{
MPolynomial r(*this);
if (r.myValue.size() < q.myValue.size())
r.myValue.resize(q.myValue.size());
for ( Size i = 0; i < q.myValue.size(); ++i )
r[i] -= q[i];
r.normalize();
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator- ( const MPolyNM1 q) const
inline

Computes the difference of this polynomial with a polynomial with one less variable.

Parameters:
qany polynomial with n-1 indeterminates in the same ring.
Returns:
the corresponding polynomial.

Definition at line 1353 of file MPolynomial.h.

{
MPolynomial r(*this);
if (r.myValue.size() < 1)
r.myValue.resize(1);
r[0] -= q;
r.normalize();
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator- ( const Ring v) const
inline

Difference to a constant.

Parameters:
vany value in the ring.
Returns:
the corresponding polynomial.

Definition at line 1383 of file MPolynomial.h.

{
MPolynomial r(*this);
if (r.myValue.size() < 1)
r.myValue.resize(1);
r[0] -= v;
r.normalize();
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator-= ( const MPolynomial< n, TRing, TAlloc > &  q)
inline

Subtracts q from this polynomial.

Parameters:
qany polynomial of this type.
Returns:
a reference to this.

Definition at line 1321 of file MPolynomial.h.

{
if (myValue.size() < q.myValue.size())
for ( Size i = 0; i < q.myValue.size(); ++i )
myValue[i] -= q[i];
return *this;
}
template<int n, typename TRing, class TAlloc>
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator-= ( const MPolyNM1 q)
inline

Self-subtraction of this polynomial with a polynomial with one less variable.

Parameters:
qany polynomial with n-1 indeterminates in the same ring.
Returns:
a reference to this.

Definition at line 1414 of file MPolynomial.h.

{
if (myValue.size() < 1)
myValue[0] -= q;
return *this;
}
template<int n, typename TRing, class TAlloc>
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator-= ( const Ring v)
inline

Self-subtraction of a constant.

Parameters:
vany value in the ring.
Returns:
a reference to this.

Definition at line 1442 of file MPolynomial.h.

{
if (myValue.size() < 1)
myValue[0] -= v;
return *this;
}
template<int n, typename TRing, class TAlloc>
MPolynomial DGtal::MPolynomial< n, TRing, TAlloc >::operator/ ( const Ring v) const
inline

Divide by constant.

Parameters:
vany value in the ring.
Returns:
the corresponding polynomial.

Definition at line 1200 of file MPolynomial.h.

{
MPolynomial r(*this);
for ( Size i = 0; i < myValue.size(); ++i )
r[i] /= v;
return r;
}
template<int n, typename TRing, class TAlloc>
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator/= ( const Ring v)
inline

Self-division by a constant.

Parameters:
vany value in the ring.
Returns:
a reference to this.

Definition at line 1236 of file MPolynomial.h.

{
for ( Size i = 0; i < myValue.size(); ++i )
myValue[i] /= v;
return *this;
}
template<int n, typename TRing, class TAlloc>
template<typename Ring2 , typename Alloc2 >
MPolynomial& DGtal::MPolynomial< n, TRing, TAlloc >::operator= ( const MPolynomial< n, Ring2, Alloc2 > &  p)
inline

Copies a polynomial of type MPolynomial<n, Ring2, Alloc2> to this polynomial (of type MPolynomial<n, Ring, Alloc>).

Definition at line 1077 of file MPolynomial.h.

{
myValue.resize(p.degree() + 1);
for ( Size i = 0; i < myValue.size(); ++i )
myValue[i] = p[i];
return *this;
}
template<int n, typename TRing, class TAlloc>
bool DGtal::MPolynomial< n, TRing, TAlloc >::operator== ( const MPolynomial< n, TRing, TAlloc > &  q) const
inline

Equality operator.

Parameters:
qany polynomial of the same type as this.
Returns:
'true' iff this polynomial is equal to q.

Definition at line 1481 of file MPolynomial.h.

{
if (myValue.size() != q.myValue.size())
return false;
for (Size i = 0; i < myValue.size(); ++i)
if (myValue[i] != q[i])
return false;
return true;
}
template<int n, typename TRing, class TAlloc>
bool DGtal::MPolynomial< n, TRing, TAlloc >::operator== ( const Ring v) const
inline

Equality operator with a constant.

Parameters:
vany value in the ring.
Returns:
'true' iff this polynomial is equal to v.

Definition at line 1506 of file MPolynomial.h.

{
if ((v == 0) && (myValue.size() == 0))
return true;
if (myValue.size() != 1)
return false;
return myValue[0] == v;
}
template<int n, typename TRing, class TAlloc>
MPolyNM1& DGtal::MPolynomial< n, TRing, TAlloc >::operator[] ( Size  i)
inline
Returns:
a reference to the i-th coefficient. If i > degree(), the array myValue is enlarged. Afterwards, one should better call normalize() to make sure future operations are correct.

Definition at line 1138 of file MPolynomial.h.

{
if (i >= myValue.size())
myValue.resize(i + 1);
return myValue[i];
}
template<int n, typename TRing, class TAlloc>
const MPolyNM1& DGtal::MPolynomial< n, TRing, TAlloc >::operator[] ( Size  i) const
inline
Returns:
a reference to the i-th coefficient, or zero if i > degree().

Definition at line 1148 of file MPolynomial.h.

{
return i < myValue.size() ? myValue[i] : myZeroPolynomial;
}
template<int n, typename TRing, class TAlloc>
void DGtal::MPolynomial< n, TRing, TAlloc >::selfDisplay ( std::ostream &  s,
int  N = n 
) const
inline

Prints this polynomial to the stream s. N gives the number of variables; this is needed for recursive printing.

Parameters:
sthe output stream where the object is written.

Definition at line 1536 of file MPolynomial.h.

{
if (isZero())
s << (Ring) 0;
else
{
Size nonzero = 0;
for (Size i = 0; i < myValue.size(); ++i)
if (!myValue[i].isZero())
++nonzero;
if (nonzero > 1) s << "(";
bool first = true;
for (Size i = 0; i < myValue.size(); ++i)
if (!myValue[i].isZero())
{
if (first) first = false;
else s << " + ";
myValue[i].selfDisplay(s, N);
if (i > 0)
{
s << " ";
s << "X_" << N - n;
if (i > 1) s << "^" << i;
}
}
if (nonzero > 1)
s << ")";
}
}
template<int n, typename TRing, class TAlloc>
void DGtal::MPolynomial< n, TRing, TAlloc >::swap ( MPolynomial< n, TRing, TAlloc > &  p)
inline

Swaps two polynomials.

Parameters:
pthe polynomial to exchange with.

Definition at line 1090 of file MPolynomial.h.

Referenced by DGtal::MPolynomial< 0, TRing, TAlloc >::swap().

{
}

Friends And Related Function Documentation

template<int n, typename TRing, class TAlloc>
void euclidDiv ( const MPolynomial< 1, TRing, TAlloc > &  ,
const MPolynomial< 1, TRing, TAlloc > &  ,
MPolynomial< 1, TRing, TAlloc > &  ,
MPolynomial< 1, TRing, TAlloc > &   
)
friend

Forward declaration, to be able to declare this as a friend.

template<int n, typename TRing, class TAlloc>
friend class MPolynomialDerivativeComputer
friend

Definition at line 960 of file MPolynomial.h.

template<int n, typename TRing, class TAlloc>
friend class MPolynomialEvaluator
friend

Definition at line 969 of file MPolynomial.h.

template<int n, typename TRing, class TAlloc>
friend class MPolynomialEvaluatorImpl
friend

Definition at line 972 of file MPolynomial.h.

template<int n, typename TRing, class TAlloc>
MPolynomial operator* ( const Ring v,
const MPolynomial< n, TRing, TAlloc > &  p 
)
friend

Multiplication by a constant from the left.

Parameters:
vany value in the ring.
pany polynomial of this type.
Returns:
the corresponding polynomial.

Definition at line 1250 of file MPolynomial.h.

{
for ( Size i = 0; i < p.myValue.size(); ++i )
r[i] *= v;
return r;
}

Field Documentation

template<int n, typename TRing, class TAlloc>
Storage DGtal::MPolynomial< n, TRing, TAlloc >::myValue
private

The vector storing polynomials coefficients. For 0 or 1 variables, uses a standard vector, for more variables, uses a specific vector of pointers to polynomials, with adequate allocators. This is for efficiency purposes.

Definition at line 999 of file MPolynomial.h.

Referenced by DGtal::MPolynomialDerivativeComputer< 0, n, Ring, Alloc >::computeDerivative(), DGtal::MPolynomialDerivativeComputer< N, n, Ring, Alloc >::computeDerivative(), DGtal::MPolynomial< 3, Ring >::degree(), DGtal::MPolynomialEvaluator< n, TRing, TAlloc, TX >::evaluate(), DGtal::MPolynomial< 3, Ring >::getAllocator(), DGtal::MPolynomial< 0, TRing, TAlloc >::isZero(), DGtal::MPolynomial< 3, Ring >::isZero(), DGtal::MPolynomial< 3, Ring >::leading(), DGtal::MPolynomial< 3, Ring >::MPolynomial(), DGtal::MPolynomial< 3, Ring >::normalize(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator const Ring &(), DGtal::MPolynomialEvaluator< n, TRing, TAlloc, TX >::operator MPolyNM1(), DGtal::MPolynomialEvaluator< 1, TRing, TAlloc, TX >::operator X(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator!=(), DGtal::MPolynomialEvaluatorImpl< 1, TRing, TOwner, TAlloc, TX >::EvalFun::operator()(), DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun< XX, Fun >::operator()(), DGtal::MPolynomialEvaluatorImpl< n, TRing, TOwner, TAlloc, TX >::EvalFun2::operator()(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator()(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator*(), DGtal::MPolynomial< 3, Ring >::operator*(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator*=(), DGtal::MPolynomial< 3, Ring >::operator*=(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator+(), DGtal::MPolynomial< 3, Ring >::operator+(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator+=(), DGtal::MPolynomial< 3, Ring >::operator+=(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator-(), DGtal::MPolynomial< 3, Ring >::operator-(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator-=(), DGtal::MPolynomial< 3, Ring >::operator-=(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator/(), DGtal::MPolynomial< 3, Ring >::operator/(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator/=(), DGtal::MPolynomial< 3, Ring >::operator/=(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator=(), DGtal::MPolynomial< 3, Ring >::operator=(), DGtal::MPolynomial< 0, TRing, TAlloc >::operator==(), DGtal::MPolynomial< 3, Ring >::operator==(), DGtal::MPolynomial< 3, Ring >::operator[](), DGtal::MPolynomial< 0, TRing, TAlloc >::selfDisplay(), DGtal::MPolynomial< 3, Ring >::selfDisplay(), DGtal::MPolynomial< 0, TRing, TAlloc >::swap(), and DGtal::MPolynomial< 3, Ring >::swap().

template<int n, typename TRing, class TAlloc>
MPolynomial< n-1, Ring, Alloc > MPolynomial::myZeroPolynomial
staticprivate

The zero polynomial of n-1 variables for a n-multivariate polynomial.

Definition at line 992 of file MPolynomial.h.

Referenced by DGtal::MPolynomial< 3, Ring >::leading(), and DGtal::MPolynomial< 3, Ring >::operator[]().


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