DGtal  1.5.beta
DGtal::MPolynomialDerivativeComputer< 0, n, Ring, Alloc > Class Template Reference

#include <DGtal/math/MPolynomial.h>

Public Types

typedef MPolynomial< n, Ring, Alloc > MPolyN
 Type for polynomial with n variable in the ring Ring. More...
 

Static Public Member Functions

static void computeDerivative (const MPolyN &src, MPolyN &dest)
 

Detailed Description

template<int n, typename Ring, class Alloc>
class DGtal::MPolynomialDerivativeComputer< 0, n, Ring, Alloc >

Utility class for computing the derivative of a given polynomial with respect to the first indeterminate. The coefficients of the first indeterminate are left untouched.

Specialization of MPolynomialDerivativeComputer to the first indeterminate.

Template Parameters
nthe number of variables or indeterminates.
Ringthe type chosen for the polynomial, defines also the type of the coefficents (generally int, float or double).
Allocis 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.

Definition at line 1852 of file MPolynomial.h.

Member Typedef Documentation

◆ MPolyN

template<int n, typename Ring , class Alloc >
typedef MPolynomial<n, Ring, Alloc> DGtal::MPolynomialDerivativeComputer< 0, n, Ring, Alloc >::MPolyN

Type for polynomial with n variable in the ring Ring.

Definition at line 1856 of file MPolynomial.h.

Member Function Documentation

◆ computeDerivative()

template<int n, typename Ring , class Alloc >
static void DGtal::MPolynomialDerivativeComputer< 0, n, Ring, Alloc >::computeDerivative ( const MPolyN src,
MPolyN dest 
)
inlinestatic

Computes the derivative of src with respect to X_0 and puts it in dest.

Parameters
srcany polynomial
dest(returns) the polynomial d/dX_0(src).

Definition at line 1866 of file MPolynomial.h.

1867  {
1868  dest.myValue.resize(src.degree() >= 0 ? src.degree() : 0);
1869  for ( int i = 1; i <= src.degree(); ++i )
1870  dest[i - 1] = src[i] * (Ring)i;
1871  dest.normalize();
1872  }

References DGtal::MPolynomial< n, TRing, TAlloc >::myValue, DGtal::MPolynomial< n, TRing, TAlloc >::normalize(), and DGtal::IVector< T, TAlloc, usePointers >::resize().


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