MCPcopy Create free account
hub / github.com/bgrimstad/splinter / setupTestFunctions

Function setupTestFunctions

test/testfunctions.cpp:23–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23void setupTestFunctions() {
24 // f_x_y: function of x variables and y degrees
25
26 // Functions of one variable
27 DenseMatrix powers;
28
29 powers = DenseMatrix::Zero(1, 1);
30 powers <<
31 0;
32 auto f_1_0 = MAKE_CONSTDEGREE_TESTFUNCTION(-13.37, 1, "-13.37", powers);
33
34 powers = DenseMatrix::Zero(2, 1);
35 powers <<
36 1,
37 0;
38 auto f_1_1 = MAKE_CONSTDEGREE_TESTFUNCTION(-5.1*x.at(0) + 13.37, 1, "-5.1*x + 13.37", powers);
39
40 powers = DenseMatrix::Zero(3, 1);
41 powers <<
42 2,
43 1,
44 0;
45 auto f_1_2 = MAKE_CONSTDEGREE_TESTFUNCTION(8.1*x.at(0)*x.at(0) - 0.2*x.at(0) + 2313.1, 1, "8.1*x^2 - 0.2*x + 2313.1", powers);
46
47 powers = DenseMatrix::Zero(2, 1);
48 powers <<
49 3,
50 2;
51 auto f_1_3 = MAKE_CONSTDEGREE_TESTFUNCTION(-4.5*x.at(0)*x.at(0)*x.at(0) + 2.2*x.at(0)*x.at(0), 1, "-4.5*x^3 + 2.2*x^2", powers);
52
53 powers = DenseMatrix::Zero(3, 1);
54 powers <<
55 4,
56 3,
57 1;
58 auto f_1_4 = MAKE_CONSTDEGREE_TESTFUNCTION(4.5*x.at(0)*x.at(0)*x.at(0)*x.at(0) + 3*x.at(0)*x.at(0)*x.at(0) - x.at(0), 1, "4.5*x^4 + x^3 - x^2", powers);
59
60 // Functions of two variables
61 powers = DenseMatrix::Zero(1, 2);
62 powers <<
63 0, 0;
64 auto f_2_0 = MAKE_CONSTDEGREE_TESTFUNCTION(0.1, 2, "0.1", powers);
65
66 powers = DenseMatrix::Zero(2, 2);
67 powers <<
68 1, 0,
69 0, 1;
70 auto f_2_1 = MAKE_CONSTDEGREE_TESTFUNCTION(- 5.1*x.at(0) + 13.37*x.at(1), 2, "-5.1*x + 13.37*y", powers);
71
72 powers = DenseMatrix::Zero(3, 2);
73 powers <<
74 2, 0,
75 1, 1,
76 0, 2;
77 auto f_2_2 = MAKE_CONSTDEGREE_TESTFUNCTION(8.1*x.at(0)*x.at(0) - 0.2*x.at(0)*x.at(1) + 13.37*x.at(1)*x.at(1), 2, "8.1*x^2 - 0.2*x*y + 13.37*y^2", powers);
78
79 powers = DenseMatrix::Zero(4, 2);
80 powers <<

Callers 1

mainFunction · 0.85

Calls 1

logFunction · 0.85

Tested by

no test coverage detected