File: test_rand.c

package info (click to toggle)
bart 0.9.00-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,040 kB
  • sloc: ansic: 116,116; python: 1,329; sh: 726; makefile: 639; javascript: 589; cpp: 106
file content (30 lines) | stat: -rw-r--r-- 464 bytes parent folder | download
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
#include <math.h>
#include <complex.h>

#include "misc/misc.h"
#include "num/rand.h"
#include "num/multind.h"
#include "num/flpmath.h"

#include "utest.h"


static bool test_var(void)
{
	enum { N = 1};
	const long dims[N] = { 1000 };

	complex float* data = md_alloc(N, dims, CFL_SIZE);
	complex float var;

	md_gaussian_rand(N, dims, data);	
	md_zvar(N, dims, ~0, &var, data);
	
	md_free(data);

	UT_ASSERT(cabsf(var - 2) < 0.2);
}

UT_REGISTER_TEST(test_var);