5#include "testing/testing.h"
9TEST(math_solvers, Tridiagonal1)
11 const float a[1] = {1};
12 const float b[1] = {2};
13 const float c[1] = {1};
14 const float d[1] = {4};
18 EXPECT_FLOAT_EQ(x[0], 2);
21TEST(math_solvers, Tridiagonal3)
23 const float a[3] = {1, 2, 3};
24 const float b[3] = {4, 5, 6};
25 const float c[3] = {7, 8, 9};
26 const float d[3] = {18, 36, 24};
30 EXPECT_FLOAT_EQ(x[0], 1);
31 EXPECT_FLOAT_EQ(x[1], 2);
32 EXPECT_FLOAT_EQ(x[2], 3);
35TEST(math_solvers, CyclicTridiagonal1)
37 const float a[1] = {1};
38 const float b[1] = {2};
39 const float c[1] = {1};
40 const float d[1] = {4};
44 EXPECT_FLOAT_EQ(x[0], 1);
47TEST(math_solvers, CyclicTridiagonal2)
49 const float a[2] = {1, 2};
50 const float b[2] = {3, 4};
51 const float c[2] = {5, 6};
52 const float d[2] = {15, 16};
56 EXPECT_FLOAT_EQ(x[0], 1);
57 EXPECT_FLOAT_EQ(x[1], 2);
60TEST(math_solvers, CyclicTridiagonal3)
62 const float a[3] = {1, 2, 3};
63 const float b[3] = {4, 5, 6};
64 const float c[3] = {7, 8, 9};
65 const float d[3] = {21, 36, 33};
69 EXPECT_FLOAT_EQ(x[0], 1);
70 EXPECT_FLOAT_EQ(x[1], 2);
71 EXPECT_FLOAT_EQ(x[2], 3);
bool BLI_tridiagonal_solve_cyclic(const float *a, const float *b, const float *c, const float *d, float *r_x, int count)
Solve a possibly cyclic tridiagonal system using the Sherman-Morrison formula.
bool BLI_tridiagonal_solve(const float *a, const float *b, const float *c, const float *d, float *r_x, int count)
Solve a tridiagonal system of equations:
TEST(math_solvers, Tridiagonal1)
local_group_size(16, 16) .push_constant(Type b