#include "mg.h"
#include "mg_dim.h"

#define PSINV_DIM       PSINV_DIM_GPU
#define RESID_DIM       RESID_DIM_GPU
#define RPRJ3_DIM       RPRJ3_DIM_GPU
#define INTERP_1_DIM    INTERP_1_DIM_GPU
#define NORM2U3_DIM     NORM2U3_DIM_GPU
#define COMM3_1_DIM     COMM3_1_DIM_GPU
#define COMM3_2_DIM     COMM3_2_DIM_GPU
#define COMM3_3_DIM     COMM3_3_DIM_GPU
#define ZERO3_DIM       ZERO3_DIM_GPU

__kernel void kernel_zran3_1(__global double* oz,
			                 __global double* starts,
			                 int n1,
			                 int n2,
			                 int n3,
			                 int offset,
			                 int e2,
			                 int e3,
			                 int d1,
			                 double a1)
{

	int i3 = get_global_id(0);
	int i2;
	double xx, x1;
	const double a = pow(5.0, 13.0);

	if (i3 < e3 && i3 >= 1)
	{
		x1 = starts[i3];
		for (i2 = 1; i2 < e2; i2++) {
		  xx = x1;
		  vranlc(d1, &xx, a, &(oz[i3*n2*n1+i2*n1+1]));
		  randlc(&x1, a1);
		}
	}

}

