1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <math.h>
#include <stddef.h>
#include "ts.h"
bool ts_test_relative_volatility( void )
{
fp_t const x0[] = { 10, 10, 10, 10, 20, 20, 20 };
fp_t const * const x[] = { x0 };
/* k=3, offset=2, y_n=5 */
/* y[2]: [10,10,10] -> 0 (overwritten by xi=3: also [10,10,10] -> 0) */
/* y[3]: [10,10,20] mean=13.33, sd=4.71 -> 35.355339 */
/* y[4]: [10,20,20] mean=16.67, sd=4.71 -> 28.284271 */
/* y[5]: [20,20,20] -> 0 */
/* y[6]: not written -> 0 */
fp_t const e[] = { 0.0, 35.355339, 28.284271, 0.0, 0.0 };
fp_t const * const exp[1] = { e };
uint_t k = 3;
return ts_test(ts_relative_volatility, ts_relative_volatility_offset, x, exp, sizeof( x0 ) / sizeof( *x0 ), (ts_constant_t *)&k, &ts_relative_volatility_p);
}
|