Home
Install
Use
Develop
Support
News
Credits
hosted by
|
11 #ifndef __MEAL_UnaryConvert_H
12 #define __MEAL_UnaryConvert_H
14 #include "MEAL/Convert.h"
23 template< typename From, typename To, typename Method>
24 class UnaryConvert : public Convert<From,To>
33 { return "UnaryConvert<" + std::string(From::Name)
34 + "," + std::string(To::Name)+ ">"; }
39 virtual void calculate ( typename To::Result& result,
40 std::vector<typename To::Result>* grad)
42 std::vector<typename From::Result> from_grad;
43 typename From::Result from_result;
45 from_result = this-> get_model()->evaluate( (grad) ? &from_grad : 0 );
46 result = method (from_result);
50 for ( unsigned i=0; i<this->get_nparam(); i++)
51 (*grad)[i] = method (from_grad[i]);
58 template< typename T, typename M>
59 UnaryConvert<T,T,M>* convert (T* function, M method)
61 UnaryConvert<T,T,M>* result = new UnaryConvert<T,T,M> (method);
62 result->set_model ( function);
67 T* convert (T* function,
68 typename T::Result (*method) ( const typename T::Result&))
70 typedef typename T::Result (*M) ( const typename T::Result&);
72 result->set_model ( function);
std::string get_name() const Return the name of the class. Definition: UnaryConvert.h:42
Method method The Unary function used to complete the conversion. Definition: UnaryConvert.h:65
Namespace in which all modeling and calibration related code is declared. Definition: ExampleComplex2.h:16
virtual void calculate(typename To::Result &result, std::vector< typename To::Result > *grad) Calculate the Mueller matrix and its gradient. Definition: UnaryConvert.h:49
Convert a function to another type using a unary function. Definition: UnaryConvert.h:29
From * get_model() Get the function to be converted. Definition: Convert.h:42
Generated using doxygen 1.8.17
|