Go to the source code of this file.
§ testDifferenceQuotient()
void testDifferenceQuotient |
( |
| ) |
|
Definition at line 38 of file ParametrizedFunctionTest.cpp.
References epsilon, os_, unit_assert_matrices_equal, and x.
Referenced by main().
40 if (
os_) *
os_ <<
"****************************************************\n";
41 if (
os_) *
os_ <<
"testDifferenceQuotient()\n";
43 using namespace DerivativeTest;
45 class TestFunction :
public VectorFunction<double>
51 virtual unsigned int argumentCount()
const {
return 2;}
52 virtual unsigned int valueCount()
const {
return 3;}
54 virtual ublas::vector<double> operator()(ublas::vector<double>
x)
const 56 if (x.size() != argumentCount())
57 throw logic_error(
"[TestFunction::()] Wrong argument count.");
59 ublas::vector<double> result(3);
60 result(0) =
x(0)*
x(0);
61 result(1) =
x(0)*
x(1);
62 result(2) =
x(1)*
x(1);
69 ublas::vector<double> args(2);
70 args(0) = 5; args(1) = 7;
71 if (
os_) *
os_ <<
"f(5,7): " << f(args) << endl;
73 if (
os_) f.printDifferenceQuotientSequence(args, *
os_);
78 ublas::matrix<double> d(2,3);
86 const double delta = 1e-9;
KernelTraitsBase< Kernel >::space_type::abscissa_type x
#define unit_assert_matrices_equal(A, B, epsilon)
§ testDerivatives()
Definition at line 160 of file ParametrizedFunctionTest.cpp.
References os_.
Referenced by main().
162 if (
os_) *
os_ <<
"****************************************************\n";
163 if (
os_) *
os_ <<
"testDerivatives()\n";
167 ublas::vector<double> p(2);
171 for (
int i=0; i<8; i++)
§ testErrorFunction()
void testErrorFunction |
( |
| ) |
|
Definition at line 176 of file ParametrizedFunctionTest.cpp.
References os_.
Referenced by main().
178 if (
os_) *
os_ <<
"****************************************************\n";
179 if (
os_) *
os_ <<
"testErrorFunction()\n";
183 ublas::vector<double> p(2);
187 ParametrizedCosine::ErrorFunction::Data data;
188 typedef ParametrizedCosine::ErrorFunction::Datum
Datum;
189 data.push_back(Datum(0,3));
190 data.push_back(Datum(M_PI/2,0));
192 ParametrizedCosine::ErrorFunction e(f, data);
193 if (
os_) *
os_ <<
"error: " << e(p) << endl;
195 DerivativeTest::testDerivatives<double>(e, p,
os_);
197 if (
os_) *
os_ <<
"8*pi^2: " << 8*M_PI*M_PI << endl;
§ testErrorLorentzian()
void testErrorLorentzian |
( |
| ) |
|
Definition at line 201 of file ParametrizedFunctionTest.cpp.
References AlphaI, AlphaR, os_, and Tau.
Referenced by main().
203 if (
os_) *
os_ <<
"****************************************************\n";
204 if (
os_) *
os_ <<
"testErrorLorentzian()\n";
208 ublas::vector<double> p(4);
212 p(TruncatedLorentzian::F0) = 0;
214 TruncatedLorentzian::ErrorFunction::Data data;
215 typedef TruncatedLorentzian::ErrorFunction::Datum
Datum;
216 data.push_back(Datum(0,3));
217 data.push_back(Datum(M_PI/2,0));
219 TruncatedLorentzian::ErrorFunction e(f, data);
220 if (
os_) *
os_ <<
"error: " << e(p) << endl;
222 DerivativeTest::testDerivatives< complex<double> >(e, p,
os_);
§ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
§ os_