DGtal  0.9.4beta
Public Member Functions | Static Public Member Functions
DerivativeTester< Calculus, order > Struct Template Reference

#include </home/travis/build/DGtal-team/DGtal/tests/dec/DECCommon.h>

Public Member Functions

 BOOST_STATIC_ASSERT ((order< (int) Calculus::dimensionEmbedded-1))
 

Static Public Member Functions

static bool test (const Calculus &calculus)
 

Detailed Description

template<typename Calculus, int order>
struct DerivativeTester< Calculus, order >

Definition at line 196 of file DECCommon.h.

Member Function Documentation

template<typename Calculus , int order>
DerivativeTester< Calculus, order >::BOOST_STATIC_ASSERT ( (order< (int) Calculus::dimensionEmbedded-1)  )
template<typename Calculus , int order>
static bool DerivativeTester< Calculus, order >::test ( const Calculus &  calculus)
inlinestatic

Definition at line 200 of file DECCommon.h.

References DGtal::Trace::info(), and DGtal::trace.

201  {
202  DGtal::trace.info() << "testing primal derivative composition order " << order << std::endl;
203 
204  { // test primal composition
206  FirstDerivative first_derivative = calculus.template derivative<order, DGtal::PRIMAL>();
208  SecondDerivative second_derivative = calculus.template derivative<order+1, DGtal::PRIMAL>();
210  DoubleDerivative double_derivative = second_derivative * first_derivative;
211  if (!is_all_zero(double_derivative.myContainer)) return false;
212  }
213 
214  DGtal::trace.info() << "testing dual derivative composition order " << order << std::endl;
215 
216  { // test dual composition
218  FirstDerivative first_derivative = calculus.template derivative<order, DGtal::DUAL>();
220  SecondDerivative second_derivative = calculus.template derivative<order+1, DGtal::DUAL>();
222  DoubleDerivative double_derivative = second_derivative * first_derivative;
223  if (!is_all_zero(double_derivative.myContainer)) return false;
224  }
225 
226  /*
227  DGtal::trace.info() << "testing liebnitz rule order " << order << std::endl;
228 
229  {
230  typedef DGtal::LinearOperator<Calculus, order, DGtal::PRIMAL, order+1, DGtal::PRIMAL> Derivative;
231  Derivative derivative = calculus.template derivative<order, DGtal::PRIMAL>();
232 
233  typedef DGtal::KForm<Calculus, order, DGtal::PRIMAL> InputForm;
234  typedef DGtal::KForm<Calculus, order+1, DGtal::PRIMAL> OutputForm;
235  InputForm alpha(calculus), beta(calculus), gamma(calculus);
236 
237  for (int kk=0; kk<calculus.kFormLength(order, DGtal::PRIMAL); kk++)
238  {
239  const double ak = static_cast<double>(random())/RAND_MAX;
240  const double bk = static_cast<double>(random())/RAND_MAX;
241  alpha.myContainer(kk) = ak;
242  beta.myContainer(kk) = bk;
243  gamma.myContainer(kk) = ak*bk;
244  }
245 
246  }
247  */
248 
250  }
Trace trace
Definition: Common.h:137
Aim: LinearOperator represents discrete linear operator between discrete kforms in the DEC package...
std::ostream & info()
static bool test(const Calculus &calculus)
Definition: DECCommon.h:200

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