1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include <math.h>
#include <stddef.h>
#include "ts.h"
bool ts_test_shinohara_intensity_ratio( void )
{
fp_t const x0[] = { 10, 10, 10, 20, 20, 20 };
fp_t const x1[] = { 14, 13, 14, 24, 23, 24 };
fp_t const x2[] = { 8, 9, 8, 18, 19, 18 };
fp_t const x3[] = { 12, 11, 13, 22, 21, 23 };
fp_t const * const x[] = { x0, x1, x2, x3 };
uint_t k = 3;
fp_t i0 = (x1[0] - x3[0]) / (x1[0] - x2[0]);
fp_t i1 = (x3[1] - x2[1]) / (x1[1] - x2[1]);
fp_t i2 = (x1[2] - x3[2]) / (x1[2] - x2[2]);
fp_t e[4];
e[0] = (i0 + i1 + i2) / 3.0;
fp_t i3 = (x3[3] > x0[3]) ? (x1[3] - x3[3]) / (x1[3] - x2[3]) : (x3[3] - x2[3]) / (x1[3] - x2[3]);
e[1] = e[0] + (i3 - i0) / 3.0;
fp_t i4 = (x3[4] > x0[4]) ? (x1[4] - x3[4]) / (x1[4] - x2[4]) : (x3[4] - x2[4]) / (x1[4] - x2[4]);
e[2] = e[1] + (i4 - i1) / 3.0;
fp_t i5 = (x3[5] > x0[5]) ? (x1[5] - x3[5]) / (x1[5] - x2[5]) : (x3[5] - x2[5]) / (x1[5] - x2[5]);
e[3] = e[2] + (i5 - i2) / 3.0;
fp_t const * const exp[1] = { e };
return ts_test(ts_shinohara_intensity_ratio, ts_shinohara_intensity_ratio_offset, x, exp, sizeof( x0 ) / sizeof( *x0 ), (ts_constant_t *)&k, &ts_shinohara_intensity_ratio_p);
}
|