16 #define MAX_USHORT 65535.0f 23 for (
int i=0;
i<24;
i++) {
33 for (
int i=0;
i<24;
i++) {
45 for (
int i=0;
i<12;
i++) {
60 for (
int i=0;
i<12;
i++) {
66 for (
int i=0;
i<12;
i++) {
77 for (
int j=0; j<N; j++) {
86 for (
int j=0; j<N; j++) {
95 for (
int j=0; j<N; j++) {
104 for (
int j=0; j<N; j++) {
113 for (
int j=0; j<N; j++) {
114 for (
int i=0;
i<24;
i++) {
120 double l2(
float *
a,
float *
b,
int N) {
123 for (
int j=0; j<N; j++) {
126 for (
int i=0;
i<24;
i++) {
127 dif +=
a[j*24+
i]*
a[j*24+
i] -
b[j*24+
i]*
b[j*24+
i];
128 nrm +=
a[j*24+
i]*
a[j*24+
i];
139 short *old_half = (
short*)
safe_malloc(24*N*
sizeof(
short));
140 float *old_norm = (
float*)
safe_malloc(N*
sizeof(
float));
141 float *old_recon = (
float*)
safe_malloc(24*N*
sizeof(
float));
142 short *new_half = (
short*)
safe_malloc(24*N*
sizeof(
short));
143 float *new_norm = (
float*)
safe_malloc(N*
sizeof(
float));
144 float *new_recon = (
float*)
safe_malloc(24*N*
sizeof(
float));
146 for (
float power=0.0; power<2.0; power+=0.1) {
155 printf(
"pow=%e, L2 spinor deviation: old = %e, new = %e, ratio = %e\n",
156 power,
l2(
ref,old_recon,N),
l2(
ref,new_recon,N),
160 for (
int j=0; j<N; j++) {
161 for (
int i=0;
i<12;
i++) {
162 printf(
"power=%4.2f i=%d ref=(%e,%e) old=(%e,%e), new=(%e,%e)\n",
163 power,
i,
ref[j*24+
i*2+0],
ref[j*24+
i*2+1],
164 old_recon[j*24+
i*2+0], old_recon[j*24+
i*2+1],
165 new_recon[j*24+
i*2+0], new_recon[j*24+
i*2+1]);
void newCopyToHalf(short *out, float *norm, float *in, int N)
__host__ __device__ ValueType norm(const complex< ValueType > &z)
Returns the magnitude of z squared.
void ucopy(float &a, const ushort &b)
__host__ __device__ ValueType sqrt(ValueType x)
cudaColorSpinorField * tmp
void new_load_half(float spinor[24], short *in, float *norm, int idx)
__host__ __device__ void copy(T1 &a, const T2 &b)
double l2(float *a, float *b, int N)
void newCopyToFloat(float *out, short *in, float *norm, int N)
void insertNoise(float *field, int N, float power)
int printf(const char *,...) __attribute__((__format__(__printf__
__host__ __device__ ValueType sin(ValueType x)
__host__ __device__ ValueType atan2(ValueType x, ValueType y)
__host__ __device__ ValueType pow(ValueType x, ExponentType e)
Provides precision abstractions and defines the register precision given the storage precision using ...
void new_save_half(float spinor[24], short *out, float *norm, int idx)
#define safe_malloc(size)
void oldCopyToFloat(float *out, short *in, float *norm, int N)
void old_save_half(float spinor[24], short *out, float *norm, int idx)
cpuColorSpinorField * out
cpuColorSpinorField * ref
void old_load_half(float spinor[24], short *in, float *norm, int idx)
__host__ __device__ ValueType cos(ValueType x)
void oldCopyToHalf(short *out, float *norm, float *in, int N)
cpuColorSpinorField * spinor