Skip to content

Commit

Permalink
Update the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi committed Oct 22, 2024
1 parent c479267 commit 688c9ab
Show file tree
Hide file tree
Showing 8 changed files with 361 additions and 610 deletions.
54 changes: 20 additions & 34 deletions test/Jacobian/FunctionCalls.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,25 @@
#include <cmath>
#include "clad/Differentiator/Differentiator.h"

double outputs[4], results[4];
double outputs[4];
clad::matrix<double> results(2, 2);

void fn1(double i, double j, double* output) {
output[0] = std::pow(i, j);
output[1] = std::pow(j, i);
}

// CHECK: void fn1_jac(double i, double j, double *output, double *jacobianMatrix) {
// CHECK-NEXT: double _t0 = output[0];
// CHECK-NEXT: output[0] = std::pow(i, j);
// CHECK-NEXT: double _t1 = output[1];
// CHECK-NEXT: output[1] = std::pow(j, i);
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: double _r2 = 0.;
// CHECK-NEXT: double _r3 = 0.;
// CHECK-NEXT: clad::custom_derivatives::pow_pullback(j, i, 1, &_r2, &_r3);
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += _r2;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL|2ULL}}] += _r3;
// CHECK-NEXT: }
// CHECK-NEXT: output[1] = _t1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: double _r0 = 0.;
// CHECK-NEXT: double _r1 = 0.;
// CHECK-NEXT: clad::custom_derivatives::pow_pullback(i, j, 1, &_r0, &_r1);
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += _r0;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL|1ULL}}] += _r1;
// CHECK-NEXT: }
// CHECK-NEXT: output[0] = _t0;
// CHECK-NEXT: }
// CHECK: void fn1_jac(double i, double j, double *output, clad::array_ref<clad::matrix<double> > _d_vector_output) {
// CHECK-NEXT: unsigned long indepVarCount = * _d_vector_output.rows() + {{2U|2UL|2ULL}};
// CHECK-NEXT: clad::array<double> _d_vector_i = clad::one_hot_vector(indepVarCount, {{0U|0UL|0ULL}});
// CHECK-NEXT: clad::array<double> _d_vector_j = clad::one_hot_vector(indepVarCount, {{1U|1UL|1ULL}});
// CHECK-NEXT: * _d_vector_output = clad::identity_matrix(* _d_vector_output.rows(), indepVarCount, {{2U|2UL|2ULL}});
// CHECK-NEXT: {{.*}} _t0 = clad::custom_derivatives::pow_pushforward(i, j, _d_vector_i, _d_vector_j);
// CHECK-NEXT: * _d_vector_output[0] = _t0.pushforward;
// CHECK-NEXT: output[0] = _t0.value;
// CHECK-NEXT: {{.*}} _t1 = clad::custom_derivatives::pow_pushforward(j, i, _d_vector_j, _d_vector_i);
// CHECK-NEXT: * _d_vector_output[1] = _t1.pushforward;
// CHECK-NEXT: output[1] = _t1.value;
// CHECK-NEXT: }

#define INIT(F) auto d_##F = clad::jacobian(F);
Expand All @@ -47,17 +34,16 @@ void fn1(double i, double j, double* output) {
template <unsigned numOfOutputs, typename Fn, typename... Args>
void test(Fn derivedFn, Args... args) {
unsigned numOfParameters = sizeof...(args);
unsigned numOfResults = numOfOutputs * numOfParameters;
for (unsigned i = 0; i < numOfOutputs; ++i)
outputs[i] = 0;
for (unsigned i = 0; i < numOfResults; ++i)
results[i] = 0;
derivedFn.execute(args..., outputs, results);
derivedFn.execute(args..., outputs, &results);
printf("{");
for (unsigned i = 0; i < numOfResults; ++i) {
printf("%.2f", results[i]);
if (i != numOfResults - 1)
printf(", ");
for (unsigned i = 0; i < numOfOutputs; ++i) {
for (unsigned j = 0; j < numOfParameters; ++j) {
printf("%.2f", results[i][j]);
if (i != numOfOutputs - 1 || j != numOfParameters - 1)
printf(", ");
}
}
printf("}\n");
}
Expand Down
299 changes: 118 additions & 181 deletions test/Jacobian/Functors.C

Large diffs are not rendered by default.

273 changes: 89 additions & 184 deletions test/Jacobian/Jacobian.C

Large diffs are not rendered by default.

26 changes: 11 additions & 15 deletions test/Jacobian/Pointers.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,27 @@ void nonMemFn(double i, double j, double* out) {
out[1] = j;
}

// CHECK: void nonMemFn_jac(double i, double j, double *out, double *jacobianMatrix) {
// CHECK-NEXT: double _t0 = out[0];
// CHECK: void nonMemFn_jac(double i, double j, double *out, clad::array_ref<clad::matrix<double> > _d_vector_out) {
// CHECK-NEXT: unsigned long indepVarCount = * _d_vector_out.rows() + {{2U|2UL|2ULL}};
// CHECK-NEXT: clad::array<double> _d_vector_i = clad::one_hot_vector(indepVarCount, {{0U|0UL|0ULL}});
// CHECK-NEXT: clad::array<double> _d_vector_j = clad::one_hot_vector(indepVarCount, {{1U|1UL|1ULL}});
// CHECK-NEXT: * _d_vector_out = clad::identity_matrix(* _d_vector_out.rows(), indepVarCount, {{2U|2UL|2ULL}});
// CHECK-NEXT: * _d_vector_out[0] = _d_vector_i;
// CHECK-NEXT: out[0] = i;
// CHECK-NEXT: double _t1 = out[1];
// CHECK-NEXT: * _d_vector_out[1] = _d_vector_j;
// CHECK-NEXT: out[1] = j;
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += 1;
// CHECK-NEXT: out[1] = _t1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += 1;
// CHECK-NEXT: out[0] = _t0;
// CHECK-NEXT: }
// CHECK-NEXT: }

#define NON_MEM_FN_TEST(var)\
res[0]=res[1]=res[2]=res[3]=0;\
var.execute(5, 7, out, res);\
printf("{%.2f %.2f %.2f %.2f}\n", res[0], res[1], res[2], res[3]);
var.execute(5, 7, out, &res);\
printf("{%.2f %.2f %.2f %.2f}\n", res[0][0], res[0][1],\
res[1][0], res[1][1]);

int main() {
auto nonMemFnPtr = &nonMemFn;
auto nonMemFnPtrToPtr = &nonMemFnPtr;

double res[4];
clad::matrix<double> res(2, 2);
double out[2];
auto d_nonMemFn = clad::jacobian(nonMemFn);
auto d_nonMemFnPar = clad::jacobian((nonMemFn));
Expand Down
112 changes: 54 additions & 58 deletions test/Jacobian/TemplateFunctors.C
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,24 @@ template <typename T> struct Experiment {
void setX(T val) { x = val; }
};

// CHECK: void operator_call_jac(double i, double j, double *output, double *jacobianMatrix) {
// CHECK-NEXT: double _t0 = output[0];
// CHECK-NEXT: output[0] = this->x * this->y * i * j;
// CHECK-NEXT: double _t1 = output[1];
// CHECK-NEXT: output[1] = 2 * this->x * this->y * i * j;
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{2U|2UL|2ULL}}] += 2 * this->x * this->y * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += 2 * this->x * this->y * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: output[1] = _t1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += this->x * this->y * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL|1ULL}}] += this->x * this->y * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: output[0] = _t0;
// CHECK-NEXT: }
// CHECK: void operator_call_jac(double i, double j, double *output, clad::array_ref<clad::matrix<double> > _d_vector_output) {
// CHECK-NEXT: unsigned long indepVarCount = * _d_vector_output.rows() + {{2U|2UL|2ULL}};
// CHECK-NEXT: clad::array<double> _d_vector_i = clad::one_hot_vector(indepVarCount, {{0U|0UL|0ULL}});
// CHECK-NEXT: clad::array<double> _d_vector_j = clad::one_hot_vector(indepVarCount, {{1U|1UL|1ULL}});
// CHECK-NEXT: * _d_vector_output = clad::identity_matrix(* _d_vector_output.rows(), indepVarCount, {{2U|2UL|2ULL}});
// CHECK-NEXT: double &_t0 = this->x;
// CHECK-NEXT: double &_t1 = this->y;
// CHECK-NEXT: double _t2 = _t0 * _t1;
// CHECK-NEXT: double _t3 = _t2 * i;
// CHECK-NEXT: * _d_vector_output[0] = ((0 * _t1 + _t0 * 0) * i + _t2 * _d_vector_i) * j + _t3 * _d_vector_j;
// CHECK-NEXT: output[0] = _t3 * j;
// CHECK-NEXT: double &_t4 = this->x;
// CHECK-NEXT: double _t5 = 2 * _t4;
// CHECK-NEXT: double &_t6 = this->y;
// CHECK-NEXT: double _t7 = _t5 * _t6;
// CHECK-NEXT: double _t8 = _t7 * i;
// CHECK-NEXT: * _d_vector_output[1] = (((0 * _t4 + 2 * 0) * _t6 + _t5 * 0) * i + _t7 * _d_vector_i) * j + _t8 * _d_vector_j;
// CHECK-NEXT: output[1] = _t8 * j;
// CHECK-NEXT: }

template <> struct Experiment<long double> {
Expand All @@ -46,60 +45,57 @@ template <> struct Experiment<long double> {
void setX(long double val) { x = val; }
};

// CHECK: void operator_call_jac(long double i, long double j, long double *output, long double *jacobianMatrix) {
// CHECK-NEXT: long double _t0 = output[0];
// CHECK-NEXT: output[0] = this->x * this->y * i * i * j;
// CHECK-NEXT: long double _t1 = output[1];
// CHECK-NEXT: output[1] = 2 * this->x * this->y * i * i * j;
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{2U|2UL|2ULL}}] += 2 * this->x * this->y * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL|2ULL}}] += 2 * this->x * this->y * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += 2 * this->x * this->y * i * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: output[1] = _t1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += this->x * this->y * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += this->x * this->y * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL|1ULL}}] += this->x * this->y * i * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: output[0] = _t0;
// CHECK-NEXT: }
// CHECK: void operator_call_jac(long double i, long double j, long double *output, clad::array_ref<clad::matrix<long double> > _d_vector_output) {
// CHECK-NEXT: unsigned long indepVarCount = * _d_vector_output.rows() + {{2U|2UL|2ULL}};
// CHECK-NEXT: clad::array<long double> _d_vector_i = clad::one_hot_vector(indepVarCount, {{0U|0UL|0ULL}});
// CHECK-NEXT: clad::array<long double> _d_vector_j = clad::one_hot_vector(indepVarCount, {{1U|1UL|1ULL}});
// CHECK-NEXT: * _d_vector_output = clad::identity_matrix(* _d_vector_output.rows(), indepVarCount, {{2U|2UL|2ULL}});
// CHECK-NEXT: long double &_t0 = this->x;
// CHECK-NEXT: long double &_t1 = this->y;
// CHECK-NEXT: long double _t2 = _t0 * _t1;
// CHECK-NEXT: long double _t3 = _t2 * i;
// CHECK-NEXT: long double _t4 = _t3 * i;
// CHECK-NEXT: * _d_vector_output[0] = (((0 * _t1 + _t0 * 0) * i + _t2 * _d_vector_i) * i + _t3 * _d_vector_i) * j + _t4 * _d_vector_j;
// CHECK-NEXT: output[0] = _t4 * j;
// CHECK-NEXT: long double &_t5 = this->x;
// CHECK-NEXT: long double _t6 = 2 * _t5;
// CHECK-NEXT: long double &_t7 = this->y;
// CHECK-NEXT: long double _t8 = _t6 * _t7;
// CHECK-NEXT: long double _t9 = _t8 * i;
// CHECK-NEXT: long double _t10 = _t9 * i;
// CHECK-NEXT: * _d_vector_output[1] = ((((0 * _t5 + 2 * 0) * _t7 + _t6 * 0) * i + _t8 * _d_vector_i) * i + _t9 * _d_vector_i) * j + _t10 * _d_vector_j;
// CHECK-NEXT: output[1] = _t10 * j;
// CHECK-NEXT: }

#define INIT(E) \
auto d_##E = clad::jacobian(&E); \
auto d_##E##Ref = clad::jacobian(E);

#define TEST_DOUBLE(E, ...) \
result[0] = result[1] = result[2] = result[3] = 0; \
output[0] = output[1] = 0; \
d_##E.execute(__VA_ARGS__, output, result); \
printf("{%.2f, %.2f, %.2f, %.2f} ", result[0], result[1], result[2], \
result[3]); \
result[0] = result[1] = result[2] = result[3] = 0; \
d_##E.execute(__VA_ARGS__, output, &result); \
printf("{%.2f, %.2f, %.2f, %.2f} ", result[0][0], result[0][1], \
result[1][0], result[1][1]); \
output[0] = output[1] = 0; \
d_##E##Ref.execute(__VA_ARGS__, output, result); \
printf("{%.2f, %.2f, %.2f, %.2f}\n", result[0], result[1], result[2], \
result[3]);
d_##E##Ref.execute(__VA_ARGS__, output, &result); \
printf("{%.2f, %.2f, %.2f, %.2f} ", result[0][0], result[0][1], \
result[1][0], result[1][1]);

#define TEST_LONG_DOUBLE(E, ...) \
result_ld[0] = result_ld[1] = result_ld[2] = result_ld[3] = 0; \
output_ld[0] = output_ld[1] = 0; \
d_##E.execute(__VA_ARGS__, output_ld, result_ld); \
printf("{%.2Lf, %.2Lf, %.2Lf, %.2Lf} ", result_ld[0], result_ld[1], \
result_ld[2], result_ld[3]); \
result_ld[0] = result_ld[1] = result_ld[2] = result_ld[3] = 0; \
d_##E.execute(__VA_ARGS__, output_ld, &result_ld); \
printf("{%.2Lf, %.2Lf, %.2Lf, %.2Lf} ", result_ld[0][0], result_ld[0][1], \
result_ld[1][0], result_ld[1][1]); \
output_ld[0] = output_ld[1] = 0; \
d_##E##Ref.execute(__VA_ARGS__, output_ld, result_ld); \
printf("{%.2Lf, %.2Lf, %.2Lf, %.2Lf}\n", result_ld[0], result_ld[1], \
result_ld[2], result_ld[3]);
d_##E##Ref.execute(__VA_ARGS__, output_ld, &result_ld); \
printf("{%.2Lf, %.2Lf, %.2Lf, %.2Lf} ", result_ld[0][0], result_ld[0][1], \
result_ld[1][0], result_ld[1][1]);

int main() {
double result[4], output[2];
long double result_ld[4], output_ld[2];
double output[2];
clad::matrix<double> result(2, 2);
long double output_ld[2];
clad::matrix<long double> result_ld(2, 2);
Experiment<double> E(3, 5);
Experiment<long double> E_ld(3, 5);

Expand Down
91 changes: 27 additions & 64 deletions test/Jacobian/constexprTest.C
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,26 @@
#include "../TestUtils.h"

double result[3] = {0};
double jacobianou[6] = {0};
double result1[3] = {0};
double jacobianou1[9] = {0};
clad::matrix<double> jacobian(3, 2);

constexpr void fn_mul(double i, double j, double *res) {
res[0] = i*i;
res[1] = j*j;
res[2] = i*j;
}

// CHECK: void fn_mul_jac(double i, double j, double *res, double *jacobianMatrix) {
// CHECK-NEXT: double _t0 = res[0];
// CHECK: constexpr void fn_mul_jac(double i, double j, double *res, clad::array_ref<clad::matrix<double> > _d_vector_res) {
// CHECK-NEXT: unsigned long indepVarCount = * _d_vector_res.rows() + {{2U|2UL|2ULL}};
// CHECK-NEXT: clad::array<double> _d_vector_i = clad::one_hot_vector(indepVarCount, {{0U|0UL|0ULL}});
// CHECK-NEXT: clad::array<double> _d_vector_j = clad::one_hot_vector(indepVarCount, {{1U|1UL|1ULL}});
// CHECK-NEXT: * _d_vector_res = clad::identity_matrix(* _d_vector_res.rows(), indepVarCount, {{2U|2UL|2ULL}});
// CHECK-NEXT: * _d_vector_res[0] = _d_vector_i * i + i * _d_vector_i;
// CHECK-NEXT: res[0] = i * i;
// CHECK-NEXT: double _t1 = res[1];
// CHECK-NEXT: * _d_vector_res[1] = _d_vector_j * j + j * _d_vector_j;
// CHECK-NEXT: res[1] = j * j;
// CHECK-NEXT: double _t2 = res[2];
// CHECK-NEXT: * _d_vector_res[2] = _d_vector_i * j + i * _d_vector_j;
// CHECK-NEXT: res[2] = i * j;
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{4U|4UL|4ULL}}] += 1 * j;
// CHECK-NEXT: jacobianMatrix[{{5U|5UL|5ULL}}] += i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: res[2] = _t2;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += j * 1;
// CHECK-NEXT: }
// CHECK-NEXT: res[1] = _t1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += 1 * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: res[0] = _t0;
// CHECK-NEXT: }
// CHECK-NEXT: }


Expand All @@ -55,49 +37,30 @@ constexpr void f_1(double x, double y, double z, double output[]) {
output[2] = z * x * 10 - y * z;
}

// CHECK: constexpr void f_1_jac(double x, double y, double z, double output[], double *jacobianMatrix) {
// CHECK-NEXT: double _t0 = output[0];
// CHECK-NEXT: output[0] = x * x * x;
// CHECK-NEXT: double _t1 = output[1];
// CHECK-NEXT: output[1] = x * y * x + y * x * x;
// CHECK-NEXT: double _t2 = output[2];
// CHECK-NEXT: output[2] = z * x * 10 - y * z;
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{8U|8UL|8ULL}}] += 1 * 10 * x;
// CHECK-NEXT: jacobianMatrix[{{6U|6UL|6ULL}}] += z * 1 * 10;
// CHECK-NEXT: jacobianMatrix[{{7U|7UL|7ULL}}] += -1 * z;
// CHECK-NEXT: jacobianMatrix[{{8U|8UL|8ULL}}] += y * -1;
// CHECK-NEXT: }
// CHECK-NEXT: output[2] = _t2;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += 1 * x * y;
// CHECK-NEXT: jacobianMatrix[{{4U|4UL|4ULL}}] += x * 1 * x;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += x * y * 1;
// CHECK-NEXT: jacobianMatrix[{{4U|4UL|4ULL}}] += 1 * x * x;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += y * 1 * x;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL|3ULL}}] += y * x * 1;
// CHECK-NEXT: }
// CHECK-NEXT: output[1] = _t1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += 1 * x * x;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += x * 1 * x;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL|0ULL}}] += x * x * 1;
// CHECK-NEXT: }
// CHECK-NEXT: output[0] = _t0;
// CHECK-NEXT: }
// CHECK: constexpr void f_1_jac(double x, double y, double z, double output[], clad::array_ref<clad::matrix<double> > _d_vector_output) {
// CHECK-NEXT: unsigned long indepVarCount = * _d_vector_output.rows() + {{3U|3UL|3ULL}};
// CHECK-NEXT: clad::array<double> _d_vector_x = clad::one_hot_vector(indepVarCount, {{0U|0UL|0ULL}});
// CHECK-NEXT: clad::array<double> _d_vector_y = clad::one_hot_vector(indepVarCount, {{1U|1UL|1ULL}});
// CHECK-NEXT: clad::array<double> _d_vector_z = clad::one_hot_vector(indepVarCount, {{2U|2UL|2ULL}});
// CHECK-NEXT: * _d_vector_output = clad::identity_matrix(* _d_vector_output.rows(), indepVarCount, {{3U|3UL|3ULL}});
// CHECK-NEXT: double _t0 = x * x;
// CHECK-NEXT: * _d_vector_output[0] = (_d_vector_x * x + x * _d_vector_x) * x + _t0 * _d_vector_x;
// CHECK-NEXT: output[0] = _t0 * x;
// CHECK-NEXT: double _t1 = x * y;
// CHECK-NEXT: double _t2 = y * x;
// CHECK-NEXT: * _d_vector_output[1] = (_d_vector_x * y + x * _d_vector_y) * x + _t1 * _d_vector_x + (_d_vector_y * x + y * _d_vector_x) * x + _t2 * _d_vector_x;
// CHECK-NEXT: output[1] = _t1 * x + _t2 * x;
// CHECK-NEXT: double _t3 = z * x;
// CHECK-NEXT: * _d_vector_output[2] = (_d_vector_z * x + z * _d_vector_x) * 10 + _t3 * 0 - (_d_vector_y * z + y * _d_vector_z);
// CHECK-NEXT: output[2] = _t3 * 10 - y * z;
// CHECK-NEXT: }

int main() {

INIT_JACOBIAN(fn_mul);
INIT_JACOBIAN(f_1);

TEST_JACOBIAN(fn_mul, 2, 6, 3, 1, result, jacobianou); // CHECK-EXEC: {6.00, 0.00, 0.00, 2.00, 1.00, 3.00}
TEST_JACOBIAN(f_1, 3, 9, 4, 5, 6, result1, jacobianou1); // CHECK-EXEC: {48.00, 0.00, 0.00, 80.00, 32.00, 0.00, 60.00, -6.00, 35.00}
TEST_JACOBIAN(fn_mul, 2, 6, 3, 1, result, &jacobian); // CHECK-EXEC: {6.00, 0.00, 0.00, 2.00, 1.00, 3.00}
TEST_JACOBIAN(f_1, 3, 9, 4, 5, 6, result1, &jacobian); // CHECK-EXEC: {48.00, 0.00, 0.00, 80.00, 32.00, 0.00, 60.00, -6.00, 35.00}
}

Loading

0 comments on commit 688c9ab

Please sign in to comment.