serial_no int64 1 24.2k | cuda_source stringlengths 11 9.01M |
|---|---|
8,501 | #include "includes.h"
__global__ void scan_kernel(unsigned int* output_block, unsigned int block_num) {
__shared__ unsigned int shared_output[BLOCK_SIZE];
if (threadIdx.x >= block_num || threadIdx.x == 0) {
shared_output[threadIdx.x] = 0x0;
} else {
shared_output[threadIdx.x] = output_block[threadIdx.x - 1];
}
__syncthreads();
for (unsigned int i = 1; i < block_num; i <<= 1) {
unsigned int val = 0;
if (threadIdx.x >= i) {
val = shared_output[threadIdx.x - i];
}
__syncthreads();
shared_output[threadIdx.x] += val;
__syncthreads();
}
if (threadIdx.x < block_num) {
output_block[threadIdx.x] = shared_output[threadIdx.x];
}
__syncthreads();
} |
8,502 | #include "includes.h"
__global__ void createResizedImage(unsigned char *imageScaledData, int scaled_width, float scale_factor, cudaTextureObject_t texObj)
{
const unsigned int tidX = blockIdx.x*blockDim.x + threadIdx.x;
const unsigned int tidY = blockIdx.y*blockDim.y + threadIdx.y;
const unsigned index = tidY*scaled_width+tidX;
//Step 3: Read the texture memory from your texture reference in CUDA Kernel
imageScaledData[index] = tex2D<unsigned char>(texObj,(float)(tidX*scale_factor),(float)(tidY*scale_factor));
} |
8,503 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <stdio.h>
__device__ float devData;
__global__ void checkGlobalVariable()
{
printf("Device: The value of global variable is %f\n", devData);
devData += 2.0;
}
int main()
{
float value = 3.14f;
cudaMemcpyToSymbol(&devData, &value, sizeof(value));
printf("Host: copied %f to the global variable\n", value);
checkGlobalVariable<<<1, 1 >>> ();
cudaMemcpyFromSymbol(&value, &devData, sizeof(value));
printf("Host: Value changed by kernel to %f\n", value);
cudaDeviceReset();
system("Pause");
return 0;
} |
8,504 | #include<stdlib.h>
#include<stdio.h>
#include<unistd.h>
#include<sys/time.h>
#include<math.h>
#include<iostream>
#ifndef NUM_THREADS_PER_BLOCK
#define NUM_THREADS_PER_BLOCK 256
#endif
typedef struct timeval tval;
double get_elapsed(tval t0, tval t1);
void saxpy(int n, const float a, float *x, float *y)
{
for (int i=0; i<n; i++)
{
y[i] = a*x[i] + y[i];
}
}
__global__
void saxpy_cuda(int n,const float a, float *x, float *y)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i < n) y[i] = a*x[i] + y[i];
}
int main(int argc, char *argv[])
{
int N = 10000;
const float a = 2.0;
tval t[2] = { 0 };
double elapsed[2] = { 0 };
float *x, *y, *d_x, *d_y;
int c;
while ((c = getopt(argc, argv, "n:p:h")) != -1)
switch (c)
{
case 'n':
N = atoi(optarg);
break;
// case 'p':
// n_threads = atoi(optarg);
// break;
case 'h':
printf(
"Options:\n-n SIZE\t\tNum Particle\n-p NTHREAD\tNumber of threads\n");
exit(1);
case '?':
break;
}
int num_blocks = (N + NUM_THREADS_PER_BLOCK - 1) / NUM_THREADS_PER_BLOCK;
printf("Num_blocks: %2d Num_threads_per_block: %2d \n", num_blocks, NUM_THREADS_PER_BLOCK);
x = (float*)malloc(N*sizeof(float));
y = (float*)malloc(N*sizeof(float));
for (int i = 0; i < N; i++)
{
x[i] = ((float)rand() / (float)RAND_MAX)*2 -1;
y[i] = ((float)rand() / (float)RAND_MAX)*2 -1;
}
cudaMalloc(&d_x, N*sizeof(float));
cudaMalloc(&d_y, N*sizeof(float));
cudaMemcpy(d_x, x, N*sizeof(float), cudaMemcpyHostToDevice);
cudaMemcpy(d_y, y, N*sizeof(float), cudaMemcpyHostToDevice);
// Launch the CPU version
printf("Computing SAXPY on the CPU...");
gettimeofday(&t[0], NULL);
saxpy(N, a, x, y);
gettimeofday(&t[1], NULL);
elapsed[0] = get_elapsed(t[0], t[1]);
printf("Done!\n");
// Launch the GPU version
printf("Computing SAXPY on the GPU...");
gettimeofday(&t[0], NULL);
saxpy_cuda<<<num_blocks, NUM_THREADS_PER_BLOCK>>>(N, a, d_x, d_y);
// Copy array y back to HOST and store in array x
cudaMemcpy(x, d_y, N*sizeof(float), cudaMemcpyDeviceToHost);
gettimeofday(&t[1], NULL);
elapsed[1] = get_elapsed(t[0], t[1]);
printf("Done!\n");
printf("Comparing the output for each implementation...");
float error = 0.0f;
for (int i = 0; i < N; i++)
error = fmax(error, fabs(y[i]-x[i]));
if (error < 1e-8){
printf("Correct!\n");
}
else{
printf("Not correct!\n");
}
printf("Elapsed CPU (ms): %f / Elapsed GPU (ms): %f\n", elapsed[0], elapsed[1]);
// Free memory
free(x);
free(y);
cudaFree(d_x);
cudaFree(d_y);
return 0;
}
double get_elapsed(tval t0, tval t1)
{
return (double)(t1.tv_sec - t0.tv_sec) * 1000.0L + (double)(t1.tv_usec - t0.tv_usec) / 1000.0L;
} |
8,505 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <stdio.h>
#include <ctime>
#define BLOCKS_NUM 4
#define BLOCK_SIZE 256
#define DATA_TYPE int
__global__ void reduce( DATA_TYPE* in, DATA_TYPE* out ){
__shared__ int data[BLOCK_SIZE];
int tid = threadIdx.x;
int i = 2 * blockIdx.x * blockDim.x + threadIdx.x;
data[ tid ] = in [ i ] + in[ i + blockDim.x ];
__syncthreads();
for ( int s = blockDim.x / 2; s > 0; s >>= 1 ){
if ( tid < s) data[tid] += data[tid + s];
__syncthreads();
}
__syncthreads();
if ( tid == 0 ) out[blockIdx.x] = data[0];
}
using namespace std;
int main(){
DATA_TYPE nums[ BLOCKS_NUM * BLOCK_SIZE ];
int res = 0;
srand(time(0));
for( int i = 0; i < BLOCKS_NUM * BLOCK_SIZE; i++ ){
if ( i < 1000 ) nums[ i ] = rand()%100 - 50;
else nums[ i ] = 0;
res += nums[ i ];
}
cout << "For summ: " << res << endl;
cudaSetDevice( 0 );
DATA_TYPE* in;
DATA_TYPE* out;
unsigned int in_memory_size = sizeof( DATA_TYPE ) * BLOCKS_NUM * BLOCK_SIZE;
unsigned int out_memory_size = sizeof( DATA_TYPE ) * BLOCKS_NUM;
cudaMalloc( ( void** ) &in, in_memory_size );
cudaMalloc( ( void** ) &out, out_memory_size );
cudaMemcpy( in, nums, in_memory_size, cudaMemcpyHostToDevice );
dim3 block( BLOCK_SIZE );
dim3 grid( BLOCKS_NUM );
reduce<<< grid, block >>>( in, out );
cudaDeviceSynchronize();
cudaMemcpy( nums, out, out_memory_size, cudaMemcpyDeviceToHost );
res = 0;
for (int i = 0; i < 2; i++) res += nums[i];
cout << "CUDA summ: " << res << endl;
cin.get();
cudaFree( in );
cudaFree( out );
return 0;
}
|
8,506 | #include<stdio.h>
#include<stdlib.h>
#include<cuda.h>
#include<time.h>
//************variables globales***************
int msk=3, dimx=1040, dimy=1388, tam_imag=1388*1040;
//*******************kernel********************
__global__ void kernel (int *B_d,float *var_d){
int idx = threadIdx.x + blockIdx.x*blockDim.x;
int idy = threadIdx.y + blockIdx.y*blockDim.y;
int offset=idx + idy*blockDim.x*gridDim.x;
int id=offset;
int i;
float X=0.f,Xprom=0.f,Y=0.f;
int dimy=1388,tam_imag=1388*1040,msk=3;
var_d[id]=0;
if(offset<tam_imag){
int dimy_B=dimy+2;
offset+=2*idy;
int id_p=offset+(dimy+msk);
int M_d[9];
M_d[0]=B_d[offset];
M_d[1]=B_d[offset+1];
M_d[2]=B_d[offset+2];
M_d[3]=B_d[id_p-1];
M_d[4]=B_d[id_p];
M_d[5]=B_d[id_p+1];
M_d[6]=B_d[(id_p-1)+dimy_B];
M_d[7]=B_d[id_p+dimy_B];
M_d[8]=B_d[(id_p+1)+dimy_B];
for(i=0;i<msk*msk;i++)
X+=M_d[i];
Xprom=((float)X)/(msk*msk);
for(i=0;i<msk*msk;i++)
Y+=(Xprom-M_d[i])*(Xprom-M_d[i]);
var_d[id]=Y/(msk*msk);
}
}
//*****************funcion main**********************
int main(int argc,char* argv[]){
//***************declaracion de variables**************
int i,j,m,cont,tam_B, init,fin;
init=atoi(argv[1]);
fin=atoi(argv[2]);
tam_B=(dimx+2)*(dimy+2);
FILE *arch, *matrizG;
int **A;
int B[dimx+2][dimy+2];
float t;
clock_t tinicio, t_GPU;
tinicio=clock();
int *B_d, *B_h;
float *var_d,*var_h;
int d;
for(d=init;d<=fin;d++){
//*******************declaracion de variables***************
printf("d=%d \n", d);
B_h=(int *)malloc(sizeof(int)*tam_B);
cudaMalloc((void**)&B_d, tam_B*sizeof(int));
var_h=(float *)malloc(sizeof(float)*tam_imag);
cudaMalloc((void**)&var_d,tam_imag*sizeof(float));
A=(int **)malloc(sizeof(int)*dimx);
for(i=0;i<dimx;i++)
A[i]=(int*)malloc(sizeof(int)*dimy);
//*****************calculo matriz B****************
char ruta1[]="MiTesis/";
sprintf(ruta1, "%s%d%s","RGB/",d,"/G");
matrizG=fopen(ruta1,"r+");
for(i=0;i<dimx;i++){
for(j=0;j<dimy;j++){
fscanf(matrizG, "%d", &A[i][j]);
}
}
fclose(matrizG);
cont=0;
for(i=0;i<dimx+2;i++){
//printf("\n");
for(j=0;j<dimy+2;j++){
B[i][j]=((i==0 || j==0 || i==dimx+1 || j==dimy+1) ? 0:A[i-1][j-1]);
B_h[cont]=B[i][j];
cont++;
}
}
//******************llamado de kernel*******************
dim3 Grid(347,20);
dim3 Block(13,16);
cudaMemcpy(B_d,B_h,sizeof(int)*tam_B,cudaMemcpyHostToDevice);
kernel<<<Grid,Block>>>(B_d,var_d);
cudaMemcpy(var_h,var_d,sizeof(float)*tam_imag,cudaMemcpyDeviceToHost);
//****************almacenamiento matriz de varianza**************
char rutaV[]="VARIANZAS/";
sprintf(rutaV, "%s%d", rutaV,d);
arch=fopen(rutaV,"w+");
for(m=0;m<tam_imag;m++){
if(m%dimy==0 && m!=0){
fprintf(arch,"\n");
}
fprintf(arch,"%f ",var_h[m]); // "%.2f " - Imprimiria 2 decimales
}
fclose(arch);
free(B_h);
free(var_h);
free(A);
cudaFree(var_d);
cudaFree(B_d);
}
t_GPU=clock();
t = ((float)t_GPU-(float)tinicio)/CLOCKS_PER_SEC;
printf("\ntiempo de procesamiento de varianzas: %6.3fs\n",t);
return 0;
}//FIN funcion main()
|
8,507 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
__host__ void cpuFunction(){}
__device__ void gpuFunction(){}
__global__ void fd(float *u0, float *u1, float *u2, int nx) {
int ix = threadIdx.x + blockIdx.x*blockDim.x;
if (ix > 0 && ix < nx-1)
u2[ix] = u1[ix+1]+u1[ix-1]-u0[ix];
}
__global__ void update(float *u0, float *u1, float *u2) {
int ix = threadIdx.x + blockIdx.x*blockDim.x;
u0[ix] = u1[ix];
u1[ix] = u2[ix];
}
int main() {
int ix, it, nx = 100, nt = 100;
size_t size = nx*sizeof(float);
float xmax = 1.0, dx = xmax/(nx+1);
float *hU0, *hU1;
float *u0, *u1, *u2, c = 0.1, dt = dx/c, x, a = 1000;
hU0 = (float*) malloc(size);
hU1 = (float*) malloc(size);
cudaMalloc((void **)&u0, size);
cudaMalloc((void **)&u1, size);
cudaMalloc((void **)&u2, size);
for (ix=0; ix<nx; ix++) {
x = ix*dx;
hU0[ix] = exp(-a*pow(x-0.5*xmax,2.0));
hU1[ix] = exp(-a*pow(x-0.5*xmax-c*dt,2.0));
}
cudaMemcpy(u0, hU0, size, cudaMemcpyHostToDevice);
cudaMemcpy(u1, hU1, size, cudaMemcpyHostToDevice);
for (it=0; it<nt; it++) {
fd<<<1,nx>>>(u0, u1, u2, nx);
update<<<1,nx>>>(u0, u1, u2);
}
cudaMemcpy(hU0, u2, size, cudaMemcpyDeviceToHost);
FILE *file = fopen("u.dat","w");
fwrite(hU0, sizeof(float), nx, file);
fclose(file);
return 0;
}
|
8,508 | #include <iostream>
int main() {
cudaDeviceProp devProp;
cudaGetDeviceProperties(&devProp, 0);
std::cout << devProp.major * 10 + devProp.minor
<< ";" << devProp.multiProcessorCount;
}
|
8,509 | #include <stdio.h>
__device__ int x;
__global__ void unaligned_kernel(void) { *(int*) ((char*)&x + 1) = 42; }
__device__ void out_of_bounds_function(void) { *(int*) 0x87654320 = 42; }
__global__ void out_of_bounds_kernel(void) { out_of_bounds_function(); }
void run_unaligned(void) { printf("Running unaligned_kernel\n"); unaligned_kernel<<<1,1>>>(); printf("Ran unaligned_kernel: %s\n", cudaGetErrorString(cudaGetLastError())); printf("Sync: %s\n", cudaGetErrorString(cudaThreadSynchronize())); }
void run_out_of_bounds(void) { printf("Running out_of_bounds_kernel\n"); out_of_bounds_kernel<<<1,1>>>(); printf("Ran out_of_bounds_kernel: %s\n", cudaGetErrorString(cudaGetLastError())); printf("Sync: %s\n", cudaGetErrorString(cudaThreadSynchronize())); }
int main() { int *devMem; printf("Mallocing memory\n"); cudaMalloc((void**)&devMem, 1024); run_unaligned(); run_out_of_bounds(); cudaDeviceReset(); cudaFree(devMem); return 0; }
|
8,510 | __device__ double atomicAddD(double* address, double val)
{
unsigned long long int* address_as_ull =
(unsigned long long int*)address;
unsigned long long int old = *address_as_ull, assumed;
do {
assumed = old;
old = atomicCAS(address_as_ull, assumed,
__double_as_longlong(val +
__longlong_as_double(assumed)));
} while (assumed != old);
return __longlong_as_double(old);
} |
8,511 | #include <stdio.h>
#define N 10000000
#define numThread 2
#define numBlock 200
__global__ void add( int *a, int *b, int *c ) {
int tid = blockDim.x * blockIdx.x + threadIdx.x;
while (tid < N) {
c[tid] = a[tid] + b[tid];
tid += blockDim.x;
}
}
int main( void ) {
int *a, *b, *c; // The arrays on the host CPU machine
int *dev_a, *dev_b, *dev_c; // The arrays for the GPU device
a = (int*)malloc( N * sizeof(int) );
b = (int*)malloc( N * sizeof(int) );
c = (int*)malloc( N * sizeof(int) );
for (int i=0; i<N; i++) {
a[i] = i;
b[i] = i;
}
cudaMalloc( (void**)&dev_a, N * sizeof(int) );
cudaMalloc( (void**)&dev_b, N * sizeof(int) );
cudaMalloc( (void**)&dev_c, N * sizeof(int) );
cudaMemcpy( dev_a, a, N * sizeof(int),
cudaMemcpyHostToDevice );
cudaMemcpy( dev_b, b, N * sizeof(int),
cudaMemcpyHostToDevice );
add<<<numBlock,numThread>>>( dev_a, dev_b, dev_c );
cudaMemcpy( c, dev_c, N * sizeof(int),
cudaMemcpyDeviceToHost );
bool success = true;
int total=0;
printf("Checking %d values in the array.\n", N);
for (int i=0; i<N; i++) {
if ((a[i] + b[i]) != c[i]) {
printf( "Error: %d + %d != %d\n", a[i], b[i], c[i] );
success = false;
}
total += 1;
}
if (success) printf( "We did it, %d values correct!\n", total );
free( a );
free( b );
free( c );
cudaFree( dev_a );
cudaFree( dev_b );
cudaFree( dev_c );
return 0;
}
|
8,512 | #include<stdio.h>
#include<cuda.h>
__global__ void dkernel(){
printf("hello world from %d\n",threadIdx.x);
}
int main()
{
dkernel<<<1,8>>>();
cudaDeviceSynchronize();
return 0;
}
|
8,513 | #include<stdio.h>
#include<stdlib.h>
#include<cuda.h>
#define pi 3.14159265359
#if __CUDA_ARCH__ < 600
__device__ double katomicAdd(double* address, double val)
{
unsigned long long int* address_as_ull = (unsigned long long int*)address;
unsigned long long int old = *address_as_ull, assumed;
do { assumed = old; old = atomicCAS(address_as_ull, assumed,
__double_as_longlong(val
+ __longlong_as_double(assumed)));
}while (assumed != old);
return __longlong_as_double(old);
}
#endif
//--------------Determinant and Inverse Code Start HERE-----------------------
__host__ __device__ void findcofact(double*A, double *cofact ,int row ,int col,int dim )
{
int kl =0;
for(int pp =0;pp<dim*dim;pp++) //iterating over all the elements
{
if(((pp%dim)!=col)&&(pp/dim!=row) ) //pick the ones who are not in same row and columns as A[i] is
{
cofact[kl] = A[pp]; //just copying from main matrix to cofactor matrix
kl = kl+1;
}
}//end of for loop
}
/*-------To find determinant of matrix--------*/
__host__ __device__ double determinant(double *A,int dim)
{ double *cofact = new double [dim*dim];
int sign = 1;
double det = 0;
if (dim==1)
{det = A[0];
}//end of if
else
{
for (int i = 0 ; i<dim;i++) // we use first row
{
findcofact(A,cofact,0 , i ,dim);
if (((i/dim)+(i%dim))%2!=0)
{ sign = -1;
}
else
{
sign = 1;
} //end of else
det = det + sign*determinant(cofact,dim-1)*A[i];
}//end of for
}//end of else
delete cofact;
return det;
}
/*-------To find adjoint of matrix--------*/
__host__ __device__ void findAdjoint(double *A ,double *adjoint ,int dim )
{ int index = 0; int sign =0 ;
for (int i =0 ;i <dim*dim;i++) // find cofactor of all elements and place it on adjoint matrix with sign
{ if (((i/dim)+(i%dim))%2!=0)
{
sign = -1;
}//end of if
else
{
sign = 1;
}// end of else
double *cofact = new double [dim*dim];
findcofact(A,cofact,i/dim,i%dim,dim);
adjoint [index++] = sign*determinant (cofact,dim-1);
delete cofact;
}//end of for
/*----for transposing ---*/
for (int jj =0 ;jj<dim;jj++)
{
for (int ii=jj;ii<dim;ii++)
{
double temp = adjoint[jj*dim+ii];
adjoint[jj*dim+ii] = adjoint[ii*dim+jj];
adjoint[ii*dim+jj] = temp;
}
}//end of for
}
/*-------To find inverse of matrix--------*/
__host__ __device__ double getInverse(double *A,int dim, double *invA)
{
double* adjoint = new double [dim*dim];
double x = determinant(A,dim);
findAdjoint(A,adjoint,dim);
//for (int i =0 ;i <d*d;i++)
//{
// printf("%f ",adjoint[i]);
//}
for (int i =0 ;i <dim*dim;i++)
{ invA[i] = adjoint[i]/x;
if(invA[i]== -0)
invA[i] = 0;
}
delete adjoint;
return x;
}//end of function
//--------------Determinant and Inverse Code End Here-------------------------
__device__ double pdf(double* point, double *mean, double *Invcov,double det, int dim){
double lo = pow(2*pi,dim/(2.0))*sqrt(det);
double* res = new double[dim];
for(int i=0;i<dim;i++){
res[i] = point[i] - mean[i];
}
double* val = new double[dim];
for(int i=0;i<dim;i++){
val[i] = 0;
for(int j=0;j<dim;j++){
val[i] = val[i] + res[j]*Invcov[j*dim + i];
}
}
double up = 0;
for(int i=0;i<dim;i++){
up = up + val[i]*res[i];
}
up = (-0.5)*up;
up = exp(up);
delete val;
delete res;
return (up/lo);
}
__global__ void likeli(double *d_point,int n,int dim,int kl ,double *d_mixK,double *d_mean,double *d_cov,double* det,double* invCov,double* d_like)
{
int id = threadIdx.x + blockDim.x*blockIdx.x;
if(id<n){
double sum = 0;
for(int i=0;i<kl;i++){
sum = sum + d_mixK[i]*pdf(&d_point[id*dim],&d_mean[i*dim],&invCov[i*dim*dim],det[i],dim);
}
d_like[id]= sum;
}
}// end of kernel
int main (int argc, char ** argv)
{ freopen(argv[3],"w",stdout); // output willl be saved in thi s file
FILE *file = fopen(argv[1], "r");
int kl;int dim ;
int i =0 ;
fscanf(file,"%d",&kl);
fscanf(file,"%d",&dim);
double *h_mixK = (double *)malloc(kl*sizeof(double));
double *h_mean =(double *)malloc(kl*dim*sizeof(double));
double *h_cov=(double *)malloc(kl*dim*dim*sizeof(double));
double *det = (double*) calloc(kl,sizeof(double));
double *h_invMat = (double*) calloc(kl*dim*dim,sizeof(double));
int j = 0;
for(j = 0 ;j<kl;j++){
fscanf(file,"%lf",&h_mixK[j]);
}
for(j = 0 ;j<kl*dim;j++){
fscanf(file,"%lf",&h_mean[j]);
}
for(j = 0 ;j<kl*dim*dim;j++){
fscanf(file,"%lf",&h_cov[j]);
}
fclose(file);
file = fopen(argv[2], "r"); //this file will contain testing data
int n ;
fscanf(file, "%d", &n); //to find the number of points in d file
double *h_points = (double *)malloc(n*dim*sizeof(double));
for(int ii =0 ;ii<n*dim ;ii++){
fscanf(file,"%lf",&h_points[ii]);
}
int threads =0; int blocks =0 ;
if(n<=1024)
{
threads = n;
blocks = 1;
}
else
{
threads = 1024;
blocks = ceil(n/(1024.0));
}
double *h_like = (double*) calloc(n,sizeof(double));
double *d_point, *d_mixK, *d_mean, *d_cov,*d_det,*d_invMat,*d_like;
cudaMalloc(&d_det,kl*sizeof(double));
cudaMalloc(&d_point,n*dim*sizeof(double));
cudaMalloc(&d_mixK ,kl*sizeof(double));
cudaMalloc(&d_mean ,kl*dim*sizeof(double));
cudaMalloc(&d_cov ,kl*dim*dim*sizeof(double));
cudaMalloc(&d_det ,kl*sizeof(double));
cudaMalloc(&d_invMat,kl*dim*dim*sizeof(double));
cudaMalloc(&d_like,n*sizeof(double));
cudaMemcpy(d_point,h_points,n*dim*sizeof(double),cudaMemcpyHostToDevice);
cudaMemcpy(d_mixK,h_mixK,kl*sizeof(double),cudaMemcpyHostToDevice);
cudaMemcpy(d_mean,h_mean,kl*dim*sizeof(double),cudaMemcpyHostToDevice);
cudaMemcpy(d_cov,h_cov,kl*dim*dim*sizeof(double),cudaMemcpyHostToDevice);
for(i=0;i<kl;i++){
det[i] = determinant(&h_cov[i*dim*dim],dim);
if(det[i]==0.0){
for (int l =0 ;l<dim;l++){
h_cov[i*dim*dim + dim*l + l] = h_cov[i*dim*dim + dim*l + l]+1; //adding 1 to diagonal elements
}
}
det[i] = getInverse(&h_cov[i*dim*dim],dim,&h_invMat[i*dim*dim]);
}
cudaMemcpy(d_invMat,h_invMat,kl*dim*dim*sizeof(double),cudaMemcpyHostToDevice);
cudaMemcpy(d_det,det,kl*sizeof(double),cudaMemcpyHostToDevice);
likeli<<<blocks,threads>>>(d_point,n,dim,kl,d_mixK,d_mean,d_cov,d_det,d_invMat,d_like);
cudaDeviceSynchronize();
cudaMemcpy(h_like,d_like,n*sizeof(double),cudaMemcpyDeviceToHost);
printf("%d\n",n);// to print no. of points
for(int i = 0; i <n;i++){
printf("%f\n",h_like[i]);
}
return 0 ;
}
|
8,514 | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define BIN_COUNT 256 /* Size of histogram and LUT */
#define BLOCK_THREADS 256 /* Threads per block */
#define NUM_OF_CUTS 4 /* Number of blocks to "cut" the src_image in */
#define STREAMS 2 /* Number of streams */
#define NUM_OF_BLOCKS 1000 /* Number of thread blocks */
#define CEIL(x,y) (((x) + (y) - 1) / (y))
#define cudaCheckError() { \
cudaError_t error=cudaGetLastError(); \
if(error!=cudaSuccess) { \
printf("ERROR IN CUDA %s:%d: '%s'\n",__FILE__,__LINE__,cudaGetErrorString(error)); \
cudaDeviceReset(); \
exit(EXIT_FAILURE); \
} \
}
typedef struct{
int w;
int h;
unsigned char * img;
} PGM_IMG;
__device__ __constant__ int d_lut[BIN_COUNT]; /* LUT in device memory, fast because small size */
__device__ __constant__ int d_hist[BIN_COUNT]; /* Histogram in device memory */
/* Kernel for histogram creation in GPU.
* Arguments:
* - d_buff_hist: intermediate buffer to store subhistograms, size = NUM_OF_BLOCKS * BIN_COUNT
* - d_img_in: src image located in global device memory
* - img_size: total image size (widht*height)
* - nbr_bin: number of bins in histogram (== BIN_COUNT)
*/
__global__ void kernelHistogram(int * d_buff_hist, unsigned char * d_img_in, int img_size, int nbr_bin){
/* One thread for every position of image */
unsigned long int i = threadIdx.x + blockIdx.x * blockDim.x;
/* Stride for accesses on src image */
unsigned long int offset = blockDim.x * gridDim.x;
/* Histogram in shared memory */
__shared__ int shareHist[BIN_COUNT];
/* Initialize shared memory */
shareHist[threadIdx.x] = 0;
__syncthreads();
while(i < img_size){
atomicAdd(&shareHist[d_img_in[i]],1);
i+=offset;
}
__syncthreads();
/* Store subhistograms in global memory, where they will be used in another kernel to form final histogram */
d_buff_hist[blockIdx.x * nbr_bin + threadIdx.x] = shareHist[threadIdx.x];
}
/* Kernel for subhistogram merging.
* Arguments:
* - d_hist_out: final histogram
* - d_hist_in: matrix of subhistograms
* - blocks: number of blocks (== NUM_OF_BLOCKS)
* - nbr_bin: number of bins (== BIN_COUNT)
*/
__global__ void AddHistograms(int *d_hist_out, int *d_hist_in, int blocks, int nbr_bin){
int i = threadIdx.x;
int sum = 0;
int j;
/* Thread-level sums for each "luminocity" of final histogram */
for(j=0; j < blocks; j++){
sum += d_hist_in[j*nbr_bin + i];
}
d_hist_out[i] = sum;
}
/* Kernel for calculating LookUpTable for final image creation
* Arguments:
* - lut_out: final LookUpTable
* - nbr_bin: number of histogram bins (== BIN_COUNT)
* - min: minimum value in histogram
*/
__global__ void lutCalculate(int *lut_out,int nbr_bin,int d,int min){
int i = threadIdx.x;
int j,cdf = 0;
/* Calculate CDF values for each thread. Does introduce divergence, but is overall fast because of histogram size */
for(j=0; j < i+1; j++) {
cdf += d_hist[j];
}
lut_out[i] = (int)(((float)cdf-min)*255/d + 0.5);
if(lut_out[i] < 0){
lut_out[i] = 0;
}
else if(lut_out[i] > 255){
lut_out[i] = 255;
}
}
/* Kernel for reconstructing the image.
* Arguments:
* - img_in: original image in global memory
* - img_out: final reconstructed image
* - img_size: total size of image
*/
__global__ void imageCreate(unsigned char *img_in , unsigned char *img_out, int img_size) {
unsigned long int i = threadIdx.x + blockIdx.x * blockDim.x;
unsigned long int offset = blockDim.x * gridDim.x;
while(i < img_size){
img_out[i] = (unsigned char)d_lut[img_in[i]];
i+=offset;
}
}
/* CPU API to GPU histogram kernel.
* arguments:
* - img_in: source image, (memcpy host 2 device)
* - img_out: final reconstructed image
* - img_size: total size of image (like a stripe)
* - nbr_bin: number of bins in histogram (here every possible grayscale value is a bin)
*/
void d_contrast_enhancement(unsigned char *img_in, unsigned char *img_out ,int img_size, int nbr_bin)
{
unsigned char * d_img_in_stream0;
unsigned char * d_img_in_stream1;
unsigned char * d_img_out_stream0;
unsigned char * d_img_out_stream1;
int * hist_out; /* Host memory final histogram */
int * d_buff_hist; /* intermediate collection of subhistograms */
int * d_hist_out; /* Final histogram */
int * d_lut_calc;
cudaStream_t stream0, stream1;
int i;
int new_img_size = img_size/NUM_OF_CUTS;
int mod = img_size % NUM_OF_CUTS;
int min=0;
int d;
cudaStreamCreate(&stream0);
cudaStreamCreate(&stream1);
cudaMallocHost((void**)&hist_out, BIN_COUNT*sizeof(int));
/* Set dim3 variables */
dim3 threads_per_block(BLOCK_THREADS, 1, 1);
dim3 blocks_in_grid(NUM_OF_BLOCKS, 1, 1);
dim3 threads_per_block_Add(nbr_bin,1,1);
dim3 blocks_in_grid_Add(1,1,1);
/* Allocate d_img_in and d_hist_out to pinned memory */
cudaMallocManaged((void**)&d_img_in_stream0, sizeof(unsigned char)*new_img_size);
cudaMallocManaged((void**)&d_img_in_stream1, sizeof(unsigned char)*(new_img_size+mod));
cudaMallocManaged((void**)&d_buff_hist, nbr_bin*sizeof(int)*NUM_OF_BLOCKS*NUM_OF_CUTS);
cudaMallocManaged((void**)&d_hist_out, nbr_bin*sizeof(int));
cudaCheckError();
for(i=0; i < NUM_OF_CUTS; i += STREAMS) {
cudaMemcpyAsync(d_img_in_stream0, &img_in[i*new_img_size], sizeof(unsigned char)*new_img_size, cudaMemcpyHostToDevice,stream0);
if (mod != 0 && i+1 == NUM_OF_CUTS - 1) {
cudaMemcpyAsync(d_img_in_stream1, &img_in[(i+1)*new_img_size], sizeof(unsigned char)*(new_img_size+mod), cudaMemcpyHostToDevice,stream1);
cudaDeviceSynchronize();
cudaCheckError();
}
else {
cudaMemcpyAsync(d_img_in_stream1, &img_in[(i+1)*new_img_size], sizeof(unsigned char)*new_img_size, cudaMemcpyHostToDevice,stream1);
cudaDeviceSynchronize();
cudaCheckError();
}
kernelHistogram<<<blocks_in_grid, threads_per_block, 0, stream0>>>(&d_buff_hist[i*NUM_OF_BLOCKS*nbr_bin], d_img_in_stream0, new_img_size, nbr_bin);
cudaDeviceSynchronize();
cudaCheckError();
if (mod != 0 && i+1 == NUM_OF_CUTS - 1) {
kernelHistogram<<<blocks_in_grid, threads_per_block, 0, stream1>>>(&d_buff_hist[(i+1)*NUM_OF_BLOCKS*nbr_bin], d_img_in_stream1, new_img_size+mod, nbr_bin);
cudaDeviceSynchronize();
cudaCheckError();
}
else {
kernelHistogram<<<blocks_in_grid, threads_per_block, 0, stream1>>>(&d_buff_hist[(i+1)*NUM_OF_BLOCKS*nbr_bin], d_img_in_stream1, new_img_size, nbr_bin);
cudaDeviceSynchronize();
cudaCheckError();
}
}
cudaDeviceSynchronize();
cudaCheckError();
AddHistograms<<<blocks_in_grid_Add,threads_per_block_Add>>>(d_hist_out,d_buff_hist, NUM_OF_BLOCKS*NUM_OF_CUTS , nbr_bin);
cudaDeviceSynchronize();
cudaCheckError();
cudaMemcpy(hist_out, d_hist_out, nbr_bin*sizeof(int), cudaMemcpyDeviceToHost);
cudaCheckError();
i=0;
while(min == 0){
min = hist_out[i++];
}
d = img_size - min;
cudaMallocManaged((void**)&d_lut_calc, nbr_bin*sizeof(int));
cudaCheckError();
cudaMemcpyToSymbol(d_hist,d_hist_out,nbr_bin*sizeof(int),0,cudaMemcpyDeviceToDevice);
cudaCheckError();
lutCalculate<<<blocks_in_grid_Add,threads_per_block_Add>>>(d_lut_calc,nbr_bin,d,min);
cudaMallocManaged((void**)&d_img_out_stream0, sizeof(unsigned char)*new_img_size);
cudaCheckError();
cudaMallocManaged((void**)&d_img_out_stream1, sizeof(unsigned char)*new_img_size);
cudaCheckError();
cudaMemcpyToSymbol(d_lut,d_lut_calc,nbr_bin*sizeof(int),0,cudaMemcpyDeviceToDevice);
cudaCheckError();
for(i=0; i < NUM_OF_CUTS; i += STREAMS) {
cudaMemcpyAsync(d_img_in_stream0, &img_in[i*new_img_size], sizeof(unsigned char)*new_img_size, cudaMemcpyHostToDevice,stream0);
cudaMemcpyAsync(d_img_in_stream1, &img_in[(i+1)*new_img_size], sizeof(unsigned char)*new_img_size, cudaMemcpyHostToDevice,stream1);
imageCreate<<<blocks_in_grid, threads_per_block, 0, stream0>>>(d_img_in_stream0, d_img_out_stream0, new_img_size);
imageCreate<<<blocks_in_grid, threads_per_block, 0, stream1>>>(d_img_in_stream1, d_img_out_stream1, new_img_size);
cudaMemcpyAsync(&img_out[i*new_img_size], d_img_out_stream0, sizeof(unsigned char)*new_img_size, cudaMemcpyDeviceToHost,stream0);
cudaMemcpyAsync(&img_out[(i+1)*new_img_size], d_img_out_stream1, sizeof(unsigned char)*new_img_size, cudaMemcpyDeviceToHost,stream1);
}
cudaDeviceSynchronize();
cudaCheckError();
/* Free all CUDA memory */
cudaFree(d_img_in_stream0);
cudaFree(d_img_in_stream1);
cudaFree(d_img_out_stream0);
cudaFree(d_img_out_stream1);
cudaFree(d_buff_hist);
cudaFree(d_hist_out);
cudaFree(d_lut_calc);
cudaFree(hist_out);
}
PGM_IMG contrast_enhancement_g(PGM_IMG img_in)
{
PGM_IMG result;
result.w = img_in.w;
result.h = img_in.h;
cudaMallocHost((void**)&result.img, result.w * result.h * sizeof(unsigned char));
d_contrast_enhancement(img_in.img, result.img ,img_in.h * img_in.w, BIN_COUNT);
return result;
}
PGM_IMG read_pgm(const char * path){
FILE * in_file;
char sbuf[256];
PGM_IMG result;
int v_max;//, i;
in_file = fopen(path, "r");
if (in_file == NULL){
printf("Input file not found!\n");
exit(1);
}
fscanf(in_file, "%s", sbuf); /*Skip the magic number*/
fscanf(in_file, "%d",&result.w);
fscanf(in_file, "%d",&result.h);
fscanf(in_file, "%d\n",&v_max);
printf("Image size: %d x %d\n", result.w, result.h);
/* For GPU purpose */
cudaMallocHost((void**)&result.img, result.w * result.h * sizeof(unsigned char));
cudaCheckError();
fread(result.img,sizeof(unsigned char), result.w*result.h, in_file);
fclose(in_file);
return result;
}
void write_pgm(PGM_IMG img, const char * path){
FILE * out_file;
out_file = fopen(path, "wb");
fprintf(out_file, "P5\n");
fprintf(out_file, "%d %d\n255\n",img.w, img.h);
fwrite(img.img,sizeof(unsigned char), img.w*img.h, out_file);
fclose(out_file);
}
void free_pgm(PGM_IMG img)
{
cudaFree(img.img);
}
void run_gpu_gray_test(PGM_IMG img_in, char *out_filename);
void run_gpu_gray_test(PGM_IMG img_in, char *out_filename)
{
unsigned int timer = 0;
PGM_IMG img_obuf;
printf("Starting GPU processing...\n");
img_obuf = contrast_enhancement_g(img_in);
write_pgm(img_obuf, out_filename);
free_pgm(img_obuf);
}
int main(int argc, char *argv[]){
PGM_IMG img_ibuf_g;
if (argc != 3) {
printf("Run with input file name and output file name as arguments\n");
exit(1);
}
printf("Running contrast enhancement for gray-scale images.\n");
img_ibuf_g = read_pgm(argv[1]);
run_gpu_gray_test(img_ibuf_g, argv[2]);
free_pgm(img_ibuf_g);
cudaDeviceReset();
return 0;
}
|
8,515 | #include <cuda.h>
#include <cuda_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#define DIV_UP(x,y) (1 + ((x - 1) / y))
__global__ void sum_kernel(int n, float const*const ptr, float *const out) {
extern __shared__ float sum[];
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (threadIdx.x == 0){
sum[0] = 0;
}
__syncthreads();
if(i < n){
atomicAdd(sum, ptr[i]);
}
__syncthreads();
if (threadIdx.x == 0){
printf("Block %d, sum = %f\n", blockIdx.x, sum[0]);
}
__syncthreads();
if (threadIdx.x == 0){
atomicAdd(out, sum[0]);
}
}
int main(int argc, char** argv) {
int n = argc == 2 ? atoi(argv[1]) : 10000;
float *const ptr = (float*) malloc(sizeof(float) * n);
float* out = (float*) malloc(sizeof(float));
*out = 0;
float *d_ptr, *d_out;
cudaMalloc((void**)&d_ptr, sizeof(float) * n);
cudaMalloc((void**)&d_out, sizeof(float));
for (int i = 0; i < n; i++){
ptr[i] = 1.0 + (2.6458 / (float)((i+20)%1024+1));
}
float check = 0.0;
for (int i = 0; i < n; i++) check += ptr[i];
for (int i = 0; i < n; i++) ptr[i] /= check;
cudaMemcpy(d_ptr, ptr, sizeof(float) * n, cudaMemcpyHostToDevice);
cudaMemcpy(d_out, out, sizeof(float), cudaMemcpyHostToDevice);
sum_kernel<<<DIV_UP(n, 1024), 1024, 100*sizeof(float)>>>(n, d_ptr, d_out);
cudaMemcpy(out, d_out, sizeof(float), cudaMemcpyDeviceToHost);
check = 0.0;
for (int i = 0; i < n; i++) check += ptr[i];
printf("CPU : %f\n", check);
printf("GPU : %f\n", *out);
printf("DIFF: %.15f\n", check-*out);
return 0;
}
|
8,516 | #include <stdio.h>
#include <assert.h>
#include <cuda.h>
#include <cuda_runtime.h>
cudaDeviceProp deviceProps;
bool cuInit()
{
bool res = true;
int device = 0;
cudaError_t err = cudaGetDevice( &device );
if( err != cudaSuccess )
{
printf("%s\n", cudaGetErrorString(err));
res = false;
return res;
}
printf(" Device Count: %d\n", device+1 );
for(int i = 0; i <= device; i++)
{
cudaGetDeviceProperties(&deviceProps, device);
printf(" Device Number: %d\n", i);
printf(" Device name: %s\n", deviceProps.name);
printf(" Memory Clock Rate (KHz): %d\n", deviceProps.memoryClockRate);
printf(" Memory Bus Width (bits): %d\n", deviceProps.memoryBusWidth );
printf(" Peak Memory Bandwidth (GB/s): %f\n\n",
2.0*deviceProps.memoryClockRate*(deviceProps.memoryBusWidth/8)/1.0e6);
printf(" Max Threads per Block: %d\n", deviceProps.maxThreadsPerBlock );
}
// Select CUDA device
cudaSetDevice(0);
return res;
}
//******************************************************************************************************
// !!! Exemple DO NOT TOCH !!!!!
//__global__ void findMean(unsigned int dataForBlock, float *inputData, float *results)
//{
// int index = blockIdx.x * blockDim.x + threadIdx.x;
// float result = 0;
// for (int i = 0; i < dataForBlock; i++)
// {
// result += inputData[index * dataForBlock + i];
// }
// result /= dataForBlock;
// results[index] = result;
//}
//void processWithGPU(float *blocks, float *results, unsigned int blockSize, unsigned int blocksCount)
//{
// unsigned int realDataCount = blockSize * blocksCount;
// cudaSetDevice(0);
// float *deviceInputData,
// *deviceResults;
// cudaMalloc( (void**)&deviceInputData, realDataCount * sizeof(float) );
// cudaMalloc( (void**)&deviceResults, realDataCount * sizeof(float) );
// cudaMemcpy( deviceInputData, blocks, realDataCount * sizeof(float), cudaMemcpyHostToDevice );
// findMean<<<1, blocksCount>>>( blockSize, deviceInputData, deviceResults );
// cudaMemcpy( (void*)results, deviceResults, blocksCount * sizeof(float), cudaMemcpyDeviceToHost );
// cudaFree(deviceInputData);
// cudaFree(deviceResults );
//}
//********************************************************************************************************
// Build Image
__global__ void cuBuildImageKernel( float* source, float* dest )
{
int x = blockIdx.x;
int y = blockIdx.y;
int offset = x + y * gridDim.x;
float* s = source + ( y * (gridDim.x * 2 ) * 2 + x * 2);
float t_[4], t_sume, t_result;
// Save temp values
t_[0] = s[0];
t_[1] = s[1];
t_[2] = s[ gridDim.x * 2];
t_[3] = s[1+gridDim.x * 2];
// Calculate sum
t_sume = t_[0] + t_[1] + t_[2] + t_[3];
// Calculate result
t_result = t_sume * 0.25;
dest[offset] = ( s[ 0 ] +
s[ 1 ] +
s[ gridDim.x * 2 ] +
s[ gridDim.x * 2 + 1] ) * 0.25f;
}
void cuBuildImage( const float* source, int sourceWidth, int sourceHeight,
const float* dest, int destWidth, int destHeight )
{
int sourceBuffLength = sourceWidth * sourceHeight;
int destBuffLength = destWidth * destHeight;
// Reserving memory on GPU
float *sourceBuff,
*destBuff;
cudaMalloc( (void**)&sourceBuff, sourceBuffLength * sizeof(float) );
cudaMalloc( (void**)&destBuff, destBuffLength * sizeof(float) );
// Copy input buffer
cudaMemcpy( sourceBuff, source, sourceBuffLength * sizeof(float), cudaMemcpyHostToDevice );
dim3 grid( destWidth, destHeight );
cuBuildImageKernel<<<grid, 1>>>( sourceBuff, destBuff );
cudaMemcpy( (void*)dest, destBuff, destBuffLength * sizeof(float), cudaMemcpyDeviceToHost );
cudaFree( sourceBuff );
cudaFree( destBuff );
}
//********************************************************************************************************
// Build Gradient
//__global__ void cuBuildGradientsKernel()
//{
//}
//void cuBuildGradients(const float* )
//{
// const float* img_pt = data.image[level] + width;
// const float* img_pt_max = data.image[level] + width * (height-1);
// float* gradxyii_pt = data.gradients[level] + width;
// // in each iteration i need -1,0,p1,mw,pw
// float val_m1 = *(img_pt-1);
// float val_00 = * img_pt;
// float val_p1;
// for(; img_pt < img_pt_max; img_pt++, gradxyii_pt++)
// {
// val_p1 = *(img_pt+1);
// *( (float*)gradxyii_pt +0) = 0.5f*(val_p1 - val_m1);
// *(((float*)gradxyii_pt)+1) = 0.5f*(*(img_pt+width) - *(img_pt-width));
// *(((float*)gradxyii_pt)+2) = val_00;
// val_m1 = val_00;
// val_00 = val_p1;
// }
//}
//********************************************************************************************************
// Build MaxGradient
//__global__ void cuBuildMaxGradientsKernel()
//{
//}
//void buildMaxGradients(int level)
//{
// float* maxGradTemp = FrameMemory::getInstance().getFloatBuffer(width * height);
// // 1. write abs gradients in real data.
// Eigen::Vector4f* gradxyii_pt = data.gradients[level] + width;
// float* maxgrad_pt = data.maxGradients[level] + width;
// float* maxgrad_pt_max = data.maxGradients[level] + width*(height-1);
// for(; maxgrad_pt < maxgrad_pt_max; maxgrad_pt++, gradxyii_pt++ )
// {
// float dx = *( (float*)gradxyii_pt);
// float dy = *(1+(float*)gradxyii_pt);
// *maxgrad_pt = sqrtf(dx*dx + dy*dy);
// }
// // 2. smear up/down direction into temp buffer
// maxgrad_pt = data.maxGradients[level] + width+1;
// maxgrad_pt_max = data.maxGradients[level] + width*(height-1)-1;
// float* maxgrad_t_pt = maxGradTemp + width+1;
// for(;maxgrad_pt<maxgrad_pt_max; maxgrad_pt++, maxgrad_t_pt++ )
// {
// float g1 = maxgrad_pt[-width];
// float g2 = maxgrad_pt[0];
// if(g1 < g2)
// g1 = g2;
// float g3 = maxgrad_pt[width];
// if(g1 < g3)
// *maxgrad_t_pt = g3;
// else
// *maxgrad_t_pt = g1;
// }
// float numMappablePixels = 0;
// // 2. smear left/right direction into real data
// maxgrad_pt = data.maxGradients[level] + width+1;
// maxgrad_pt_max = data.maxGradients[level] + width*(height-1)-1;
// maxgrad_t_pt = maxGradTemp + width+1;
// for(;maxgrad_pt<maxgrad_pt_max; maxgrad_pt++, maxgrad_t_pt++ )
// {
// float g1 = maxgrad_t_pt[-1];
// float g2 = maxgrad_t_pt[0];
// if(g1 < g2)
// g1 = g2;
// float g3 = maxgrad_t_pt[1];
// if(g1 < g3)
// {
// *maxgrad_pt = g3;
// if(g3 >= MIN_ABS_GRAD_CREATE)
// numMappablePixels++;
// }
// else
// {
// *maxgrad_pt = g1;
// if(g1 >= MIN_ABS_GRAD_CREATE)
// numMappablePixels++;
// }
// }
// if(level==0)
// this->numMappablePixels = numMappablePixels;
// FrameMemory::getInstance().returnBuffer(maxGradTemp);
//}
//********************************************************************************************************
//__global__ void cuBuildIDepthAndIDepthVarKernel()
//{
//}
//// Build IDepth And IDepth Var
//void buildIDepthAndIDepthVar( int level )
//{
// int sw = data.width[level - 1];
// const float* idepthSource = data.idepth [level - 1];
// const float* idepthVarSource = data.idepthVar[level - 1];
// float* idepthDest = data.idepth [level];
// float* idepthVarDest = data.idepthVar[level];
// for( int y = 0; y < height; y++ )
// {
// for( int x = 0; x < width; x++ )
// {
// int idx = 2 * ( x + y * sw );
// int idxDest = ( x + y * width );
// float idepthSumsSum = 0;
// float ivarSumsSum = 0;
// int num = 0;
// // build sums
// float ivar;
// float var = idepthVarSource[idx];
// if( var > 0 )
// {
// ivar = 1.0f / var;
// ivarSumsSum += ivar;
// idepthSumsSum += ivar * idepthSource[idx];
// num++;
// }
// var = idepthVarSource[ idx + 1 ];
// if( var > 0 )
// {
// ivar = 1.0f / var;
// ivarSumsSum += ivar;
// idepthSumsSum += ivar * idepthSource[ idx + 1 ];
// num++;
// }
// var = idepthVarSource[ idx + sw ];
// if( var > 0 )
// {
// ivar = 1.0f / var;
// ivarSumsSum += ivar;
// idepthSumsSum += ivar * idepthSource[ idx + sw ];
// num++;
// }
// var = idepthVarSource[ idx + sw + 1 ];
// if( var > 0 )
// {
// ivar = 1.0f / var;
// ivarSumsSum += ivar;
// idepthSumsSum += ivar * idepthSource[ idx + sw + 1 ];
// num++;
// }
// if(num > 0)
// {
// float depth = ivarSumsSum / idepthSumsSum;
// idepthDest [ idxDest ] = 1.0f / depth;
// idepthVarDest[ idxDest ] = num / ivarSumsSum;
// }
// else
// {
// idepthDest [ idxDest ] = -1;
// idepthVarDest[ idxDest ] = -1;
// }
// }
// }
//}
|
8,517 |
__device__
const double2 operator-(const double2& vala, const double2& valb) {
return (double2){vala.x - valb.x, vala.y - valb.y};
}
__device__
const double2 operator+(const double2& vala, const double2& valb) {
return (double2){vala.x + valb.x, vala.y + valb.y};
}
__device__
const double2 operator*(const double& vala, const double2& valb) {
return (double2){vala * valb.x, vala * valb.y};
}
__device__
const double2 operator*(const double2& vala, const double& valb) {
return valb * vala;
}
__device__
double2 complex_exp(double2 val) {
return exp(val.x) * (double2){cos(val.y), sin(val.y)};
}
__device__
double pown(double val, unsigned long i) {
unsigned long j;
double ret = val;
for (j = 1; j < i; j++) {
ret = ret * val;
}
return ret;
}
__device__
double complex_mag2(double2 val) {
return pown(val.x, 2) + pown(val.y, 2);
}
__device__
double complex_mag(double2 val) {
return sqrt(complex_mag2(val));
}
__device__
double2 complex_ln(double2 val) {
return (double2){log(complex_mag(val)), atan2(val.y, val.x)};
}
__device__
double2 complex_mult(double2 vala, double2 valb) {
return (double2){vala.x * valb.x - vala.y * valb.y, vala.x * valb.y + vala.y * valb.x};
}
__device__
double2 complex_pow(double2 val, double2 w) {
return complex_exp(complex_mult(w, complex_ln(val)));
}
__device__
double2 complex_pown(double2 val, unsigned long n) {
double2 ret = val;
unsigned long i;
for (i = 1; i < n; i++) {
ret = complex_mult(ret, val);
}
return ret;
}
__device__
double2 complex_divide(double2 vala, double2 valb) {
double diver = 1 / complex_mag2(valb);
return diver * complex_mult(vala, (double2){valb.x, -valb.y});
}
|
8,518 | #include "includes.h"
#define SIZ 20
#define num_inp 4
using namespace std;
typedef struct edge {
int first, second;
} edges;
__global__ void y_batch_kernel(double* y_batch, double * y, int * sample_indices, int size)
{
int i = blockIdx.x;
y_batch[i] = y[sample_indices[i]];
} |
8,519 |
/* This is a automatically generated test. Do not modify */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
__global__
void compute(float comp, int var_1,float var_2,float var_3,float var_4,float var_5,float var_6,float* var_7,float var_8,float var_9,float var_10,float var_11,float var_12,float var_13,float var_14,float var_15,float var_16,float var_17,float var_18,float var_19,float var_20,float var_21,float var_22,float var_23,float var_24,float var_25) {
comp += -0.0f / (+1.2561E-36f * var_2);
float tmp_1 = -1.5926E34f;
comp = tmp_1 + var_3 - var_4 / -1.1094E-35f / (+1.6490E-42f - +1.2148E-44f);
comp += (var_5 + (var_6 * -1.7500E-36f));
for (int i=0; i < var_1; ++i) {
comp += -1.3421E-27f + var_8;
float tmp_2 = +1.1335E34f;
var_7[i] = -1.9658E35f;
comp += var_7[i] / tmp_2 * +1.2695E36f / (-1.7763E-36f / sinhf((+1.4111E34f + var_9 + (var_10 + fmodf(sinf((var_11 * (+1.2423E-36f / -1.1896E-6f))), (var_12 * expf((+1.3143E-42f / (-1.7207E-30f / var_13)))))))));
}
if (comp <= (-1.1836E-3f / var_14 - -1.8748E-37f)) {
comp += +1.8424E-36f - (var_15 * (var_16 - +1.4196E35f * var_17));
float tmp_3 = (+1.7800E10f / -1.7184E3f / +1.5816E-5f - (+1.3587E35f / acosf((var_18 - var_19))));
comp = tmp_3 / (+0.0f - (var_20 * coshf((+1.7935E-43f - fabsf((var_21 / (-1.8991E-37f / var_22)))))));
}
if (comp >= (var_23 + var_24)) {
comp += log10f(+1.1894E-37f / var_25);
}
printf("%.17g\n", comp);
}
float* initPointer(float v) {
float *ret = (float*) malloc(sizeof(float)*10);
for(int i=0; i < 10; ++i)
ret[i] = v;
return ret;
}
int main(int argc, char** argv) {
/* Program variables */
float tmp_1 = atof(argv[1]);
int tmp_2 = atoi(argv[2]);
float tmp_3 = atof(argv[3]);
float tmp_4 = atof(argv[4]);
float tmp_5 = atof(argv[5]);
float tmp_6 = atof(argv[6]);
float tmp_7 = atof(argv[7]);
float* tmp_8 = initPointer( atof(argv[8]) );
float tmp_9 = atof(argv[9]);
float tmp_10 = atof(argv[10]);
float tmp_11 = atof(argv[11]);
float tmp_12 = atof(argv[12]);
float tmp_13 = atof(argv[13]);
float tmp_14 = atof(argv[14]);
float tmp_15 = atof(argv[15]);
float tmp_16 = atof(argv[16]);
float tmp_17 = atof(argv[17]);
float tmp_18 = atof(argv[18]);
float tmp_19 = atof(argv[19]);
float tmp_20 = atof(argv[20]);
float tmp_21 = atof(argv[21]);
float tmp_22 = atof(argv[22]);
float tmp_23 = atof(argv[23]);
float tmp_24 = atof(argv[24]);
float tmp_25 = atof(argv[25]);
float tmp_26 = atof(argv[26]);
compute<<<1,1>>>(tmp_1,tmp_2,tmp_3,tmp_4,tmp_5,tmp_6,tmp_7,tmp_8,tmp_9,tmp_10,tmp_11,tmp_12,tmp_13,tmp_14,tmp_15,tmp_16,tmp_17,tmp_18,tmp_19,tmp_20,tmp_21,tmp_22,tmp_23,tmp_24,tmp_25,tmp_26);
cudaDeviceSynchronize();
return 0;
}
|
8,520 | /*
Date: December 16th, 2016
Authors: Miguel A. Jardines, Tariq Juman
Description: Bisection algorithm and our Bisection in parallel's time complexities are compared aiming optimization in parallel
Uniqnes: This our own work and nobody else's.
*/
// Libraries
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <emmintrin.h>
#include <sys/time.h>
//Used for dividing the intervals of the graph into segments
//and to define number of threads and number of cores.
long N = (2496/(192))*1024;
long doPrint = 0;
struct timeval start, end;
void print(double* a, long N) {
if (doPrint) {
long i;
for (i = 0; i < N; ++i)
printf("%f ", a[i]);
printf("\n");
}
}
//Method used to calculate start time when normal/gpu method is called
void starttime() {
gettimeofday( &start, 0 );
}
//End time when normal/gpu method is finished
void endtime(const char* c) {
gettimeofday( &end, 0 );
double elapsed = ( end.tv_sec - start.tv_sec ) * 1000.0 + ( end.tv_usec - start.tv_usec ) / 1000.0;
printf("%s: %f ms\n", c, elapsed);
}
//Start time, formatting
void init(double* a, long N, const char* c) {
printf("***************** %s **********************\n", c);
print(a, N);
starttime();
}
//Endtime, formatting
void finish(double* a, long N, const char* c) {
endtime(c);
print(a, N);
printf("***************************************************\n");
}
//Host Continuous function over [a,b]
double f (double x) {
return 128 * sin(x/256);
}
//Device Continuous function over [a,b]
__device__ double ff (double x) {
return 128 * sin(x/256);
}
//Device bisection method
__device__ void doBisectionGPU (double a, double b, double t1, long maxNumOfIterations){
double p1 = 0.0;
//Step 1
long i = 0;
// Left y-axis point of current interval [a,b]
double fOfA = ff(a);
//Step 2
while (i <= maxNumOfIterations) {
//Step 3
double p = ((a + b) / 2);
double fOfP = ff(p);
if (fabs((p - p1) / p) < t1 && (p != p1)){
//printf("Iteration no. %3d X = %7.5f\n", i, p);
break;
}
//Step 5
i = i + 1;
//Step 6
if (fOfA * ff(p) > 0) {
a = p;
fOfA = ff(p);
}
else
b = p;
// update p1
p1 = p;
//Step 7
if (i == maxNumOfIterations) {
printf ("Method failed after %ld iterations\n",
maxNumOfIterations);
}
}
}
// Device parallelized N-section method
__global__ void gpu_doBisection(long N, double aStart, double h) {
long element = blockIdx.x*blockDim.x + threadIdx.x;
// As long as element is less than number of threads, step into if statement
if (element < N){
//f(X) times f(Xi+1) = result
double result = ff((aStart+element*h)) * ff((aStart+(element+1)*h));
// Return only negative results indexes
if(result<0){
//Calculate left and right enpoint of negative results at which roots lay.
// Left Xi and Right Xi+1 endpoints for each N
double aSmaller = aStart + (element*h);
double bSmaller = aStart + ((element+1)*h);
doBisectionGPU (aSmaller, bSmaller, 0.0000001, 500);
}
}
}
// Host bisection method
void doBisection (double a, double b, double t1, long maxNumOfIterations1){
double p1 = 0.0;
// Step 1
long i = 0;
double fOfA = f(a);
// Step 2
while (i <= maxNumOfIterations1) {
// Step 3
double p = ((a + b) / 2);
double fOfP = f(p);
if (fabs((p - p1) / p) < t1 && (p != p1)){
//printf("Iteration no. %3ld X = %7.5f\n", i, p);
break;
}
// Step 5
i = i + 1;
// Step 6
if (fOfA * f(p) > 0) {
a = p;
fOfA = f(p);
} else
b = p;
// update p1
p1 = p;
// Step 7: Print the amount of iterations it took to find no root
if (i == maxNumOfIterations1) {
printf ("Method failed after %ld iterations\n",
maxNumOfIterations1);
}
}
}
// Host CPU method
void gpu(long N)
{
//Declaring GPU threads and cores based on N
long numThreads = 1024;
long numCores = N / 1024 + 1;
//Start and end of graph
double aStart = 400;
double b = 1200000000;
//Brake the graph into smaller intervals
double h = (b-aStart)/N;
//Call GPU method
gpu_doBisection<<<numCores, numThreads>>>(N, aStart, h);
cudaDeviceSynchronize();
}
// Host main
int main()
{
double* a;
posix_memalign((void**)&a, 16, N * sizeof(double));
// Test 1: Sequential For Loop
//Start time for normal method
init(a, N, "Normal");
long i;
long counter;
//Normal method to find all roots given a fixed interval
for(i = 400; i < 120000000; i=i+800){
doBisection (i, i+800, 0.0000001, 500);
counter++;
}
//Count roots
printf("There are %ld roots\n",counter);
//End time for normal method
finish(a, N, "Normal");
// Test 2: Vectorization
//Start time for GPU method
init(a, N, "GPU");
//Call GPU
gpu(N);
//End time for GPU method
finish(a, N, "GPU");
return 0;
}
|
8,521 | #include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <cuda_runtime.h>
#include <iostream>
const int INF = 1000000000;
void input(char *inFileName);
void output(char *outFileName);
void block_FW(int B);
int ceil(int a, int b);
void cal(char* d,size_t pitch,int B, int Round, int block_start_x, int block_start_y, int block_width, int block_height);
void cpu(int B, int Round, int block_start_x, int block_start_y, int block_width, int block_height);
int n, m;
static int* d;
double io_time = 0;
double comp_time = 0;
double mem_time = 0;
int main(int argc, char* argv[]) {
auto io_beg = std::chrono::high_resolution_clock::now();
input(argv[1]);
auto io_end = std::chrono::high_resolution_clock::now();
io_time += std::chrono::duration<double>(io_end-io_beg).count();
int B = 192;
block_FW(B);
io_beg = std::chrono::high_resolution_clock::now();
output(argv[2]);
io_end = std::chrono::high_resolution_clock::now();
io_time += std::chrono::duration<double>(io_end-io_beg).count();
// std::cout<< comp_time <<" "<<mem_time<<" "<<io_time;
return 0;
}
void input(char* infile) {
FILE* file = fopen(infile, "rb");
fread(&n, sizeof(int), 1, file);
fread(&m, sizeof(int), 1, file);
d = new int[n*n];
for (int i = 0; i < n; ++ i) {
for (int j = 0; j < n; ++ j) {
if (i == j) {
d[i*n+j] = 0;
} else {
d[i*n+j] = INF;
}
}
}
int pair[3];
for (int i = 0; i < m; ++ i) {
fread(pair, sizeof(int), 3, file);
d[pair[0]*n+pair[1]] = pair[2];
}
fclose(file);
}
void output(char *outFileName) {
FILE *outfile = fopen(outFileName, "w");
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (d[i*n+j] >= INF)
d[i*n+j] = INF;
}
}
fwrite(d, sizeof(int), n*n, outfile);
fclose(outfile);
}
int ceil(int a, int b) {
return (a + b - 1) / b;
}
void block_FW(int B) {
int round = ceil(n, B);
char *device_d;
size_t pitch = sizeof(int)*n;
// cudaMalloc(&device_d,sizeof(int)*n*n);
// cudaMemcpy(device_d,d,sizeof(int)*n*n,cudaMemcpyHostToDevice);
cudaMallocPitch(&device_d,&pitch,sizeof(int)*n,n);
auto mem_beg = std::chrono::high_resolution_clock::now();
cudaMemcpy2D(device_d,pitch,d,sizeof(int)*n,sizeof(int)*n,n,cudaMemcpyHostToDevice);
auto mem_end = std::chrono::high_resolution_clock::now();
mem_time += std::chrono::duration<double>(mem_end-mem_beg).count();
for (int r = 0; r < round; ++r) {
auto comp_beg = std::chrono::high_resolution_clock::now();
/* Phase 1*/
cal(device_d,pitch, B, r, r, r, 1, 1);
// cpu(B, r, r, r, 1, 1);
// cudaMemcpy2D(device_d+r*B*pitch+r*B*sizeof(int),pitch,
// d+r*B*n+r*B,sizeof(int)*n,
// sizeof(int)*B,B,
// cudaMemcpyHostToDevice);
/* Phase 2*/
// #pragma omp parallel
//#pragma omp sections
{
//#pragma omp section
cal(device_d,pitch, B, r, r, 0, r, 1);
//#pragma omp section
cal(device_d,pitch, B, r, r, r +1, round - r -1, 1);
//#pragma omp section
cal(device_d,pitch, B, r, 0, r, 1, r);
//#pragma omp section
cal(device_d,pitch, B, r, r +1, r, 1, round - r -1);
}
/* Phase 3*/
// #pragma omp parallel
//#pragma omp sections
{
//#pragma omp section
cal(device_d,pitch, B, r, 0, 0, r, r);
//#pragma omp section
cal(device_d,pitch, B, r, 0, r +1, round -r -1, r);
//#pragma omp section
cal(device_d,pitch, B, r, r +1, 0, r, round - r -1);
//#pragma omp section
cal(device_d,pitch, B, r, r +1, r +1, round -r -1, round - r -1);
}
auto comp_end = std::chrono::high_resolution_clock::now();
std::cout<< std::chrono::duration<double>(comp_end-comp_beg).count()<<"\n";
}
// cudaStreamSynchronize(0);
mem_beg = std::chrono::high_resolution_clock::now();
cudaMemcpy2DAsync(d,sizeof(int)*n,device_d,pitch,sizeof(int)*n,n,cudaMemcpyDeviceToHost);
mem_end = std::chrono::high_resolution_clock::now();
mem_time += std::chrono::duration<double>(mem_end-mem_beg).count();
// cudaMemcpy(d,device_d,sizeof(int)*n*n,cudaMemcpyDeviceToHost);
}
__device__ inline int gmin(int a,int b){
return (a>b)*b+(a<=b)*a;
}
__global__ void gpu(char* d,size_t pitch,int block_start_x,
int block_start_y,int k,int n){
int B = blockDim.y;
int j = gmin( (block_start_y+blockIdx.y)*B+threadIdx.y , n-1 );
// int* d_k = (int*)(d+pitch*k);
int x_beg = (block_start_x + blockIdx.x)*B;
int x_end = gmin( x_beg+B , n );
int j_offset = (block_start_y+blockIdx.y)*B;
int slice = (B+blockDim.y-1)/blockDim.y;
extern __shared__ int d_k[];
#pragma unroll
for(int i=(threadIdx.y)*slice;i<(threadIdx.y+1)*slice&&i<n;i++){
d_k[i] = ((int*)(d+pitch*k))[i+j_offset];
// d_k[i+B] = ((int*)(d+pitch*(i+x_beg)))[k];
}
__syncthreads();
// int d_i[n];
// for(int i=0;i<n;i++)
// d_i[i] = ((int*)(d+pitch*i))[i];
#pragma unroll
for(int i=x_beg;i<x_end;i++){
int* d_i = ((int*)(d+pitch*i));
__syncthreads();
int new_d = d_i[k]+d_k[j-j_offset];
if(d_i[j]>new_d){
d_i[j]=new_d;
}
}
}
void cal(char* d,size_t pitch,int B, int Round, int block_start_x,
int block_start_y, int block_width, int block_height) {
// To calculate B*B elements in the block (b_i, b_j)
// For each block, it need to compute B times
for (int k = Round * B; k < (Round +1) * B && k < n; ++k) {
// To calculate original index of elements in the block (b_i, b_j)
// For instance, original index of (0,0) in block (1,2) is (2,5) for V=6,B=2
dim3 dimBlock(1,B);
dim3 dimGrid(block_height,block_width);
gpu<<<dimGrid,dimBlock,sizeof(int)*(B)>>>(
d,pitch,
block_start_x,
block_start_y,
k,n
);
}
}
void cpu(int B, int Round, int block_start_x, int block_start_y, int block_width, int block_height) {
int block_end_x = block_start_x + block_height;
int block_end_y = block_start_y + block_width;
for (int b_i = block_start_x; b_i < block_end_x; ++b_i) {
for (int b_j = block_start_y; b_j < block_end_y; ++b_j) {
// To calculate B*B elements in the block (b_i, b_j)
// For each block, it need to compute B times
for (int k = Round * B; k < (Round +1) * B && k < n; ++k) {
// To calculate original index of elements in the block (b_i, b_j)
// For instance, original index of (0,0) in block (1,2) is (2,5) for V=6,B=2
int block_internal_start_x = b_i * B;
int block_internal_end_x = (b_i +1) * B;
int block_internal_start_y = b_j * B;
int block_internal_end_y = (b_j +1) * B;
if (block_internal_end_x > n) block_internal_end_x = n;
if (block_internal_end_y > n) block_internal_end_y = n;
for (int i = block_internal_start_x; i < block_internal_end_x; ++i) {
for (int j = block_internal_start_y; j < block_internal_end_y; ++j) {
if (d[i*n+k] + d[k*n+j] < d[i*n+j]) {
d[i*n+j] = d[i*n+k] + d[k*n+j];
}
}
}
}
}
}
}
|
8,522 | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<unistd.h>
#include<cuda_runtime.h>
using namespace std;
#define SUBMATRIX_SIZE 16384
////////////////////////////////////////////////////////////////////////
// Number of histogram bins has to be edited by hand, prior to
// copmilation.
////////////////////////////////////////////////////////////////////////
#define DEFAULT_NBINS 254
//#define DEFAULT_NBINS 126
//#define DEFAULT_NBINS 62
//#define DEFAULT_NBINS 30
#define CONV_FACTOR 57.2957795 // 180/pi
int doCalcRaDec(FILE *infile0, FILE *infile1, FILE *outfile, bool silent_on_GPU_testing, float scale_factor, int nbins, float hist_lower_range, float hist_upper_range, float hist_bin_width, int log_binning_flag, bool two_different_files, float conv_factor_angle);
int doCalcMpc(FILE *infile0, FILE *infile1, FILE *outfile, bool silent_on_GPU_testing, float scale_factor, int nbins, float hist_lower_range, float hist_upper_range, float hist_bin_width, int log_binning_flag, bool two_different_files, float conv_factor_angle);
void getDeviceDiagnostics(int tot_Gals, int n_coords);
__device__ float acf(float a0, float cos_d0, float sin_d0, float a1, float d1)
{
float w = 0.0;
float a_diff, sin_a_diff, cos_a_diff;
float cos_d1, sin_d1, numer, denom, mult1, mult2;
float d1_rad;
a_diff = a1 - a0;
d1_rad = d1;
sin_a_diff = sin(a_diff);
cos_a_diff = cos(a_diff);
sin_d1 = sin(d1_rad);
cos_d1 = cos(d1_rad);
mult1 = cos_d1 * cos_d1 * sin_a_diff * sin_a_diff;
mult2 = cos_d0 * sin_d1 - sin_d0 * cos_d1 * cos_a_diff;
mult2 = mult2 * mult2;
numer = sqrt(mult1 + mult2);
denom = sin_d0 *sin_d1 + cos_d0 * cos_d1 * cos_a_diff;
w = atan2(numer,denom);
return w;
}
////////////////////////////////////////////////////////////////////////
// Kernel to calculate angular distances between galaxies and histogram
// the distances.
////////////////////////////////////////////////////////////////////////
__global__ void distance(volatile float *a0, volatile float *d0, volatile float *a1, volatile float *d1, int xind, int yind, int max_xind, int max_yind, volatile int *dev_hist, float hist_min, float hist_max, int nbins, float bin_width, int log_binning=0, bool two_different_files=1, float conv_factor_angle=57.2957795)
{
////////////////////////////////////////////////////////////////////////////
// Idx will keep track of which thread is being calculated within a given
// warp.
////////////////////////////////////////////////////////////////////////////
int idx = blockIdx.x * blockDim.x + threadIdx.x; // This should range to SUBMATRIX_SIZE
idx += xind;
////////////////////////////////////////////////////////////////////////
// Shared memory stuff.
////////////////////////////////////////////////////////////////////////
__shared__ int shared_hist[DEFAULT_NBINS+2];
// Note that we only clear things out for the first thread on each block.
if(threadIdx.x==0)
{
for (int i=0;i<nbins+2;i++)
shared_hist[i] = 0;
}
__syncthreads();
////////////////////////////////////////////////////////////////////////
if (idx<max_xind)
{
int i=0;
float alpha_rad = a0[idx];
float delta0 = d0[idx];
float cos_d0 = cos(delta0);
float sin_d0 = sin(delta0);
float dist;
int bin_index = 0;
float a_diff, sin_a_diff, cos_a_diff;
float cos_d1, sin_d1, numer, denom, mult1, mult2;
float d1_rad;
bool do_calc = 1;
int ymax = yind + SUBMATRIX_SIZE;
if (ymax>max_yind)
{
ymax = max_yind;
}
for(i=yind; i<ymax; i++)
{
if (two_different_files)
{
do_calc = 1;
}
else // Doing the same file
{
if (xind != yind) // Non-diagonal chunks.
{
do_calc = 1;
}
else // Diagonal chunks.
{
if(idx > i)
do_calc=1;
else
do_calc=0;
}
}
//if(idx > i) ///////// CHECK THIS
if (do_calc)
{
dist = acf(alpha_rad,cos_d0,sin_d0,a1[i],d1[i]);
/*
a_diff = a1[i] - alpha_rad;
d1_rad = d1[i];
sin_a_diff = sin(a_diff);
cos_a_diff = cos(a_diff);
sin_d1 = sin(d1_rad);
cos_d1 = cos(d1_rad);
mult1 = cos_d1 * cos_d1 * sin_a_diff * sin_a_diff;
mult2 = cos_d0 * sin_d1 - sin_d0 * cos_d1 * cos_a_diff;
mult2 = mult2 * mult2;
numer = sqrt(mult1 + mult2);
denom = sin_d0 *sin_d1 + cos_d0 * cos_d1 * cos_a_diff;
dist = atan2(numer,denom);
*/
dist *= conv_factor_angle; // Convert to degrees or what have you.
if(dist < hist_min)
bin_index = 0;
else if(dist >= hist_max)
bin_index = nbins + 1;
else
{
if (log_binning==0)
{
bin_index = int((dist-hist_min)/bin_width) + 1;
}
else if (log_binning==1)// log binning
{
bin_index = int((log(dist)-log(hist_min))/bin_width) + 1;
}
else if (log_binning==2)// log 10 binning
{
bin_index = int((log10(dist)-log10(hist_min))/bin_width) + 1;
}
}
atomicAdd(&shared_hist[bin_index],1);
}
}
}
__syncthreads();
if(threadIdx.x==0)
{
for(int i=0;i<nbins+2;i++)
dev_hist[i+(blockIdx.x*(nbins+2))]=shared_hist[i];
}
}
////////////////////////////////////////////////////////////////////////
// Kernel to calculate angular distances between galaxies and histogram
// the distances.
// Assuming coordinates are already in x,y,z (in Mpc)
////////////////////////////////////////////////////////////////////////
__global__ void distanceMpc(volatile float *x0, volatile float *y0, volatile float *z0, volatile float *x1, volatile float *y1, volatile float *z1, int xind, int yind, int max_xind, int max_yind, volatile int *dev_hist, float hist_min, float hist_max, int nbins, float bin_width, int log_binning=0, bool two_different_files=1, float conv_factor_angle=57.2957795)
{
////////////////////////////////////////////////////////////////////////////
// Idx will keep track of which thread is being calculated within a given
// warp.
////////////////////////////////////////////////////////////////////////////
int idx = blockIdx.x * blockDim.x + threadIdx.x; // This should range to SUBMATRIX_SIZE
idx += xind;
////////////////////////////////////////////////////////////////////////
// Shared memory stuff.
////////////////////////////////////////////////////////////////////////
__shared__ int shared_hist[DEFAULT_NBINS+2];
// Note that we only clear things out for the first thread on each block.
if(threadIdx.x==0)
{
for (int i=0;i<nbins+2;i++)
shared_hist[i] = 0;
}
__syncthreads();
////////////////////////////////////////////////////////////////////////
if (idx<max_xind)
{
int i=0;
float dist, xdiff, ydiff, zdiff;
int bin_index = 0;
bool do_calc = 1;
int ymax = yind + SUBMATRIX_SIZE;
if (ymax>max_yind)
{
ymax = max_yind;
}
for(i=yind; i<ymax; i++)
{
if (two_different_files)
{
do_calc = 1;
}
else // Doing the same file
{
if(idx > i)
do_calc=1;
else
do_calc=0;
}
//if(idx > i) ///////// CHECK THIS
if (do_calc)
{
// this is a way simpler calculation. We already have the x,y,z coodis in co-moving distance, so we can simply do the distance
xdiff = x0[idx] - x1[idx];
ydiff = y0[idx] - y1[idx];
zdiff = z0[idx] - z1[idx];
dist = sqrt( (xdiff*xdiff) + (ydiff*ydiff) + (zdiff*zdiff));
if(dist < hist_min)
bin_index = 0;
else if(dist >= hist_max)
bin_index = nbins + 1;
else
{
if (log_binning==0)
{
bin_index = int((dist-hist_min)/bin_width) + 1;
}
else if (log_binning==1)// log binning
{
bin_index = int((log(dist)-log(hist_min))/bin_width) + 1;
}
else if (log_binning==2)// log 10 binning
{
bin_index = int((log10(dist)-log10(hist_min))/bin_width) + 1;
}
}
atomicAdd(&shared_hist[bin_index],1);
}
}
}
__syncthreads();
if(threadIdx.x==0)
{
for(int i=0;i<nbins+2;i++)
dev_hist[i+(blockIdx.x*(nbins+2))]=shared_hist[i];
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// Main
////////////////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
// Needed for parsing command-line arguments.
extern char *optarg;
extern int optind, optopt, opterr;
int c;
char *outfilename = NULL;
char defaultoutfilename[256];
sprintf(defaultoutfilename,"default_out.dat");
float hist_lower_range = 0.0000001;
float hist_upper_range = 0;
int nbins = DEFAULT_NBINS;
float hist_bin_width = 0.05;
int log_binning_flag = 0; // False
float scale_factor = 1.0; // For if we need to convert input to arcsec or arcmin
float conv_factor_angle = 57.2957795; // 180/pi // For if we need to convert arcdistance to arcsec or arcmin
int radec_input = 1; // are we using ra/dec coords, or x/y/z coords?
bool silent_on_GPU_testing = false;
int cuda_device = 0;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
while ((c = getopt(argc, argv, "ao:L:l:w:smSd:")) != -1) {
switch(c) {
case 'L':
printf("L is set\n");
hist_lower_range = atof(optarg);
break;
case 'w':
hist_bin_width = atof(optarg);
printf("Histogram bin width: %f\n",hist_bin_width);
break;
case 'l':
log_binning_flag = atoi(optarg);
printf("Will use log binning.\n");
break;
case 's':
scale_factor = 206264.0; // To convert arcseconds to radians.
conv_factor_angle *= 3600.0; // convert radians to arcseconds.
printf("Reading in values assuming they are arcseconds.\n");
printf("scale_factor: %f\n",scale_factor);
printf("conv_factor_angle: %f\n",conv_factor_angle);
break;
case 'm':
scale_factor = 3437.74677; // To convert arcminutes to radians.
conv_factor_angle *= 60.0; // convert radians to arcminutes.
printf("scale_factor: %f\n",scale_factor);
printf("conv_factor_angle: %f\n",conv_factor_angle);
printf("Reading in values assuming they are arcminutes.\n");
break;
case 'o':
outfilename = optarg;
printf("Output filename is %s\n", outfilename);
break;
case 'd':
cuda_device = atoi(optarg); // Use this CUDA device.
conv_factor_angle *= 3600.0; // convert radians to arcseconds.
printf("Will attempt to use CUDA device %d\n",cuda_device);
break;
case 'S':
printf("Silent mode - don't run the GPU test (suppresses some output)\n");
silent_on_GPU_testing = true;
break;
case 'p':
printf("Using input files in Mpc format");
radec_input = 0;
break;
case '?':
printf("unknown arg %c\n", optopt);
break;
}
}
if (argc < 2)
{
printf("\nMust pass in at least two input files on command line!\n");
printf("\nUsage: ", argv[0] );
//printf(" <cluster_data file> <distances file> \n\n");
exit(1);
}
// Set a default output file name, if none was passed in on the
// command line.
if (outfilename == NULL)
{
outfilename = defaultoutfilename;
printf("Output filename is %s\n", outfilename);
}
float temp_lo = hist_lower_range;
if (hist_upper_range == 0)
{
if (log_binning_flag==0)
{
for (int i=0;i<nbins;i++)
{
hist_upper_range = temp_lo + hist_bin_width;
temp_lo = hist_upper_range;
}
}
else if (log_binning_flag==1)
{
for (int i=0;i<nbins;i++)
{
hist_upper_range = exp(log(temp_lo) + hist_bin_width);
temp_lo = hist_upper_range;
}
}
else if (log_binning_flag==2)
{
for (int i=0;i<nbins;i++)
{
hist_upper_range = pow(10,(log10(temp_lo) + hist_bin_width));
temp_lo = hist_upper_range;
}
}
}
printf("hist_upper_range: %f\n",hist_upper_range);
FILE *infile0, *infile1, *outfile ;
infile0 = fopen(argv[optind],"r");
infile1 = fopen(argv[optind+1],"r");
printf("Opening input file 0: %s\n",argv[optind]);
printf("Opening input file 1: %s\n",argv[optind+1]);
outfile = fopen(outfilename, "w");
////////////////////////////////////////////////////////////////////////////
// Check to see if the two files are actually the same file.
// This is the case for the DD and RR calculations and change slightly
// the exact calculations being performed.
////////////////////////////////////////////////////////////////////////////
bool two_different_files = 1;
if (strcmp(argv[optind],argv[optind+1])==0)
{
two_different_files = 0;
printf("Using the same file!\n");
}
printf("\n");
////////////////////////////////////////////////////////////////////////
// Set the CUDA device. This is useful if your machine has multiple GPUs
// on it.
////////////////////////////////////////////////////////////////////////
cudaError_t error_id = cudaSetDevice(cuda_device);
if (error_id == cudaSuccess) {
printf( "cudaSetDevice returned %d\n-> %s\n", (int)error_id, cudaGetErrorString(error_id) );
}
else{
printf( "cudaSetDevice failed on Device %d!\n\n",cuda_device);
exit(-1);
}
if(radec_input==1) int success = doCalcRaDec(infile0, infile1, outfile, silent_on_GPU_testing, scale_factor, nbins, hist_lower_range, hist_upper_range, hist_bin_width, log_binning_flag, two_different_files, conv_factor_angle);
else int success = doCalcMpc(infile0, infile1, outfile, silent_on_GPU_testing, scale_factor, nbins, hist_lower_range, hist_upper_range, hist_bin_width, log_binning_flag, two_different_files, conv_factor_angle);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// Module that runs the calculations for input files in the format ra:dec
////////////////////////////////////////////////////////////////////////
int doCalcRaDec(FILE *infile0, FILE *infile1, FILE *outfile, bool silent_on_GPU_testing, float scale_factor, int nbins, float hist_lower_range, float hist_upper_range, float hist_bin_width, int log_binning_flag, bool two_different_files, float conv_factor_angle){
float *d_alpha0, *d_delta0;
float *h_alpha0, *h_delta0;
float *d_alpha1, *d_delta1;
float *h_alpha1, *h_delta1;
int NUM_GALAXIES0;
int NUM_GALAXIES1;
//////////////////////////////////////////////////////////////////////
// Read in the galaxy files.
////////////////////////////////////////////////////////////////////////////
// Read in the first file
////////////////////////////////////////////////////////////////////////////
fscanf(infile0, "%d", &NUM_GALAXIES0);
int size_of_galaxy_array0 = NUM_GALAXIES0 * sizeof(float);
printf("SIZE 0 # GALAXIES: %d\n",NUM_GALAXIES0);
h_alpha0 = (float*)malloc(size_of_galaxy_array0);
h_delta0 = (float*)malloc(size_of_galaxy_array0);
float temp0, temp1;
for(int i=0; i<NUM_GALAXIES0; i++)
{
fscanf(infile0, "%f %f", &temp0, &temp1);
h_alpha0[i] = temp0/scale_factor;
h_delta0[i] = temp1/scale_factor;
//if (i<10)
//printf("%e %e\n", h_alpha0[i], h_delta0[i]);
}
////////////////////////////////////////////////////////////////////////////
// Read in the second file
////////////////////////////////////////////////////////////////////////////
fscanf(infile1, "%d", &NUM_GALAXIES1);
int size_of_galaxy_array1 = NUM_GALAXIES1 * sizeof(float);
printf("SIZE 1 # GALAXIES: %d\n",NUM_GALAXIES1);
h_alpha1 = (float*)malloc(size_of_galaxy_array1);
h_delta1 = (float*)malloc(size_of_galaxy_array1);
for(int i=0; i<NUM_GALAXIES1; i++)
{
fscanf(infile1, "%f %f", &temp0, &temp1);
h_alpha1[i] = temp0/scale_factor;
h_delta1[i] = temp1/scale_factor;
//if (i<10)
//printf("%e %e\n", h_alpha1[i], h_delta1[i]);
}
//get device diagnostics
if (!silent_on_GPU_testing) getDeviceDiagnostics(NUM_GALAXIES0+NUM_GALAXIES1, 2);
////////////////////////////////////////////////////////////////////////////
// Allocation of histogram
///////////////////////////////////////////////////////////////////////////
int *hist, *dev_hist;
int size_hist = SUBMATRIX_SIZE * (nbins+2);
int size_hist_bytes = size_hist*sizeof(int);
hist = (int*)malloc(size_hist_bytes);
memset(hist, 0, size_hist_bytes);
printf("Size of histogram: %d bytes\n",size_hist_bytes);
cudaMalloc((void **) &dev_hist, (size_hist_bytes));
cudaMemset(dev_hist, 0, size_hist_bytes);
unsigned long *hist_array;
int hist_array_size = (nbins+2) * sizeof(unsigned long);
hist_array = (unsigned long*)malloc(hist_array_size);
printf("Size of histogram array: %d bytes\n",hist_array_size);
memset(hist_array,0,hist_array_size);
////////////////////////////////////////////////////////////////////////////
// Define the grid and block size
////////////////////////////////////////////////////////////////////////////
dim3 grid, block;
// 128*4 = 512, the amount of memory needed for one histogram.
// 8192*4 = 32768 is max memory to ask for for the histograms.
// 8192/128 = 64, is is the right number of blocks?
grid.x = 8192/(DEFAULT_NBINS+2); // Is this the number of blocks?
block.x = SUBMATRIX_SIZE/grid.x; // Is this the number of threads per block? NUM_GALAXIES/block.x;
// SUBMATRIX is the number of threads per warp? Per kernel call?
////////////////////////////////////////////////////////////////////////////
cudaMalloc((void **) &d_alpha0, size_of_galaxy_array0 );
cudaMalloc((void **) &d_delta0, size_of_galaxy_array0 );
cudaMalloc((void **) &d_alpha1, size_of_galaxy_array1 );
cudaMalloc((void **) &d_delta1, size_of_galaxy_array1 );
// Check to see if we allocated enough memory.
if (0==d_alpha0 || 0==d_delta0 || 0==d_alpha1 || 0==d_delta1 || 0==dev_hist)
{
printf("couldn't allocate memory\n");
return 1;
}
// Initialize array to all 0's
cudaMemset(d_alpha0,0,size_of_galaxy_array0);
cudaMemset(d_delta0,0,size_of_galaxy_array0);
cudaMemset(d_alpha1,0,size_of_galaxy_array1);
cudaMemset(d_delta1,0,size_of_galaxy_array1);
cudaMemcpy(d_alpha0, h_alpha0, size_of_galaxy_array0, cudaMemcpyHostToDevice );
cudaMemcpy(d_delta0, h_delta0, size_of_galaxy_array0, cudaMemcpyHostToDevice );
cudaMemcpy(d_alpha1, h_alpha1, size_of_galaxy_array1, cudaMemcpyHostToDevice );
cudaMemcpy(d_delta1, h_delta1, size_of_galaxy_array1, cudaMemcpyHostToDevice );
int x, y;
int num_submatrices_x = NUM_GALAXIES0 / SUBMATRIX_SIZE;
int num_submatrices_y = NUM_GALAXIES1 / SUBMATRIX_SIZE;
// Take care of edges of matrix.
if (NUM_GALAXIES0%SUBMATRIX_SIZE != 0)
{
num_submatrices_x += 1;
}
if (NUM_GALAXIES1%SUBMATRIX_SIZE != 0)
{
num_submatrices_y += 1;
}
printf("Breaking down the calculations.\n");
printf("Number of submatrices: %dx%d\n",num_submatrices_x,num_submatrices_y);
printf("Number of calculations per submatrices: %dx%d\n",SUBMATRIX_SIZE,SUBMATRIX_SIZE);
int bin_index = 0;
for(int k = 0; k < num_submatrices_y; k++)
{
y = k*SUBMATRIX_SIZE;
//printf("%d %d\n",k,y);
int jmax = 0;
// If we're dealing with the same file, then only loop over
// the upper half of the matrix of operations.
if (two_different_files == 0)
{
jmax = k;
}
for(int j = jmax; j < num_submatrices_x; j++)
{
x = j*SUBMATRIX_SIZE;
//printf("----\n");
//printf("%d %d\t\t%d %d\n",k,y,j,x);
//printf("----\n");
// Set the histogram to all zeros each time.
cudaMemset(dev_hist,0,size_hist_bytes);
int max_x = NUM_GALAXIES0;
int max_y = NUM_GALAXIES1;
distance<<<grid,block>>>(d_alpha0, d_delta0,d_alpha1, d_delta1, x, y, max_x, max_y, dev_hist, hist_lower_range, hist_upper_range, nbins, hist_bin_width, log_binning_flag, two_different_files,conv_factor_angle);
cudaMemcpy(hist, dev_hist, size_hist_bytes, cudaMemcpyDeviceToHost);
////////////////////////////////////////////////////////////////////
// Sum up the histograms from each thread (hist).
////////////////////////////////////////////////////////////////////
for(int m=0; m<size_hist; m++)
{
bin_index = m%(nbins+2);
hist_array[bin_index] += hist[m];
}
}
}
unsigned long total = 0;
float lo = hist_lower_range;
float hi = 0;
for(int k=0; k<nbins+1; k++)
{
if (k==0)
{
//fprintf(outfile, "Underflow below %.3e %s %lu \n", lo, ",", hist_array[k]);
}
else
{
if (log_binning_flag==0)
{
hi = lo + hist_bin_width;
}
else if (log_binning_flag==1)
{
//printf("lo: %f\t\tlog(lo): %f\n",lo,log(lo));
hi = exp(log(lo) + hist_bin_width);
}
else if (log_binning_flag==2)
{
//printf("lo: %f\t\tlog10(lo): %f\n",lo,log10(lo));
hi = pow(10,(log10(lo) + hist_bin_width));
}
fprintf(outfile, "%.3e %.3e %lu \n",lo,hi,hist_array[k]);
total += hist_array[k];
lo = hi;
}
}
printf("total: %lu \n", total);
fclose(infile0);
fclose(infile1);
fclose(outfile);
free(h_alpha0);
free(h_delta0);
free(h_alpha1);
free(h_delta1);
free(hist);
cudaFree(d_alpha0);
cudaFree(d_delta0);
cudaFree(d_alpha1);
cudaFree(d_delta1);
cudaFree(dev_hist);
return 0;
}
//////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// Module that runs the calculations for input files in the format x:y:z in Mpc
////////////////////////////////////////////////////////////////////////
int doCalcMpc(FILE *infile0, FILE *infile1, FILE *outfile, bool silent_on_GPU_testing, float scale_factor, int nbins, float hist_lower_range, float hist_upper_range, float hist_bin_width, int log_binning_flag, bool two_different_files, float conv_factor_angle){
float *d_x0, *d_y0, *d_z0;
float *h_x0, *h_y0, *h_z0;
float *d_x1, *d_y1, *d_z1;
float *h_x1, *h_y1, *h_z1;
int NUM_GALAXIES0;
int NUM_GALAXIES1;
//////////////////////////////////////////////////////////////////////
// Read in the galaxy files.
////////////////////////////////////////////////////////////////////////////
// Read in the first file
////////////////////////////////////////////////////////////////////////////
fscanf(infile0, "%d", &NUM_GALAXIES0);
int size_of_galaxy_array0 = NUM_GALAXIES0 * sizeof(float);
printf("SIZE 0 # GALAXIES: %d\n",NUM_GALAXIES0);
h_x0 = (float*)malloc(size_of_galaxy_array0);
h_y0 = (float*)malloc(size_of_galaxy_array0);
h_z0 = (float*)malloc(size_of_galaxy_array0);
float temp0, temp1, temp2;
for(int i=0; i<NUM_GALAXIES0; i++)
{
fscanf(infile0, "%f %f", &temp0, &temp1, &temp2);
h_x0[i] = temp0/scale_factor;
h_y0[i] = temp1/scale_factor;
h_z0[i] = temp2/scale_factor;
//if (i<10)
//printf("%e %e\n", h_x0[i], h_y0[i], h_y0[i],);
}
////////////////////////////////////////////////////////////////////////////
// Read in the second file
////////////////////////////////////////////////////////////////////////////
fscanf(infile1, "%d", &NUM_GALAXIES1);
int size_of_galaxy_array1 = NUM_GALAXIES1 * sizeof(float);
printf("SIZE 1 # GALAXIES: %d\n",NUM_GALAXIES1);
h_x1 = (float*)malloc(size_of_galaxy_array1);
h_y1 = (float*)malloc(size_of_galaxy_array1);
h_z1 = (float*)malloc(size_of_galaxy_array1);
for(int i=0; i<NUM_GALAXIES1; i++)
{
fscanf(infile1, "%f %f", &temp0, &temp1, &temp2);
h_x1[i] = temp0/scale_factor;
h_y1[i] = temp1/scale_factor;
h_z1[i] = temp2/scale_factor;
//if (i<10)
//printf("%e %e\n", h_x1[i], h_y1[i], h_z1[i]);
}
// get device diagnostics
if (!silent_on_GPU_testing) getDeviceDiagnostics(NUM_GALAXIES0+NUM_GALAXIES1, 2);
////////////////////////////////////////////////////////////////////////////
// Allocation of histogram
///////////////////////////////////////////////////////////////////////////
int *hist, *dev_hist;
int size_hist = SUBMATRIX_SIZE * (nbins+2);
int size_hist_bytes = size_hist*sizeof(int);
hist = (int*)malloc(size_hist_bytes);
memset(hist, 0, size_hist_bytes);
printf("Size of histogram: %d bytes\n",size_hist_bytes);
cudaMalloc((void **) &dev_hist, (size_hist_bytes));
cudaMemset(dev_hist, 0, size_hist_bytes);
unsigned long *hist_array;
int hist_array_size = (nbins+2) * sizeof(unsigned long);
hist_array = (unsigned long*)malloc(hist_array_size);
printf("Size of histogram array: %d bytes\n",hist_array_size);
memset(hist_array,0,hist_array_size);
////////////////////////////////////////////////////////////////////////////
// Define the grid and block size
////////////////////////////////////////////////////////////////////////////
dim3 grid, block;
// 128*4 = 512, the amount of memory needed for one histogram.
// 8192*4 = 32768 is max memory to ask for for the histograms.
// 8192/128 = 64, is is the right number of blocks?
grid.x = 8192/(DEFAULT_NBINS+2); // Is this the number of blocks?
block.x = SUBMATRIX_SIZE/grid.x; // Is this the number of threads per block? NUM_GALAXIES/block.x;
// SUBMATRIX is the number of threads per warp? Per kernel call?
////////////////////////////////////////////////////////////////////////////
cudaMalloc((void **) &d_x0, size_of_galaxy_array0 );
cudaMalloc((void **) &d_y0, size_of_galaxy_array0 );
cudaMalloc((void **) &d_z0, size_of_galaxy_array0 );
cudaMalloc((void **) &d_x1, size_of_galaxy_array1 );
cudaMalloc((void **) &d_y1, size_of_galaxy_array1 );
cudaMalloc((void **) &d_z1, size_of_galaxy_array1 );
// Check to see if we allocated enough memory.
if (0==d_x0 || 0==d_y0 || 0==d_z0 || 0==d_x1 || 0==d_y1 || 0==d_z1 || 0==dev_hist)
{
printf("couldn't allocate memory\n");
return 1;
}
// Initialize array to all 0's
cudaMemset(d_x0,0,size_of_galaxy_array0);
cudaMemset(d_y0,0,size_of_galaxy_array0);
cudaMemset(d_z0,0,size_of_galaxy_array0);
cudaMemset(d_x1,0,size_of_galaxy_array1);
cudaMemset(d_y1,0,size_of_galaxy_array1);
cudaMemset(d_z1,0,size_of_galaxy_array1);
cudaMemcpy(d_x0, h_x0, size_of_galaxy_array0, cudaMemcpyHostToDevice );
cudaMemcpy(d_y0, h_y0, size_of_galaxy_array0, cudaMemcpyHostToDevice );
cudaMemcpy(d_z0, h_z0, size_of_galaxy_array0, cudaMemcpyHostToDevice );
cudaMemcpy(d_x1, h_x1, size_of_galaxy_array1, cudaMemcpyHostToDevice );
cudaMemcpy(d_y1, h_y1, size_of_galaxy_array1, cudaMemcpyHostToDevice );
cudaMemcpy(d_z1, h_z1, size_of_galaxy_array1, cudaMemcpyHostToDevice );
int x, y;
int num_submatrices_x = NUM_GALAXIES0 / SUBMATRIX_SIZE;
int num_submatrices_y = NUM_GALAXIES1 / SUBMATRIX_SIZE;
// Take care of edges of matrix.
if (NUM_GALAXIES0%SUBMATRIX_SIZE != 0)
{
num_submatrices_x += 1;
}
if (NUM_GALAXIES1%SUBMATRIX_SIZE != 0)
{
num_submatrices_y += 1;
}
printf("Breaking down the calculations.\n");
printf("Number of submatrices: %dx%d\n",num_submatrices_x,num_submatrices_y);
printf("Number of calculations per submatrices: %dx%d\n",SUBMATRIX_SIZE,SUBMATRIX_SIZE);
int bin_index = 0;
for(int k = 0; k < num_submatrices_y; k++)
{
y = k*SUBMATRIX_SIZE;
//printf("%d %d\n",k,y);
for(int j = 0; j < num_submatrices_x; j++)
{
x = j*SUBMATRIX_SIZE;
//printf("----\n");
//printf("%d %d\t\t%d %d\n",k,y,j,x);
//printf("----\n");
// Set the histogram to all zeros each time.
cudaMemset(dev_hist,0,size_hist_bytes);
int max_x = NUM_GALAXIES0;
int max_y = NUM_GALAXIES1;
distanceMpc<<<grid,block>>>(d_x0, d_y0, d_z0,d_x1, d_y1, d_z1, x, y, max_x, max_y, dev_hist, hist_lower_range, hist_upper_range, nbins, hist_bin_width, log_binning_flag, two_different_files,conv_factor_angle);
cudaMemcpy(hist, dev_hist, size_hist_bytes, cudaMemcpyDeviceToHost);
////////////////////////////////////////////////////////////////////
// Sum up the histograms from each thread (hist).
////////////////////////////////////////////////////////////////////
for(int m=0; m<size_hist; m++)
{
bin_index = m%(nbins+2);
hist_array[bin_index] += hist[m];
}
}
}
unsigned long total = 0;
float lo = hist_lower_range;
float hi = 0;
for(int k=0; k<nbins+1; k++)
{
if (k==0)
{
//fprintf(outfile, "Underflow below %.3e %s %lu \n", lo, ",", hist_array[k]);
}
else
{
if (log_binning_flag==0)
{
hi = lo + hist_bin_width;
}
else if (log_binning_flag==1)
{
//printf("lo: %f\t\tlog(lo): %f\n",lo,log(lo));
hi = exp(log(lo) + hist_bin_width);
}
else if (log_binning_flag==2)
{
//printf("lo: %f\t\tlog10(lo): %f\n",lo,log10(lo));
hi = pow(10,(log10(lo) + hist_bin_width));
}
fprintf(outfile, "%.3e %.3e %lu \n",lo,hi,hist_array[k]);
total += hist_array[k];
lo = hi;
}
}
printf("total: %lu \n", total);
fclose(infile0);
fclose(infile1);
fclose(outfile);
free(h_x0);
free(h_y0);
free(h_z0);
free(h_x1);
free(h_y1);
free(h_z1);
free(hist);
cudaFree(d_x0);
cudaFree(d_y0);
cudaFree(d_z0);
cudaFree(d_x1);
cudaFree(d_y1);
cudaFree(d_z1);
cudaFree(dev_hist);
return 0;
}
//////////////////////////////////////////////////////////////////////
void getDeviceDiagnostics(int tot_gals, int n_coords){
////////////////////////////////////////////////////////////////////////////
// Now get the info from the device.
////////////////////////////////////////////////////////////////////////////
printf("\n------ CUDA device diagnostics ------\n\n");
int nx = SUBMATRIX_SIZE;
int ncalc = nx * nx;
int gpu_mem_needed = int(tot_gals * sizeof(float)) * n_coords; // need to allocate ra, dec.
printf("Requirements: %d calculations and %d bytes memory on the GPU \n\n", ncalc, gpu_mem_needed);
int deviceCount = 0;
cudaError_t error_id = cudaGetDeviceCount(&deviceCount);
if (error_id != cudaSuccess) {
printf( "cudaGetDeviceCount returned %d\n-> %s\n", (int)error_id, cudaGetErrorString(error_id) );
}
// This function call returns 0 if there are no CUDA capable devices.
if (deviceCount == 0)
printf("There is no device supporting CUDA\n");
else
printf("Found %d CUDA Capable device(s)\n", deviceCount);
int dev=0;
for (dev = 0; dev < deviceCount; ++dev) {
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, dev);
printf("\nDevice %d: \"%s\"\n", dev, deviceProp.name);
printf(" Total amount of global memory: %.0f MBytes (%llu bytes)\n",
(float)deviceProp.totalGlobalMem/1048576.0f, (unsigned long long) deviceProp.totalGlobalMem);
printf(" Warp size: %d\n", deviceProp.warpSize);
printf(" Maximum number of threads per block: %d\n", deviceProp.maxThreadsPerBlock);
printf(" Maximum sizes of each dimension of a block: %d x %d x %d\n",
deviceProp.maxThreadsDim[0],
deviceProp.maxThreadsDim[1],
deviceProp.maxThreadsDim[2]);
printf(" Maximum sizes of each dimension of a grid: %d x %d x %d\n",
deviceProp.maxGridSize[0],
deviceProp.maxGridSize[1],
deviceProp.maxGridSize[2]);
// does this device have enough capcacity for the calculation?
printf("\n*************\n");
// check memory
if((unsigned long long) deviceProp.totalGlobalMem < gpu_mem_needed) printf(" FAILURE: Not eneough memeory on device for this calculation! \n");
else
{
printf("Hurrah! This device has enough memory to perform this calculation\n");
// check # threads
int threadsPerBlock = deviceProp.maxThreadsPerBlock; // maximal efficiency exists if we use max # threads per block.
int blocksPerGrid = int(ceil(ncalc / threadsPerBlock)); // need nx*nx threads total
if(deviceProp.maxThreadsDim[0] >blocksPerGrid) printf("FAILURE: Not enough threads on the device to do this calculation!\n");
else
{
printf("Hurrah! This device supports enough threads to do this calculation\n");
// how many kernels can we run at once on this machine?
int n_mem = floor(deviceProp.totalGlobalMem / float(gpu_mem_needed));
int n_threads = floor(threadsPerBlock * deviceProp.maxThreadsDim[0]*deviceProp.maxThreadsDim[1] / float(ncalc) ); // max # threads possible?
printf("%d %d \n", n_threads, deviceProp.maxThreadsDim[0]);
int max_kernels = 0;
n_mem<n_threads ? max_kernels = n_mem : max_kernels = n_threads;
printf(" you can run %d kernels at a time on this device without overloading the resources \n", max_kernels);
}
}
}
printf("\n------ End CUDA device diagnostics ------\n\n");
}
////////////////////////////////////////////////////////////////////////////
|
8,523 | #include <stdio.h>
#include <time.h>
#define M 32//矩阵维度
#define Exp 4096//计算的幂次
__constant__ const int gpu_m=M;
__constant__ const int gpu_exp=Exp;
__global__ void Gpu_FastExp(float *gpu_martix,float* gpu_res)
{
// printf("%d ", threadIdx.y)
__shared__ float temp[gpu_m*gpu_m];
float res[gpu_m];
int tid=threadIdx.y;
temp[tid]=gpu_martix[tid];
__syncthreads();
for(int i=1;i<gpu_exp;i*=2){
for(int k=0;k<M;k++)
{
res[k]=0;
for(int j=0;j<M;j++){
res[k]+=temp[tid*M+j]*temp[j*M+tid];
}
}
for(int i=0;i<M;i++){
gpu_res[tid*M+i]=res[i];
temp[tid*M+i]=res[i];
}
__syncthreads();
}
}
int main()
{
float * cpu_martix;
float * cpu_res;
float* gpu_martix;
float * gpu_res;
cudaMallocHost((void**)&cpu_martix,M*M*sizeof(float));
cudaMallocHost((void**)&cpu_res,M*M*sizeof(float));
cudaMalloc((void**)&gpu_res,M*M*sizeof(float));
cudaMalloc((void**)&gpu_martix,M*M*sizeof(float));
for(int i=0;i<M;i++){
for(int j=0;j<M;j++){
cpu_martix[i*M+j] = 1.0/M;
}
}
printf("init elem=%f",1.0/M);
cudaMemcpy(gpu_martix,cpu_martix,M*M*sizeof(float),cudaMemcpyHostToDevice);
float begin=clock();
dim3 threads(1,M);
// printf("一切正常\n");
Gpu_FastExp<<<1,threads>>>(gpu_martix,gpu_res);
cudaDeviceSynchronize();
// printf("一切正常\n");
cudaMemcpy(cpu_res,gpu_res,M*M*sizeof(float),cudaMemcpyDeviceToHost);
float end=clock();
printf("result = %.10f time spend=%.10f\n",cpu_res[0],(end-begin)/CLOCKS_PER_SEC);
}
|
8,524 | extern "C" __global__
void cu_hysteresis_low(float* final_img, float* edge_img, float* strong_edge_mask,
float* weak_edge_mask, float t_low, int img_height, int img_width)
{
int n, s, e, w;
int nw, ne, sw, se;
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (weak_edge_mask[idx] > 0)
{
n = idx - img_width;
nw = n - 1;
ne = n + 1;
s = idx + img_width;
sw = s - 1;
se = s + 1;
w = idx - 1;
e = idx + 1;
if (strong_edge_mask[nw] > 0) {
final_img[idx] = 1;
}
if (strong_edge_mask[n] > 0) {
final_img[idx] = 1;
}
if (strong_edge_mask[ne] > 0) {
final_img[idx] = 1;
}
if (strong_edge_mask[w] > 0) {
final_img[idx] = 1;
}
if (strong_edge_mask[e] > 0) {
final_img[idx] = 1;
}
if (strong_edge_mask[sw] > 0) {
final_img[idx] = 1;
}
if (strong_edge_mask[s] > 0) {
final_img[idx] = 1;
}
if (strong_edge_mask[se] > 0) {
final_img[idx] = 1;
}
}
// if ((idx > img_width) /* skip first row */
// && (idx < (img_height * img_width) - img_width) /* skip last row */
// && ((idx % img_width) < (img_width - 1)) /* skip last column */
// && ((idx % img_width) > 0)) /* skip first column */
// {
// if (strong_edge_mask[idx]>0) { /* if this pixel was previously found to be a strong edge */
// // get indices
// n = idx - img_width;
// nw = n - 1;
// ne = n + 1;
// s = idx + img_width;
// sw = s - 1;
// se = s + 1;
// w = idx - 1;
// e = idx + 1;
// if (edge_img[nw] >= t_low) {
// final_img[idx] = 1;
// }
// if (edge_img[n] >= t_low) {
// final_img[idx] = 1;
// }
// if (edge_img[ne] >= t_low) {
// final_img[idx] = 1;
// }
// if (edge_img[w] >= t_low) {
// final_img[idx] = 1;
// }
// if (edge_img[e] >= t_low) {
// final_img[idx] = 1;
// }
// if (edge_img[sw] >= t_low) {
// final_img[idx] = 1;
// }
// if (edge_img[s] >= t_low) {
// final_img[idx] = 1;
// }
// if (edge_img[se] >= t_low) {
// final_img[idx] = 1;
// }
// }//end if(1 == strong_edge_mask[idx])
// }//end if ((idx > img_width)
} |
8,525 | #include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <limits.h>
#include "parallel_floyd_warshall.cuh"
#define min(a,b) (((a)<(b))?(a):(b))
#define BLOCK_SIZE 16
static size_t data_size = 10;
//state variable
static uint64_t rand_state;
__global__ void parallel_floyd_warshall(int *graph, int n, int *path)
{
// block indices
int bx = blockIdx.x;
int by = blockIdx.y;
int tx = threadIdx.x;
int ty = threadIdx.y;
int aBegin = n * BLOCK_SIZE * by;
int aEnd = aBegin + n - 1;
int aStep = BLOCK_SIZE;
int bBegin = BLOCK_SIZE * bx;
int bStep = BLOCK_SIZE * n;
int pathsub = 0;
for(int a = aBegin, b = bBegin; a <= aEnd; a += aStep, b += bStep) {
//load block into shared memory
__shared__ int graph_s[BLOCK_SIZE][BLOCK_SIZE];
__shared__ int path_s[BLOCK_SIZE][BLOCK_SIZE];
graph_s[ty][tx] = graph[a + n * ty + tx];
path_s[ty][tx] = path[b + n * ty + tx];
__syncthreads();
//find minimum for block
for(int k = 0; k < BLOCK_SIZE; ++k) {
pathsub = graph_s[ty][k] < graph_s[ty][k] + path_s[k][tx] ?
graph_s[ty][k] : graph_s[ty][k] + path_s[k][tx];
}
__syncthreads();
}
//writeback
int pathwrite = n * BLOCK_SIZE * by + BLOCK_SIZE * bx;
path[pathwrite + n * ty + tx] = pathsub;
}
int *serial_floyd_warshall(int *graph, int n)
{
int *path = (int *) calloc(sizeof(int), n*n);
memcpy(graph, path, n*n);
for(int k=0; k < n; k++) {
for(int i=0; i < n; i++) {
for(int j=0; j < n; j++) {
path[(i * n) + j] = min(path[(i * n) + j], path[(i * n) + k]+path[(k * n) + j]);
}
}
}
return path;
}
struct timespec timer_start()
{
struct timespec start_time;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time);
return start_time;
}
long int timer_end(struct timespec start_time)
{
struct timespec end_time;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time);
long int diff = (end_time.tv_sec - start_time.tv_sec) *
(long)1e9 + (end_time.tv_nsec - start_time.tv_nsec);
return diff;
}
uint64_t xorshift(void)
{
uint64_t u = rand_state;
u ^= u << 12;
u ^= u << 25;
u ^= u >> 27;
rand_state = u;
return u * 0x2545F4914F6CDD1D;
}
uint64_t xrand(void)
{
return xorshift();
}
void xseed(uint64_t seed)
{
rand_state = seed;
}
int main(int argc, char ** argv)
{
//seed RNG
xseed(time(NULL));
unsigned long int n = 0;
if(argc != 2) {
n = data_size;
}
else {
n = atoi(argv[1]);
}
//create graph
int *graph = (int *) calloc(sizeof(int), n * n);
for(int i=0; i < n; i++) {
for(int j=0; j < n; j++) {
if(i == j){
graph[(i * n) + j] = 0;
}
else {
graph[(i * n) + j] = xrand();
}
}
}
int *path = NULL;
//test serial code speed
struct timespec start = timer_start();
path = serial_floyd_warshall(graph, n);
printf("serial Floyd-Warshall: %li nanoseconds\n", timer_end(start));
int *graph_d;
cudaMalloc(&graph_d, n*n);
cudaMemcpy(graph_d, graph, n*n, cudaMemcpyHostToDevice);
int *path_d;
cudaMalloc(&path_d, n*n);
int grid = 1;
int block = 1;
//test parallel code speed
start = timer_start();
parallel_floyd_warshall<<<grid, block>>>(graph_d, n, path_d);
printf("parallel Floyd-Warshall: %li nanoseconds\n", timer_end(start));
//free memory
cudaFree(path_d);
cudaFree(graph_d);
free(path);
free(graph);
return 0;
}
|
8,526 |
#include <math.h>
extern "C"
__global__ void relative(double x1, double y1, double x2, double y2,double* result )
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
double returned=0;
double sum=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
returned=sqrt(sum);
if (index == 0) result[0] = returned;
}
extern "C"
__global__ void real(double lat1,double lon1,double lat2,double lon2,double* result )
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
double returned=0;
double R = 6371; // Radius of the earth in km
double dLat = (lat2-lat1)*3.14159265359/180; // deg2rad below
double dLon = (lon2-lon1)*3.14159265359/180;
double a =
sin(dLat/2) * sin(dLat/2) +
cos((lat1*3.14159265359/180)) * cos((lat2*3.14159265359/180)) *
sin(dLon/2) * sin(dLon/2);
double c = 2 * atan2(sqrt(a), sqrt(1-a));
double d = R * c; // Distance in km
returned=d*1000;
if (index == 0) result[0] = returned;
}
/*
double deg2rad(double deg) {
double pi=3.14159265359;
return deg * (pi/180);
}
*/
|
8,527 | float h_A[]= {
0.7047913479967793, 0.8102106655983439, 0.6142205806783946, 0.8036972372791509, 0.5007180173918724, 0.9854404240446716, 0.8970281648473355, 0.8784465550503671, 0.9362014552484377, 0.8781315795114085, 0.716594577863504, 0.9098931174026705, 0.7184783127476397, 0.7681144632865852, 0.8263978705096848, 0.5253545433962963, 0.6923346660424399, 0.9067246367085866, 0.6358229328841656, 0.7615735888571356, 0.8902980936125561, 0.776766973516672, 0.9256159420421348, 0.507733772501175, 0.6225191302435089, 0.9301735927508639, 0.5124648170438638, 0.8490883072226884, 0.9915456693062399, 0.7467801420861264, 0.6952480460002094, 0.776841204366417, 0.7442087211037629, 0.7542143937570132, 0.8422071253176542, 0.8283087031993608, 0.8020444856346709, 0.9460164125362487, 0.7008049035462945, 0.9236267299423826, 0.6817026930837492, 0.8927531764231788, 0.78112379737385, 0.9088765192091344, 0.5944376077186222, 0.8609270675506469, 0.7484391481415518, 0.9761314190781814, 0.7196730203177275, 0.7674291215711895, 0.9501714795151152, 0.6495004174848849, 0.5772645348438599, 0.7608870324459108, 0.8136047821030301, 0.597637680654588, 0.6986727040863729, 0.8411031900470987, 0.7125675936626923, 0.5613319035800202, 0.750465214186387, 0.5642055142228108, 0.6251356368511907, 0.8576756917259012, 0.5178749949106465, 0.9428688511462491, 0.8759835406072811, 0.9731982413510043, 0.9786864921504994, 0.824055075683974, 0.5840146775577644, 0.6093992702007742, 0.6652488739939271, 0.8312797724479366, 0.7837074559603172, 0.5076278052427552, 0.8782327782709904, 0.6998565829453633, 0.8435716876604402, 0.5351199457574041, 0.9219400988262638, 0.7019347638564372, 0.5474683965742313, 0.6487505223191026, 0.8558913560351624, 0.8893748897306366, 0.7718999318582055, 0.9094734718242533, 0.8462156165866278, 0.6569014608794184, 0.8151117710712414, 0.863396721269369, 0.5403183551538249, 0.5071011301497438, 0.502010884992347, 0.9478762585286737, 0.8204680675831963, 0.7300237587690404, 0.6214107493282108, 0.7090059767882041, 0.8600651010363483, 0.7808088829563269, 0.5464769757948784, 0.9407989698282149, 0.9221181260591843, 0.7983448043118699, 0.5051038082489945, 0.578676220449012, 0.6230782572914106, 0.5278322267288225, 0.747769717723082, 0.7854059363569483, 0.7674437560857801, 0.6188323444874362, 0.8120657960457511, 0.6060691635762936, 0.9697802006592656, 0.5197561773363726, 0.5587319281515748, 0.8252209472041042, 0.7864290297939598, 0.6291051636761662, 0.5062953614568442, 0.7372956548990628, 0.6294458587401242, 0.6753681708378778, 0.5512859874824081, 0.9544848273694297, 0.7229667066237504, 0.518383069239785, 0.8563444222622967, 0.6017581327119592, 0.94177577893567, 0.6358411433001383, 0.9986426015950427, 0.940850046237367, 0.9924003484858819, 0.9021518600341495, 0.5446202584299337, 0.7195551441155255, 0.9605961899181854, 0.596380803407915, 0.7934174272318062, 0.6761558955803486, 0.8809075250545984, 0.5666650089499913, 0.5075382013795264, 0.7715924463240924, 0.8005457724741976, 0.6408612943656741, 0.8089736400035825, 0.85305029251627, 0.5904715864755674, 0.5849961313970862, 0.9829137177005619, 0.8975816898229376, 0.7034062265644568, 0.5293897574035569, 0.7528735402530908, 0.9821352378433237, 0.9702125239979, 0.581040896269456, 0.6210344519874016, 0.5570603683826407, 0.5535450717926163, 0.7742205856358417, 0.5120291697754369, 0.6742916128218814, 0.7096799308003916, 0.6104999618399195, 0.501273574238509, 0.9488247443373841, 0.5808078427530836, 0.6728555992955108, 0.6034742891181213, 0.8833810753488565, 0.7614333042017525, 0.526537580246164, 0.9731153892400422, 0.8022743469773617, 0.6932872782342718, 0.6146822888123501, 0.8172552590937001, 0.8034882658275885, 0.9229920612522199, 0.7860371194596241, 0.7317777167694741, 0.9549912951102124, 0.9939700932941037, 0.6041402917616584, 0.8398066231458203, 0.6773102754082416, 0.8343961439395017, 0.6121347145759017, 0.7304179486607261, 0.6047250453663111, 0.7416012125022328, 0.6902234564094016, 0.6193751430140497, 0.6093056000449761, 0.9284791955794192, 0.5505614790654099, 0.8220277760578943, 0.864813557620367, 0.6122950589484719, 0.655433820762577, 0.6931511694462653, 0.5399711535946636, 0.6425732057874399, 0.9244061612010857, 0.9622449716422536, 0.5735204525813449, 0.901321973360725, 0.7547022133450045, 0.674003614159103, 0.8771530304558843, 0.986950924384683, 0.8904585421801327, 0.7279937514612296, 0.6213725067765812, 0.8486044969836662, 0.55736090039465, 0.8960308425149215, 0.5976720979313922, 0.5313700432266374, 0.5860984020988333, 0.6449590398602418, 0.9308237109055384, 0.5761981085912145, 0.6112613867431215, 0.725330814175436, 0.850257930071274, 0.8650813526351891, 0.7235703988854554, 0.9999131108259887, 0.9999040982356422, 0.9484894808071243, 0.7080123862411262, 0.8666891510714918, 0.8217692705808508, 0.5954102726575334, 0.7420748644678123, 0.6065738028738075, 0.8803580673275686, 0.9560014113908348, 0.6896100195528263, 0.8908017327016136, 0.7104737072906538, 0.9435713453349006, 0.7453389767590989, 0.9864547344169565, 0.8102798522083673, 0.7219414875342653, 0.7721651218385146, 0.9041097813443868, 0.6571459064144016, 0.6040934833482863, 0.7694992551302694, 0.6843441889483466, 0.7793892647096643, 0.6299119415463645, 0.5398627437760302, 0.8396577089082355, 0.9500066342876153, 0.8294854027147172, 0.576335661670064, 0.7162873325355709, 0.802033406363265, 0.7156261497221937, 0.6574488356156325, 0.6792836631642003, 0.6164182597966534, 0.9293006875931298, 0.5763076821813322, 0.5789503105798428, 0.687539610301833, 0.8195500345711401, 0.8088483893095337, 0.5831728815869812, 0.6373999838746567, 0.9969138729673133, 0.5116257137045631, 0.6091782365632505, 0.5080689808189567, 0.9743937667926413, 0.8205485363699856, 0.5180741105376734, 0.5653731923834848, 0.7914125096392686, 0.9644258998745099, 0.9157926870830417, 0.7790993601160887, 0.881510876435646, 0.6878601587753339, 0.9667124368664644, 0.6437671366939203, 0.5165151406599906, 0.5806387951386459, 0.9601073020809834, 0.9241405960925957, 0.5183045064893104, 0.8871215039641062, 0.6027271886884098, 0.9293714926764731, 0.9469039277053676, 0.9108368151323956, 0.5067630436912776, 0.6655936021356493, 0.7083973060202742, 0.8733624977748387, 0.9105751441072278, 0.5283025114548048, 0.593540577736495, 0.9506194268113368, 0.7878534474750123, 0.9010148426085016, 0.9662329469482797, 0.627842977123751, 0.5855449071982828, 0.5753244682032477, 0.9601499321931362, 0.7093874448675823, 0.6361790562257232, 0.7601911290452888, 0.9973452126683032, 0.9545411888353761, 0.5701559420243134, 0.928786891784006, 0.6047560560223331, 0.8148969267633195, 0.5863976312306395, 0.7197427809411859, 0.9525109908902905, 0.7163426670018241, 0.8280701761379209, 0.9445807759104796, 0.6034656729074426, 0.5111281139729922, 0.5800690078531515, 0.9054413811291878, 0.7068564418460046, 0.9732411719436478, 0.8330954806572948, 0.7336237071722433, 0.512430655709897, 0.5652286073909161, 0.6464696876963063, 0.5713979985147926, 0.5369460822553613, 0.8230388541752489, 0.5343172357761699, 0.6183176791000058, 0.8980201971847885, 0.624325605597632, 0.8002270254376299, 0.800450216865948, 0.6684935308762079, 0.6406761534524767, 0.6008811953701308, 0.5518624229993025, 0.6845366429576047, 0.9000183114540078, 0.6434465120934432, 0.635835856854842, 0.582906424631233, 0.9792954817905395, 0.6264266862189729, 0.9408655977279438, 0.7239380405292688, 0.7778500704007428, 0.8633270015239811, 0.9319995410913643, 0.6026246213469564, 0.8268388199102068, 0.6632008189005286, 0.5926398507269544, 0.8822097699486049, 0.6795841255856749, 0.6668581248204062, 0.6824076044645042, 0.7394285212271238, 0.7354974053934854, 0.6035324798553664, 0.9756054228807693, 0.700093314026557, 0.6252191265311571, 0.7016364854260393, 0.7252789382515625, 0.9956003155344678, 0.5736962967533932, 0.9319025258954836, 0.5839615511603611, 0.5646780125451297, 0.9850906540622781, 0.6556749490070739, 0.566861909844418, 0.7625152427496311, 0.7629120480361162, 0.9593264425603956, 0.7474319823407795, 0.8329674309986417, 0.8608335161233631, 0.9183864875176058, 0.5680499019095167, 0.7834918674367104, 0.883426217158352, 0.6043676596142997, 0.9767542669741958, 0.8350150447866711, 0.8203167209796809, 0.6552534930368541, 0.6669511132140327, 0.8044072588747598, 0.7207649030180358, 0.6563802763548452, 0.9446839046480036, 0.9100321179250249, 0.5673994495926018, 0.636478622953375, 0.6165987680480784, 0.5305735614050429, 0.8743411115292229, 0.543740494750591, 0.8811565962499018, 0.8514383606614249, 0.5696982430688841, 0.5101241971274457, 0.6264927857497116, 0.934694215414769, 0.7679793234064833, 0.8675443018147846, 0.6569489380674226, 0.6424061419087446, 0.8375068812190443, 0.8814172278445831, 0.6672407515006887, 0.5750773784223705, 0.755667584073819, 0.6850841887699348, 0.9815924712337735, 0.6886061172196268, 0.6715994728275793, 0.5834806732753182, 0.5906820164723372, 0.8901962989349509, 0.5947912646176825, 0.5800849096299332, 0.6141098088496983, 0.5918100345179271, 0.8584793039181253, 0.5142443167673241, 0.8229618286100076, 0.9105226806316982, 0.6452479321778462, 0.5579548158338763, 0.8435192974249118, 0.9952206835911634, 0.692653006733198, 0.5570912391067, 0.683246695559526, 0.6829499357959886, 0.8281827556725845, 0.6598372021404277, 0.5355041507604292, 0.9273916169002917, 0.6335254461442748, 0.6658192421539905, 0.8163872359962301, 0.9253342152444006, 0.6068449226513937, 0.8054155522231601, 0.5198111312679072, 0.5059685819503, 0.7453740183753517, 0.9527010112774895, 0.5176517565877173, 0.8527001293756573, 0.6610343071821485, 0.6523550228378358, 0.941885174860275, 0.7671726421863143, 0.9676222844735376, 0.8882528290256138, 0.6069507279689593, 0.739866887706784, 0.552195123501638, 0.7776329898160546, 0.8986587948983322, 0.636791725740735, 0.9794007714053744, 0.9973343291136092, 0.5807220702102507, 0.5293424212529846, 0.7927843507064133, 0.7992864262797474, 0.7105812718841067, 0.5496963782439768, 0.6800269656754081, 0.563935371506437, 0.5910770159868097, 0.67713816919869, 0.7489426781799396, 0.7599541400165342, 0.855424931542399, 0.6004392459414682, 0.8773169448314307, 0.9981279516493552, 0.5835796828846108, 0.5396442968693829, 0.8940137731300541, 0.9191578748825658, 0.506832661849944, 0.7906151624836913, 0.801618717799732, 0.9789329247385721, 0.6837499281983073, 0.5879614699673483, 0.7223109121178453, 0.7303669496781214, 0.6903017957071726, 0.9648431126768544, 0.7502298818950206, 0.9975643144829669, 0.5673551243267031, 0.8894423248333719, 0.7945288017048089, 0.884305371588735, 0.705715200946749, 0.7347400150151663, 0.669275164342074, 0.805353887440707, 0.8874391289732684, 0.6699936646225768, 0.6308995126584754, 0.7074708070859508, 0.5229208500420133, 0.8362575366346753, 0.9245367077144391, 0.963782090310038, 0.8647315055022826, 0.5426460832135924, 0.6522407931687414, 0.5630475410701734, 0.8324915819002696, 0.8322730323578147, 0.7202999893528574, 0.734646754933715, 0.5613646080914718, 0.8113514982128144, 0.6822658661607716, 0.515341987798213, 0.6681337826808118, 0.8100158408807934, 0.8419999509654001, 0.7547578955353197, 0.8251483533969868, 0.885620318327621, 0.8228717431426011, 0.7630875782836186, 0.9637831699505377, 0.7754525918021271, 0.9511341848252512, 0.709704277751124, 0.7602317279083655, 0.5935303124728648, 0.7903389279343827, 0.547457858353495, 0.9004615331480579, 0.9805173477421922, 0.8053601252088255, 0.9108804284311354, 0.7095721878999703, 0.6754513822472161, 0.6256413922841726, 0.5496534146264941, 0.5355296715818315, 0.7419279604203599, 0.6691560000701242, 0.728937987263349, 0.9645841209301381, 0.8354201307409372, 0.5872548302917415, 0.50592702044662, 0.5206512242173249, 0.6467977904878683, 0.5705832059648779, 0.909299054553892, 0.5155201055466776, 0.7368875521340008, 0.6033654721057334, 0.7272988363457532, 0.7737553599107264, 0.7683372085882357, 0.631887292481458, 0.5864021311247307, 0.7656545915944815, 0.9289644553628451, 0.5430625106829621, 0.5650314460287993, 0.8994253688430702, 0.836881288078562, 0.979013994039232, 0.8886145038050179, 0.8987845605482354, 0.8527743119735655, 0.57689178232773, 0.6054807537275413, 0.8752094834256556, 0.9379084022524428, 0.5389060039721503, 0.8408864940120159, 0.7640273788821845, 0.9025049791264009, 0.8805669653312376, 0.6114849764072097, 0.5395878241334356, 0.5217225099227298, 0.9702608971707116, 0.6189491450085074, 0.6828487105993659, 0.7599014090161476, 0.6150290380268997, 0.5247529532959094, 0.6425935469539489, 0.6330100598840547, 0.5966812112173645, 0.7521520678330282, 0.65028222571269, 0.872179414529333, 0.9210647337946464, 0.9594851938036874, 0.8151925012184303, 0.548153015716748, 0.9178467939108877, 0.5496576969647868, 0.9579704393831308, 0.5063990921085999, 0.7018991117485396, 0.9189164923226111, 0.7897069018766216, 0.7540218430717606, 0.875664160399594, 0.7193478471598924, 0.9148937409714424, 0.5296987524054355, 0.8124573491213309, 0.8807151281641348, 0.8804460489515701, 0.8594746130428779, 0.9775427448621229, 0.6328124780220723, 0.9233578166392407, 0.8323554188745963, 0.7826514288793375, 0.8402959701714386, 0.5377654513169651, 0.6737702667203067, 0.9458917065654864, 0.8078395043891649, 0.5978300214911647, 0.6224771271863205, 0.7211635856427352, 0.7297373777677971, 0.8369571612080877, 0.8717814230480102, 0.9127976981417554, 0.8802875717059802, 0.6914573183202903, 0.5866007515629275, 0.5746853019043058, 0.7121299367217602, 0.5318668477427099, 0.5427718912041763, 0.5464344495101605, 0.908389400267356, 0.7226724752837688, 0.9972221886733377, 0.7953743381288023, 0.5843762745356571, 0.8528716934496208, 0.9083883217516737, 0.9162751726736336, 0.691834373211844, 0.9138123086185583, 0.5673625008330999, 0.6446641620286522, 0.5591114793918321, 0.8219246808814145, 0.6692186781024636, 0.6763368937005879, 0.853232675362454, 0.8030002173597068, 0.6574879890463343, 0.5348604008473203, 0.5224073976612129, 0.8045148777085518, 0.6604428954163633, 0.6720300890820778, 0.933443024263094, 0.7745744725846667, 0.7455453394265616, 0.7169035650137301, 0.7102313428614341, 0.7134805338480708, 0.9080760988678016, 0.9896062475562153, 0.907360456492033, 0.8634645524366102, 0.9880672316996121, 0.5795109479566473, 0.9407952402120375, 0.6985093516410561, 0.7079106936685255, 0.5162796388914543, 0.7628729687189864, 0.7091190071394358, 0.5555082724696927, 0.7786062856537221, 0.6280948653422004, 0.9187760717047864, 0.9248707883135796, 0.7858402955317602, 0.927107796954784, 0.5116254392837016, 0.8388694574719202, 0.9327385787449951, 0.844002389744621, 0.6805931528131947, 0.9077635673949197, 0.5033217939161498, 0.8327276773280265, 0.7848296831407309, 0.6168923998720568, 0.731803386651476, 0.9128088654889472, 0.9399870244223927, 0.8728486262086449, 0.8893154235087366, 0.5754636955628879, 0.5097344004079813, 0.8187434638080173, 0.8992777529593203, 0.988320080160875, 0.9772148622030994, 0.5418713175059238, 0.6049739185896336, 0.6441239643762178, 0.5180299634547261, 0.7919273913131688, 0.9531115480342727, 0.7900955536065947, 0.6078525673547828, 0.639504452517361, 0.8893799668720842, 0.6724716058491841, 0.5097678332160516, 0.8378746899466396, 0.881075025473516, 0.6272056670130428, 0.7102893379927753, 0.6309602214570049, 0.6997744420000664, 0.6465700880415426, 0.9526989558254104, 0.8211793550888218, 0.7675261226834171, 0.5799590607234744, 0.8544712898058839, 0.7708112777688435, 0.9116774221064625, 0.9487332173694205, 0.931771703016455, 0.8181889863918567, 0.5702125824459742, 0.8124627960472753, 0.8981109225469834, 0.9128355196082442, 0.9614029610556087, 0.7929280751363597, 0.904167793192885, 0.761837576546152, 0.8879567754763334, 0.8685381415155604, 0.8831668815899221, 0.7716062433793694, 0.8277375308340369, 0.9519779924122178, 0.9683253418951752, 0.8447225651052777, 0.8741895976306719, 0.8847613673154202, 0.5092784526482385, 0.9239140382444422, 0.7016475004203304, 0.7337430146410191, 0.5468394706956894, 0.5100890423322975, 0.5880390095868304, 0.5184014027235411, 0.9244983769843165, 0.9673262314143397, 0.7834501199773312, 0.7281500451787062, 0.9007297693221008, 0.86076617657952, 0.9865219029479939, 0.5032230164429484, 0.5277865966433759, 0.8757078828583137, 0.6345060862210055, 0.991222462638663, 0.5950407109974152, 0.9513447656611995, 0.6645300215859459, 0.8795290408351544, 0.5007913863942512, 0.7905033118005262, 0.9133215235706068, 0.6825977086188557, 0.5582320047442658, 0.8802888547047615, 0.5925836098894368, 0.7997287339911894, 0.5476185139424535, 0.9693481816316777, 0.6846456777183971, 0.5539203881161425, 0.7201971655927061, 0.7706497990113349, 0.9320240330875244, 0.9856794420036252, 0.7189786302065948, 0.7301765936544833, 0.5062335440432488, 0.7010161841482498, 0.8771288265164681, 0.643445106544078, 0.617033433882793, 0.8477669773801623, 0.6422115206799337, 0.5596437312920006, 0.7526612234971464, 0.5350892410687202, 0.7978844680668713, 0.6427565872695835, 0.9021101649778851, 0.759896777513338, 0.6634834683326843, 0.595562150709311, 0.5963973969968, 0.8229258835009128, 0.8405387011108632, 0.5860244260867082, 0.9482985483286112, 0.5712399355558166, 0.9399850120752953, 0.6345235927240347, 0.9957952406720791, 0.5075131596537408, 0.9940640281194215, 0.5439741920611211, 0.9240640063758963, 0.6332998155353902, 0.9297367802993414, 0.7369864105238866, 0.7195757955309998, 0.961517177150045, 0.6423782943898952, 0.7556660128117988, 0.6910172990029746, 0.6194766992802216, 0.8035524274556638, 0.5770387457652363, 0.9076513855709032, 0.7980309408626745, 0.6745319009381752, 0.6540117139548278, 0.9053256891290865, 0.8653096778325378, 0.8991441328822674, 0.944069663073192, 0.9454137882764124, 0.526397163506574, 0.6588009219858187, 0.782810610210305, 0.8733662506141207, 0.9073214199865336, 0.6133600133085546, 0.8648869743433938, 0.921580061554373, 0.5702214631850588, 0.956871582662693, 0.8333007460616919, 0.9096437262469765, 0.8829786116098006, 0.7450841458270505, 0.5792374565013938, 0.9302080655162763, 0.9421549594278337, 0.9368613017408252, 0.6697524939884427, 0.6314483207335555, 0.9572203129042708, 0.826379605084524, 0.7885089621495471, 0.616075909583419, 0.5920034844919156, 0.9952713468723406, 0.8852460700999836, 0.5527369192631539, 0.7534772243974424, 0.7587639656990446, 0.9004958344655081, 0.681944973255948, 0.6538427326407865, 0.8390158512574722, 0.7084432323268817, 0.5335496671654714, 0.8068980950378835, 0.7049627762303226, 0.6897653398971568, 0.8787880510716348, 0.896735614565791, 0.9149029857220413, 0.8183692409295358, 0.7450249300884881, 0.5226383670676844, 0.5321207675039655, 0.9260585849673352, 0.7031476134342167, 0.9179158725455467, 0.6155503097556964, 0.5000558718499433, 0.7361566784295444, 0.776816746880483, 0.5284726130740336, 0.5546958507581625, 0.6725153080048536, 0.7326847918180679, 0.81702040151202, 0.8875429928136016, 0.8122549582890091, 0.570923554989617, 0.9078083491453239, 0.8000203162972754, 0.8123132952667622, 0.6011639834448992, 0.7217414811702116, 0.5002894791476346, 0.6646513059496904, 0.7039487565661711, 0.5452734214965725, 0.8464519847372631, 0.5156192022424582, 0.8421137573663284, 0.6977251005535452, 0.7721833994245415, 0.7794011369185633, 0.5088758350687492, 0.9370470898738678, 0.5691304815600096, 0.6628951470054154, 0.5803212637024148, 0.638484315542041, 0.8176402723385687, 0.9561178798518919, 0.5344717346302094, 0.9806481736594275, 0.5339729102802953, 0.7156365898992949, 0.7322723232640698, 0.8883947722083493, 0.533990260536932, 0.7149627187614541, 0.7335864134421621, 0.8332884946171022, 0.9461353223596467, 0.7896585495428481, 0.8209605130375763, 0.8092050759484124, 0.7606482309336169, 0.7664924237814863, 0.9075135278868605, 0.8061372696157749, 0.9216181715136698, 0.5250585587373999, 0.531669993856253, 0.6103556574199154, 0.5714345147703291, 0.9282700925151477, 0.7461919732517726, 0.9865499772948179, 0.9652780056372235, 0.9046014382902094, 0.673886318141504, 0.7699418840352629, 0.8098273127660776, 0.7507369561529946, 0.7483177707244721, 0.6912167852664886, 0.9202919935622025, 0.8409658726846965, 0.9827238456129528, 0.5794914452158176, 0.5074495744218297, 0.9717075758332283, 0.6207736346888878, 0.5252400711256537, 0.5172635726088378, 0.7313310986810804, 0.9932717951421741, 0.5149868725703968, 0.7889888024414942, 0.736071076460008, 0.7257076144046106, 0.6924231619859712, 0.8520009508601629, 0.7231208695181004, 0.7973707349155299, 0.8357620470188798, 0.7058679378976702, 0.5465287172550892, 0.9952767405000305, 0.7041729306003984, 0.5864784755304107, 0.5091923224375414, 0.6896048363718421, 0.9184346566893851, 0.776291108723633, 0.5260828639559474, 0.5909887574900039, 0.8310796133189609, 0.5249839853196485, 0.9116866068631919, 0.7869613470964184, 0.5559310556230133, 0.645930895025466, 0.9452498226082043, 0.8249126729659854, 0.730622677246376, 0.7415908161576877, 0.8190545101014789, 0.9060109200944055, 0.6352364182152835, 0.7922365821545019, 0.73458631516622, 0.6884966201001662, 0.5580405490625149, 0.5241643540122604, 0.8843821133157623, 0.681936767045025, 0.5701734317257633, 0.7306604349933965, 0.7823882736002863, 0.7417167427985236, 0.6575065606219623, 0.644341154315627, 0.8360225971806827, 0.9689575963516458, 0.7932218544538168, 0.7729613241557245, 0.5572860937698194, 0.9710586075172627, 0.5550067676822303, 0.8979537745573944, 0.7487971479820953, 0.6838081367200359, 0.6573707099878797, 0.6705051596444562, 0.6602410687182938, 0.935523193183287, 0.9813262939501013, 0.9209661171060033, 0.5169492507028819, 0.6408433503304566, 0.5037711761649799, 0.7772137604743377, 0.5925551079910987, 0.5135674651794127, 0.5924918128225418, 0.8764222918342225, 0.7833385131090387, 0.8105049494147445, 0.6086976762910286, 0.9338923518108846, 0.9275278261572699, 0.5572810490771039, 0.9385083000505245, 0.946305513427886, 0.9844264603738372, 0.56770233547865, 0.8562085618843422, 0.6268996026437927, 0.5539894269631589, 0.9927300475246482, 0.7716344129755117, 0.5237330945033736, 0.6653946146991526, 0.7528671941422058, 0.7408452706794233, 0.7707567323275513, 0.662435163713292, 0.6233024644094571, 0.6156381270482946, 0.948093985930129, 0.9371112925368323, 0.607557112370983, 0.6513538671249652, 0.5725889273138534, 0.7766583013987249, 0.9887345029400746, 0.8782454039936539, 0.8353469819283779, 0.811838526301998, 0.903791120115043, 0.9717510368773632, 0.5143415044795803, 0.679999020337978, 0.5378984704023921, 0.6654623803755932, 0.7393103313907867, 0.8339542254534487, 0.980906579736584, 0.9427414822607527, 0.5219640546918138, 0.682332560947557, 0.6778728289084317, 0.5808996755418069, 0.6905406624388271, 0.7983829815611143, 0.5624561208389022, 0.9205925642565767, 0.6954711383321074, 0.8834041593997211, 0.7903164957989337, 0.7086157307313921, 0.821201361496882, 0.5101781445642825, 0.5813473664551351, 0.5691214574988318, 0.655211011234704, 0.5444799870308101, 0.5976129317727499, 0.5146133191479829, 0.533210518462867, 0.783296917118857, 0.7845963611933731, 0.7896567331793573, 0.6417039853707224, 0.5754314395581193, 0.5582026832287872, 0.9167148147918651, 0.6816152220769023, 0.70575003943605, 0.8549044632823708, 0.8849357954057944, 0.8613761904025279, 0.884553645050292, 0.8609451365605085, 0.8280150270287645, 0.7909548766014223, 0.8408625358995044, 0.8015393394435172, 0.7688226100981541, 0.7597934918655779, 0.7422528718776062, 0.9860277850108075, 0.6991331934271319, 0.6536491783739402, 0.8272060674853035, 0.9677724231099296, 0.67544509199923, 0.6872660479480426, 0.8058819367773522, 0.7258946888381103, 0.5074001977558449, 0.7803648473862079, 0.8278063901002541, 0.8709451910077244, 0.7694943785007907, 0.980234873122495, 0.8042507571478288, 0.9507655267673795, 0.9214444190449763, 0.8121639994635966, 0.875871623138837, 0.959969931557417, 0.9287773892226592, 0.6464682634272032, 0.9752057130004999, 0.8545992490217326, 0.7928917235604842, 0.7038780256548902, 0.5064445769018737, 0.7804625104948064, 0.8885417725790947, 0.7931881369245548, 0.5676645702009071, 0.616962214385002, 0.8603552274623409, 0.6937349440868619, 0.9328411736111876, 0.9581845064382646, 0.5804436312478518, 0.656115722393696, 0.9354234406546738, 0.7140760551106601, 0.6160133332207133, 0.5085433841959219, 0.7074116055571577, 0.6227046269446086, 0.5856260761968592, 0.597598133887697, 0.9039693485910667, 0.5584237204283005, 0.5751726076416122, 0.9825980472621976, 0.8493887367904209, 0.5761950877417974, 0.7307327779548727, 0.704187546362721, 0.6939490747849574, 0.8295253225516335, 0.7480026079803602, 0.6226111300720629, 0.5739316484907557, 0.5447043552265254, 0.5292627741199445, 0.5850004122233357, 0.613808396416978, 0.6640823105017134, 0.7286194980521274, 0.976100326120654, 0.9951881213579742, 0.6497297574097313, 0.6997629999242713, 0.6356310656405308, 0.7205743102660419, 0.6188828536680598, 0.8751342519757228, 0.7233034489680745, 0.9615358829729418, 0.5587503375307568, 0.9728738921440756, 0.8486489564719162, 0.65987678817026, 0.5352858365741437, 0.7083616424525468, 0.5098419997132264, 0.77187519699913, 0.9748346384598939, 0.8597916215493433, 0.7120032323134496, 0.7002897007618121, 0.5389274060331983, 0.552721779733641, 0.977115803203474, 0.7040342089595021, 0.7339186213869826, 0.5741354670437977, 0.5549673115732914, 0.825043467262689, 0.5197979615665667, 0.7200753617228263, 0.5634685834630173, 0.8937275609864519, 0.8556017677184287, 0.8763028154878916, 0.53027457637313, 0.5988491894696617, 0.6167566241891216, 0.5109839667580586, 0.5143409161365626, 0.5679288662256683, 0.8609638284745208, 0.8008951451640487, 0.6296684458421911, 0.7093966100621408, 0.7792863539847831, 0.8985034218373268, 0.8312323299179658, 0.6197208164923672, 0.9162306604054329, 0.7758477005902011, 0.9839888526604441, 0.7024176950172801, 0.5244630008216931, 0.5885959667063756, 0.7726439508071772, 0.5282550586658028, 0.9973096359665712, 0.8762793137244885, 0.5032386979592259, 0.5719174638708461, 0.7675965865251211, 0.9209469862330951, 0.8956828944408469, 0.795968507339496, 0.8821708604965615, 0.7690578175348288, 0.9009281528851639, 0.9145313684939391, 0.5882391493630433, 0.5544457238903308, 0.8263935550404966, 0.8124082393175949, 0.5654913676504346, 0.9792802730715813, 0.5931111131974043, 0.9519900635487368, 0.9200808961346374, 0.5545328725342582, 0.9312116118774414, 0.5889187618513758, 0.8208909686699069, 0.9291278589269139, 0.9024599832330129, 0.907985184359857, 0.7438610495461999, 0.8391150264520387, 0.6613579246239637, 0.7983403477256625, 0.8947652169500899, 0.8338718469500757, 0.8643501626552987, 0.6695433271211549, 0.764060514131812, 0.8155701040608443, 0.8616692039451856, 0.5641895300870203, 0.8291877209897283, 0.7495736582930768, 0.8778051902504971, 0.5986868799784579, 0.7453923399297182, 0.9102975331728841, 0.7891950101444807, 0.9994022764659058, 0.8820572595495317, 0.9829684747463376, 0.6002463751953635, 0.5684198670016781, 0.6646238451366859, 0.7967971060331844, 0.5137987783999154, 0.5393108368621519, 0.9461724289811055, 0.5826680830907685, 0.8683635484970056, 0.5454470920639312, 0.732288981462343, 0.9700353931620385, 0.7630139783381614, 0.8911673800255093, 0.5985598525509959, 0.7993613049002284, 0.779529870815984, 0.9741682006309158, 0.5539070326833577, 0.9570061902158766, 0.6871600213406419, 0.5711878000154261, 0.5219803119316768, 0.5647292463700111, 0.7722467744421664, 0.79455549443107, 0.5380787770369814, 0.908938595159823, 0.9445394910679948, 0.9828358014374662, 0.8583433468406323, 0.6176437793616891, 0.9417919614602277, 0.7124436865351631, 0.6895853466697528, 0.8660016551683406, 0.8586253396541154, 0.9161745233819314, 0.8241665712891915, 0.7619086218288803, 0.6485963651192974, 0.8616068923032298, 0.8927843029316159, 0.8083578918978259, 0.6841558527176788, 0.7020908406304852, 0.7414320795769522, 0.509806054143115, 0.8182375588264748, 0.9954934618994382, 0.5265610416855006, 0.576943825070854, 0.805679203343255, 0.9808747178648289, 0.9492143766998886, 0.5289665035986885, 0.807900433004591, 0.5167572376492859, 0.6241561641734519, 0.8193319109639569, 0.6453379364550531, 0.5755084948761877, 0.8186226760765336, 0.6413779870797474, 0.9031103364806687, 0.8980886084275772, 0.7441103190070915, 0.7419020479465894, 0.8208047424765403, 0.705573525619262, 0.5533346587041073, 0.8754686680796036, 0.809955746968217, 0.7582053787344976, 0.7562840498188543, 0.7837985640106883, 0.9968525672032826, 0.8645177830361559, 0.9715861304358668, 0.763562178353336, 0.9534844528194945, 0.5754665926889448, 0.8312386845500506, 0.6307234050711445, 0.8843792980215116, 0.637025158793963, 0.5755755511103346, 0.997694134670671, 0.9394378900352228, 0.8670817021905513, 0.5511280288297549, 0.9193909282200307, 0.8159119905310188, 0.7259945875654863, 0.5376766871050735, 0.8191459603988004, 0.9301507556925295, 0.8397540572515578, 0.5521511621687025, 0.558958468779971, 0.6374993765130508, 0.7702932092045861, 0.7434767087697272, 0.9725479187027326, 0.7936579985201109, 0.8646442250246619, 0.8066341140763043, 0.800986402831467, 0.9456068909625203, 0.8910148033639451, 0.9636705475505783, 0.9134842500195633, 0.5956792665629587, 0.7201811515362586, 0.8596520884925369, 0.8216296744050653, 0.8113516926240685, 0.8849858787935831, 0.6839924367361965, 0.5425047174591618, 0.7772592490775381, 0.5878661816089177, 0.7915979357563441, 0.9439809971855315, 0.7123407417332639, 0.7534721649731809, 0.9105434914910014, 0.7643370475164725, 0.7335606884645838, 0.552166396764215, 0.7185989693618482, 0.9582551116700195, 0.9354821438734697, 0.9860435934580001, 0.5612634257969707, 0.668100760393415, 0.7018666185826083, 0.5194423978303258, 0.5193450383133354, 0.8596995487095043, 0.8638080041056068, 0.7113354183827383, 0.9431003944294089, 0.7425541332015906, 0.511478562990981, 0.743159241412692, 0.6261773469833651, 0.7319502650690665, 0.5053606447175667, 0.5949843105919386, 0.9938024983900033, 0.5058520242131455, 0.8830046615107041, 0.8782650072922451, 0.9105167493374215, 0.9705142175425178, 0.9747609460279043, 0.7960988331108998, 0.8544678152408471, 0.9467544226890479, 0.702720343330957, 0.8881769993422082, 0.7819713318842985, 0.7264763500724869, 0.8340643778408673, 0.6783951717191741, 0.6797205327681619, 0.533205445206703, 0.8642544200392217, 0.7628928347414661, 0.6199457230668728, 0.8788277008335283, 0.5368698377578791, 0.7003152303026461, 0.9046256567316318, 0.7252332392192264, 0.8969322782629776, 0.6044943443939901, 0.9474052165930922, 0.5939788393320959, 0.8834510386001008, 0.6125279001323949, 0.5632354847815735, 0.879663605305449, 0.8671356600009231, 0.941160338844738, 0.810487147619392, 0.7950608279360278, 0.5427311544660514, 0.6461829280401793, 0.9168484607214794, 0.6884695424156799, 0.8240374197811358, 0.8988689525771332, 0.9313095383530496, 0.7650909631083911, 0.5853549662284412, 0.7548641363612227, 0.6626910990981296, 0.5076847022565132, 0.6010631160247317, 0.7743275259224309, 0.9119957388187325, 0.5664518541581816, 0.8496551928245311, 0.964353767636344, 0.8726380848065564, 0.5120322033420086, 0.7964514047113272, 0.7809424655166647, 0.6878412410063149, 0.7368691592310603, 0.585230169854283, 0.7501230734619445, 0.5357537485954436, 0.7214132005267013, 0.7644290777376657, 0.7848241108308761, 0.9442903452823224, 0.7959682368909549, 0.5405308362217038, 0.949737336065798, 0.8836142381442249, 0.6106679785316003, 0.7954909795706089, 0.8300687923198898, 0.5076741082768188, 0.7122191806303176, 0.5735196948462922, 0.5775772027658423, 0.6033322095118667, 0.9327105736481625, 0.7675742862106518, 0.5936863118219061, 0.8358518075328119, 0.9350715392033688, 0.9402732574242869, 0.6373672392838656, 0.7902613948484605, 0.5076888116144915, 0.7446617235310177, 0.5964333168476836, 0.6408958189126127, 0.5751315889991242, 0.7042838896687946, 0.932199357837951, 0.9688124515953671, 0.6011986638534161, 0.5299696468272026, 0.604916186388837, 0.7138711151123365, 0.8458409109202263, 0.7986433202526817, 0.5385824304912648, 0.520675137434266, 0.9742652065690602, 0.5492631029880006, 0.7416769388020283, 0.7614044571022486, 0.8796550545262865, 0.8350550541048867, 0.5015347017470827, 0.6726485509446465, 0.5468149281915133, 0.7800496909579193, 0.639886561640846, 0.8076818275368903, 0.5015034430669567, 0.9001718391347859, 0.6188390222140535, 0.5065942588344365, 0.6129296531737262, 0.7321405733902138, 0.771569436435146, 0.7026237203098586, 0.631924510107611, 0.8382662586749505, 0.9952885127852992, 0.704483456730518, 0.9745721660889821, 0.7182895141985475, 0.9710426431562403, 0.8709229660024436, 0.9631597952102784, 0.7228067293835014, 0.5324120961737389, 0.7527895024171782, 0.8248581360292664, 0.5505746026640783, 0.7277582556215523, 0.7653086414140837, 0.5370673400461263, 0.6928290343609611, 0.917890110509973, 0.9800390714819986, 0.5681238295423093, 0.7499573870795111, 0.9308944390843328, 0.5476059535967899, 0.6315207943257273, 0.8048137103858743, 0.7427233076496857, 0.5493485437327884, 0.9991959491322748, 0.9404097671001383, 0.9350227811341794, 0.9982805183477066, 0.6590444468761631, 0.8741992132871, 0.5832634450353601, 0.9955659972322213, 0.7736589027373226, 0.5434954337446438, 0.8252462031349714, 0.8751494567782845, 0.9794150901975496, 0.7890803522426064, 0.7916427254547813, 0.5249460747160334, 0.7857679592483175, 0.7406671751233251, 0.9418184024880433, 0.5181063635822358, 0.8768370873192459, 0.6482358608766491, 0.808829289578568, 0.6194626682838533, 0.6473815818512484, 0.9684748140995342, 0.5233278074419809, 0.5191437718973895, 0.885170173794674, 0.8794175311093702, 0.8868027301213679, 0.9093994476431965, 0.752636746866097, 0.752987349243493, 0.9940368714297662, 0.5247325132771175, 0.8433798339997014, 0.5081407412193817, 0.7608552580060821, 0.5841925444013081, 0.9224594554613406, 0.8922091288719369, 0.8296554537316319, 0.7610660129997389, 0.5865762308146145, 0.5842571778095376, 0.9378630274265396, 0.7543718853017686, 0.7893240883208278, 0.6197828898217492, 0.7381273056638584, 0.6633480431896213, 0.8372289116858613, 0.6370786333347074, 0.6406106190233545, 0.8554285371486547, 0.5115661732441519, 0.638820680010149, 0.7170158724468237, 0.6675462273557651, 0.6251891406817616, 0.5376795399383165, 0.8388849611126028, 0.7827572658328543, 0.6783426746152482, 0.9717176504585452, 0.7538032286897978, 0.6314932026580954, 0.6176878890554813, 0.9391142612325278, 0.7275428344931825, 0.7451805621242549, 0.6731859808155518, 0.8397445938785292, 0.8495840706036446, 0.8148540293634541, 0.6548765820577624, 0.7465527724769687, 0.8882499384273627, 0.5877058587924261, 0.6201312264995615, 0.7543385785892365, 0.7305795489334397, 0.9618500549193927, 0.7567538195954817, 0.6908475445150584, 0.8981354772785157, 0.8968395229628328, 0.5160301483873448, 0.576523267668261, 0.872258806650721, 0.9543437107616852, 0.8902675596121468, 0.6341937441249349, 0.6434152454774056, 0.5863844652528973, 0.7462264968595334, 0.8901797186998588, 0.670535937430828, 0.8101380133432516, 0.9248718812863392, 0.8366996503934014, 0.973978806487142, 0.9332831300160154, 0.7236251348243357, 0.683238607908512, 0.61667548041182, 0.9925478639616019, 0.7604929054654739, 0.6990991133381489, 0.680611455617649, 0.5173377715737766, 0.8021186841110015, 0.8852836175279732, 0.5015259689382089, 0.5640460526119948, 0.8502297071205818, 0.9313832389760476, 0.7269320635725649, 0.7093925849121756, 0.9800964903064314, 0.6654275288672372, 0.5507942787731002, 0.6428162559228203, 0.7366233974114617, 0.7019693519589052, 0.551546633527985, 0.6895014880186356, 0.6292013239275545, 0.8975444664487018, 0.8272747418132254, 0.5297634534288332, 0.797036020475145, 0.8076818901390415, 0.9568661987986703, 0.7572770495039232, 0.9564409821728025, 0.587665800664822, 0.6988844701888055, 0.7763294194803183, 0.6452089416459201, 0.772892774112766, 0.6600452757261286, 0.5699217738842519, 0.6161120553469241, 0.9263630560285829, 0.7824699557950833, 0.9717439118072083, 0.5645304555886812, 0.9479934421895413, 0.9530260022723474, 0.9028941247943126, 0.5339552275726036, 0.9289561985164205, 0.6695860469676385, 0.7676757590210432, 0.9432187250199328, 0.5956839554434245, 0.8282160557169322, 0.9658869652226221, 0.8475697218346079, 0.7715006563490278, 0.714803527356011, 0.6379521292585717, 0.7302015328076038, 0.7021101406514983, 0.6089584530161437, 0.6855494338589645, 0.706950033857438, 0.7566489083064931, 0.5489472333676773, 0.9520570234984542, 0.8183343420235317, 0.6261079830883731, 0.5281175468315887, 0.9649275885918296, 0.5075035672144702, 0.5468552716729782, 0.8619195520582605, 0.8855283398216667, 0.7917403504237988, 0.9189757650160751, 0.9815254517448724, 0.735845165258062, 0.5697052475234992, 0.8622506660103397, 0.7522913634202768, 0.8240857687547734, 0.8718893231496928, 0.658699457401222, 0.5929455822219005, 0.944518373965425, 0.9419086851749114, 0.6697917659471522, 0.9660172720253022, 0.5569891703878558, 0.9412121586810331, 0.7391781402496136, 0.5588115653815331, 0.756331160204921, 0.6502160193838515, 0.8974950495919153, 0.7899818900958806, 0.9317785002607473, 0.5679176441170173, 0.7863547080872718, 0.5987695493274864, 0.865590219514593, 0.7933026925659655, 0.6781102492645148, 0.6126820946827046, 0.5312444361269081, 0.9073454932801749, 0.6466460535060944, 0.620148697528452, 0.6132195220778878, 0.9927236902349299, 0.9017500560714584, 0.5672634035419791, 0.8998329657659544, 0.7094941293272026, 0.5033837666737229, 0.6544778257058175, 0.8314703786799358, 0.9656493279081373, 0.5026502945913114, 0.9946814838671114, 0.5908906756438287, 0.5138973171114911, 0.8409847167766202, 0.8517854623944535, 0.9317305183972572, 0.9088583466972155, 0.7699328649636248, 0.5656847906189888, 0.5454264676909111, 0.5620509960601211, 0.8343276466426772, 0.5049513872771363, 0.988271427651088, 0.9290861812210379, 0.6343178811002306, 0.9517967620635422, 0.651067708985235, 0.850022407910909, 0.9282393270663469, 0.780939767887202, 0.9489337270263747, 0.5658760897942401, 0.6693815299691943, 0.605726902518639, 0.7832680210415734, 0.7428016443803566, 0.916650889991979, 0.8789144018752433, 0.8069052113216252, 0.5194836620435844, 0.713696513911769, 0.5791749340331054, 0.7840820881954005, 0.6555836278674518, 0.6509096402295909, 0.6273269033236188, 0.7568175876608043, 0.7114435057820798, 0.9859600440250775, 0.704501013212909, 0.9225027300083344, 0.6501802499210994, 0.9299851377335178, 0.5953561619614245, 0.8981643078554733, 0.8601478020023834, 0.8153657246929092, 0.6529292170659311, 0.6397567983706648, 0.6444951264854549, 0.9346272237419251, 0.6547157888454147, 0.6305490430282552, 0.723702435142449, 0.7948583735795234, 0.581490597267494, 0.8267489517540205, 0.7172073232892365, 0.5395968060745934, 0.5932890128170275, 0.5826799690175017, 0.5678417716592583, 0.8794766420068585, 0.6619214329104066, 0.8234325080005658, 0.8481601809672569, 0.8913522869921424, 0.6311871612239686, 0.8261631033948225, 0.8426483973238429, 0.9644896344607718, 0.7627770248865302, 0.5371554748897872, 0.9710254424815835, 0.687334762804791, 0.8663053843856959, 0.7142382889145932, 0.8126378550049698, 0.9133773523361317, 0.7211849355388749, 0.562559747988634, 0.6535469178268007, 0.9654307544107634, 0.5530356050046763, 0.9436107790858563, 0.8786510072487332, 0.6147542054657231, 0.6933644628905922, 0.9027730852795048, 0.854571767929081, 0.9927297833329328, 0.7027249780338852, 0.7055331534701109, 0.7092256433354868, 0.5103229144303523, 0.7861732517848437, 0.7230093993055503, 0.7061823397767497, 0.6891393546154795, 0.7132641928920314, 0.5125023033379821, 0.986482214563449, 0.9527239981185991, 0.5581367017031537, 0.6632033755231018, 0.5262535843658682, 0.5921800867765021, 0.5311623839745894, 0.8396700963553967, 0.5387816729829149, 0.569506387380619, 0.7003621025165093, 0.9468383051364537, 0.59177838899188, 0.692376740700126, 0.7106565336629034, 0.6540290468939682, 0.6434734669363789, 0.7405817791857073, 0.8957034490790279, 0.7684394823614379, 0.5701563435102193, 0.588029109195642, 0.8291960029686638, 0.8324614582965676, 0.7463663347086542, 0.9923528568691045, 0.8571504009654931, 0.6884427832011689, 0.5078841797098435, 0.6691427102976708, 0.9953963840734279, 0.5767404033472021, 0.8753842462798485, 0.7785582481295408, 0.5251727119857127, 0.6257577676095619, 0.7105614683286954, 0.5632412744926374, 0.5756135363150032, 0.8371080763560175, 0.8883940619472439, 0.8547846358326775, 0.5350325506830467, 0.8619036048663211, 0.8495538743662342, 0.5871132718625709, 0.7049395439683891, 0.9867277870045279, 0.9521228740585821, 0.9154054494558628, 0.8944813398769542, 0.6517265679203894, 0.7501450469459989, 0.5536015429218609, 0.6557129190651219, 0.9758752196061087, 0.7136532187689593, 0.6126045315275416, 0.7840399985588045, 0.6475999435987942, 0.638465746316187, 0.5150346143456852, 0.8465575188578809, 0.8224606409398135, 0.7183137620843467, 0.5812756260891914, 0.6945222842253531, 0.7377246852492655, 0.855457088289022, 0.6255632324615249, 0.6493269662155723, 0.9454430937138374, 0.8961225427161512, 0.9015133728066198, 0.9577231996759823, 0.8643046611140688, 0.7478421721421676, 0.7524346733677327, 0.6777890630376066, 0.8123860222697847, 0.8256491303311343, 0.6472468222612471, 0.6588684312794117, 0.6202272732667156, 0.597797764765619, 0.6630479030487764, 0.8164620873955555, 0.7360780022093519, 0.6169355504114323, 0.8349873501249012, 0.7572444526643765, 0.6549534668094156, 0.61293188459252, 0.7768072357836977, 0.8741828213445998, 0.7000830229662729, 0.7350370969144631, 0.7368974939220201, 0.579861920969411, 0.9006793426697111, 0.9017373527562127, 0.8057790444379422, 0.9520971680874262, 0.9306621495733342, 0.5015298711356062, 0.757436201494609, 0.7741256986052834, 0.9482247601412472, 0.9845255453400044, 0.5408595383204002, 0.8213002247029995, 0.8126011955132988, 0.5012520773070088, 0.5837352616417774, 0.5226914423309349, 0.5479956744017264, 0.5264234915309578, 0.7144568785285833, 0.8636994705373975, 0.9823503539000924, 0.9005276941124298, 0.8661530427508064, 0.9828558619089731, 0.9655480081761998, 0.5690733130833938, 0.6154459322215147, 0.9413654040668603, 0.8340415711661313, 0.9420725544132331, 0.6956928808672496, 0.7713469220030784, 0.60241121900155, 0.7882936884419279, 0.9028479912040703, 0.5078124854646276, 0.856703161123963, 0.937130714143665, 0.6728910290450894, 0.7204900455215533, 0.857890227402462, 0.813761173102584, 0.6386985385136541, 0.5166707928741554, 0.7801314244322808, 0.6836034095053214, 0.9770848451296725, 0.6937679276899822, 0.9145697582502392, 0.6436808205941968, 0.569622972494465, 0.9614518800661469, 0.936397540417681, 0.570383920393805, 0.5410554490415864, 0.8096124596611951, 0.7655795785217796, 0.8353540035015751, 0.5591232339025616, 0.7883274103629498, 0.8300978779509777, 0.9684413178577258, 0.7009152553781232, 0.7236731943621828, 0.7036983616497469, 0.8701719436071932, 0.5906388475017764, 0.5158152201123125, 0.651253119531542, 0.5724859109064347, 0.5752584735514163, 0.5135980682220063, 0.5903075381455308, 0.8253974030079891, 0.5839650264823526, 0.5303610113918975, 0.9092615181641038, 0.5822185929818429, 0.8333280493918939, 0.8864134740141981, 0.8307288835177584, 0.5385637951184903, 0.6100380062054247, 0.6892757641589466, 0.8796230060110115, 0.7744994178517468, 0.5835646733932078, 0.9790482444275597, 0.5649004205356063, 0.786588578885922, 0.7273959892658122, 0.5003839629279887, 0.6232546347711632, 0.8018219135172238, 0.5965483035915513, 0.7269706441180344, 0.9887480545669858, 0.6208966880321021, 0.8903714180674118, 0.7136652314119367, 0.7293682658181675, 0.7117545867835532, 0.7638516749286994, 0.6213993775450444, 0.8791651092273514, 0.9851699990961221, 0.6046973107725583, 0.6013549154772804, 0.6796888260804749, 0.5143286445756637, 0.6652042347670937, 0.9324870908679717, 0.7668731502354906, 0.7357104665669396, 0.8316096733941509, 0.9886806577294089, 0.7386265833312555, 0.7512141920779867, 0.6526499724739248, 0.5792491585834654, 0.8851818846834231, 0.5845039493976238, 0.5488348280042695, 0.9978759176148595, 0.700718998121852, 0.6608069226773221, 0.5479431431630788, 0.9522777307663448, 0.6226881494397193, 0.951572227049297, 0.9534612724170108, 0.8353942787001789, 0.8464858997536766, 0.617520631194499, 0.5796830763760266, 0.6027092803959361, 0.9276503648701482, 0.9220397727384473, 0.59255482880834, 0.6352258393922464, 0.7946367801724759, 0.9139598228331147, 0.7584739031492493, 0.889827157619268, 0.605707635508905, 0.5680687501498958, 0.9520237711915329, 0.6847603031815205, 0.9970991116953363, 0.8253122012062983, 0.7142775611213145, 0.9056803170191565, 0.6443766787441926, 0.8962688136255144, 0.6550465949519877, 0.6856251938130082, 0.870846465191182, 0.853640478876512, 0.9943971095182647, 0.5190163306331621, 0.7053541971819504, 0.548982936581403, 0.654490819103523, 0.6490830497605732, 0.6036304726875457, 0.5857097205164492, 0.963906335188475, 0.8625596342776458, 0.9890300005427519, 0.5813347155248263, 0.6223222069921484, 0.7734294258808874, 0.7768355697537259, 0.5321172151946205, 0.6980760904147296, 0.9970843780863305, 0.6656061690608241, 0.5674536807238268, 0.7091126560754096, 0.7786409173269421, 0.58490589430507, 0.7152939002710441, 0.599848834178964, 0.7036086932467042, 0.734450398255329, 0.6697889881435917, 0.5899860852547494, 0.7070983685273049, 0.6256350682955834, 0.7522809335021974, 0.6764987304738259, 0.7269862855273448, 0.710299923720878, 0.7495049796453075, 0.6704894934470836, 0.6709638425583653, 0.8080623569025047, 0.8945762715536968, 0.7913371735288396, 0.661392923020781, 0.9827791437720484, 0.9115234311877467, 0.7299763844220333, 0.6459476585043169, 0.8748343990929442, 0.6291265802220622, 0.5430393227476445, 0.8950061201602223, 0.6885375393048675, 0.6589163224504662, 0.7938527710791092, 0.9127958840559001, 0.5387557086644764, 0.5882787707757208, 0.8588089277368838, 0.7465379367354819, 0.6840556076836075, 0.5753870739516949, 0.5529923851210696, 0.6411571792264436, 0.9734071079362778, 0.8655689597421999, 0.8427240689181528, 0.8620829807473775, 0.7482587178161598, 0.9048239271390988, 0.7552853076697619, 0.8610850426582493, 0.8857706915511694, 0.9093907112380495, 0.6277841981839765, 0.7465551772802205, 0.9457943271260447, 0.5307335134028727, 0.5473591721259503, 0.7276122676701386, 0.8873064050308269, 0.7539449866622364, 0.7501890087513726, 0.9415228522301962, 0.9488587603301836, 0.8735358984919097, 0.6688657004563494, 0.5873218161201573, 0.5443625852441006, 0.7089412016640692, 0.7308942492070083, 0.6426184819530544, 0.5392939893239292, 0.8325174871181309, 0.5348556806061919, 0.90761752128266, 0.843379603484784, 0.665783086437145, 0.7789592751752312, 0.639830763740326, 0.9755451704349607, 0.7124402111413621, 0.623178655874056, 0.7121487773692163, 0.5634567309813158, 0.8443235485280955, 0.8590281246282143, 0.7632754910133105, 0.9257709016759514, 0.8569842980625133, 0.8852207233285343, 0.9736493506029951, 0.8875635964440218, 0.6545635587880644, 0.9684281739606888, 0.7211984870309753, 0.652598777805576, 0.5910900619604003, 0.9241797322815548, 0.5690109796936156, 0.8183411805356644, 0.6463923747706894, 0.8746780519714876, 0.7205345872671637, 0.530893631668681, 0.8626437504464592, 0.5126242359914954, 0.5646234801978621, 0.9429861148371173, 0.5762572814473992, 0.7185000362473785, 0.8757567197490483, 0.8690670262585993, 0.5776090522531366, 0.6011936114335663, 0.6942028442737016, 0.5688649051280945, 0.6386380792953621, 0.987700368596685, 0.8700557960243991, 0.9275426066629935, 0.8703694944914054, 0.8038858910896614, 0.7372919364092018, 0.5882662715196145, 0.5667280812484929, 0.6134914895832058, 0.9870960038274024, 0.5539289243728945, 0.9262521846231009, 0.9391839102132111, 0.9245194426885794, 0.6342615591536356, 0.6518217952302561, 0.9751370644851046, 0.6018119044002674, 0.5841339388858819, 0.5222981388306034, 0.8659726758138688, 0.782040867674394, 0.7327749304679021, 0.6873858962598182, 0.7085493819894002, 0.7830032994514629, 0.54297930039812, 0.511439788304037, 0.9205462993116664, 0.9780133397954351, 0.6353786857066046, 0.7160896707441048, 0.8014396328882236, 0.7901358784748096, 0.6873080057035703, 0.7163634548554455, 0.8669259895289758, 0.6302336510794346, 0.8819471961396594, 0.9960842044416034, 0.7189528594168337, 0.9006488956597485, 0.823963190817004, 0.805197820427448, 0.9014826483484129, 0.5214795264402616, 0.8336251424508374, 0.6261181259858044, 0.603046476929981, 0.9500365775713349, 0.5635130152533505, 0.8261726522651964, 0.8943784932772451, 0.5116781325099653, 0.5889104265443252, 0.7698295770798755, 0.901929620369176, 0.8462004275412902, 0.5497493349639325, 0.879661163167113, 0.8579846159101684, 0.9954162536234591, 0.8283503498497387, 0.674603714290076, 0.5288149263874001, 0.7954287746746569, 0.639961871583238, 0.9377509605513973, 0.536423266712343, 0.8998082588732237, 0.5343721378108004, 0.7083055114869931, 0.8030746825885354, 0.9044510551086147, 0.7990530780241287, 0.8637975792423884, 0.595447890639085, 0.5204944515140912, 0.7359411122078884, 0.7530033763974111, 0.5608046849386406, 0.757726269684323, 0.6560042552776673, 0.7576892124733148, 0.6228303657808765, 0.7753308040616118, 0.7491705060436099, 0.8462094893004302, 0.960481025539934, 0.6044624247276085, 0.9915852271546451, 0.7587803961179145, 0.9221978400641617, 0.9431410468780405, 0.6918314588707025, 0.6462141037983922, 0.5593596749422853, 0.5573721534436111, 0.9710305600742539, 0.9562767873855909, 0.7619615721309381, 0.5626538377488648, 0.6829489748104414, 0.9236619399586175, 0.8629650918800387, 0.849948291359013, 0.6592132197155885, 0.6730761459381929, 0.8680507690310266, 0.6944997470480894, 0.8240071961515525, 0.6613924684647438, 0.7918459068966837, 0.9984945860382434, 0.7060279720824847, 0.8123634088152776, 0.8387113051095488, 0.5299249843006878, 0.7766742040800368, 0.5373951829278534, 0.8526513010813752, 0.8664892244944387, 0.6313034440895483, 0.9876811967239725, 0.5278733709991932, 0.9017877563349115, 0.8928554412471332, 0.6410837897904895, 0.6891856338233616, 0.5438761287223974, 0.6495162971999533, 0.6332273525047247, 0.8827455937885561, 0.8024309860786669, 0.5082221977177921, 0.6642331116394038, 0.596332271732631, 0.5634494229113145, 0.5070184945870368, 0.5001960250604107, 0.7927501989434371, 0.7914610652819993, 0.8581183428184704, 0.8525240908965861, 0.906568919376624, 0.8763760203140085, 0.9373056441763947, 0.7165924113815805, 0.5093988760734511, 0.6303481571626286, 0.5637874987238897, 0.7715393845531155, 0.8917394936799201, 0.8023803510911727, 0.9054299920386941, 0.6803981676512524, 0.6179321650932146, 0.5677310232475978, 0.8921979640060705, 0.7409364235940363, 0.8336182484978001, 0.9337348305505104, 0.5523526069302367, 0.8712734304136076, 0.8094631462055002, 0.9559232195232061, 0.5038263676591654, 0.9368163044971729, 0.7853194739966982, 0.9697884094398899, 0.7923131341281204, 0.6627761742150746, 0.6726426350717234, 0.8439752862908152, 0.8405135283497229, 0.6291536253176448, 0.5290262770338434, 0.5370092994358795, 0.9345395198634334, 0.582836797288712, 0.8965462076655855, 0.6863751339520003, 0.7076062150199092, 0.6683669313697869, 0.8225987591940975, 0.9565417696121543, 0.6226188126011809, 0.5790595335887765, 0.7505717919368302, 0.726635099495609, 0.8208866455396417, 0.9795057193624173, 0.665886847984575, 0.5728482220792017, 0.919873494020274, 0.7044670860391624, 0.8055913809613016, 0.8854907031325951, 0.5675524161916445, 0.7022241120407049, 0.9746405571654579, 0.5561245980068394, 0.9308759872487541, 0.9977629684734809, 0.5978979376614162, 0.5134512048032729, 0.6951773750920807, 0.8955461611086185, 0.5197115916349524, 0.7889251070049341, 0.7406794013922811, 0.8490040891579935, 0.6394746393989514, 0.7124285383950338, 0.6441568818431076, 0.5742410437559065, 0.9734154608774117, 0.8411931437246933, 0.5953441156670556, 0.5870029487886299, 0.5690877762959063, 0.6579422586382919, 0.5511909599706231, 0.9826933926139113, 0.976186093396245, 0.7279135034856399, 0.9697807526053482, 0.8569258712666283, 0.5803885944634186, 0.7439427123857135, 0.6234141842964835, 0.5899298375703191, 0.911648804846827, 0.9560170349439114, 0.615855889963394, 0.9033309457513714, 0.9813905600724175, 0.8515029653275765, 0.9926006158944519, 0.9424867875474412, 0.9004566082524905, 0.7632036330116658, 0.668435176646141, 0.7767333670206826, 0.5567125567128979, 0.9989095087841677, 0.7596861743486344, 0.5919194393426908, 0.5377055067492583, 0.9697501918717547, 0.7235403685792591, 0.5614198182096632, 0.5566609029842897, 0.5753795367343477, 0.711145668108295, 0.7917815444258258, 0.7859926303962299, 0.6542375559122942, 0.6019482318629306, 0.8988415673764566, 0.5116992154045013, 0.8125409291983835, 0.8487706549674179, 0.5952629304772415, 0.7687497742375944, 0.571292512650412, 0.8601115449928847, 0.7614858478659609, 0.7096120882827297, 0.8496979097344539, 0.6979310732919302, 0.6611885976042038, 0.9562339932660349, 0.7092362694126989, 0.5996453019528448, 0.9442691427801571, 0.7662132347263033, 0.5468835582642815, 0.7991156978148846, 0.6176919466260731, 0.5559149206383559, 0.9539359957996584, 0.6336820400374781, 0.6443875443211893, 0.6483184150506214, 0.9279818202278767, 0.6533214114041177, 0.7642885212901981, 0.5249054904709091, 0.9453966652317403, 0.7147179849249405, 0.6623318687421931, 0.5409580223623633, 0.5279463418249548, 0.722383481431583, 0.7788244247521638, 0.932868863569532, 0.5199066841121504, 0.636553634091782, 0.563639276478836, 0.583163639071897, 0.6558578709415193, 0.8900249121958363, 0.7087828047402024, 0.5016311274113856, 0.7128185307064225, 0.5409206276097257, 0.5148818029095129, 0.7122613561372366, 0.794686755002578, 0.5503463725795823, 0.5176770171544939, 0.6446993400864673, 0.8482809557881431, 0.6933465575960645, 0.8653158802931383, 0.9188225472494841, 0.8965151436919154, 0.7724529614015903, 0.9796067303237485, 0.9256962803335034, 0.9993370709686356, 0.6448880735374805, 0.9551694344641437, 0.7968596766638736, 0.7476350261507796, 0.7865808164016748, 0.7317318005165996, 0.9562835070397452, 0.7119149550492645, 0.972387597060271, 0.8651390935738039, 0.6154947031801753, 0.7906107814022787, 0.8392422254882641, 0.988666566265024, 0.9491065361188222, 0.8800086748122267, 0.8451444233023468, 0.7515007282232573, 0.61355453018964, 0.8883342760524775, 0.9433163224936695, 0.812754512401549, 0.5351582566877146, 0.5956166322732288, 0.5511644056875988, 0.8330192042979013, 0.5510133611005175, 0.5243340120212128, 0.8797200611387763, 0.713124649139872, 0.6245372153856636, 0.9128879418190474, 0.6664816340218538, 0.8789403518013097, 0.7176781251458764, 0.7597987357457996, 0.9773503016663484, 0.9741502863610867, 0.6968930626009959, 0.7293101417366894, 0.9224619021026382, 0.5925703893876055, 0.8013906812506624, 0.6577517252052767, 0.8401046638281455, 0.5876461825044399, 0.7789549911134945, 0.667077819330637, 0.7274110686764949, 0.8548455160821484, 0.9287586993393637, 0.7513790184580034, 0.9275731400680669, 0.9757370779442345, 0.7884436154043315, 0.686452878441072, 0.8204810391480875, 0.7981788214359884, 0.6280909707863152, 0.5196603502214276, 0.8667955388065984, 0.8306534631260161, 0.6820109613202754, 0.898511402335592, 0.5313948237393065, 0.5837149004977056, 0.9681806150950711, 0.5357479362243849, 0.5879347688291336, 0.6664204362256867, 0.8762443460438312, 0.6849824348227938, 0.7500356823231338, 0.6110116025569703, 0.6679905919879425, 0.6640681708777068, 0.5703892199552073, 0.9643362318575828, 0.5761448255389647, 0.8352526192897152, 0.5975855791404769, 0.5608542125273002, 0.7376307982899397, 0.5797568720156498, 0.9969520781700114, 0.5504342167846908, 0.5555130723738307, 0.7938128184126505, 0.7437368503084059, 0.5138050686925013, 0.5835630697579737, 0.5551797558536888, 0.8455014785692605, 0.613307007940235, 0.5547960214573927, 0.6494275447478017, 0.7259338316886418, 0.7405343425725999, 0.5086409585349023, 0.9192733567186631, 0.6762939775095524, 0.6920499866786475, 0.8129922677688857, 0.8171980165397841, 0.6184422001411247, 0.7515673597027699, 0.5033450377979792, 0.7296849341045116, 0.5854523292567455, 0.6611122785181355, 0.8151503703416161, 0.7760584573814413, 0.6902154829447769, 0.5773126638772264, 0.7340351476765574, 0.98482809595797, 0.7558152550063688, 0.9354838855022021, 0.8106039675605805, 0.6804812849483063, 0.7390419131704274, 0.5331270600659195, 0.9844457527445805, 0.7231957463133079, 0.6918007552108858, 0.6116402527064897, 0.8755550206236185, 0.673710332522257, 0.7650955551190385, 0.6695322821105331, 0.6190603821381597, 0.8241014662164958, 0.9819123571411328, 0.5806418776452343, 0.5083707714054482, 0.8558608114363782, 0.7782897389319545, 0.9219222616818579, 0.8729187093532087, 0.7132023021720498, 0.5105812462490122, 0.5737355233344081, 0.6249355749543244, 0.74305504641324, 0.8327026842753722, 0.8856009985662199, 0.678192690764905, 0.8609293173607848, 0.7236229565955117, 0.6944662684150796, 0.7234375951635559, 0.5402959592473885, 0.9898246379514772, 0.5667749107044249, 0.5369265981107085, 0.5904778290632534, 0.8013235822588933, 0.9623582438029152, 0.6088788825847302, 0.7558785452318284, 0.533311289066337, 0.852161384258402, 0.9315608449843031, 0.6783480279466918, 0.6718788379607725, 0.8034412153540483, 0.6242605498100776, 0.7002364664365739, 0.9858261765678183, 0.7455840755683367, 0.9101713490994441, 0.8067742308629933, 0.9183825758673027, 0.8493453002665141, 0.6957351483376965, 0.569661566335512, 0.5579829706056092, 0.9706845696320411, 0.6266075876829885, 0.5432237705322815, 0.5958929569261602, 0.8744719515868774, 0.9254932775763489, 0.5992777155728162, 0.5938250406754368, 0.8186314849360423, 0.7488191150857317, 0.5785430622385155, 0.802948706235822, 0.7526001083169349, 0.8607933417067841, 0.568653548442721, 0.7053575465090824, 0.707268157037096, 0.9934231701955809, 0.9851340495673739, 0.7119320955548973, 0.5162232761933361, 0.97374676368514, 0.9732635413232033, 0.9495015846414583, 0.8822453392691545, 0.9047137760763206, 0.6040085293908389, 0.8871469343154936, 0.5302237584362826, 0.7604102018269301, 0.8402841603015173, 0.7745090932415761, 0.5977232179563661, 0.6380614682946806, 0.52114921387498, 0.8891396003239387, 0.792134850924342, 0.6060563735930159, 0.626553122449472, 0.511230341104808, 0.8833510415373387, 0.5513300045151033, 0.8709702390910876, 0.5177609690730118, 0.8269024025260473, 0.6656373688369372, 0.8276730505302115, 0.732099102515616, 0.6515445913411093, 0.6397921219362784, 0.9274629738719837, 0.6626490532552567, 0.9660456644754094, 0.9471248507909248, 0.6117701768504503, 0.9869918581381556, 0.5374499207579768, 0.8007158174716187, 0.7911885110011144, 0.8133345393306459, 0.6607828496134007, 0.859446706534543, 0.5463646301601754, 0.7288646065421024, 0.7582689537381602, 0.8523642003649436, 0.5847471463022351, 0.7160078893487254, 0.9833797606094601, 0.878534890991373, 0.6486363499927575, 0.5891380024786267, 0.9839253145746643, 0.6767233171611273, 0.5290167011382072, 0.9732435736393874, 0.9518826510831682, 0.6149300151794435, 0.8741678448491305, 0.7245311943745943, 0.7351675924419889, 0.5929278512055909, 0.8883018379806995, 0.9276390227715698, 0.7520205343961542, 0.5376151975463236, 0.5651120178093629, 0.7008751481920343, 0.546094179721041, 0.9288132579775001, 0.5389234805242925, 0.6149005031204913, 0.6507941922665392, 0.9019918600118919, 0.9280667588368237, 0.5038804270115613, 0.5284701524843032, 0.9241418827743675, 0.5630973712246634, 0.6540015248710974, 0.6292173750859245, 0.9417240758245111, 0.9396442343757687, 0.5516790332016148, 0.9222441128774328, 0.967305216794863, 0.6227094304698231, 0.747876660240624, 0.894465554893771, 0.7875436329949506, 0.8737873587886775, 0.555853037625828, 0.5306908895028096, 0.5743180039982727, 0.7144943781554238, 0.7439012832054281, 0.7521675378109347, 0.9343183464671238, 0.9187080574308214, 0.730231197479294, 0.5168800606505233, 0.7763699129768826, 0.9353572709380966, 0.9986766429219243, 0.7547667215173361, 0.9595046964388081, 0.8693372463179516, 0.6928448658691249, 0.7899963637592106, 0.6963374006758143, 0.8853690198755735, 0.9116280564555828, 0.9569636177240117, 0.964370624058061, 0.7930659872948101, 0.7677480200874751, 0.988249837124891, 0.5430446098124113, 0.5646855718415646, 0.9318958711809265, 0.9625301354628695, 0.5492509430270355, 0.6083058023539659, 0.6189750185024373, 0.6711545965363275, 0.8141869369387407, 0.8866590411156386, 0.997880677541499, 0.8713844306241463, 0.60068247775353, 0.9256401354059645, 0.7178568119870331, 0.7861476015096027, 0.8707093518042928, 0.7604741208097189, 0.5369900773531375, 0.7553216775003612, 0.8371737407792885, 0.7188804096989196, 0.9897413736171343, 0.9516991172669962, 0.6667527351159646, 0.8302760096348405, 0.7517097951073045, 0.7825237765096152, 0.5423524135407696, 0.762958841166804, 0.8581543105369296, 0.6421743272410425, 0.507742068773424, 0.7852056230161291, 0.5559191275758664, 0.6009052900368168, 0.5668364607999477, 0.8133078321529686, 0.9732456824655873, 0.748018086655398, 0.9642583221262886, 0.8465167863168056, 0.7641933749555904, 0.8511408102065359, 0.9129176468435527, 0.5505596674939712, 0.5513462808664948, 0.8318225474463582, 0.571570348589961, 0.5067822818886921, 0.5178393213101864, 0.7315996298262372, 0.8534002584625442, 0.9002863416578779, 0.878814648878306, 0.8872125040157919, 0.7952174766655413, 0.8239788430442947, 0.9205645341922533, 0.6609642716622542, 0.8662352030969, 0.913963834164554, 0.5793181685774733, 0.6632542167949336, 0.7132999564211566, 0.9941121864175466, 0.8411622701341139, 0.5393179608379316, 0.8760231398614289, 0.8121012257380547, 0.9330812458921736, 0.8083452417794574, 0.8595512947340866, 0.9017166564905622, 0.8200488444481044, 0.7349160837631985, 0.9452823211483239, 0.7760592437700651, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0};
int h_B[]= {
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 375, 377, 379, 381, 383, 385, 387, 389, 391, 393, 396, 398, 400, 402, 404, 406, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 470, 472, 474, 476, 478, 480, 482, 484, 486, 488, 490, 492, 495, 497, 499, 501, 503, 505, 507, 509, 511, 513, 515, 517, 519, 521, 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, 568, 570, 573, 575, 577, 579, 581, 583, 585, 587, 589, 591, 593, 595, 597, 599, 601, 603, 605, 607, 609, 611, 613, 615, 617, 619, 621, 623, 625, 627, 629, 631, 633, 635, 637, 639, 641, 643, 645, 647, 649, 651, 654, 656, 659, 661, 663, 665, 667, 669, 671, 673, 675, 677, 679, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 701, 703, 705, 707, 709, 711, 713, 715, 717, 719, 721, 723, 725, 727, 729, 731, 733, 735, 737, 739, 741, 743, 745, 747, 749, 752, 754, 756, 758, 761, 763, 765, 767, 771, 773, 775, 777, 779, 781, 783, 785, 787, 789, 791, 793, 795, 797, 799, 801, 803, 805, 807, 809, 811, 813, 815, 817, 819, 821, 823, 825, 827, 829, 831, 833, 836, 838, 840, 842, 846, 848, 850, 852, 854, 856, 859, 861, 863, 865, 868, 870, 873, 875, 880, 882, 884, 886, 888, 890, 893, 895, 897, 899, 901, 903, 905, 907, 909, 911, 913, 915, 918, 920, 923, 925, 928, 930, 933, 935, 938, 940, 942, 944, 947, 949, 952, 954, 959, 961, 963, 965, 967, 969, 971, 973, 975, 977, 979, 981, 983, 985, 987, 989, 991, 993, 995, 997, 999, 1001, 1003, 1005, 1007, 1009, 1011, 1013, 1015, 1017, 1019, 1021, 1023, 1025, 1027, 1029, 1031, 1033, 1035, 1037, 1040, 1042, 1044, 1046, 1049, 1051, 1053, 1055, 1057, 1059, 1061, 1063, 1065, 1067, 1069, 1071, 1073, 1075, 1077, 1079, 1082, 1084, 1086, 1088, 1092, 1094, 1096, 1098, 1100, 1102, 1104, 1106, 1108, 1110, 1112, 1114, 1116, 1118, 1120, 1122, 1125, 1127, 1129, 1131, 1133, 1135, 1137, 1139, 1142, 1144, 1147, 1149, 1152, 1154, 1157, 1159, 1165, 1167, 1170, 1172, 1175, 1177, 1180, 1182, 1185, 1187, 1189, 1191, 1193, 1195, 1198, 1200, 1203, 1205, 1207, 1209, 1211, 1213, 1215, 1217, 1219, 1221, 1223, 1225, 1227, 1229, 1231, 1233, 1236, 1238, 1240, 1242, 1244, 1246, 1248, 1250, 1252, 1254, 1257, 1259, 1261, 1263, 1265, 1267, 1269, 1271, 1273, 1275, 1277, 1279, 1281, 1283, 1285, 1287, 1289, 1291, 1293, 1295, 1297, 1299, 1301, 1303, 1306, 1308, 1310, 1312, 1314, 1316, 1318, 1320, 1322, 1324, 1326, 1328, 1330, 1332, 1334, 1336, 1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352, 1354, 1356, 1358, 1360, 1362, 1364, 1366, 1368, 1370, 1372, 1374, 1376, 1379, 1381, 1383, 1385, 1387, 1389, 1391, 1393, 1396, 1398, 1400, 1402, 1405, 1407, 1409, 1411, 1413, 1415, 1417, 1419, 1421, 1423, 1425, 1427, 1430, 1432, 1434, 1436, 1438, 1440, 1443, 1445, 1448, 1450, 1456, 1458, 1461, 1463, 1467, 1469, 1471, 1473, 1475, 1477, 1480, 1482, 1485, 1487, 1490, 1492, 1495, 1497, 1500, 1502, 1505, 1507, 1510, 1512, 1514, 1516, 1518, 1520, 1523, 1525, 1527, 1529, 1531, 1533, 1535, 1537, 1539, 1541, 1543, 1545, 1547, 1549, 1551, 1553, 1555, 1557, 1560, 1562, 1564, 1566, 1569, 1571, 1574, 1576, 1581, 1583, 1586, 1588, 1591, 1593, 1596, 1598, 1601, 1603, 1606, 1608, 1611, 1613, 1616, 1618, 1621, 1623, 1626, 1628, 1631, 1633, 1156, 1156, 1164, 1162, 1161, 1164, 1162, 1161, 1590, 1455, 1453, 409, 408, 1590, 1455, 1453, 1455, 1453, 1578, 1573, 1585, 1504, 1509, 1455, 1453, 1455, 1453, 409, 408, 1455, 1453, 1455, 1453, 409, 408, 1453, 1455, 1455, 1453, 1504, 1509, 1479, 1489, 1479, 1489, 1635, 1630, 1585, 1455, 1453, 1455, 1453, 1465, 1460, 1455, 1453, 1455, 1453, 1465, 1460, 1455, 1453, 1455, 1453, 409, 408, 1455, 1453, 1455, 1453, 1455, 1453, 1455, 1453, 1378, 1504, 1509, 1504, 1509, 1378, 1504, 1509, 1504, 1509, 1578, 1573, 1585, 1590, 1578, 1573, 1585, 1590, 1630, 1635, 1635, 1630, 1578, 1573, 1585, 1590, 946, 958, 1455, 1453, 1489, 1489, 1504, 1509, 1504, 1509, 1578, 1573, 1578, 1573, 1585, 1590, 1578, 1573, 1578, 1573, 1585, 1590, 1580, 1305, 858, 858, 845, 845, 879, 879, 958, 946, 946, 958, 1141, 1141, 1091, 1091, 1164, 1162, 1164, 1162, 1164, 1162, 1164, 1162, 1455, 1453, 1479, 1479, 1479, 1489, 1479, 1489, 1455, 1453, 1305, 1509, 1509, 1504, 1504, 1455, 1453, 1455, 1453, 1455, 1453, 1455, 1453, 1635, 1630, 1635, 1630, 1580, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 3200, 3202, 3204, 3206, 3208, 3210, 3212, 3214, 3216, 3218, 3220, 3222, 3224, 3226, 3228, 3230, 3232, 3234, 3236, 3238, 3240, 3242, 3244, 3246, 3248, 3250, 3252, 3254, 3256, 3258, 3260, 3262, 3264, 3266, 3268, 3270, 3272, 3274, 3276, 3278, 3280, 3282, 3284, 3286, 3288, 3290, 3292, 3294, 3296, 3298, 3300, 3302, 3304, 3306, 3308, 3310, 3312, 3314, 3316, 3318, 3320, 3322, 3324, 3326, 3328, 3330, 3332, 3334, 3336, 3338, 3340, 3342, 3344, 3346, 3348, 3350, 3352, 3354, 3356, 3358, 3360, 3362, 3364, 3366, 3368, 3370, 3372, 3374, 3376, 3378, 3380, 3382, 3384, 3386, 3388, 3390, 3392, 3394, 3396, 3398, 3400, 3402, 3404, 3406, 3408, 3410, 3412, 3414, 3416, 3418, 3420, 3422, 3424, 3426, 3428, 3430, 3432, 3434, 3436, 3438, 3440, 3442, 3444, 3446, 3448, 3450, 3452, 3454, 3456, 3458, 3460, 3462, 3464, 3466, 3468, 3470, 3472, 3474, 3476, 3478, 3480, 3482, 3484, 3486, 3488, 3490, 3492, 3494, 3496, 3498, 3500, 3502, 3504, 3506, 3508, 3510, 3512, 3514, 3516, 3518, 3520, 3522, 3524, 3526, 3528, 3530, 3532, 3534, 3536, 3538, 3540, 3542, 3544, 3546, 3548, 3550, 3552, 3554, 3556, 3558, 3560, 3562, 3564, 3566, 3568, 3570, 3572, 3574, 3576, 3578, 3580, 3582, 3584, 3586, 3588, 3590, 3592, 3594, 3596, 3598, 3600, 3602, 3604, 3606, 3608, 3610, 3612, 3614, 3616, 3618, 3620, 3622, 3624, 3626, 3628, 3630, 3632, 3634, 3636, 3638, 3640, 3642, 3644, 3646, 3648, 3650, 3652, 3654, 3656, 3658, 3660, 3662, 3664, 3666, 3668, 3670, 3672, 3674, 3676, 3678, 3680, 3682, 3684, 3686, 3688, 3690, 3692, 3694, 3696, 3698, 3700, 3702, 3704, 3706, 3708, 3710, 3712, 3714, 3716, 3718, 3720, 3722, 3724, 3726, 3728, 3730, 3732, 3734, 3736, 3738, 3740, 3742, 3744, 3746, 3748, 3750, 3752, 3754, 3756, 3758, 3760, 3762, 3764, 3766, 3768, 3770, 3772, 3774, 3776, 3778, 3780, 3782, 3784, 3786, 3788, 3790, 3792, 3794, 3796, 3798, 3800, 3802, 3804, 3806, 3808, 3810, 3812, 3814, 3816, 3818, 3820, 3822, 3824, 3826, 3828, 3830, 3832, 3834, 3836, 3838, 3840, 3842, 3844, 3846, 3848, 3850, 3852, 3854, 3856, 3858, 3860, 3862, 3864, 3866, 3868, 3870, 3872, 3874, 3876, 3878, 3880, 3882, 3884, 3886, 3888, 3890, 3892, 3894, 3896, 3898, 3900, 3902, 3904, 3906, 3908, 3910, 3912, 3914, 3916, 3918, 3920, 3922, 3924, 3926, 3928, 3930, 3932, 3934, 3936, 3938, 3940, 3942, 3944, 3946, 3948, 3950, 3952, 3954, 3956, 3958, 3960, 3962, 3964, 3966, 3968, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 877, 872, 4227, 858, 927, 922, 956, 951, 653, 653, 892, 1146, 1151, 1151, 1146, 1162, 1179, 1174, 658, 658, 927, 922, 4245, 956, 951, 927, 922, 1151, 1146, 1146, 1151, 658, 653, 1202, 1197, 4611, 4614, 1202, 1197, 1465, 1460, 1484, 1479, 1452, 1447, 4618, 4620, 1484, 1499, 1494, 4269, 4623, 1452, 1447, 4625, 1465, 1460, 1484, 1509, 4274, 4627, 1452, 1447, 1453, 1455, 1465, 1460, 4352, 1479, 1489, 1499, 1494, 4630, 1452, 1447, 4632, 1452, 1447, 4634, 1460, 4636, 1452, 1447, 4638, 1452, 1447, 4640, 1465, 4642, 1452, 1447, 1452, 1447, 1484, 1484, 1499, 1494, 1484, 1484, 1499, 1494, 1484, 1484, 1499, 1494, 1504, 4646, 1479, 1499, 1494, 1447, 1452, 1455, 1453, 1465, 1460, 4352, 1479, 1489, 1494, 1499, 4648, 1455, 1453, 1465, 1460, 4352, 4650, 4652, 4311, 4312, 4654, 4586, 1452, 1447, 4657, 1452, 1447, 4659, 4661, 4317, 1447, 1452, 4663, 1452, 1447, 4665, 4667, 4322, 1452, 1447, 4669, 1452, 1447, 4671, 1465, 1460, 4673, 1484, 1484, 1499, 1494, 1499, 1494, 1499, 1494, 1504, 1452, 1447, 4675, 1452, 1447, 4677, 1465, 1460, 4334, 1452, 1447, 4679, 1452, 1447, 4681, 1465, 1460, 4573, 1484, 1479, 1499, 1494, 1504, 1499, 1494, 1499, 1494, 1452, 1447, 1455, 1453, 1465, 1460, 4345, 1479, 1489, 1499, 1494, 4684, 1499, 1494, 4686, 1447, 1452, 1453, 1455, 1465, 1460, 4352, 1479, 1489, 1499, 1494, 4689, 1494, 1499, 4691, 4693, 4695, 1600, 4697, 4699, 1595, 1610, 1605, 1615, 1625, 1620, 1625, 1620, 1625, 1620, 4703, 4705, 4707, 927, 922, 4368, 956, 951, 927, 922, 4374, 956, 951, 1151, 1146, 1151, 1146, 1146, 1151, 1156, 658, 653, 1202, 1197, 4711, 1479, 1484, 1484, 1499, 1494, 1509, 1499, 1494, 1504, 1447, 1452, 1453, 1455, 1465, 1460, 4404, 1378, 1479, 1489, 1499, 1494, 4715, 1499, 1494, 4717, 4719, 4721, 4723, 1600, 1595, 4725, 4727, 4729, 1600, 1595, 4586, 4533, 1590, 1585, 1595, 1600, 1605, 1610, 1559, 1620, 1625, 1635, 1630, 877, 872, 877, 872, 877, 872, 877, 872, 4428, 4430, 877, 872, 858, 877, 872, 877, 872, 4439, 892, 927, 922, 4444, 956, 951, 4739, 927, 922, 937, 932, 956, 951, 956, 951, 1151, 1146, 1151, 1146, 1146, 1151, 1156, 1162, 1169, 1151, 1146, 1151, 1146, 1146, 1151, 1156, 1164, 1169, 1151, 1146, 1151, 1146, 1146, 1151, 1156, 1162, 1164, 1161, 1179, 1174, 1179, 1174, 4508, 1202, 1197, 1151, 1146, 1141, 1151, 1146, 1156, 4747, 1169, 4749, 1161, 1151, 1146, 1141, 1151, 1146, 1156, 4751, 1161, 4753, 1169, 1179, 1174, 1184, 4508, 1202, 1197, 1573, 1590, 1585, 4518, 4755, 1484, 1484, 1578, 1590, 1585, 1452, 1447, 1455, 1453, 1465, 1460, 4518, 1378, 4759, 1499, 1494, 1494, 1499, 1452, 1447, 1455, 1453, 1465, 1460, 4541, 1378, 4761, 1499, 1494, 1494, 1499, 1452, 1447, 1452, 1447, 4763, 1484, 1479, 1509, 1504, 4533, 4535, 1452, 1447, 1453, 1455, 1460, 1465, 4541, 1378, 1489, 1479, 1499, 1494, 1499, 1494, 1447, 1452, 1455, 1453, 1465, 1460, 4552, 1378, 1479, 1489, 1499, 1494, 1499, 1494, 1452, 1447, 4770, 1452, 1447, 4772, 1465, 1460, 4566, 1452, 1447, 4774, 1452, 1447, 4776, 1465, 1460, 4573, 1484, 1479, 1484, 1489, 1499, 1494, 1509, 1504, 4586, 1590, 1585, 1600, 1595, 1605, 1610, 1559, 1625, 1620, 4778, 4586, 1585, 1590, 1595, 1600, 1605, 1610, 1559, 1625, 1620, 4780, 1578, 1573, 1590, 1585, 1600, 1595, 1610, 1605, 1615, 1625, 1620, 1635, 1630, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 4864, 4865, 4866, 4867, 4868, 4869, 4870, 4871, 4872, 4873, 4874, 4875, 4876, 4877, 4878, 4879, 4880, 4881, 4882, 4883, 4884, 4885, 4886, 4887, 4888, 4889, 4890, 4891, 4892, 4893, 4894, 4895, 4896, 4897, 4898, 4901, 4902, 4903, 4904, 4905, 4906, 4907, 4908, 4911, 4912, 4913, 4914, 4916, 4917, 4919, 4920, 4921, 4922, 4923, 4925, 4926, 4927, 4928, 4929, 4930, 4931, 4932, 4933, 4934, 4935, 4937, 4938, 4940, 4941, 4943, 4945, 4946, 4948, 4949, 4951, 4953, 4954, 4955, 4956, 4957, 4958, 4959, 4960, 4961, 4962, 4963, 4964, 4965, 4966, 4967, 4968, 4969, 4971, 4972, 4973, 4974, 4975, 4976, 4977, 4978, 4979, 4980, 4981, 4982, 4983, 4984, 4986, 4987, 4988, 4989, 4990, 4993, 4994, 4996, 4997, 4998, 5000, 5001, 5004, 5005, 5006, 5008, 5009, 5012, 5013, 5014, 5016, 5017, 5019, 5020, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031, 5032, 5034, 5035, 5037, 5038, 5039, 5040, 5041, 5043, 5044, 5046, 5047, 5048, 5049, 5050, 5051, 5052, 5053, 5054, 5055, 5056, 5057, 5058, 5059, 5060, 5061, 5062, 5063, 5064, 5065, 5066, 5067, 5068, 5070, 5071, 5073, 5074, 5075, 5076, 5077, 5078, 5079, 5080, 5081, 5082, 5083, 5085, 5086, 5090, 5093, 5094, 5095, 5096, 5097, 5098, 5099, 5100, 5101, 5102, 5106, 5107, 5108, 5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125, 5126, 5128, 5129, 5130, 5131, 5132, 5133, 5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144, 5145, 5146, 5147, 5148, 5150, 5151, 5156, 5157, 5161, 5162, 5163, 5164, 5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210, 5211, 5212, 5213, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221, 5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232, 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243, 5244, 5245, 5246, 5247, 5248, 5249, 5251, 5253, 5254, 5255, 5256, 5257, 5258, 5259, 5261, 5263, 5264, 5265, 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5275, 5276, 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298, 5299, 5300, 5302, 5303, 5304, 5305, 5306, 5307, 5308, 5309, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325, 5326, 5327, 5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342, 5343, 5344, 5345, 5346, 5348, 5349, 5351, 5352, 5353, 5354, 5355, 5357, 5358, 5360, 5361, 5362, 5363, 5364, 5365, 5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375, 5376, 5377, 5378, 5379, 5380, 5382, 5383, 5384, 5385, 5386, 5387, 5388, 5389, 5390, 5391, 5393, 5394, 5395, 5396, 5397, 5398, 5399, 5400, 5401, 5402, 5403, 5404, 5405, 4616, 4613, 4732, 4732, 4992, 4991, 4732, 4732, 4992, 4991, 4732, 4732, 4732, 4732, 4731, 4732, 4731, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 5504, 5508, 5510, 5515, 5517, 5520, 5524, 5527, 5529, 5531, 5533, 5535, 5537, 5539, 5541, 5545, 5548, 5551, 5553, 5558, 5560, 5562, 5565, 5567, 5569, 5571, 5574, 5576, 5579, 5581, 5585, 5589, 5593, 5597, 5599, 5601, 5603, 5606, 5608, 5610, 5612, 5618, 5620, 5623, 5625, 5628, 5630, 5632, 5636, 5638, 5640, 5643, 5645, 5647, 5650, 5652, 5654, 5659, 5662, 5664, 5666, 5668, 5670, 5673, 5675, 5677, 5679, 5681, 5683, 5686, 5688, 5690, 5694, 5697, 5699, 5701, 5703, 5706, 5708, 5711, 5713, 5715, 5717, 5720, 5722, 5727, 5730, 5733, 5735, 5737, 5741, 5743, 5745, 5747, 5749, 5753, 5755, 5757, 5760, 5762, 5764, 5766, 5768, 5770, 5774, 5777, 5779, 5783, 5786, 5788, 5790, 5792, 5794, 5796, 5798, 5800, 5805, 5807, 5809, 5814, 5816, 5818, 5821, 5824, 5826, 5829, 5831, 5834, 5839, 5842, 5847, 5851, 5854, 5860, 5862, 5864, 5866, 5870, 5872, 5874, 5876, 5878, 5882, 5884, 5886, 5888, 5892, 5896, 5898, 5900, 5904, 5906, 5908, 5910, 5912, 5914, 5918, 5920, 5922, 5924, 5926, 5928, 5931, 5933, 5935, 5942, 5944, 5947, 5949, 5951, 5954, 5957, 5959, 5961, 5964, 5966, 5968, 5970, 5972, 5975, 5977, 4736, 4735, 5514, 5804, 5813, 5838, 5837, 5846, 5845, 4736, 4735, 5514, 5804, 5813, 5838, 5837, 5846, 5845, 4736, 4735, 5782, 5804, 5813, 5838, 5837, 5846, 5979, 5980, 5724, 4714, 4713, 5981, 4731, 5982, 4731, 5983, 5984, 5544, 4910, 4952, 5622, 5627, 4714, 4713, 4714, 4713, 4714, 4713, 4731, 5692, 4731, 5693, 4731, 4714, 4713, 5724, 5985, 4731, 5986, 4731, 4944, 4952, 5622, 5627, 4714, 4713, 4714, 4713, 4714, 4713, 5596, 5987, 5988, 4731, 5692, 4731, 5693, 4731, 5622, 5627, 4714, 4713, 5658, 5989, 5692, 5990, 5693, 5991, 4714, 4713, 5724, 5992, 5993, 5994, 5995, 4732, 4731, 4736, 4735, 5782, 5804, 5813, 5838, 5837, 5846, 5845, 5891, 5941, 4765, 5941, 4758, 4757, 4765, 5288, 5301, 5891, 5941, 4765, 4765, 5941, 5939, 4782, 4782, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 4738, 4737, 4734, 4733, 6197, 6198, 5507, 4738, 4737, 6199, 5705, 4709, 5710, 4710, 6126, 4741, 4742, 4743, 4609, 6200, 4609, 4743, 6201, 4609, 4743, 5823, 4746, 4745, 6028, 4609, 4743, 6202, 6203, 4609, 4743, 6204, 6205, 5849, 6029, 4738, 4737, 4734, 4733, 6206, 6207, 4738, 4737, 5776, 6208, 5705, 4709, 5710, 4710, 6126, 4742, 4741, 4743, 4609, 6209, 4609, 4743, 6210, 4609, 4743, 5823, 4746, 4745, 6028, 4609, 4743, 6211, 6212, 4609, 4743, 6213, 6214, 5849, 6029, 4738, 4737, 4734, 4733, 6215, 6216, 4738, 4737, 5776, 6217, 5526, 4709, 5710, 4710, 6126, 4742, 4741, 4610, 4744, 6218, 4610, 4744, 6219, 4610, 4744, 5823, 4746, 4745, 6028, 4610, 4744, 6220, 6221, 4610, 4744, 6222, 5849, 6029, 4918, 4915, 5930, 5359, 5356, 5937, 6225, 6226, 6227, 5732, 5556, 6104, 5739, 6106, 5152, 5149, 6229, 6193, 5974, 6196, 6231, 6112, 5759, 6115, 6055, 5614, 6232, 5072, 5069, 5036, 4970, 5649, 5045, 5042, 5656, 6234, 5661, 4767, 4766, 6051, 5605, 6053, 4985, 4942, 4909, 6235, 4950, 4947, 6236, 5002, 4999, 6237, 5010, 4645, 4644, 6238, 6239, 6240, 4766, 6241, 6242, 4767, 6243, 6244, 5595, 6036, 5564, 6038, 4936, 6245, 6246, 6247, 6248, 5696, 4702, 4701, 4995, 6249, 6112, 5759, 6115, 4918, 4915, 5930, 5359, 5356, 5937, 6250, 6251, 6252, 5732, 5556, 6104, 5739, 6106, 5152, 5149, 6254, 6193, 5974, 6196, 6256, 6112, 5759, 6115, 6036, 5564, 6038, 4936, 4942, 4939, 6257, 4950, 4947, 6258, 5002, 4999, 6259, 5010, 4645, 4644, 6260, 6261, 6262, 4766, 6263, 6264, 4767, 6265, 6266, 5595, 5036, 4970, 5649, 5045, 5042, 5656, 6267, 5661, 4767, 4766, 6051, 5605, 6053, 4985, 6055, 5614, 6268, 5072, 5069, 6270, 6271, 6272, 6273, 5696, 4702, 4701, 4995, 6274, 6112, 5759, 6115, 5002, 4999, 6275, 5010, 5007, 6276, 5018, 5015, 5021, 6277, 6278, 5642, 4767, 4766, 5036, 5033, 5649, 5045, 5042, 5656, 6279, 4767, 4766, 5661, 6077, 5672, 6079, 5072, 5069, 6083, 5685, 6085, 5087, 5084, 6281, 6283, 5696, 5103, 4702, 4701, 6112, 5759, 6115, 5705, 4709, 5710, 4710, 5719, 4744, 4743, 6100, 5347, 5127, 5930, 5359, 5356, 5937, 6285, 6286, 6287, 5732, 5729, 6104, 5739, 6106, 5152, 5149, 6288, 6109, 6290, 6110, 5974, 6196, 6292, 6293, 6112, 5759, 6115, 4738, 4737, 4734, 4733, 6294, 6295, 4738, 4737, 5776, 6296, 5785, 5200, 6126, 4742, 4741, 5802, 4744, 4743, 6297, 5811, 4744, 4743, 6298, 5820, 4744, 4743, 5823, 4746, 4745, 6141, 5836, 5833, 6299, 6300, 5844, 5841, 6301, 6302, 5849, 6147, 6164, 5902, 6166, 4767, 4766, 6170, 5856, 6172, 4769, 4768, 5347, 5350, 5930, 5356, 5310, 5937, 6303, 6304, 6162, 6305, 6193, 5974, 6196, 6164, 5902, 6166, 4767, 4766, 6170, 5856, 6172, 4769, 4768, 5347, 5274, 5930, 5356, 5310, 5937, 6306, 6307, 6308, 6182, 6309, 6193, 5974, 6196, 6151, 5868, 6310, 4769, 4768, 6156, 5880, 6311, 4769, 4768, 6164, 5902, 6166, 4767, 4766, 5347, 5350, 5930, 5356, 5310, 5937, 6312, 6313, 6162, 6314, 6184, 5953, 5381, 6315, 6188, 5963, 5392, 6164, 5902, 6166, 4767, 4766, 6170, 5916, 6172, 4769, 4768, 5350, 5347, 5930, 5359, 5356, 5937, 6316, 6317, 6182, 6318, 6184, 5953, 5381, 6319, 6188, 5963, 5392, 4782, 6193, 5974, 6196, 122, 123, 124, 125, 126, 127, 6400, 6401, 6402, 6403, 6404, 6406, 6407, 6408, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6420, 6421, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6433, 6434, 6435, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6445, 6446, 6447, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6459, 6460, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6472, 6473, 6474, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6484, 6485, 6486, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6498, 6499, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6228, 6533, 6534, 6535, 6230, 6537, 6538, 6539, 6540, 6541, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6562, 6563, 6565, 6566, 6568, 6569, 6570, 6572, 6574, 6575, 6577, 6578, 6580, 6581, 6582, 6583, 6584, 6589, 6590, 6591, 6592, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6253, 6614, 6615, 6616, 6255, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6628, 6629, 6631, 6632, 6634, 6635, 6636, 6638, 6640, 6641, 6643, 6644, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6664, 6665, 6670, 6671, 6672, 6673, 6675, 6676, 6677, 6678, 6679, 6681, 6682, 6684, 6685, 6686, 6687, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6746, 6748, 6749, 6750, 6751, 6753, 6754, 6755, 6756, 6757, 6758, 6759, 6760, 6762, 6763, 6764, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6775, 6776, 6777, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6790, 6791, 6792, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6814, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6838, 6840, 6841, 6842, 6843, 6844, 6846, 6847, 6848, 6849, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6866, 6868, 6869, 6870, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6893, 6895, 6896, 6897, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6588, 6586, 6669, 6667, 6713, 6712, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 6912, 6914, 6917, 6925, 6927, 6929, 6931, 6934, 6937, 6940, 6945, 6947, 6950, 6958, 6960, 6962, 6964, 6967, 6970, 6973, 6978, 6980, 6983, 6991, 6993, 6995, 6997, 7000, 7003, 7006, 7008, 7011, 7014, 7017, 7018, 7023, 7035, 7037, 7040, 7043, 7050, 7052, 7054, 7056, 7070, 7076, 7079, 7082, 7083, 7088, 7102, 7104, 7106, 7108, 7117, 7120, 7123, 7132, 7135, 7141, 7143, 7145, 7149, 7152, 7155, 7158, 7164, 7169, 7172, 7182, 7186, 7189, 7192, 7193, 7198, 7208, 7210, 7213, 7219, 7221, 7224, 7227, 7231, 7234, 7237, 7245, 7250, 7252, 7255, 7266, 7271, 7273, 7276, 7279, 7286, 7290, 7295, 7297, 7300, 7314, 7319, 7321, 7324, 6923, 6921, 6944, 6956, 6954, 6977, 6989, 6987, 7010, 7021, 7026, 7028, 7030, 7032, 7034, 7047, 7049, 7064, 7062, 7060, 7066, 7068, 7339, 7340, 7073, 7075, 7086, 7091, 7093, 7095, 7097, 7099, 7101, 7116, 7114, 7112, 7127, 7129, 7131, 7341, 7342, 7138, 7140, 7162, 7167, 7343, 7344, 7175, 7177, 7181, 7179, 7241, 7196, 7201, 7200, 7203, 7205, 7207, 7217, 7241, 7243, 7248, 7259, 7260, 7262, 7264, 7269, 7281, 7283, 7285, 7289, 7293, 7304, 7305, 7307, 7308, 7310, 7312, 7317, 7328, 7329, 7331, 7332, 7334, 7336, 7338, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 7424, 7426, 7434, 7436, 7444, 7446, 7463, 7467, 7468, 7477, 7480, 7482, 7486, 7489, 7492, 7493, 7499, 7501, 7503, 7504, 7505, 7427, 7527, 7528, 6933, 6422, 6419, 6936, 6942, 6939, 7529, 7437, 7530, 7531, 6966, 6461, 6458, 6969, 6975, 6972, 7532, 7447, 7533, 7534, 6999, 6500, 6497, 7002, 7454, 7005, 7535, 7016, 7013, 7458, 7536, 7459, 7537, 7538, 7539, 7540, 7541, 7460, 7042, 7039, 7542, 7543, 6567, 6564, 6561, 7544, 7545, 7546, 7547, 7548, 7549, 7551, 7552, 7081, 7078, 7472, 7553, 7473, 7554, 7555, 7556, 7557, 7558, 7559, 6633, 6630, 6627, 7560, 7561, 7562, 7122, 7119, 7563, 7564, 7565, 7481, 7566, 7568, 7569, 7147, 6683, 6680, 7157, 7154, 7570, 7490, 7571, 7491, 7572, 7574, 7575, 7502, 7576, 7577, 7185, 7239, 7236, 7578, 7191, 7188, 7497, 7579, 7498, 7580, 7581, 7582, 7583, 7584, 7502, 7585, 7233, 7239, 7236, 7586, 7587, 7509, 7588, 7510, 7257, 7254, 7589, 7590, 7591, 7592, 7513, 7593, 7514, 7278, 7275, 7280, 7594, 7595, 7596, 7518, 7597, 7519, 7598, 7520, 7302, 7299, 7599, 7600, 7601, 7602, 7603, 7604, 7523, 7605, 7524, 7326, 7323, 7606, 7607, 7608, 7609, 7610, 7611, 7612, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 6409, 6916, 7701, 7704, 7705, 7706, 7707, 7708, 7709, 6448, 6949, 7711, 7714, 7715, 7716, 7717, 7718, 7719, 6487, 6982, 7721, 7724, 7725, 7726, 7727, 7728, 7729, 7731, 7732, 7733, 7735, 7741, 7742, 7743, 7686, 6571, 7746, 7747, 7748, 7749, 7688, 7757, 7758, 7759, 7761, 6637, 7768, 7769, 7770, 7771, 7774, 7775, 7690, 7779, 7691, 7783, 7784, 7785, 7692, 7786, 7787, 7693, 7789, 7791, 7694, 6765, 7212, 7795, 7230, 6778, 6774, 7798, 7799, 7800, 7802, 7803, 7804, 7806, 7807, 6765, 7212, 7812, 7230, 6778, 6774, 7814, 7815, 7816, 7819, 7821, 7822, 7823, 7828, 7830, 7831, 7832, 7833, 7837, 7839, 7841, 7842, 7843, 7850, 7852, 7853, 7854, 7739, 7737, 7753, 7745, 7756, 7765, 7763, 7767, 7777, 7782, 7794, 7811, 7826, 7835, 7848, 7846, 7861, 7859, 7857, 125, 126, 127, 7936, 7937, 7938, 7939, 7943, 7945, 7946, 7947, 7948, 7952, 7954, 7955, 7956, 7957, 7961, 7963, 7968, 7970, 7971, 7973, 7975, 7976, 7977, 7981, 7983, 7985, 7986, 7988, 7990, 7991, 7994, 7995, 7997, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8008, 8010, 8015, 8016, 8017, 8018, 8019, 8020, 8022, 8026, 8030, 8036, 8040, 7966, 8042, 8043, 8044, 8045, 7967, 8046, 7980, 8047, 8048, 8049, 7989, 8050, 8051, 7999, 7998, 8052, 8013, 8053, 7809, 8025, 8024, 8054, 8029, 8028, 8055, 8035, 8034, 8033, 8056, 8057, 8039, 8038, 8058, 8059, 8060, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8064, 8066, 8067, 8069, 8071, 8072, 8074, 8076, 8077, 8082, 8087, 8093, 8098, 8100, 8101, 8106, 8109, 7710, 7720, 7730, 8117, 7965, 8118, 8081, 8122, 8085, 8124, 7979, 8125, 8091, 8128, 8092, 8131, 8132, 8096, 8097, 7801, 8134, 8012, 8136, 7817, 7824, 8137, 8138, 8032, 8140, 8141, 7844, 8143, 8144, 8145, 8146, 7855, 8148, 8149, 8150, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8201, 8202, 8206, 8208, 8193, 8209, 7942, 8196, 8210, 7951, 8199, 8211, 7960, 8213, 8215, 8217, 8219, 8221, 8127, 8223, 8226, 8094, 8224, 8227, 8205, 8228, 8230, 8135, 8108, 8232, 8233, 8236, 8239, 8241, 8244, 8247, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8324, 8326, 8327, 8329, 8330, 8332, 8212, 8084, 8120, 8123, 8218, 8089, 8130, 8341, 8133, 8344, 8007, 8229, 8348, 8021, 8350, 8351, 8352, 8354, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8325, 8328, 8331, 8455, 8459, 8340, 8464, 8467, 8468, 8469, 8470, 8471, 8220, 8214, 8347, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8579, 8580, 8342, 8345, 8349, 8578, 8577, 8576, 8588, 8589, 8590, 8355, 8243, 8142, 8139, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8456, 8705, 8709, 8710, 8711, 8462, 8707, 8708, 8715, 8716, 8717, 8718, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8832, 8833, 8834, 8837, 8838, 8839, 8840, 8842, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8962, 8460, 8457, 8966, 8714, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9089, 9090, 9091, 9092, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8712, 8963, 9218, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9344, 9346, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9472, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9600, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9728, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9473, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127};
int h_C[]= {
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, 325, 327, 329, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365, 367, 369, 371, 373, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 397, 399, 401, 403, 405, 407, 411, 413, 415, 417, 419, 421, 423, 425, 427, 429, 431, 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, 453, 455, 457, 459, 461, 463, 465, 467, 469, 471, 473, 475, 477, 479, 481, 483, 485, 487, 489, 491, 493, 496, 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 525, 527, 529, 531, 533, 535, 537, 539, 541, 543, 545, 547, 549, 551, 553, 555, 557, 559, 561, 563, 565, 567, 569, 571, 574, 576, 578, 580, 582, 584, 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 642, 644, 646, 648, 650, 652, 655, 657, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 753, 755, 757, 759, 762, 764, 766, 768, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, 834, 837, 839, 841, 843, 847, 849, 851, 853, 855, 857, 860, 862, 864, 866, 869, 871, 874, 876, 881, 883, 885, 887, 889, 891, 894, 896, 898, 900, 902, 904, 906, 908, 910, 912, 914, 916, 919, 921, 924, 926, 929, 931, 934, 936, 939, 941, 943, 945, 948, 950, 953, 955, 960, 962, 964, 966, 968, 970, 972, 974, 976, 978, 980, 982, 984, 986, 988, 990, 992, 994, 996, 998, 1000, 1002, 1004, 1006, 1008, 1010, 1012, 1014, 1016, 1018, 1020, 1022, 1024, 1026, 1028, 1030, 1032, 1034, 1036, 1038, 1041, 1043, 1045, 1047, 1050, 1052, 1054, 1056, 1058, 1060, 1062, 1064, 1066, 1068, 1070, 1072, 1074, 1076, 1078, 1080, 1083, 1085, 1087, 1089, 1093, 1095, 1097, 1099, 1101, 1103, 1105, 1107, 1109, 1111, 1113, 1115, 1117, 1119, 1121, 1123, 1126, 1128, 1130, 1132, 1134, 1136, 1138, 1140, 1143, 1145, 1148, 1150, 1153, 1155, 1158, 1160, 1166, 1168, 1171, 1173, 1176, 1178, 1181, 1183, 1186, 1188, 1190, 1192, 1194, 1196, 1199, 1201, 1204, 1206, 1208, 1210, 1212, 1214, 1216, 1218, 1220, 1222, 1224, 1226, 1228, 1230, 1232, 1234, 1237, 1239, 1241, 1243, 1245, 1247, 1249, 1251, 1253, 1255, 1258, 1260, 1262, 1264, 1266, 1268, 1270, 1272, 1274, 1276, 1278, 1280, 1282, 1284, 1286, 1288, 1290, 1292, 1294, 1296, 1298, 1300, 1302, 1304, 1307, 1309, 1311, 1313, 1315, 1317, 1319, 1321, 1323, 1325, 1327, 1329, 1331, 1333, 1335, 1337, 1339, 1341, 1343, 1345, 1347, 1349, 1351, 1353, 1355, 1357, 1359, 1361, 1363, 1365, 1367, 1369, 1371, 1373, 1375, 1377, 1380, 1382, 1384, 1386, 1388, 1390, 1392, 1394, 1397, 1399, 1401, 1403, 1406, 1408, 1410, 1412, 1414, 1416, 1418, 1420, 1422, 1424, 1426, 1428, 1431, 1433, 1435, 1437, 1439, 1441, 1444, 1446, 1449, 1451, 1457, 1459, 1462, 1464, 1468, 1470, 1472, 1474, 1476, 1478, 1481, 1483, 1486, 1488, 1491, 1493, 1496, 1498, 1501, 1503, 1506, 1508, 1511, 1513, 1515, 1517, 1519, 1521, 1524, 1526, 1528, 1530, 1532, 1534, 1536, 1538, 1540, 1542, 1544, 1546, 1548, 1550, 1552, 1554, 1556, 1558, 1561, 1563, 1565, 1567, 1570, 1572, 1575, 1577, 1582, 1584, 1587, 1589, 1592, 1594, 1597, 1599, 1602, 1604, 1607, 1609, 1612, 1614, 1617, 1619, 1622, 1624, 1627, 1629, 1632, 1634, 1039, 1048, 1163, 1163, 136, 1163, 1163, 137, 760, 1442, 1442, 1429, 1429, 751, 1454, 1454, 1442, 1442, 572, 572, 760, 1395, 1395, 1442, 1442, 1454, 1454, 1429, 1429, 1442, 1442, 1454, 1454, 1429, 1429, 1454, 1454, 1442, 1442, 1404, 1404, 1235, 1235, 1256, 1256, 1568, 1568, 751, 1454, 1454, 1442, 1442, 374, 374, 1454, 1454, 1442, 1442, 395, 395, 1442, 1442, 1454, 1454, 1429, 1429, 1442, 1442, 1454, 1454, 1454, 1454, 1442, 1442, 494, 1395, 1395, 1404, 1404, 523, 1395, 1395, 1404, 1404, 572, 572, 751, 751, 572, 572, 751, 751, 1522, 1522, 1568, 1568, 572, 572, 751, 751, 917, 917, 1442, 1442, 1235, 1256, 1395, 1395, 1404, 1404, 769, 769, 769, 769, 751, 751, 769, 769, 769, 769, 760, 760, 770, 770, 867, 878, 835, 844, 867, 878, 917, 917, 957, 957, 1039, 1048, 1081, 1090, 1124, 1124, 1124, 1124, 1163, 1163, 1163, 1163, 1442, 1442, 1235, 1256, 1235, 1235, 1256, 1256, 1454, 1454, 1579, 1395, 1404, 1395, 1404, 1454, 1454, 1442, 1442, 1442, 1442, 1454, 1454, 1522, 1522, 1568, 1568, 1579, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 3201, 3203, 3205, 3207, 3209, 3211, 3213, 3215, 3217, 3219, 3221, 3223, 3225, 3227, 3229, 3231, 3233, 3235, 3237, 3239, 3241, 3243, 3245, 3247, 3249, 3251, 3253, 3255, 3257, 3259, 3261, 3263, 3265, 3267, 3269, 3271, 3273, 3275, 3277, 3279, 3281, 3283, 3285, 3287, 3289, 3291, 3293, 3295, 3297, 3299, 3301, 3303, 3305, 3307, 3309, 3311, 3313, 3315, 3317, 3319, 3321, 3323, 3325, 3327, 3329, 3331, 3333, 3335, 3337, 3339, 3341, 3343, 3345, 3347, 3349, 3351, 3353, 3355, 3357, 3359, 3361, 3363, 3365, 3367, 3369, 3371, 3373, 3375, 3377, 3379, 3381, 3383, 3385, 3387, 3389, 3391, 3393, 3395, 3397, 3399, 3401, 3403, 3405, 3407, 3409, 3411, 3413, 3415, 3417, 3419, 3421, 3423, 3425, 3427, 3429, 3431, 3433, 3435, 3437, 3439, 3441, 3443, 3445, 3447, 3449, 3451, 3453, 3455, 3457, 3459, 3461, 3463, 3465, 3467, 3469, 3471, 3473, 3475, 3477, 3479, 3481, 3483, 3485, 3487, 3489, 3491, 3493, 3495, 3497, 3499, 3501, 3503, 3505, 3507, 3509, 3511, 3513, 3515, 3517, 3519, 3521, 3523, 3525, 3527, 3529, 3531, 3533, 3535, 3537, 3539, 3541, 3543, 3545, 3547, 3549, 3551, 3553, 3555, 3557, 3559, 3561, 3563, 3565, 3567, 3569, 3571, 3573, 3575, 3577, 3579, 3581, 3583, 3585, 3587, 3589, 3591, 3593, 3595, 3597, 3599, 3601, 3603, 3605, 3607, 3609, 3611, 3613, 3615, 3617, 3619, 3621, 3623, 3625, 3627, 3629, 3631, 3633, 3635, 3637, 3639, 3641, 3643, 3645, 3647, 3649, 3651, 3653, 3655, 3657, 3659, 3661, 3663, 3665, 3667, 3669, 3671, 3673, 3675, 3677, 3679, 3681, 3683, 3685, 3687, 3689, 3691, 3693, 3695, 3697, 3699, 3701, 3703, 3705, 3707, 3709, 3711, 3713, 3715, 3717, 3719, 3721, 3723, 3725, 3727, 3729, 3731, 3733, 3735, 3737, 3739, 3741, 3743, 3745, 3747, 3749, 3751, 3753, 3755, 3757, 3759, 3761, 3763, 3765, 3767, 3769, 3771, 3773, 3775, 3777, 3779, 3781, 3783, 3785, 3787, 3789, 3791, 3793, 3795, 3797, 3799, 3801, 3803, 3805, 3807, 3809, 3811, 3813, 3815, 3817, 3819, 3821, 3823, 3825, 3827, 3829, 3831, 3833, 3835, 3837, 3839, 3841, 3843, 3845, 3847, 3849, 3851, 3853, 3855, 3857, 3859, 3861, 3863, 3865, 3867, 3869, 3871, 3873, 3875, 3877, 3879, 3881, 3883, 3885, 3887, 3889, 3891, 3893, 3895, 3897, 3899, 3901, 3903, 3905, 3907, 3909, 3911, 3913, 3915, 3917, 3919, 3921, 3923, 3925, 3927, 3929, 3931, 3933, 3935, 3937, 3939, 3941, 3943, 3945, 3947, 3949, 3951, 3953, 3955, 3957, 3959, 3961, 3963, 3965, 3967, 3969, 1655, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1681, 1688, 1689, 1690, 1691, 1696, 1697, 1698, 1701, 1702, 1708, 1709, 1710, 1722, 1723, 1726, 1727, 1730, 1731, 1733, 1734, 1737, 1738, 1741, 1742, 1744, 1745, 1748, 1751, 1765, 1766, 1781, 1782, 1788, 1789, 1790, 1791, 1794, 1795, 1797, 1800, 1801, 1804, 1805, 1806, 1807, 1811, 1812, 1815, 1816, 1817, 1818, 1822, 1823, 1826, 1827, 1830, 1831, 1843, 1844, 1847, 1848, 1854, 1855, 1858, 1859, 1879, 1884, 1885, 1888, 1889, 1897, 1902, 1903, 1906, 1907, 1908, 1909, 1910, 1911, 1913, 1914, 1915, 1916, 1923, 1926, 1929, 1930, 1931, 1932, 1933, 1934, 1940, 1946, 1958, 1959, 1962, 1964, 1983, 1984, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2006, 2008, 2022, 2025, 2031, 2033, 2039, 2042, 2050, 2051, 2058, 2061, 2082, 2085, 2094, 2097, 2107, 2108, 2110, 2111, 2119, 2120, 2122, 2123, 2135, 2136, 2138, 2140, 2152, 2153, 2166, 2167, 2176, 2177, 2184, 2197, 2200, 2213, 2216, 2219, 2220, 2223, 2224, 2230, 2231, 2234, 2235, 2257, 2258, 2269, 2270, 2273, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 4225, 4224, 4226, 4228, 4230, 4229, 4232, 4231, 4233, 4507, 4234, 4236, 4235, 4238, 4237, 4239, 4241, 4240, 4255, 4507, 4243, 4242, 4244, 4247, 4246, 4249, 4248, 4251, 4250, 4253, 4252, 4255, 4254, 4257, 4256, 4612, 4615, 4259, 4258, 4261, 4260, 4262, 4263, 4265, 4264, 4619, 4621, 4266, 4268, 4267, 572, 4624, 4331, 4330, 4626, 4271, 4270, 4272, 4273, 572, 4628, 4397, 4275, 4349, 4399, 4402, 4350, 4310, 4407, 4353, 4557, 4556, 4631, 4277, 4276, 4633, 4279, 4278, 4635, 4280, 4637, 4282, 4281, 4639, 4284, 4283, 4641, 4285, 4643, 4287, 4286, 4288, 4287, 4289, 4290, 4292, 4291, 4293, 4294, 4296, 4295, 4297, 4298, 4300, 4299, 4301, 4647, 4302, 4395, 4394, 4348, 4397, 4399, 4303, 4402, 4304, 4310, 4407, 4305, 4558, 4524, 4649, 4307, 4306, 4309, 4308, 4310, 4651, 4653, 572, 572, 4655, 572, 4314, 4313, 4658, 4316, 4315, 4660, 4662, 1466, 4319, 4318, 4664, 4321, 4320, 4666, 4668, 1466, 4331, 4323, 4670, 4528, 4527, 4672, 4333, 4324, 4674, 4325, 4326, 4339, 4327, 4341, 4340, 4395, 4328, 4329, 4331, 4330, 4676, 4528, 4527, 4678, 4333, 4332, 1429, 4570, 4569, 4680, 4568, 4567, 4682, 4572, 4571, 1466, 4335, 4388, 4337, 4336, 4396, 4339, 4338, 4341, 4340, 4342, 4348, 4343, 4349, 4402, 4350, 4344, 4407, 4346, 4557, 4347, 4685, 4408, 4544, 4687, 4348, 4397, 4349, 4399, 4402, 4350, 4351, 4407, 4353, 4557, 4556, 4690, 4558, 4524, 4692, 4694, 4696, 4354, 4698, 4700, 4355, 4357, 4356, 4358, 4360, 4359, 4362, 4361, 4364, 4363, 4704, 4706, 4708, 4366, 4365, 4367, 4370, 4369, 4372, 4371, 4373, 4376, 4375, 4378, 4377, 4380, 4379, 4382, 4381, 4383, 4385, 4384, 4387, 4386, 4712, 4388, 4389, 4390, 4392, 4391, 4393, 4395, 4394, 4396, 4398, 4397, 4400, 4399, 4402, 4401, 4403, 4405, 4407, 4406, 4557, 4556, 4716, 4408, 4544, 4718, 4720, 4722, 4724, 4410, 4409, 4726, 4728, 4730, 4412, 4411, 769, 769, 4587, 4582, 4413, 4601, 4592, 4414, 4415, 4594, 4416, 4418, 4417, 4420, 4419, 4422, 4421, 4424, 4423, 4426, 4425, 4427, 4429, 4432, 4431, 4433, 4435, 4434, 4437, 4436, 4438, 4440, 4442, 4441, 4443, 4446, 4445, 4740, 4448, 4447, 4450, 4449, 4452, 4451, 4454, 4453, 4456, 4455, 4458, 4457, 4460, 4459, 4461, 4462, 4463, 4465, 4464, 4467, 4466, 4469, 4468, 4470, 4471, 4472, 4474, 4473, 4476, 4475, 4478, 4477, 4479, 4481, 4480, 4482, 4484, 4483, 4486, 4485, 4507, 4510, 4487, 4489, 4488, 4490, 4492, 4491, 4493, 4748, 4494, 4750, 4495, 4497, 4496, 4498, 4500, 4499, 4501, 4752, 4502, 4754, 4503, 4505, 4504, 4506, 4507, 4510, 4509, 4511, 4587, 4512, 4522, 4756, 4513, 4514, 4515, 4517, 4516, 4519, 4546, 4521, 4520, 4550, 4549, 4522, 4523, 4760, 4557, 4556, 4558, 4524, 4519, 4546, 4521, 4520, 4550, 4549, 4522, 4523, 4762, 4557, 4556, 4558, 4524, 4526, 4525, 4528, 4527, 4764, 4529, 4530, 4532, 4531, 4534, 4534, 4537, 4536, 4547, 4538, 4549, 4539, 4540, 4542, 4554, 4543, 4557, 4556, 4559, 4544, 4546, 4545, 4548, 4547, 4550, 4549, 4551, 4553, 4555, 4554, 4557, 4556, 4559, 4558, 4561, 4560, 4771, 4563, 4562, 4773, 4565, 4564, 1429, 4568, 4567, 4775, 4570, 4569, 4777, 4572, 4571, 1466, 4574, 4575, 4576, 4577, 4579, 4578, 4581, 4580, 4585, 4587, 4582, 4589, 4583, 4592, 4591, 4584, 4595, 4594, 4779, 4585, 4588, 4587, 4590, 4589, 4592, 4591, 4593, 4595, 4594, 4781, 4597, 4596, 4599, 4598, 4601, 4600, 4603, 4602, 4604, 4606, 4605, 4608, 4607, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1679, 1680, 1682, 1683, 1684, 1685, 1686, 1687, 1692, 1693, 1694, 1695, 1699, 1700, 1703, 1704, 1705, 1706, 1707, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1724, 1725, 1728, 1729, 1732, 1735, 1736, 1739, 1740, 1743, 1746, 1747, 1749, 1750, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1783, 1784, 1785, 1786, 1787, 1792, 1793, 1796, 1798, 1799, 1802, 1803, 1808, 1809, 1810, 1813, 1814, 1819, 1820, 1821, 1824, 1825, 1828, 1829, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1845, 1846, 1849, 1850, 1851, 1852, 1853, 1856, 1857, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1880, 1881, 1882, 1883, 1886, 1887, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1898, 1899, 1900, 1901, 1904, 1905, 1912, 1917, 1918, 1919, 1920, 1921, 1922, 1924, 1925, 1927, 1928, 1935, 1936, 1937, 1938, 1939, 1941, 1942, 1943, 1944, 1945, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1960, 1961, 1963, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1985, 1986, 1995, 1996, 2003, 2004, 2005, 2007, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2023, 2024, 2026, 2027, 2028, 2029, 2030, 2032, 2034, 2035, 2036, 2037, 2038, 2040, 2041, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2052, 2053, 2054, 2055, 2056, 2057, 2059, 2060, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2083, 2084, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2095, 2096, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2109, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2121, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2137, 2139, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2178, 2179, 2180, 2181, 2182, 2183, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2198, 2199, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2214, 2215, 2217, 2218, 2221, 2222, 2225, 2226, 2227, 2228, 2229, 2232, 2233, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2271, 2272, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 4900, 4899, 4924, 5104, 4683, 4683, 4924, 5104, 4683, 4683, 5088, 5091, 5104, 5154, 5153, 5159, 5158, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 5505, 5509, 5511, 5516, 5518, 5521, 5525, 5528, 5530, 5532, 5534, 5536, 5538, 5540, 5542, 5546, 5549, 5552, 5554, 5559, 5561, 5563, 5566, 5568, 5570, 5572, 5575, 5577, 5580, 5582, 5586, 5590, 5594, 5598, 5600, 5602, 5604, 5607, 5609, 5611, 5613, 5619, 5621, 5624, 5626, 5629, 5631, 5633, 5637, 5639, 5641, 5644, 5646, 5648, 5651, 5653, 5655, 5660, 5663, 5665, 5667, 5669, 5671, 5674, 5676, 5678, 5680, 5682, 5684, 5687, 5689, 5691, 5695, 5698, 5700, 5702, 5704, 5707, 5709, 5712, 5714, 5716, 5718, 5721, 5723, 5728, 5731, 5734, 5736, 5738, 5742, 5744, 5746, 5748, 5750, 5754, 5756, 5758, 5761, 5763, 5765, 5767, 5769, 5771, 5775, 5778, 5780, 5784, 5787, 5789, 5791, 5793, 5795, 5797, 5799, 5801, 5806, 5808, 5810, 5815, 5817, 5819, 5822, 5825, 5827, 5830, 5832, 5835, 5840, 5843, 5848, 5852, 5855, 5861, 5863, 5865, 5867, 5871, 5873, 5875, 5877, 5879, 5883, 5885, 5887, 5889, 5893, 5897, 5899, 5901, 5905, 5907, 5909, 5911, 5913, 5915, 5919, 5921, 5923, 5925, 5927, 5929, 5932, 5934, 5936, 5943, 5945, 5948, 5950, 5952, 5955, 5958, 5960, 5962, 5965, 5967, 5969, 5971, 5973, 5976, 5978, 5773, 5506, 5781, 5519, 5812, 5252, 5250, 5262, 5260, 5773, 5772, 5781, 5519, 5812, 5252, 5250, 5262, 5260, 5773, 5772, 5781, 5803, 5812, 5252, 5250, 5262, 2399, 2400, 5890, 5726, 5555, 2419, 5557, 2424, 5617, 2431, 2432, 5543, 5573, 5578, 5003, 5011, 5584, 5547, 5588, 5587, 5592, 5591, 5550, 4622, 5616, 4622, 5617, 5726, 5555, 5938, 2503, 5557, 2508, 5617, 5573, 5578, 5003, 5011, 5584, 5583, 5588, 5587, 5592, 5591, 5657, 2555, 2556, 5615, 4656, 5616, 4656, 5617, 5003, 5011, 5635, 5634, 5657, 2605, 5089, 2607, 5092, 2613, 5726, 5725, 5938, 2641, 2642, 2644, 2645, 5752, 5751, 5773, 5772, 5781, 5803, 5812, 5252, 5250, 5262, 5260, 5890, 5940, 5853, 5940, 5858, 5857, 5859, 5869, 5881, 5890, 5940, 5894, 5895, 5940, 5938, 5946, 5956, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 6119, 6118, 6117, 6016, 2289, 2290, 6120, 6122, 6121, 2294, 6017, 6023, 6094, 6095, 6125, 6127, 6018, 6020, 6019, 2304, 6134, 6132, 2307, 6137, 6135, 6138, 6140, 6021, 5512, 6143, 6142, 2316, 2317, 6145, 6144, 2320, 2321, 6146, 5513, 6119, 6118, 6117, 6116, 2328, 2329, 6122, 6121, 6120, 2333, 6092, 6023, 6094, 6095, 6125, 6128, 6127, 6020, 6019, 2343, 6134, 6132, 2346, 6137, 6135, 6138, 6140, 6021, 5522, 6143, 6142, 2355, 2356, 6145, 6144, 2359, 2360, 6146, 5523, 6119, 6118, 6117, 6116, 2367, 2368, 6122, 6121, 6120, 2372, 6022, 6023, 6024, 6095, 6125, 6128, 6127, 6026, 6025, 2382, 6134, 6133, 2385, 6137, 6136, 6138, 6140, 6139, 6027, 6143, 6142, 2394, 2395, 6145, 6144, 2398, 6146, 5850, 6033, 6175, 6034, 6179, 6178, 6180, 2409, 2410, 2411, 6102, 6101, 6103, 6105, 5740, 6108, 6107, 2420, 4617, 6194, 6195, 2425, 4617, 6113, 6114, 6076, 6056, 6233, 6081, 6080, 6068, 6067, 6030, 6071, 6070, 6072, 2441, 6049, 6075, 6074, 6050, 6052, 4688, 6054, 6041, 6031, 2451, 6043, 6042, 2454, 6058, 6057, 2457, 6060, 6045, 6044, 2461, 2462, 2463, 6032, 2465, 2466, 6047, 2468, 2469, 6048, 6035, 6037, 4688, 6039, 2475, 2476, 2477, 2478, 6088, 6090, 6089, 6091, 2483, 4622, 6113, 6114, 6033, 6161, 6034, 6179, 6178, 6180, 2493, 2494, 2495, 6102, 6101, 6103, 6105, 5740, 6108, 6107, 2504, 4629, 6194, 6195, 2509, 4629, 6113, 6114, 6035, 6037, 4688, 6039, 6041, 6040, 2519, 6043, 6042, 2522, 6058, 6057, 2525, 6060, 6045, 6044, 2529, 2530, 2531, 6046, 2533, 2534, 6047, 2536, 2537, 6048, 6068, 6067, 6069, 6071, 6070, 6072, 2545, 6049, 6075, 6074, 6050, 6052, 4688, 6054, 6076, 6056, 6269, 6081, 6080, 2559, 2560, 2561, 2562, 6088, 6090, 6089, 6091, 2567, 4656, 6113, 6114, 6058, 6057, 2573, 6060, 6059, 2576, 6062, 6061, 6063, 2580, 2581, 6066, 6065, 6064, 6068, 6067, 6069, 6071, 6070, 6072, 2591, 6075, 6074, 6073, 6076, 6078, 4683, 6081, 6080, 6082, 6084, 4688, 6087, 6086, 2606, 2608, 6088, 6091, 6090, 6089, 5105, 6113, 6114, 6092, 6093, 6094, 6095, 6098, 6097, 6096, 6099, 6175, 6160, 6177, 6179, 6178, 6180, 2631, 2632, 2633, 6102, 6101, 6103, 6105, 5740, 6108, 6107, 6289, 5155, 6291, 5160, 6194, 6195, 2649, 2650, 6111, 6113, 6114, 6119, 6118, 6117, 6116, 2658, 2659, 6122, 6121, 6120, 2663, 6123, 6124, 6125, 6128, 6127, 6131, 6130, 6129, 2672, 6134, 6133, 6132, 2676, 6137, 6136, 6135, 6138, 6140, 6139, 5828, 6143, 6142, 2686, 2687, 6145, 6144, 2690, 2691, 6146, 5850, 6163, 6165, 5903, 6168, 6167, 6169, 6171, 5917, 6174, 6173, 6161, 6176, 6177, 6178, 6179, 6180, 2710, 2711, 6181, 2713, 6148, 6194, 6195, 6163, 6165, 5903, 6168, 6167, 6169, 6171, 5917, 6174, 6173, 6161, 6176, 6177, 6178, 6179, 6180, 2733, 2734, 2735, 6181, 2737, 6149, 6194, 6195, 6150, 6152, 2743, 6154, 6153, 6155, 6157, 2748, 6159, 6158, 6163, 6165, 5903, 6168, 6167, 6161, 6160, 6177, 6178, 6179, 6180, 2762, 2763, 6181, 2765, 6183, 6185, 6186, 2769, 6187, 6189, 6190, 6163, 6165, 5903, 6168, 6167, 6169, 6171, 5917, 6174, 6173, 6176, 6175, 6177, 6179, 6178, 6180, 2789, 2790, 6181, 2792, 6183, 6185, 6186, 2796, 6187, 6189, 6190, 6191, 6192, 6194, 6195, 122, 123, 124, 125, 126, 127, 2285, 2286, 2287, 2288, 6405, 2291, 2292, 2293, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2305, 2306, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 6432, 2318, 2319, 6436, 2322, 2323, 2324, 2325, 2326, 2327, 6444, 2330, 2331, 2332, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2344, 2345, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 6471, 2357, 2358, 6475, 2361, 2362, 2363, 2364, 2365, 2366, 6483, 2369, 2370, 2371, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2383, 2384, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 6510, 2396, 2397, 6223, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 6523, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 6532, 2421, 2422, 2423, 6536, 2426, 2427, 2428, 2429, 2430, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450, 2452, 2453, 2455, 2456, 2458, 2459, 2460, 6573, 2464, 6576, 2467, 6579, 2470, 2471, 2472, 2473, 2474, 2479, 2480, 2481, 2482, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 6604, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 6613, 2505, 2506, 2507, 6617, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2520, 2521, 2523, 2524, 2526, 2527, 2528, 6639, 2532, 6642, 2535, 6645, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2557, 2558, 2563, 2564, 2565, 2566, 2568, 2569, 2570, 2571, 2572, 2574, 2575, 2577, 2578, 2579, 6688, 2582, 2583, 2584, 2585, 2586, 2587, 2588, 2589, 2590, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2609, 2610, 2611, 2612, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 6736, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2643, 2646, 2647, 2648, 6752, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 6761, 2660, 2661, 2662, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2673, 2674, 2675, 2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 6789, 2688, 2689, 6793, 2692, 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 6813, 2712, 2714, 2715, 2716, 2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 6836, 2736, 2738, 2739, 2740, 2741, 2742, 2744, 2745, 2746, 2747, 2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 6865, 2764, 2766, 2767, 2768, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 6892, 2791, 2793, 2794, 2795, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 6587, 6585, 6668, 6666, 6282, 6280, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 6913, 6915, 6918, 6926, 6928, 6930, 6932, 6935, 6938, 6941, 6946, 6948, 6951, 6959, 6961, 6963, 6965, 6968, 6971, 6974, 6979, 6981, 6984, 6992, 6994, 6996, 6998, 7001, 7004, 7007, 6224, 7012, 7015, 6524, 7019, 7024, 7036, 7038, 7041, 7044, 7051, 7053, 7055, 7057, 7071, 7077, 7080, 6605, 7084, 7089, 7103, 7105, 7107, 7109, 7118, 7121, 7124, 7133, 7136, 7142, 7144, 7146, 7150, 7153, 7156, 7159, 7165, 7170, 7173, 7183, 7187, 7190, 6737, 7194, 7199, 7209, 7211, 7214, 7220, 7222, 7225, 7228, 7232, 7235, 7238, 7246, 7251, 7253, 7256, 7267, 7272, 7274, 7277, 6837, 7287, 7291, 7296, 7298, 7301, 7315, 7320, 7322, 7325, 6922, 6920, 6943, 6955, 6953, 6976, 6988, 6986, 7009, 7020, 7025, 7027, 7029, 7031, 7033, 7046, 7048, 7063, 7061, 7059, 7065, 7067, 2865, 2866, 6593, 7074, 7085, 7090, 7092, 7094, 7096, 7098, 7100, 7115, 7113, 7111, 7126, 7128, 7130, 2895, 2896, 6674, 7139, 7161, 7166, 2911, 2912, 6284, 7176, 7180, 7178, 7240, 7195, 6747, 6745, 7202, 7204, 7206, 7216, 7240, 7242, 7247, 7258, 6815, 7261, 7263, 7268, 6839, 7282, 7284, 7288, 7292, 7303, 6867, 7306, 6871, 7309, 7311, 7316, 7327, 6894, 7330, 6898, 7333, 7335, 7337, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 7425, 6919, 7435, 6952, 7445, 6985, 7045, 7058, 7072, 7110, 7125, 7137, 7151, 7160, 7174, 7184, 7500, 7215, 7223, 7226, 7229, 6924, 2807, 2808, 7430, 7429, 7428, 7431, 7433, 7432, 2815, 6957, 2819, 2820, 7440, 7439, 7438, 7441, 7443, 7442, 2827, 6990, 2831, 2832, 7450, 7449, 7448, 7451, 7453, 7452, 2839, 7456, 7455, 7457, 2843, 7022, 2845, 2846, 2847, 2848, 2849, 6542, 7462, 7461, 2854, 2855, 7466, 7465, 7464, 2860, 2861, 2862, 2863, 2864, 7550, 2868, 2869, 7470, 7469, 7471, 2873, 7087, 2875, 2876, 2877, 2878, 2879, 2880, 7476, 7475, 7474, 2885, 2886, 2887, 7479, 7478, 2891, 2892, 2893, 6663, 7567, 2898, 2899, 7485, 7484, 7483, 7488, 7487, 2907, 7163, 2909, 7168, 7573, 2914, 2915, 7218, 2919, 2920, 7506, 7508, 7507, 2927, 7495, 7494, 7496, 2931, 7197, 2933, 2934, 2935, 2936, 2937, 7218, 2941, 7506, 7508, 7507, 2948, 2949, 7244, 2951, 7249, 7512, 7511, 2955, 2956, 2957, 2958, 7265, 2960, 7270, 7516, 7515, 7517, 2965, 2966, 2967, 6845, 2969, 6850, 2971, 7294, 7522, 7521, 2975, 2976, 2977, 2978, 2979, 2980, 7313, 2982, 7318, 7526, 7525, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 7681, 7680, 2806, 2809, 2810, 2811, 2812, 2813, 2814, 7683, 7682, 2818, 2821, 2822, 2823, 2824, 2825, 2826, 7685, 7684, 2830, 2833, 2834, 2835, 2836, 2837, 2838, 2840, 2841, 2842, 2844, 2850, 2851, 2852, 6551, 7687, 2857, 2858, 2859, 7750, 7069, 2870, 2871, 2872, 2874, 7689, 2882, 2883, 2884, 7772, 2888, 2889, 6653, 2894, 7134, 2900, 2901, 2902, 7148, 2904, 2905, 6698, 2908, 2910, 7171, 7697, 7696, 2918, 7700, 7699, 7695, 2924, 2925, 2926, 2928, 2929, 2930, 2932, 7808, 7697, 7696, 2940, 7700, 7699, 7698, 2945, 2946, 2947, 2950, 2952, 2953, 2954, 2959, 2961, 2962, 2963, 2964, 2968, 2970, 2972, 2973, 2974, 2981, 2983, 2984, 2985, 7738, 7736, 7752, 7744, 7755, 7764, 7762, 7766, 7776, 7781, 7793, 7810, 7825, 7834, 7847, 7845, 7860, 7858, 7856, 125, 126, 127, 2804, 2805, 7702, 7940, 7944, 2816, 2817, 7712, 7949, 7953, 2828, 2829, 7722, 7958, 7962, 7964, 7969, 2853, 2856, 7974, 7751, 2867, 7978, 2881, 7984, 7773, 7987, 2890, 2897, 7992, 2903, 7996, 2906, 2913, 2916, 2917, 7796, 2921, 2922, 2923, 8009, 8011, 2938, 2939, 7813, 2942, 2943, 2944, 8023, 8027, 8031, 8037, 8041, 7734, 3004, 3005, 3006, 3009, 7740, 3011, 7760, 3015, 3016, 3019, 7778, 3021, 3022, 7790, 7788, 3028, 7805, 3035, 8014, 7820, 7818, 3043, 7829, 7827, 3047, 7840, 7838, 7836, 3052, 3053, 7851, 7849, 3057, 3058, 3059, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8065, 7703, 7941, 8070, 7713, 7950, 8075, 7723, 7959, 7972, 7982, 7993, 8099, 7797, 8102, 8107, 8110, 8068, 8073, 8078, 3002, 8079, 8119, 8080, 3010, 7754, 3013, 8086, 8126, 8090, 3020, 7780, 3024, 3025, 8095, 7792, 8104, 3033, 8105, 3036, 8112, 8113, 3041, 3042, 8114, 3045, 3046, 8115, 3049, 3050, 3051, 8147, 8116, 3055, 3056, 8151, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8083, 8088, 8103, 8111, 8192, 2994, 8194, 8195, 2997, 8197, 8198, 3000, 8200, 3003, 3007, 3012, 3014, 3018, 8222, 3023, 3026, 8203, 8225, 3029, 8204, 3031, 3034, 8231, 8207, 3038, 3040, 3044, 3048, 8242, 3054, 8152, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 2993, 2995, 2996, 2998, 2999, 3001, 8333, 8320, 8334, 8335, 8336, 8321, 8339, 3027, 8343, 3030, 8322, 8346, 3037, 8323, 8234, 8237, 8240, 8245, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8449, 8451, 8453, 3008, 3017, 8461, 3032, 3039, 8235, 8238, 8353, 8246, 8458, 8454, 8465, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8121, 8337, 8581, 8582, 8583, 8452, 8450, 8448, 3063, 3067, 3069, 8587, 8586, 8585, 8584, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8704, 8338, 3060, 3061, 3062, 8706, 8463, 8466, 3071, 3072, 3073, 3074, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8216, 8129, 8835, 3065, 3068, 3070, 8841, 8843, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8836, 8961, 8960, 8967, 8964, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 3064, 3066, 8965, 3076, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9216, 9217, 3075, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9345, 9219, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 8713, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9088, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 3077, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 9856, 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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127};
bool h_Op[]= {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
#define THREADS_PER_BLOCK 128
#define BLOCKS_PER_GRID 1
#define SIZE_OF_IN 3200
#define SIZE_OF_AC 6912
__device__ void
ac(float *A, const int *B, const int *C, const bool *Op, int n_iter) {
int i= blockDim.x * blockIdx.x + threadIdx.x;
__shared__ float R[79*THREADS_PER_BLOCK];
const int t= THREADS_PER_BLOCK;
__shared__ float final;
final=0;
R[i + 0*t] = A[i + 0*t];
R[i + 1*t] = A[i + 1*t];
R[i + 2*t] = A[i + 2*t];
R[i + 3*t] = A[i + 3*t];
R[i + 4*t] = A[i + 4*t];
R[i + 5*t] = A[i + 5*t];
R[i + 6*t] = A[i + 6*t];
R[i + 7*t] = A[i + 7*t];
R[i + 8*t] = A[i + 8*t];
R[i + 9*t] = A[i + 9*t];
R[i + 10*t] = A[i + 10*t];
R[i + 11*t] = A[i + 11*t];
R[i + 12*t] = A[i + 12*t];
R[i + 13*t] = A[i + 13*t];
R[i + 14*t] = A[i + 14*t];
R[i + 15*t] = A[i + 15*t];
R[i + 16*t] = A[i + 16*t];
R[i + 17*t] = A[i + 17*t];
R[i + 18*t] = A[i + 18*t];
R[i + 19*t] = A[i + 19*t];
R[i + 20*t] = A[i + 20*t];
R[i + 21*t] = A[i + 21*t];
R[i + 22*t] = A[i + 22*t];
R[i + 23*t] = A[i + 23*t];
R[i + 24*t] = A[i + 24*t];
__syncthreads();
for (int iter=0; iter< n_iter; iter++) {
R[i + 25*t] = Op[i + 0*t] ? R[B[i + 0*t]] * R[C[i + 0*t]] : R[B[i + 0*t]] + R[C[i + 0*t]];
R[i + 26*t] = Op[i + 1*t] ? R[B[i + 1*t]] * R[C[i + 1*t]] : R[B[i + 1*t]] + R[C[i + 1*t]];
R[i + 27*t] = Op[i + 2*t] ? R[B[i + 2*t]] * R[C[i + 2*t]] : R[B[i + 2*t]] + R[C[i + 2*t]];
R[i + 28*t] = Op[i + 3*t] ? R[B[i + 3*t]] * R[C[i + 3*t]] : R[B[i + 3*t]] + R[C[i + 3*t]];
R[i + 29*t] = Op[i + 4*t] ? R[B[i + 4*t]] * R[C[i + 4*t]] : R[B[i + 4*t]] + R[C[i + 4*t]];
R[i + 30*t] = Op[i + 5*t] ? R[B[i + 5*t]] * R[C[i + 5*t]] : R[B[i + 5*t]] + R[C[i + 5*t]];
R[i + 31*t] = Op[i + 6*t] ? R[B[i + 6*t]] * R[C[i + 6*t]] : R[B[i + 6*t]] + R[C[i + 6*t]];
R[i + 32*t] = Op[i + 7*t] ? R[B[i + 7*t]] * R[C[i + 7*t]] : R[B[i + 7*t]] + R[C[i + 7*t]];
__syncthreads();
R[i + 33*t] = Op[i + 8*t] ? R[B[i + 8*t]] * R[C[i + 8*t]] : R[B[i + 8*t]] + R[C[i + 8*t]];
R[i + 34*t] = Op[i + 9*t] ? R[B[i + 9*t]] * R[C[i + 9*t]] : R[B[i + 9*t]] + R[C[i + 9*t]];
R[i + 35*t] = Op[i + 10*t] ? R[B[i + 10*t]] * R[C[i + 10*t]] : R[B[i + 10*t]] + R[C[i + 10*t]];
R[i + 36*t] = Op[i + 11*t] ? R[B[i + 11*t]] * R[C[i + 11*t]] : R[B[i + 11*t]] + R[C[i + 11*t]];
R[i + 37*t] = Op[i + 12*t] ? R[B[i + 12*t]] * R[C[i + 12*t]] : R[B[i + 12*t]] + R[C[i + 12*t]];
__syncthreads();
R[i + 38*t] = Op[i + 13*t] ? R[B[i + 13*t]] * R[C[i + 13*t]] : R[B[i + 13*t]] + R[C[i + 13*t]];
R[i + 39*t] = Op[i + 14*t] ? R[B[i + 14*t]] * R[C[i + 14*t]] : R[B[i + 14*t]] + R[C[i + 14*t]];
R[i + 40*t] = Op[i + 15*t] ? R[B[i + 15*t]] * R[C[i + 15*t]] : R[B[i + 15*t]] + R[C[i + 15*t]];
R[i + 41*t] = Op[i + 16*t] ? R[B[i + 16*t]] * R[C[i + 16*t]] : R[B[i + 16*t]] + R[C[i + 16*t]];
R[i + 42*t] = Op[i + 17*t] ? R[B[i + 17*t]] * R[C[i + 17*t]] : R[B[i + 17*t]] + R[C[i + 17*t]];
__syncthreads();
R[i + 43*t] = Op[i + 18*t] ? R[B[i + 18*t]] * R[C[i + 18*t]] : R[B[i + 18*t]] + R[C[i + 18*t]];
R[i + 44*t] = Op[i + 19*t] ? R[B[i + 19*t]] * R[C[i + 19*t]] : R[B[i + 19*t]] + R[C[i + 19*t]];
R[i + 45*t] = Op[i + 20*t] ? R[B[i + 20*t]] * R[C[i + 20*t]] : R[B[i + 20*t]] + R[C[i + 20*t]];
R[i + 46*t] = Op[i + 21*t] ? R[B[i + 21*t]] * R[C[i + 21*t]] : R[B[i + 21*t]] + R[C[i + 21*t]];
__syncthreads();
R[i + 47*t] = Op[i + 22*t] ? R[B[i + 22*t]] * R[C[i + 22*t]] : R[B[i + 22*t]] + R[C[i + 22*t]];
R[i + 48*t] = Op[i + 23*t] ? R[B[i + 23*t]] * R[C[i + 23*t]] : R[B[i + 23*t]] + R[C[i + 23*t]];
R[i + 49*t] = Op[i + 24*t] ? R[B[i + 24*t]] * R[C[i + 24*t]] : R[B[i + 24*t]] + R[C[i + 24*t]];
__syncthreads();
R[i + 50*t] = Op[i + 25*t] ? R[B[i + 25*t]] * R[C[i + 25*t]] : R[B[i + 25*t]] + R[C[i + 25*t]];
R[i + 51*t] = Op[i + 26*t] ? R[B[i + 26*t]] * R[C[i + 26*t]] : R[B[i + 26*t]] + R[C[i + 26*t]];
R[i + 52*t] = Op[i + 27*t] ? R[B[i + 27*t]] * R[C[i + 27*t]] : R[B[i + 27*t]] + R[C[i + 27*t]];
R[i + 53*t] = Op[i + 28*t] ? R[B[i + 28*t]] * R[C[i + 28*t]] : R[B[i + 28*t]] + R[C[i + 28*t]];
__syncthreads();
R[i + 54*t] = Op[i + 29*t] ? R[B[i + 29*t]] * R[C[i + 29*t]] : R[B[i + 29*t]] + R[C[i + 29*t]];
R[i + 55*t] = Op[i + 30*t] ? R[B[i + 30*t]] * R[C[i + 30*t]] : R[B[i + 30*t]] + R[C[i + 30*t]];
R[i + 56*t] = Op[i + 31*t] ? R[B[i + 31*t]] * R[C[i + 31*t]] : R[B[i + 31*t]] + R[C[i + 31*t]];
R[i + 57*t] = Op[i + 32*t] ? R[B[i + 32*t]] * R[C[i + 32*t]] : R[B[i + 32*t]] + R[C[i + 32*t]];
__syncthreads();
R[i + 58*t] = Op[i + 33*t] ? R[B[i + 33*t]] * R[C[i + 33*t]] : R[B[i + 33*t]] + R[C[i + 33*t]];
R[i + 59*t] = Op[i + 34*t] ? R[B[i + 34*t]] * R[C[i + 34*t]] : R[B[i + 34*t]] + R[C[i + 34*t]];
__syncthreads();
R[i + 60*t] = Op[i + 35*t] ? R[B[i + 35*t]] * R[C[i + 35*t]] : R[B[i + 35*t]] + R[C[i + 35*t]];
R[i + 61*t] = Op[i + 36*t] ? R[B[i + 36*t]] * R[C[i + 36*t]] : R[B[i + 36*t]] + R[C[i + 36*t]];
__syncthreads();
R[i + 62*t] = Op[i + 37*t] ? R[B[i + 37*t]] * R[C[i + 37*t]] : R[B[i + 37*t]] + R[C[i + 37*t]];
__syncthreads();
R[i + 63*t] = Op[i + 38*t] ? R[B[i + 38*t]] * R[C[i + 38*t]] : R[B[i + 38*t]] + R[C[i + 38*t]];
__syncthreads();
R[i + 64*t] = Op[i + 39*t] ? R[B[i + 39*t]] * R[C[i + 39*t]] : R[B[i + 39*t]] + R[C[i + 39*t]];
__syncthreads();
R[i + 65*t] = Op[i + 40*t] ? R[B[i + 40*t]] * R[C[i + 40*t]] : R[B[i + 40*t]] + R[C[i + 40*t]];
__syncthreads();
R[i + 66*t] = Op[i + 41*t] ? R[B[i + 41*t]] * R[C[i + 41*t]] : R[B[i + 41*t]] + R[C[i + 41*t]];
__syncthreads();
R[i + 67*t] = Op[i + 42*t] ? R[B[i + 42*t]] * R[C[i + 42*t]] : R[B[i + 42*t]] + R[C[i + 42*t]];
__syncthreads();
R[i + 68*t] = Op[i + 43*t] ? R[B[i + 43*t]] * R[C[i + 43*t]] : R[B[i + 43*t]] + R[C[i + 43*t]];
__syncthreads();
R[i + 69*t] = Op[i + 44*t] ? R[B[i + 44*t]] * R[C[i + 44*t]] : R[B[i + 44*t]] + R[C[i + 44*t]];
__syncthreads();
R[i + 70*t] = Op[i + 45*t] ? R[B[i + 45*t]] * R[C[i + 45*t]] : R[B[i + 45*t]] + R[C[i + 45*t]];
__syncthreads();
R[i + 71*t] = Op[i + 46*t] ? R[B[i + 46*t]] * R[C[i + 46*t]] : R[B[i + 46*t]] + R[C[i + 46*t]];
__syncthreads();
R[i + 72*t] = Op[i + 47*t] ? R[B[i + 47*t]] * R[C[i + 47*t]] : R[B[i + 47*t]] + R[C[i + 47*t]];
__syncthreads();
R[i + 73*t] = Op[i + 48*t] ? R[B[i + 48*t]] * R[C[i + 48*t]] : R[B[i + 48*t]] + R[C[i + 48*t]];
__syncthreads();
R[i + 74*t] = Op[i + 49*t] ? R[B[i + 49*t]] * R[C[i + 49*t]] : R[B[i + 49*t]] + R[C[i + 49*t]];
__syncthreads();
R[i + 75*t] = Op[i + 50*t] ? R[B[i + 50*t]] * R[C[i + 50*t]] : R[B[i + 50*t]] + R[C[i + 50*t]];
__syncthreads();
R[i + 76*t] = Op[i + 51*t] ? R[B[i + 51*t]] * R[C[i + 51*t]] : R[B[i + 51*t]] + R[C[i + 51*t]];
__syncthreads();
R[i + 77*t] = Op[i + 52*t] ? R[B[i + 52*t]] * R[C[i + 52*t]] : R[B[i + 52*t]] + R[C[i + 52*t]];
__syncthreads();
R[i + 78*t] = Op[i + 53*t] ? R[B[i + 53*t]] * R[C[i + 53*t]] : R[B[i + 53*t]] + R[C[i + 53*t]];
if (i==0) { final += R[78*t]; }
__syncthreads();
}
if (i==0) { A[0]= final;}
}
|
8,528 | #include "includes.h"
__global__ void makeKernel_nonefftshift(float* KernelPhase, int row, int column, float* ImgProperties) {
const int numThreads = blockDim.x * gridDim.x;
const int threadID = blockIdx.x * blockDim.x + threadIdx.x;
float pixSize = ImgProperties[0];
float MagX = ImgProperties[1];
float nmed = ImgProperties[2];
float lambda = ImgProperties[3];
float MagXscaling = 1/ImgProperties[4];
float pixdxInv = MagX / pixSize*MagXscaling; // Magnification/pixSize
float km = nmed / lambda; // nmed / lambda
for (int i = threadID; i < row*column; i += numThreads) {
int dx = i % row;
int dy = i / row;
dx= ((dx - row / 2)>0) ? (dx - row) : dx;
dy= ((dy - row / 2)>0) ? (dy - row) : dy;
float kdx = float(dx)*pixdxInv;
float kdy = float(dy)*pixdxInv;
float temp = km*km - kdx*kdx - kdy*kdy;
KernelPhase[i] = (temp >= 0) ? (sqrtf(temp)-km) : 0;
}
} |
8,529 | #include <stdio.h>
#define N 10
__global__ void add (int *a, int *b, int *c) {
int tid=blockIdx.x;
if (tid<N) {
c[tid]=a[tid]+b[tid];
}
}
int main(int arc, char **argv) {
int a[N],b[N],c[N];
int *dev_a,*dev_b,*dev_c;
int i;
/* Allocate memory on GPU */
cudaMalloc((void **)&dev_a,N*sizeof(int));
cudaMalloc((void **)&dev_b,N*sizeof(int));
cudaMalloc((void **)&dev_c,N*sizeof(int));
/* Fill the host arrays with values */
for(i=0;i<N;i++) {
a[i]=-i;
b[i]=i*i;
}
cudaMemcpy(dev_a,a,N*sizeof(int),cudaMemcpyHostToDevice);
cudaMemcpy(dev_b,b,N*sizeof(int),cudaMemcpyHostToDevice);
add<<<N,1>>>(dev_a,dev_b,dev_c);
cudaMemcpy(c,dev_c,N*sizeof(int),cudaMemcpyDeviceToHost);
/* results */
for(i=0;i<N;i++) {
printf("%d+%d=%d\n",a[i],b[i],c[i]);
}
cudaFree(dev_a);
cudaFree(dev_b);
cudaFree(dev_c);
return 0;
}
|
8,530 | #include <iostream>
#include <cstdlib>
#include <cassert>
#include <zlib.h>
#include <png.h>
#define MASK_N 2
#define MASK_X 5
#define MASK_Y 5
#define SCALE 8
unsigned char *device_s = NULL;
unsigned char *device_t = NULL;
__device__ int dev_mask[MASK_N][MASK_X][MASK_Y] = {
{{ -1, -4, -6, -4, -1},
{ -2, -8,-12, -8, -2},
{ 0, 0, 0, 0, 0},
{ 2, 8, 12, 8, 2},
{ 1, 4, 6, 4, 1}},
{{ -1, -2, 0, 2, 1},
{ -4, -8, 0, 8, 4},
{ -6,-12, 0, 12, 6},
{ -4, -8, 0, 8, 4},
{ -1, -2, 0, 2, 1}}
};
int read_png(const char* filename, unsigned char** image, unsigned* height,
unsigned* width, unsigned* channels) {
unsigned char sig[8];
FILE* infile;
infile = fopen(filename, "rb");
fread(sig, 1, 8, infile);
if (!png_check_sig(sig, 8))
return 1; /* bad signature */
png_structp png_ptr;
png_infop info_ptr;
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr)
return 4; /* out of memory */
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
png_destroy_read_struct(&png_ptr, NULL, NULL);
return 4; /* out of memory */
}
png_init_io(png_ptr, infile);
png_set_sig_bytes(png_ptr, 8);
png_read_info(png_ptr, info_ptr);
int bit_depth, color_type;
png_get_IHDR(png_ptr, info_ptr, width, height, &bit_depth, &color_type, NULL, NULL, NULL);
png_uint_32 i, rowbytes;
png_bytep row_pointers[*height];
png_read_update_info(png_ptr, info_ptr);
rowbytes = png_get_rowbytes(png_ptr, info_ptr);
*channels = (int) png_get_channels(png_ptr, info_ptr);
/*
if ((*image = (unsigned char *) malloc(rowbytes * *height)) == NULL) {
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return 3;
}*/
cudaMallocHost(image, rowbytes * *height);
for (i = 0; i < *height; ++i)
row_pointers[i] = *image + i * rowbytes;
png_read_image(png_ptr, row_pointers);
png_read_end(png_ptr, NULL);
return 0;
}
void write_png(const char* filename, png_bytep image, const unsigned height, const unsigned width,
const unsigned channels) {
FILE* fp = fopen(filename, "wb");
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_infop info_ptr = png_create_info_struct(png_ptr);
png_init_io(png_ptr, fp);
png_set_IHDR(png_ptr, info_ptr, width, height, 8,
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
png_set_filter(png_ptr, 0, PNG_NO_FILTERS);
png_write_info(png_ptr, info_ptr);
png_set_compression_level(png_ptr, 1);
png_bytep row_ptr[height];
for (int i = 0; i < height; ++ i) {
row_ptr[i] = image + i * width * channels * sizeof(unsigned char);
}
png_write_image(png_ptr, row_ptr);
png_write_end(png_ptr, NULL);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp);
}
void __global__ sobel (unsigned char* s, unsigned char* t, unsigned height, unsigned width, unsigned channels,size_t pitch) {
int x, y, i, v, u;
int R, G, B;
double val[MASK_N*3] = {0.0};
int adjustX, adjustY, xBound, yBound;
__shared__ int mask[MASK_N][MASK_X][MASK_Y];
x = (blockIdx.x * blockDim.x + threadIdx.x)%MASK_N;
y = (blockIdx.x * blockDim.x + threadIdx.x)/MASK_N%MASK_X;
i = (blockIdx.x * blockDim.x + threadIdx.x)/MASK_N/MASK_X%MASK_Y;
mask[x][y][i] = dev_mask[x][y][i];
__syncthreads();// wait for each thread to copy its elemene
//for (y = 0; y < height; ++y) {
y = blockIdx.x * blockDim.x + threadIdx.x + 2;
if (y>=height + 2)
return;
for (x = 2; x < width+2; ++x) {
for (i = 0; i < MASK_N; ++i) {
adjustX = (MASK_X % 2) ? 1 : 0;//5
adjustY = (MASK_Y % 2) ? 1 : 0;//5
xBound = MASK_X /2;//2
yBound = MASK_Y /2;//2
val[i*3+2] = 0.0;
val[i*3+1] = 0.0;
val[i*3] = 0.0;
for (v = -yBound; v < yBound + adjustY; ++v) {
for (u = -xBound; u < xBound + adjustX; ++u) {
//if ((x + u) >= 0 && (x + u) < width && y + v >= 0 && y + v < height) {
R = s[pitch * (y+v) + channels*(x+u) + 2];
G = s[pitch * (y+v) + channels*(x+u) + 1];
B = s[pitch * (y+v) + channels*(x+u) + 0];
val[i*3+2] += R * mask[i][u + xBound][v + yBound];
val[i*3+1] += G * mask[i][u + xBound][v + yBound];
val[i*3+0] += B * mask[i][u + xBound][v + yBound];
//}
}
}
}
double totalR = 0.0;
double totalG = 0.0;
double totalB = 0.0;
for (i = 0; i < MASK_N; ++i) {
totalR += val[i * 3 + 2] * val[i * 3 + 2];
totalG += val[i * 3 + 1] * val[i * 3 + 1];
totalB += val[i * 3 + 0] * val[i * 3 + 0];
}
totalR = sqrt(totalR) / SCALE;
totalG = sqrt(totalG) / SCALE;
totalB = sqrt(totalB) / SCALE;
const unsigned char cR = (totalR > 255.0) ? 255 : totalR;
const unsigned char cG = (totalG > 255.0) ? 255 : totalG;
const unsigned char cB = (totalB > 255.0) ? 255 : totalB;
t[pitch * y + channels*x + 2] = cR;
t[pitch * y + channels*x + 1] = cG;
t[pitch * y + channels*x + 0] = cB;
}
//}
}
int main(int argc, char** argv) {
assert(argc == 3);
unsigned height, width, channels;
unsigned char* host_s = NULL;
read_png(argv[1], &host_s, &height, &width, &channels);
//cudaMalloc(&device_s, (height+4) * (width+4) * channels * sizeof(unsigned char));
size_t pitch;
cudaMallocPitch(&device_s, &pitch, (width+4) * sizeof(unsigned char)* channels, (height+4));
cudaMallocPitch(&device_t, &pitch,(width+4) * sizeof(unsigned char)* channels, (height+4));
unsigned char* host_t = (unsigned char*) malloc(height * width * channels * sizeof(unsigned char));
//cudaMemcpy(device_s, host_s, (height+4) * (width+4) * channels * sizeof(unsigned char), cudaMemcpyHostToDevice);
cudaMemcpy2D(device_s+2*pitch+2*channels, pitch, host_s, width * sizeof(unsigned char)* channels ,width * channels * sizeof(unsigned char), height, cudaMemcpyHostToDevice);
sobel<<<(height/256) + 1, 256>>>(device_s, device_t, height, width, channels,pitch);
//cudaMemcpy(host_t, device_t, height * width * channels * sizeof(unsigned char), cudaMemcpyDeviceToHost);
cudaMemcpy2D( host_t , width * sizeof(unsigned char)* channels, device_t+2*pitch+2*channels, pitch , width * channels * sizeof(unsigned char), height, cudaMemcpyDeviceToHost);
write_png(argv[2], host_t, height, width, channels);
cudaFree(device_s);
cudaFree(device_t);
cudaFreeHost(host_s);
free(host_t);
return 0;
}
|
8,531 | #include <stdio.h>
#define SIZE 64
#define BLOCKS 4
__global__ void device_global(unsigned int *array_a, int num_elements) {
int my_index = blockIdx.x * blockDim.x + threadIdx.x;
array_a[my_index] = my_index % (num_elements/2); // write overlaping indicies
__syncthreads();
int next_index = array_a[my_index]; // use written index
array_a[next_index] = my_index; // cause a write write race
}
int main(void) {
// malloc arrays
unsigned int *host_array = (unsigned int*) malloc(SIZE*sizeof(unsigned int));
unsigned int *device_array_a = 0;
cudaMalloc((void **) &device_array_a, SIZE*sizeof(unsigned int));
// check mallocs
if (host_array == 0) { return 1;}
if (device_array_a == 0) { return 2;}
// init host array to 0
for (int i=0; i<SIZE; i++) {
host_array[i] = 0;
}
// copy to device, call global, and copy output back
cudaMemcpy(device_array_a, host_array, SIZE, cudaMemcpyHostToDevice);
device_global<<<BLOCKS,(SIZE/BLOCKS)>>> (device_array_a, SIZE);
cudaMemcpy(host_array, device_array_a, SIZE, cudaMemcpyDeviceToHost);
// print output
for (int i=0; i<SIZE; i += SIZE/BLOCKS) {
for (int j=0; j<SIZE/BLOCKS; j++){
printf("%d, ", host_array[i+j]);
}
printf("\n");
}
// cleanup
free(host_array);
cudaFree(device_array_a);
} |
8,532 | #include <cuda.h>
#include <stdio.h>
#include <math.h>
#include<sys/time.h>
#include <cooperative_groups.h>
#define N 512
namespace cg = cooperative_groups;
__global__ void decompose(float *A, float *pivots, int iteration)
{
int blockID = blockIdx.x;
int threadId = threadIdx.x;
float p = 0;
if(blockID >= iteration){
p = A[blockIdx.x * N + iteration - 1]/A[(iteration - 1)*N + iteration - 1];
A[blockID*N + threadId] -= p * A[(iteration-1)*N + threadId];
A[blockID*N + iteration-1] = p;
}
}
void printA(float *A){
for(int i=0;i<N;i++){
for(int j=0;j<N;j++)
printf(" %8.2f ", A[i*N + j]);
printf("\n");
}
}
int main(int argc, char *argv[]){
float *A;
float *pivots;
float *dev_a, *dev_pivots;
int *devItr;
A=(float *)malloc(sizeof(float)*N*N);
cudaEvent_t start, stop;
float time;
float totalTime=0;
cudaMalloc ( (void**)&dev_a, N*N* sizeof (float) );
cudaMalloc ( (void**)&dev_pivots, N*sizeof (float) );
cudaMalloc ( (void**)&devItr, sizeof (int) );
pivots=(float *)malloc(sizeof(float)*N);
for(int i=0;i<N*N;i++)
A[i] = (float)(rand()%100);;
cudaMemcpy(dev_a, A, N*N*sizeof(float), cudaMemcpyHostToDevice);
/*for(int i=0;i<N;i++){
for(int j=0;j<N;j++)
printf(" %6.2f ", A[i*N + j]);
printf("\n");
}
printf("\n\n");*/
for(int i=1;i<N;i++)
pivots[i] = A[(i)*N]/A[0];
cudaMemcpy(dev_pivots, pivots, N*sizeof(float), cudaMemcpyHostToDevice);
cudaEventCreate(&start);
cudaEventCreate(&stop);
for(int i=1;i<N;i++) {
cudaEventRecord(start, 0);
decompose<<<N,N>>>(dev_a,dev_pivots,i);
cudaEventRecord(stop, 0);
cudaThreadSynchronize();
//printf("\n");
cudaMemcpy(A, dev_a, N*N*sizeof(float), cudaMemcpyDeviceToHost);
cudaEventElapsedTime(&time, start, stop);
totalTime += time;
}
printf("\n \n GPU kernel execution time = %f ms\n",totalTime);
}
|
8,533 | #include "includes.h"
__global__ void init_sssp_data(bool * d_mask, int* d_dists, int* d_update_dists, const int source, const int num_vtx) {
int tid = blockIdx.x * blockDim.x + threadIdx.x;
if (tid < num_vtx) {
if (source == tid) {
d_mask[tid] = true;
d_dists[tid] = 0;
d_update_dists[tid] = 0;
}
else {
d_mask[tid] = false;
d_dists[tid] = INT_MAX;
d_update_dists[tid] = INT_MAX;
}
}
} |
8,534 | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sstream>
#include <string>
#include <iostream>
#define X 16 //will fail with 23, as sqrt(512) 22.sth and there can only be 512 threads per block
#define Y 16
#define GETCOORDS(row, col) (row) * (Y) + (col)
void MatrixMultHost(float* M, float* N, float* P, int width){
for(int i=0; i < width; i++){
for(int j=0; j < width; j++){
float sum = 0;
for(int k = 0; k < width; k++){
sum += M[ GETCOORDS(i,k) ] * N[ GETCOORDS(k,j) ];
}
P[ GETCOORDS(i,j) ] = sum;
}
}
}
std::string sprint(float *M){
std::ostringstream oss;
for( int i = 0; i < X; i++) {
for( int j = 0; j < Y; j++) {
oss << M[ GETCOORDS(i,j) ] << " " ;
}
oss << std::endl;
}
return oss.str();
}
__global__ void MatrixMulKernel(float* Md, float* Nd, float* Pd, int width){
int tx = threadIdx.x;
int ty = threadIdx.y;
float sum = 0.0f;
for(int i=0; i < width; i++){
float elemM = Md[ GETCOORDS(tx,i) ];
float elemN = Nd[ GETCOORDS(i,ty) ];
sum += elemM * elemN;
}
Pd[tx*width + ty] = sum;
}
void MatrixMultDevice(float* M, float* N, float* P, int width){
int size = width*width*sizeof(float);
float *Md, *Nd, *Pd;
//0. reserve memory on device
cudaMalloc( (void**)&Md, size );
cudaMalloc( (void**)&Nd, size );
cudaMalloc( (void**)&Pd, size );
//1. transfer M and N to device memory
cudaMemcpy(Md, M, size, cudaMemcpyHostToDevice);
cudaMemcpy(Nd, N, size, cudaMemcpyHostToDevice);
//2. kernel invokation
dim3 dimBlock(width, width);
dim3 dimGrid(1,1);
MatrixMulKernel<<<dimGrid, dimBlock>>>(Md, Nd, Pd, width);
//3. copy P from device to host
cudaMemcpy(P, Pd, size, cudaMemcpyDeviceToHost);
//4. Free Md, Nd, Pd
cudaFree(Md);
cudaFree(Nd);
cudaFree(Pd);
}
int main(){
float *M, *N, *P;
// allocate M, N, P
M = (float*)malloc( sizeof(float)*X*Y );
N = (float*)malloc( sizeof(float)*X*Y );
P = (float*)malloc( sizeof(float)*X*Y );
for( int i = 0; i < X; i++) {
for( int j = 0; j < Y; j++) {
M[ GETCOORDS(i,j) ] = i+j;
}
}
for( int i = 0; i < X; i++) {
for( int j = 0; j < Y; j++) {
N[ GETCOORDS(i,j) ] = i*j;
}
}
// M*N on host
MatrixMultHost(M,N,P, Y);
const std::string Phost(sprint(P));
//std::cout << Phost << std::endl;
memset(P, 0, sizeof(float)*X*Y );
// M*N on device
MatrixMultDevice(M,N,P, Y);
const std::string Pdev(sprint(P));
//std::cout << Pdev << std::endl;
if( Phost != Pdev ){
std::cout << "FAIL" << std::endl;
} else{
std::cout << "WIN" << std::endl;
}
// Free M, N, P
free(M);
free(N);
free(P);
return 0;
}
|
8,535 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "device_functions.h"
#include "168ModelMaker.cuh"
#include <cmath>
#include <time.h>
#include <string>
#include <vector>
using namespace std;
int residual_offset = 0;
int residuals_indexes[HIST_COUNT][5] = {};
extern uint3 blocks = { 2, 2, 1 };
extern uint3 threads = { 16, 16, 1 };
__global__ void add_hist(int **hist1, int start, int count)
{
int index = threadIdx.x;
int sum = 0;
int end = start + count;//printf("\nstart : %d end :%d\n", start, end);
if (index < SPAM_SYM_COUNT * 2)
{
for (size_t i = start; i < end; i++)
{
sum += hist1[i][index];
}
//printf("\n%d\n", sum);
hist1[start][index] = sum;
}
//__syncthreads();
}
void compute_submodels(PSRM_Features &host_features)
{
int **hists;
cudaError_t cudaStatus = cudaMalloc((void**)&hists, HIST_COUNT * sizeof(int*));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 2374: cudaMalloc failed!");
}
cudaStatus = cudaMemcpy(hists, host_features.hists, HIST_COUNT * sizeof(int*), cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 2378: cudaMemcpy failed!");
}
for (size_t i = 0; i <= host_features.submodel_index; i++)
{
add_hist << < 1, SPAM_SYM_COUNT * 2 >> >(hists, host_features.sub_model_index[i], host_features.sub_model_count[i]);
}
}
void make_models_1st(float **dev_residuals, int** residuals, float ** host_residuals, int *dev_MINMAXsymmCoord, int *dev_SPAMsymmCoord, cudaStream_t streams[], PSRM_Features &host_features, int src_width, int src_height)
{
//return;
residual_offset = 0;
memset( residuals_indexes, 0, HIST_COUNT * 5 * sizeof(int));
//int tile_width = src_width / blocks.x / threads.x, tile_height = src_height / blocks.y / threads.y;
int tile_width = 8, tile_height = 8;
const int q = 1;
host_features.last_index = -1;
host_features.submodel_index = -1;
/*float **dev_residuals;
int* residuals[HIST_COUNT];
for (int i = 0; i < HIST_COUNT; i++)
{
cudaStatus = cudaMalloc((void**)&residuals[i], 5 * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc for failed!");
}
}
cudaStatus = cudaMalloc((void**)&dev_residuals, 30 * sizeof(float*));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 57: cudaMalloc failed!");
}
cudaStatus = cudaMemcpy(dev_residuals, host_residuals, 30 * sizeof(float*), cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 61: cudaMemcpy failed!");
}*/
/*//L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
[RLq_min, UDq_min, RLq_max, UDq_max] = deal(min(R, L), min(U, D), max(R, L), max(U, D));
g.min22h = reshape(ProjHistMinMax(RLq_min, 'hor', q) + ProjHistMinMax(UDq_min, 'ver', q), [], 1);
g.max22h = reshape(ProjHistMinMax(RLq_max, 'hor', q) + ProjHistMinMax(UDq_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 0;
strcpy(host_features.name[host_features.last_index], "s1_minmax22h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::R; residuals_indexes[residual_offset][1] = RESIDUALS_1st::L;
//strcpy(host_features.name[host_features.last_index], "s1_minmax22v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(2, false, 2);//();
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 0;
strcpy(host_features.name[host_features.last_index], "s1_minmax22v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
//return;
host_features.index[++host_features.last_index] = 1;host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 1;
strcpy(host_features.name[host_features.last_index], "s1_min34h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U; residuals_indexes[residual_offset][2] = RESIDUALS_1st::R;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 1;
strcpy(host_features.name[host_features.last_index], "s1_min34h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::R; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D; residuals_indexes[residual_offset][2] = RESIDUALS_1st::L;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 1;
strcpy(host_features.name[host_features.last_index], "s1_min34h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R; residuals_indexes[residual_offset][2] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 1;
strcpy(host_features.name[host_features.last_index], "s1_min34h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::D; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U; residuals_indexes[residual_offset][2] = RESIDUALS_1st::L;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*//L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
g.spam14h = reshape(ProjHistSpam(R, 'hor', q) + ProjHistSpam(U, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.spam14v = reshape(ProjHistSpam(R, 'ver', q) + ProjHistSpam(U, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
host_features.index[++host_features.last_index] = 1; host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 2;
strcpy(host_features.name[host_features.last_index], "s1_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_1st::R], false, false, 2); // , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 2;
strcpy(host_features.name[host_features.last_index], "s1_spam14h");
COOC_HIST_SPAM( host_residuals[RESIDUALS_1st::U], true , false, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 1;
host_features.submodel[host_features.last_index] = 2;
strcpy(host_features.name[host_features.last_index], "s1_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_1st::R], true, true, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 2;
strcpy(host_features.name[host_features.last_index], "s1_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_1st::U], false, true, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*//L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
g.min22v = reshape(ProjHistMinMax(RLq_min, 'ver', q) + ProjHistMinMax(UDq_min, 'hor', q), [], 1);
g.max22v = reshape(ProjHistMinMax(RLq_max, 'ver', q) + ProjHistMinMax(UDq_max, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
host_features.index[++host_features.last_index] = 1;host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 3;
strcpy(host_features.name[host_features.last_index], "s1_min22v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 3;
strcpy(host_features.name[host_features.last_index], "s1_min22v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*//L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
[RUq_min, RDq_min, LUq_min, LDq_min] = deal(min(R, U), min(R, D), min(L, U), min(L, D));
[RUq_max, RDq_max, LUq_max, LDq_max] = deal(max(R, U), max(R, D), max(L, U), max(L, D));
g.min24 = reshape(ProjHistMinMax(RUq_min, 'hor', q) + ProjHistMinMax(RDq_min, 'hor', q) + ProjHistMinMax(LUq_min, 'hor', q) + ProjHistMinMax(LDq_min, 'hor', q) + ...
ProjHistMinMax(RUq_min, 'ver', q) + ProjHistMinMax(RDq_min, 'ver', q) + ProjHistMinMax(LUq_min, 'ver', q) + ProjHistMinMax(LDq_min, 'ver', q), [], 1);
g.max24 = reshape(ProjHistMinMax(RUq_max, 'hor', q) + ProjHistMinMax(RDq_max, 'hor', q) + ProjHistMinMax(LUq_max, 'hor', q) + ProjHistMinMax(LDq_max, 'hor', q) + ...
ProjHistMinMax(RUq_max, 'ver', q) + ProjHistMinMax(RDq_max, 'ver', q) + ProjHistMinMax(LUq_max, 'ver', q) + ProjHistMinMax(LDq_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 4;
strcpy(host_features.name[host_features.last_index], "s1_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 4;
strcpy(host_features.name[host_features.last_index], "s1_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 4;
strcpy(host_features.name[host_features.last_index], "s1_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::R; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 4;
strcpy(host_features.name[host_features.last_index], "s1_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::R; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 4;
strcpy(host_features.name[host_features.last_index], "s1_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 4;
strcpy(host_features.name[host_features.last_index], "s1_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 4;
strcpy(host_features.name[host_features.last_index], "s1_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::D; residuals_indexes[residual_offset][1] = RESIDUALS_1st::L;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 4;
strcpy(host_features.name[host_features.last_index], "s1_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*//L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
g.min34v = reshape(ProjHistMinMax(Uq_min, 'ver', q) + ProjHistMinMax(Dq_min, 'ver', q) + ProjHistMinMax(Rq_min, 'hor', q) + ProjHistMinMax(Lq_min, 'hor', q), [], 1);
g.max34v = reshape(ProjHistMinMax(Uq_max, 'ver', q) + ProjHistMinMax(Dq_max, 'ver', q) + ProjHistMinMax(Rq_max, 'hor', q) + ProjHistMinMax(Lq_max, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 5;
strcpy(host_features.name[host_features.last_index], "s1_min34v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U; residuals_indexes[residual_offset][2] = RESIDUALS_1st::R;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 5;
strcpy(host_features.name[host_features.last_index], "s1_min34v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R; residuals_indexes[residual_offset][2] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 5;
strcpy(host_features.name[host_features.last_index], "s1_min34v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R; residuals_indexes[residual_offset][2] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 5;
strcpy(host_features.name[host_features.last_index], "s1_min34v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::D; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U; residuals_indexes[residual_offset][2] = RESIDUALS_1st::L;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
[R_min, R_max] = deal(min(RLq_min, UDq_min), max(RLq_max, UDq_max));
g.min41 = reshape(ProjHistMinMax(R_min, 'hor', q) + ProjHistMinMax(R_min, 'ver', q), [], 1);
g.max41 = reshape(ProjHistMinMax(R_max, 'hor', q) + ProjHistMinMax(R_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
//return;
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 6;
strcpy(host_features.name[host_features.last_index], "s1_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U; residuals_indexes[residual_offset][2] = RESIDUALS_1st::R; residuals_indexes[residual_offset][3] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 6;
strcpy(host_features.name[host_features.last_index], "s1_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U; residuals_indexes[residual_offset][2] = RESIDUALS_1st::R; residuals_indexes[residual_offset][3] = RESIDUALS_1st::D;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
//return;
/*//L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
[RUq_min, RDq_min, LUq_min, LDq_min] = deal(min(RUq_min, RU), min(RDq_min, RD), min(LUq_min, LU), min(LDq_min, LD));
[RUq_max, RDq_max, LUq_max, LDq_max] = deal(max(RUq_max, RU), max(RDq_max, RD), max(LUq_max, LU), max(LDq_max, LD));
g.min34 = reshape(ProjHistMinMax(RUq_min, 'hor', q) + ProjHistMinMax(RDq_min, 'hor', q) + ProjHistMinMax(LUq_min, 'hor', q) + ProjHistMinMax(LDq_min, 'hor', q) + ...
ProjHistMinMax(RUq_min, 'ver', q) + ProjHistMinMax(RDq_min, 'ver', q) + ProjHistMinMax(LUq_min, 'ver', q) + ProjHistMinMax(LDq_min, 'ver', q), [], 1);
g.max34 = reshape(ProjHistMinMax(RUq_max, 'hor', q) + ProjHistMinMax(RDq_max, 'hor', q) + ProjHistMinMax(LUq_max, 'hor', q) + ProjHistMinMax(LDq_max, 'hor', q) + ...
ProjHistMinMax(RUq_max, 'ver', q) + ProjHistMinMax(RDq_max, 'ver', q) + ProjHistMinMax(LUq_max, 'ver', q) + ProjHistMinMax(LDq_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 7;
strcpy(host_features.name[host_features.last_index], "s1_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R; residuals_indexes[residual_offset][2] = RESIDUALS_1st::RU;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 7;
strcpy(host_features.name[host_features.last_index], "s1_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::R; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D; residuals_indexes[residual_offset][2] = RESIDUALS_1st::RD;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 7;
strcpy(host_features.name[host_features.last_index], "s1_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U; residuals_indexes[residual_offset][2] = RESIDUALS_1st::LU;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 7;
strcpy(host_features.name[host_features.last_index], "s1_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D; residuals_indexes[residual_offset][2] = RESIDUALS_1st::LD;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 7;
strcpy(host_features.name[host_features.last_index], "s1_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R; residuals_indexes[residual_offset][2] = RESIDUALS_1st::RU;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 7;
strcpy(host_features.name[host_features.last_index], "s1_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::R; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D; residuals_indexes[residual_offset][2] = RESIDUALS_1st::RD;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 7;
strcpy(host_features.name[host_features.last_index], "s1_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U; residuals_indexes[residual_offset][2] = RESIDUALS_1st::LU;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 7;
strcpy(host_features.name[host_features.last_index], "s1_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D; residuals_indexes[residual_offset][2] = RESIDUALS_1st::LD;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
//return;
/*//L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
[RUq_min2, RDq_min2, LDq_min2, LUq_min2] = deal(min(RUq_min, LU), min(RDq_min, RU), min(LDq_min, RD), min(LUq_min, LD));
[RUq_min3, RDq_min3, LDq_min3, LUq_min3] = deal(min(RUq_min, RD), min(RDq_min, LD), min(LDq_min, LU), min(LUq_min, RU));
g.min48h = reshape(ProjHistMinMax(RUq_min2, 'hor', q) + ProjHistMinMax(LDq_min2, 'hor', q) + ProjHistMinMax(RDq_min3, 'hor', q) + ProjHistMinMax(LUq_min3, 'hor', q) + ...
ProjHistMinMax(RDq_min2, 'ver', q) + ProjHistMinMax(LUq_min2, 'ver', q) + ProjHistMinMax(RUq_min3, 'ver', q) + ProjHistMinMax(LDq_min3, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.min48v = reshape(ProjHistMinMax(RDq_min2, 'hor', q) + ProjHistMinMax(LUq_min2, 'hor', q) + ProjHistMinMax(RUq_min3, 'hor', q) + ProjHistMinMax(LDq_min3, 'hor', q) + ...
ProjHistMinMax(RUq_min2, 'ver', q) + ProjHistMinMax(LDq_min2, 'ver', q) + ProjHistMinMax(RDq_min3, 'ver', q) + ProjHistMinMax(LUq_min3, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex - 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LU;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RD;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::R; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LD;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RU;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RU;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LD;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RD;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LU;
COOC_HIST_MIN_MAX(4, true, 2);
//return;
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*//L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
[RUq_max2, RDq_max2, LDq_max2, LUq_max2] = deal(max(RUq_max, LU), max(RDq_max, RU), max(LDq_max, RD), max(LUq_max, LD));
[RUq_max3, RDq_max3, LDq_max3, LUq_max3] = deal(max(RUq_max, RD), max(RDq_max, LD), max(LDq_max, LU), max(LUq_max, RU));
g.max48h = reshape(ProjHistMinMax(RUq_max2, 'hor', q) + ProjHistMinMax(LDq_max2, 'hor', q) + ProjHistMinMax(RDq_max3, 'hor', q) + ProjHistMinMax(LUq_max3, 'hor', q) + ...
ProjHistMinMax(RDq_max2, 'ver', q) + ProjHistMinMax(LUq_max2, 'ver', q) + ProjHistMinMax(RUq_max3, 'ver', q) + ProjHistMinMax(LDq_max3, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.max48v = reshape(ProjHistMinMax(RDq_max2, 'hor', q) + ProjHistMinMax(LUq_max2, 'hor', q) + ProjHistMinMax(RUq_max3, 'hor', q) + ProjHistMinMax(LDq_max3, 'hor', q) + ...
ProjHistMinMax(RUq_max2, 'ver', q) + ProjHistMinMax(LDq_max2, 'ver', q) + ProjHistMinMax(RDq_max3, 'ver', q) + ProjHistMinMax(LUq_max3, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
host_features.index[++host_features.last_index] = 1; host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::D; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RU;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LD;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::R; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RD;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LU;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LU;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RD;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::D; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LD;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 8;
strcpy(host_features.name[host_features.last_index], "s1_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RU;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/* L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
%[RUq_max4,RDq_max4,LDq_max4,LUq_max4] = deal(max(R-U-RU-LU,RD),max(R-D-RD-RU,LD),max(L-D-LD-RD,LU),max(L-U-LU-LD,RU));
%[RUq_max5,RDq_max5,LDq_max5,LUq_max5] = deal(max(R-U-RU-RD,LU),max(R-D-RD-LD,RU),max(L-D-LD-LU,RD),max(L-U-LU-RU,LD));
g.min54 = reshape(ProjHistMinMax(RUq_min4, 'hor', q) + ProjHistMinMax(LDq_min4, 'hor', q) + ProjHistMinMax(RDq_min5, 'hor', q) + ProjHistMinMax(LUq_min5, 'hor', q) + ...
ProjHistMinMax(RDq_min4, 'ver', q) + ProjHistMinMax(LUq_min4, 'ver', q) + ProjHistMinMax(RUq_min5, 'ver', q) + ProjHistMinMax(LDq_min5, 'ver', q), [], 1);
[RUq_max4, RDq_max4, LDq_max4, LUq_max4] = deal(max(RUq_max2, RD), max(RDq_max2, LD), max(LDq_max2, LU), max(LUq_max2, RU));
[RUq_max5, RDq_max5, LDq_max5, LUq_max5] = deal(max(RUq_max3, LU), max(RDq_max3, RU), max(LDq_max3, RD), max(LUq_max3, LD));
g.max54 = reshape(ProjHistMinMax(RUq_max4, 'hor', q) + ProjHistMinMax(LDq_max4, 'hor', q) + ProjHistMinMax(RDq_max5, 'hor', q) + ProjHistMinMax(LUq_max5, 'hor', q) + ...
ProjHistMinMax(RDq_max4, 'ver', q) + ProjHistMinMax(LUq_max4, 'ver', q) + ProjHistMinMax(RUq_max5, 'ver', q) + ProjHistMinMax(LDq_max5, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
//return;
host_features.index[++host_features.last_index] = 1; host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 9;
strcpy(host_features.name[host_features.last_index], "s1_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LU; residuals_indexes[residual_offset][4] = RESIDUALS_1st::RD;
COOC_HIST_MIN_MAX(5, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 9;
strcpy(host_features.name[host_features.last_index], "s1_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RD; residuals_indexes[residual_offset][4] = RESIDUALS_1st::LU;
COOC_HIST_MIN_MAX(5, false, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 9;
strcpy(host_features.name[host_features.last_index], "s1_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::R; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RU; residuals_indexes[residual_offset][4] = RESIDUALS_1st::LD;
COOC_HIST_MIN_MAX(5, false, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 9;
strcpy(host_features.name[host_features.last_index], "s1_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LD; residuals_indexes[residual_offset][4] = RESIDUALS_1st::RU;
COOC_HIST_MIN_MAX(5, false, 2);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 9;
strcpy(host_features.name[host_features.last_index], "s1_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::D; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RU; residuals_indexes[residual_offset][4] = RESIDUALS_1st::LD;
COOC_HIST_MIN_MAX(5, true, 2);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 9;
strcpy(host_features.name[host_features.last_index], "s1_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::U;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LD; residuals_indexes[residual_offset][4] = RESIDUALS_1st::RU;
COOC_HIST_MIN_MAX(5, true, 2);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 9;
strcpy(host_features.name[host_features.last_index], "s1_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::U; residuals_indexes[residual_offset][1] = RESIDUALS_1st::R;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::RU; residuals_indexes[residual_offset][3] = RESIDUALS_1st::LU; residuals_indexes[residual_offset][4] = RESIDUALS_1st::RD;
COOC_HIST_MIN_MAX(5, true, 2);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 9;
strcpy(host_features.name[host_features.last_index], "s1_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_1st::L; residuals_indexes[residual_offset][1] = RESIDUALS_1st::D;
residuals_indexes[residual_offset][2] = RESIDUALS_1st::LD; residuals_indexes[residual_offset][3] = RESIDUALS_1st::RD; residuals_indexes[residual_offset][4] = RESIDUALS_1st::LU;
COOC_HIST_MIN_MAX(5, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
//float t1 = (float)clock();
//for (int i = 0; i < HIST_COUNT; i++)
//{
// cudaStatus = cudaFree(residuals[i]);
//}
//cudaStatus = cudaFree(dev_residuals);
//float t2 = (clock() - t1) / CLOCKS_PER_SEC;
//fprintf(stderr, "\nCPU Elapsed Time is %f Seconds\n", t2);
return;
}
void make_models_2st(float **dev_residuals, int** residuals, float ** host_residuals, int *dev_MINMAXsymmCoord, int *dev_SPAMsymmCoord, cudaStream_t streams[], PSRM_Features &host_features, int src_width, int src_height)
{
//return;
int tile_width = 8, tile_height = 8;
const int q = 2;
/*H = 8 V = 9 D = 10 M = 11
g.spam12h = reshape(ProjHistSpam(Dh, 'hor', q) + ProjHistSpam(Dv, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.spam12v = reshape(ProjHistSpam(Dh, 'ver', q) + ProjHistSpam(Dv, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1; host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 10;
strcpy(host_features.name[host_features.last_index], "s2_spam12h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_2st::dH], false, false, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 10;
strcpy(host_features.name[host_features.last_index], "s2_spam12h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_2st::dV], true, false, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 1;
host_features.submodel[host_features.last_index] = 10;
strcpy(host_features.name[host_features.last_index], "s2_spam12v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_2st::dH], true, true, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 10;
strcpy(host_features.name[host_features.last_index], "s2_spam12v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_2st::dV], false, true, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*H = 8 V = 9 D = 10 M = 11
[Dmin, Dmax] = deal(min(Dh, Dv), max(Dh, Dv));
g.min21 = reshape(ProjHistMinMax(Dmin, 'hor', q) + ProjHistMinMax(Dmin, 'ver', q), [], 1);
g.max21 = reshape(ProjHistMinMax(Dmax, 'hor', q) + ProjHistMinMax(Dmax, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 11;
strcpy(host_features.name[host_features.last_index], "s2_min21"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dH; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 11;
strcpy(host_features.name[host_features.last_index], "s2_min21"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dH; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*H = 8 V = 9 D = 10 M = 11
[Dmin2, Dmax2] = deal(min(min(Dh, Dv), min(Dd, Dm)), max(max(Dh, Dv), max(Dd, Dm)));
g.min41 = reshape(ProjHistMinMax(Dmin2, 'hor', q) + ProjHistMinMax(Dmin2, 'ver', q), [], 1);
g.max41 = reshape(ProjHistMinMax(Dmax2, 'hor', q) + ProjHistMinMax(Dmax2, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 12;
strcpy(host_features.name[host_features.last_index], "s2_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dH; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
residuals_indexes[residual_offset][2] = RESIDUALS_2st::dD; residuals_indexes[residual_offset][3] = RESIDUALS_2st::dM;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 12;
strcpy(host_features.name[host_features.last_index], "s2_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dH; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
residuals_indexes[residual_offset][2] = RESIDUALS_2st::dD; residuals_indexes[residual_offset][3] = RESIDUALS_2st::dM;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*H = 8 V = 9 D = 10 M = 11
[RUq_min, RDq_min] = deal(min(min(Dh, Dv), Dm), min(min(Dh, Dv), Dd));
[RUq_max, RDq_max] = deal(max(max(max(Dh, Dv), Dm), max(max(max(Dh, Dv), Dd));
g.min32 = reshape(ProjHistMinMax(RUq_min, 'hor', q) + ProjHistMinMax(RDq_min, 'hor', q) + ProjHistMinMax(RUq_min, 'ver', q) + ProjHistMinMax(RDq_min, 'ver', q), [], 1);
g.max32 = reshape(ProjHistMinMax(RUq_max, 'hor', q) + ProjHistMinMax(RDq_max, 'hor', q) + ProjHistMinMax(RUq_max, 'ver', q) + ProjHistMinMax(RDq_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 13;
strcpy(host_features.name[host_features.last_index], "s2_min32"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dH; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
residuals_indexes[residual_offset][2] = RESIDUALS_2st::dM;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 13;
strcpy(host_features.name[host_features.last_index], "s2_min32"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dH; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
residuals_indexes[residual_offset][2] = RESIDUALS_2st::dD;
COOC_HIST_MIN_MAX(3, false, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 13;
strcpy(host_features.name[host_features.last_index], "s2_min32"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dH; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
residuals_indexes[residual_offset][2] = RESIDUALS_2st::dM;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 13;
strcpy(host_features.name[host_features.last_index], "s2_min32"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dH; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
residuals_indexes[residual_offset][2] = RESIDUALS_2st::dD;
COOC_HIST_MIN_MAX(3, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*H = 8 V = 9 D = 10 M = 11
[RUq_min2, RDq_min2, RUq_min3, LUq_min3] = deal(min(Dm, Dh), min(Dd, Dh), min(Dm, Dv), min(Dd, Dv));
g.min24h = reshape(ProjHistMinMax(RUq_min2, 'hor', q) + ProjHistMinMax(RDq_min2, 'hor', q) + ProjHistMinMax(RUq_min3, 'ver', q) + ProjHistMinMax(LUq_min3, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.min24v = reshape(ProjHistMinMax(RUq_min2, 'ver', q) + ProjHistMinMax(RDq_min2, 'ver', q) + ProjHistMinMax(RUq_min3, 'hor', q) + ProjHistMinMax(LUq_min3, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex - 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 14;
strcpy(host_features.name[host_features.last_index], "s2_min24h"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dM; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dH;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 14;
strcpy(host_features.name[host_features.last_index], "s2_min24h"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dD; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dH;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 14;
strcpy(host_features.name[host_features.last_index], "s2_min24h"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dM; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 14;
strcpy(host_features.name[host_features.last_index], "s2_min24h"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dD; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
COOC_HIST_MIN_MAX(2, true, 2);
/*H = 8 V = 9 D = 10 M = 11
[RUq_max2, RDq_max2, RUq_max3, LUq_max3] = deal(max(Dm, Dh), max(Dd, Dh), max(Dm, Dv), max(Dd, Dv));
g.max24h = reshape(ProjHistMinMax(RUq_max2, 'hor', q) + ProjHistMinMax(RDq_max2, 'hor', q) + ProjHistMinMax(RUq_max3, 'ver', q) + ProjHistMinMax(LUq_max3, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.max24v = reshape(ProjHistMinMax(RUq_max2, 'ver', q) + ProjHistMinMax(RDq_max2, 'ver', q) + ProjHistMinMax(RUq_max3, 'hor', q) + ProjHistMinMax(LUq_max3, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 14;
strcpy(host_features.name[host_features.last_index], "s2_min24v"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dM; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dH;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 14;
strcpy(host_features.name[host_features.last_index], "s2_min24v"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dD; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dH;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 14;
strcpy(host_features.name[host_features.last_index], "s2_min24v"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dM; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 14;
strcpy(host_features.name[host_features.last_index], "s2_min24v"); residuals_indexes[residual_offset][0] = RESIDUALS_2st::dD; residuals_indexes[residual_offset][1] = RESIDUALS_2st::dV;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
//for (int i = 0; i < HIST_COUNT; i++)
//{
// cudaStatus = cudaFree(residuals[i]);
//}
//cudaStatus = cudaFree(dev_residuals);
return;
}
void make_models_3x3(float **dev_residuals, int** residuals, float ** host_residuals, int *dev_MINMAXsymmCoord, int *dev_SPAMsymmCoord, cudaStream_t streams[], PSRM_Features &host_features, int src_width, int src_height)
{
//return;
int tile_width = 8, tile_height = 8;
/*float **dev_residuals;
int* residuals[HIST_COUNT];
for (int i = 0; i < HIST_COUNT; i++)
{
cudaStatus = cudaMalloc((void**)&residuals[i], 5 * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc for failed!");
}
}
cudaStatus = cudaMalloc((void**)&dev_residuals, 30 * sizeof(float*));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 789: cudaMalloc failed!");
}
cudaStatus = cudaMemcpy(dev_residuals, host_residuals, 30 * sizeof(float*), cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 793: cudaMemcpy failed!");
}*/
const int q = 4;
/*Dl = 20 Du = 21 Dr = 22 Db = 23 D = 24
g.spam14v = reshape(ProjHistSpam(Du, 'ver', q) + ProjHistSpam(Db, 'ver', q) + ProjHistSpam(Dl, 'hor', q) + ProjHistSpam(Dr, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.spam14h = reshape(ProjHistSpam(Du, 'hor', q) + ProjHistSpam(Db, 'hor', q) + ProjHistSpam(Dl, 'ver', q) + ProjHistSpam(Dr, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
host_features.index[++host_features.last_index] = 1; host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 27;
strcpy(host_features.name[host_features.last_index], "s3x3_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::Du], true, true, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 27;
strcpy(host_features.name[host_features.last_index], "s3x3_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::Db], true, true, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 27;
strcpy(host_features.name[host_features.last_index], "s3x3_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::Dl], false, true, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 27;
strcpy(host_features.name[host_features.last_index], "s3x3_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::Dr], false, true, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 1;
host_features.submodel[host_features.last_index] = 27;
strcpy(host_features.name[host_features.last_index], "s3x3_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::Du], false, false, 2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 27;
strcpy(host_features.name[host_features.last_index], "s3x3_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::Db], false, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 27;
strcpy(host_features.name[host_features.last_index], "s3x3_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::Dl], true,false,2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 27;
strcpy(host_features.name[host_features.last_index], "s3x3_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::Dr], true,false ,2);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*Dl = 20 Du = 21 Dr = 22 Db = 23 D = 24
[Dmin1, Dmin2, Dmin3, Dmin4] = deal(min(Du, Dl), min(Db, Dr), min(Du, Dr), min(Db, Dl));
g.min24 = reshape(ProjHistMinMax(Dmin1, 'ver', q) + ProjHistMinMax(Dmin2, 'ver', q) + ProjHistMinMax(Dmin3, 'ver', q) + ProjHistMinMax(Dmin4, 'ver', q) + ...
ProjHistMinMax(Dmin1, 'hor', q) + ProjHistMinMax(Dmin2, 'hor', q) + ProjHistMinMax(Dmin3, 'hor', q) + ProjHistMinMax(Dmin4, 'hor', q), [], 1);
[Dmax1, Dmax2, Dmax3, Dmax4] = deal(max(Du, Dl), max(Db, Dr), max(Du, Dr), max(Db, Dl));
g.max24 = reshape(ProjHistMinMax(Dmax1, 'ver', q) + ProjHistMinMax(Dmax2, 'ver', q) + ProjHistMinMax(Dmax3, 'ver', q) + ProjHistMinMax(Dmax4, 'ver', q) + ...
ProjHistMinMax(Dmax1, 'hor', q) + ProjHistMinMax(Dmax2, 'hor', q) + ProjHistMinMax(Dmax3, 'hor', q) + ProjHistMinMax(Dmax4, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 28;
strcpy(host_features.name[host_features.last_index], "s3x3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Du; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dl;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 28;
strcpy(host_features.name[host_features.last_index], "s3x3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Db; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dr;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 28;
strcpy(host_features.name[host_features.last_index], "s3x3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Du; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dr;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 28;
strcpy(host_features.name[host_features.last_index], "s3x3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Db; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dl;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 28;
strcpy(host_features.name[host_features.last_index], "s3x3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Du; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dl;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 28;
strcpy(host_features.name[host_features.last_index], "s3x3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Db; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dr;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 28;
strcpy(host_features.name[host_features.last_index], "s3x3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Du; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dr;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 28;
strcpy(host_features.name[host_features.last_index], "s3x3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Db; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dl;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*Dl = 20 Du = 21 Dr = 22 Db = 23 D = 24
[UEq_min, REq_min] = deal(min(Du, Db), min(Dr, Dl));
[UEq_max, REq_max] = deal(max(Du, Db), max(Dr, Dl));
g.min22h = reshape(ProjHistMinMax(UEq_min, 'hor', q) + ProjHistMinMax(REq_min, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.max22h = reshape(ProjHistMinMax(UEq_max, 'hor', q) + ProjHistMinMax(REq_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.min22v = reshape(ProjHistMinMax(UEq_min, 'ver', q) + ProjHistMinMax(REq_min, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex - 1;
g.max22v = reshape(ProjHistMinMax(UEq_max, 'ver', q) + ProjHistMinMax(REq_max, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 29;
strcpy(host_features.name[host_features.last_index], "s3x3_min22v"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Du; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Db;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 29;
strcpy(host_features.name[host_features.last_index], "s3x3_min22v"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Dr; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dl;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 30;
strcpy(host_features.name[host_features.last_index], "s3x3_min22h"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Du; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Db;
COOC_HIST_MIN_MAX(2, false, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 30;
strcpy(host_features.name[host_features.last_index], "s3x3_min22h"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Dr; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Dl;
COOC_HIST_MIN_MAX(2, true, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*Dl = 20 Du = 21 Dr = 22 Db = 23 D = 24
[Dmin5, Dmax5] = deal(min(Dmin1, Dmin2), max(Dmax1, Dmax2));
g.min41 = reshape(ProjHistMinMax(Dmin5, 'ver', q) + ProjHistMinMax(Dmin5, 'hor', q), [], 1);
g.max41 = reshape(ProjHistMinMax(Dmax5, 'ver', q) + ProjHistMinMax(Dmax5, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 31;
strcpy(host_features.name[host_features.last_index], "s3x3_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Du; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Db;
residuals_indexes[residual_offset][2] = RESIDUALS_3x3::Dr; residuals_indexes[residual_offset][3] = RESIDUALS_3x3::Dl;
COOC_HIST_MIN_MAX(4, true, 2);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 31;
strcpy(host_features.name[host_features.last_index], "s3x3_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_3x3::Du; residuals_indexes[residual_offset][1] = RESIDUALS_3x3::Db;
residuals_indexes[residual_offset][2] = RESIDUALS_3x3::Dr; residuals_indexes[residual_offset][3] = RESIDUALS_3x3::Dl;
COOC_HIST_MIN_MAX(4, false, 2);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
return;
}
void make_models_3st(float **dev_residuals, int** residuals, float ** host_residuals, int *dev_MINMAXsymmCoord, int *dev_SPAMsymmCoord, cudaStream_t streams[], PSRM_Features &host_features, int src_width, int src_height)
{
//return;
int tile_width = 8, tile_height = 8;
/*host_features.last_index = -1;
host_features.submodel_index = -1;*/
/*float **dev_residuals;
int* residuals[HIST_COUNT];
for (int i = 0; i < HIST_COUNT; i++)
{
cudaStatus = cudaMalloc((void**)&residuals[i], 5 * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc for failed!");
}
}
cudaStatus = cudaMalloc((void**)&dev_residuals, 30 * sizeof(float*));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 789: cudaMalloc failed!");
}
cudaStatus = cudaMemcpy(dev_residuals, host_residuals, 30 * sizeof(float*), cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 793: cudaMemcpy failed!");
}*/
const int q = 3;
/*L = 12 U = 13 R = 14 D = 15 LU = 16 RU = 17 RD = 18 LD = 19
[RLq_min, UDq_min, RLq_max, UDq_max] = deal(min(R, L), min(U, D), max(R, L), max(U, D));
g.min22h = reshape(ProjHistMinMax(RLq_min, 'hor', q) + ProjHistMinMax(UDq_min, 'ver', q), [], 1);
g.max22h = reshape(ProjHistMinMax(RLq_max, 'hor', q) + ProjHistMinMax(UDq_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
/**/host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 16;
strcpy(host_features.name[host_features.last_index], "s3_min22h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::L_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 2;
//host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 16;
strcpy(host_features.name[host_features.last_index], "s3_min22h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
//return;
/*L = 12 U = 13 R = 14 D = 15 LU = 16 RU = 17 RD = 18 LD = 19
[Uq_min, Rq_min, Dq_min, Lq_min] = deal(min(RLq_min, U), min(UDq_min, R), min(RLq_min, D), min(UDq_min, L));
[Uq_max, Rq_max, Dq_max, Lq_max] = deal(max(RLq_max, U), max(UDq_max, R), max(RLq_max, D), max(UDq_max, L));
g.min34h = reshape(ProjHistMinMax(Uq_min, 'hor', q) + ProjHistMinMax(Dq_min, 'hor', q) + ProjHistMinMax(Lq_min, 'ver', q) + ProjHistMinMax(Rq_min, 'ver', q), [], 1);
g.max34h = reshape(ProjHistMinMax(Uq_max, 'hor', q) + ProjHistMinMax(Dq_max, 'hor', q) + ProjHistMinMax(Lq_max, 'ver', q) + ProjHistMinMax(Rq_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 17;
strcpy(host_features.name[host_features.last_index], "s3_min34h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::R_;
COOC_HIST_MIN_MAX(3, false, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 17;
strcpy(host_features.name[host_features.last_index], "s3_min34h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(3, true, 4);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 17;
strcpy(host_features.name[host_features.last_index], "s3_min34h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][2] = RESIDUALS_3st::L_;
COOC_HIST_MIN_MAX(3, false, 4);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 17;
strcpy(host_features.name[host_features.last_index], "s3_min34h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::L_;
COOC_HIST_MIN_MAX(3, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*//L = 0 U = 1 R = 2 D = 3 LU = 4 RU = 5 RD = 6 LD = 7
g.spam14h = reshape(ProjHistSpam(R, 'hor', q) + ProjHistSpam(U, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.spam14v = reshape(ProjHistSpam(R, 'ver', q) + ProjHistSpam(U, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
host_features.index[++host_features.last_index] = 1; host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 18;
strcpy(host_features.name[host_features.last_index], "s3_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3st::R_], false, false, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 18;
strcpy(host_features.name[host_features.last_index], "s3_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3st::U_], true, false, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 1;
host_features.submodel[host_features.last_index] = 18;
strcpy(host_features.name[host_features.last_index], "s3_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3st::R_], true, true, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 18;
strcpy(host_features.name[host_features.last_index], "s3_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3st::U_], false, true, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*L = 12 U = 13 R = 14 D = 15 LU = 16 RU = 17 RD = 18 LD = 19
g.min22v = reshape(ProjHistMinMax(RLq_min, 'ver', q) + ProjHistMinMax(UDq_min, 'hor', q), [], 1);
g.max22v = reshape(ProjHistMinMax(RLq_max, 'ver', q) + ProjHistMinMax(UDq_max, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 19;
strcpy(host_features.name[host_features.last_index], "s3_min22v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 19;
strcpy(host_features.name[host_features.last_index], "s3_min22v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*L = 12 U = 13 R = 14 D = 15 LU = 16 RU = 17 RD = 18 LD = 19
[RUq_min, RDq_min, LUq_min, LDq_min] = deal(min(R, U), min(R, D), min(L, U), min(L, D));
[RUq_max, RDq_max, LUq_max, LDq_max] = deal(max(R, U), max(R, D), max(L, U), max(L, D));
g.min24 = reshape(ProjHistMinMax(RUq_min, 'hor', q) + ProjHistMinMax(RDq_min, 'hor', q) + ProjHistMinMax(LUq_min, 'hor', q) + ProjHistMinMax(LDq_min, 'hor', q) + ...
ProjHistMinMax(RUq_min, 'ver', q) + ProjHistMinMax(RDq_min, 'ver', q) + ProjHistMinMax(LUq_min, 'ver', q) + ProjHistMinMax(LDq_min, 'ver', q), [], 1);
g.max24 = reshape(ProjHistMinMax(RUq_max, 'hor', q) + ProjHistMinMax(RDq_max, 'hor', q) + ProjHistMinMax(LUq_max, 'hor', q) + ProjHistMinMax(LDq_max, 'hor', q) + ...
ProjHistMinMax(RUq_max, 'ver', q) + ProjHistMinMax(RDq_max, 'ver', q) + ProjHistMinMax(LUq_max, 'ver', q) + ProjHistMinMax(LDq_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 20;
strcpy(host_features.name[host_features.last_index], "s3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 20;
strcpy(host_features.name[host_features.last_index], "s3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 20;
strcpy(host_features.name[host_features.last_index], "s3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 20;
strcpy(host_features.name[host_features.last_index], "s3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][1] = RESIDUALS_3st::L_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 20;
strcpy(host_features.name[host_features.last_index], "s3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 20;
strcpy(host_features.name[host_features.last_index], "s3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 20;
strcpy(host_features.name[host_features.last_index], "s3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 20;
strcpy(host_features.name[host_features.last_index], "s3_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*L = 12 U = 13 R = 14 D = 15 LU = 16 RU = 17 RD = 18 LD = 19
g.min34v = reshape(ProjHistMinMax(Uq_min, 'ver', q) + ProjHistMinMax(Dq_min, 'ver', q) + ProjHistMinMax(Rq_min, 'hor', q) + ProjHistMinMax(Lq_min, 'hor', q), [], 1);
g.max34v = reshape(ProjHistMinMax(Uq_max, 'ver', q) + ProjHistMinMax(Dq_max, 'ver', q) + ProjHistMinMax(Rq_max, 'hor', q) + ProjHistMinMax(Lq_max, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 21;
strcpy(host_features.name[host_features.last_index], "s3_min34v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::R_;
COOC_HIST_MIN_MAX(3, true, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 21;
strcpy(host_features.name[host_features.last_index], "s3_min34v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(3, true, 4);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 21;
strcpy(host_features.name[host_features.last_index], "s3_min34v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(3, false, 4);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 21;
strcpy(host_features.name[host_features.last_index], "s3_min34v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::L_;
COOC_HIST_MIN_MAX(3, false, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*L = 12 U = 13 R = 14 D = 15 LU = 16 RU = 17 RD = 18 LD = 19
[R_min, R_max] = deal(min(RUq_min, LDq_min), max(RUq_max, LDq_max));
g.min41 = reshape(ProjHistMinMax(R_min, 'hor', q) + ProjHistMinMax(R_min, 'ver', q), [], 1);
g.max41 = reshape(ProjHistMinMax(R_max, 'hor', q) + ProjHistMinMax(R_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 22;
strcpy(host_features.name[host_features.last_index], "s3_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 22;
strcpy(host_features.name[host_features.last_index], "s3_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::D_3st;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*L = 12 U = 13 R = 14 D = 15 LU = 16 RU = 17 RD = 18 LD = 19
[RUq_min2, RDq_min2, LUq_min2, LDq_min2] = deal(min(RUq_min, RU), min(RDq_min, RD), min(LUq_min, LU), min(LDq_min, LD));
[RUq_max2, RDq_max2, LUq_max2, LDq_max2] = deal(max(RUq_max, RU), max(RDq_max, RD), max(LUq_max, LU), max(LDq_max, LD));
g.min34 = reshape(ProjHistMinMax(RUq_min2, 'hor', q) + ProjHistMinMax(RDq_min2, 'hor', q) + ProjHistMinMax(LUq_min2, 'hor', q) + ProjHistMinMax(LDq_min2, 'hor', q) + ...
ProjHistMinMax(RUq_min2, 'ver', q) + ProjHistMinMax(RDq_min2, 'ver', q) + ProjHistMinMax(LUq_min2, 'ver', q) + ProjHistMinMax(LDq_min2, 'ver', q), [], 1);
g.max34 = reshape(ProjHistMinMax(RUq_max2, 'hor', q) + ProjHistMinMax(RDq_max2, 'hor', q) + ProjHistMinMax(LUq_max2, 'hor', q) + ProjHistMinMax(LDq_max2, 'hor', q) + ...
ProjHistMinMax(RUq_max2, 'ver', q) + ProjHistMinMax(RDq_max2, 'ver', q) + ProjHistMinMax(LUq_max2, 'ver', q) + ProjHistMinMax(LDq_max2, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 23;
strcpy(host_features.name[host_features.last_index], "s3_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::RU_;
COOC_HIST_MIN_MAX(3, false, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 23;
strcpy(host_features.name[host_features.last_index], "s3_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][2] = RESIDUALS_3st::RD_;
COOC_HIST_MIN_MAX(3, false, 4);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 23;
strcpy(host_features.name[host_features.last_index], "s3_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::LU_;
COOC_HIST_MIN_MAX(3, false, 4);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 23;
strcpy(host_features.name[host_features.last_index], "s3_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][2] = RESIDUALS_3st::LD_;
COOC_HIST_MIN_MAX(3, false, 4);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 23;
strcpy(host_features.name[host_features.last_index], "s3_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::RU_;
COOC_HIST_MIN_MAX(3, true, 4);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 23;
strcpy(host_features.name[host_features.last_index], "s3_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][2] = RESIDUALS_3st::RD_;
COOC_HIST_MIN_MAX(3, true, 4);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 23;
strcpy(host_features.name[host_features.last_index], "s3_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][2] = RESIDUALS_3st::LU_;
COOC_HIST_MIN_MAX(3, true, 4);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 23;
strcpy(host_features.name[host_features.last_index], "s3_min34"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][2] = RESIDUALS_3st::LD_;
COOC_HIST_MIN_MAX(3, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*L = 12 U = 13 R = 14 D = 15 LU = 16 RU = 17 RD = 18 LD = 19
[RUq_min3, RDq_min3, LDq_min3, LUq_min3] = deal(min(RUq_min2, LU), min(RDq_min2, RU), min(LDq_min2, RD), min(LUq_min2, LD));
[RUq_min4, RDq_min4, LDq_min4, LUq_min4] = deal(min(RUq_min2, RD), min(RDq_min2, LD), min(LDq_min2, LU), min(LUq_min2, RU));
g.min48h = reshape(ProjHistMinMax(RUq_min3, 'hor', q) + ProjHistMinMax(LDq_min3, 'hor', q) + ProjHistMinMax(RDq_min4, 'hor', q) + ProjHistMinMax(LUq_min4, 'hor', q) + ...
ProjHistMinMax(RDq_min3, 'ver', q) + ProjHistMinMax(LUq_min3, 'ver', q) + ProjHistMinMax(RUq_min4, 'ver', q) + ProjHistMinMax(LDq_min4, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.min48v = reshape(ProjHistMinMax(RUq_min3, 'ver', q) + ProjHistMinMax(LDq_min3, 'ver', q) + ProjHistMinMax(RDq_min4, 'ver', q) + ProjHistMinMax(LUq_min4, 'ver', q) + ...
ProjHistMinMax(RDq_min3, 'hor', q) + ProjHistMinMax(LUq_min3, 'hor', q) + ProjHistMinMax(RUq_min4, 'hor', q) + ProjHistMinMax(LDq_min4, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex - 1;
*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LU_;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RD_;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LD_;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RU_;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RU_;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LD_;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RD_;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48h"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LU_;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RU_;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LD_;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RD_;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LU_;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LU_;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RD_;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LD_;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 24;
strcpy(host_features.name[host_features.last_index], "s3_min48v"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RU_;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*L = 12 U = 13 R = 14 D = 15 LU = 16 RU = 17 RD = 18 LD = 19
[RUq_min5, RDq_min5, LDq_min5, LUq_min5] = deal(min(RUq_min3, RD), min(RDq_min3, LD), min(LDq_min3, LU), min(LUq_min3, RU));
[RUq_max5, RDq_max5, LDq_max5, LUq_max5] = deal(max(RUq_max3, RD), max(RDq_max3, LD), max(LDq_max3, LU), max(LUq_max3, RU));
g.min54 = reshape(ProjHistMinMax(RUq_min5, 'hor', q) + ProjHistMinMax(LDq_min5, 'hor', q) + ProjHistMinMax(RDq_min5, 'hor', q) + ProjHistMinMax(LUq_min5, 'hor', q) + ...
ProjHistMinMax(RDq_min5, 'ver', q) + ProjHistMinMax(LUq_min5, 'ver', q) + ProjHistMinMax(RUq_min5, 'ver', q) + ProjHistMinMax(LDq_min5, 'ver', q), [], 1);
g.max54 = reshape(ProjHistMinMax(RUq_max5, 'hor', q) + ProjHistMinMax(LDq_max5, 'hor', q) + ProjHistMinMax(RDq_max5, 'hor', q) + ProjHistMinMax(LUq_max5, 'hor', q) + ...
ProjHistMinMax(RDq_max5, 'ver', q) + ProjHistMinMax(LUq_max5, 'ver', q) + ProjHistMinMax(RUq_max5, 'ver', q) + ProjHistMinMax(LDq_max5, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 25;
strcpy(host_features.name[host_features.last_index], "s3_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LU_; residuals_indexes[residual_offset][4] = RESIDUALS_3st::RD_;
COOC_HIST_MIN_MAX(5, false, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 25;
strcpy(host_features.name[host_features.last_index], "s3_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RD_; residuals_indexes[residual_offset][4] = RESIDUALS_3st::LU_;
COOC_HIST_MIN_MAX(5, false, 4);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 25;
strcpy(host_features.name[host_features.last_index], "s3_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::R_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RU_; residuals_indexes[residual_offset][4] = RESIDUALS_3st::LD_;
COOC_HIST_MIN_MAX(5, false, 4);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 25;
strcpy(host_features.name[host_features.last_index], "s3_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LD_; residuals_indexes[residual_offset][4] = RESIDUALS_3st::RU_;
COOC_HIST_MIN_MAX(5, false, 4);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 25;
strcpy(host_features.name[host_features.last_index], "s3_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::D_3st; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RU_; residuals_indexes[residual_offset][4] = RESIDUALS_3st::LD_;
COOC_HIST_MIN_MAX(5, true, 4);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 25;
strcpy(host_features.name[host_features.last_index], "s3_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::U_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LD_; residuals_indexes[residual_offset][4] = RESIDUALS_3st::RU_;
COOC_HIST_MIN_MAX(5, true, 4);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 25;
strcpy(host_features.name[host_features.last_index], "s3_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::U_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::R_;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::RU_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::LU_; residuals_indexes[residual_offset][4] = RESIDUALS_3st::RD_;
COOC_HIST_MIN_MAX(5, true, 4);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 25;
strcpy(host_features.name[host_features.last_index], "s3_min54"); residuals_indexes[residual_offset][0] = RESIDUALS_3st::L_; residuals_indexes[residual_offset][1] = RESIDUALS_3st::D_3st;
residuals_indexes[residual_offset][2] = RESIDUALS_3st::LD_; residuals_indexes[residual_offset][3] = RESIDUALS_3st::RD_; residuals_indexes[residual_offset][4] = RESIDUALS_3st::LU_;
COOC_HIST_MIN_MAX(5, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*for (int i = 0; i < HIST_COUNT; i++)
{
cudaStatus = cudaFree(residuals[i]);
}
cudaStatus = cudaFree(dev_residuals);*/
return;
}
void make_models_5x5(float **dev_residuals, int** residuals, float ** host_residuals, int *dev_MINMAXsymmCoord, int *dev_SPAMsymmCoord, cudaStream_t streams[], PSRM_Features &host_features, int src_width, int src_height)
{
//return;
int tile_width = 8, tile_height = 8;
/*float **dev_residuals;
int* residuals[HIST_COUNT];
for (int i = 0; i < HIST_COUNT; i++)
{
cudaStatus = cudaMalloc((void**)&residuals[i], 5 * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc for failed!");
}
}
cudaStatus = cudaMalloc((void**)&dev_residuals, 30 * sizeof(float*));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 789: cudaMalloc failed!");
}
cudaStatus = cudaMemcpy(dev_residuals, host_residuals, 30 * sizeof(float*), cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "line 793: cudaMemcpy failed!");
}*/
int q = 12;
/*Dl = 20 Du = 21 Dr = 22 Db = 23 D = 24
g.spam14v = reshape(ProjHistSpam(Du, 'ver', q) + ProjHistSpam(Db, 'ver', q) + ProjHistSpam(Dl, 'hor', q) + ProjHistSpam(Dr, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.spam14h = reshape(ProjHistSpam(Du, 'hor', q) + ProjHistSpam(Db, 'hor', q) + ProjHistSpam(Dl, 'ver', q) + ProjHistSpam(Dr, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
*/
host_features.index[++host_features.last_index] = 1; host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 33;
strcpy(host_features.name[host_features.last_index], "s5x5_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::Du_], true, true, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 33;
strcpy(host_features.name[host_features.last_index], "s5x5_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::Db_], true, true, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 33;
strcpy(host_features.name[host_features.last_index], "s5x5_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::Dl_], false, true, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 33;
strcpy(host_features.name[host_features.last_index], "s5x5_spam14v");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::Dr_], false, true, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 1;
host_features.submodel[host_features.last_index] = 33;
strcpy(host_features.name[host_features.last_index], "s5x5_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::Du_], false, false, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 33;
strcpy(host_features.name[host_features.last_index], "s5x5_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::Db_], false, false, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 33;
strcpy(host_features.name[host_features.last_index], "s5x5_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::Dl_], true, false, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 33;
strcpy(host_features.name[host_features.last_index], "s5x5_spam14h");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::Dr_], true, false, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 34;
strcpy(host_features.name[host_features.last_index], "s5x5_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Du_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dl_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 34;
strcpy(host_features.name[host_features.last_index], "s5x5_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Db_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dr_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 3;
host_features.submodel[host_features.last_index] = 34;
strcpy(host_features.name[host_features.last_index], "s5x5_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Du_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dr_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 4;
host_features.submodel[host_features.last_index] = 34;
strcpy(host_features.name[host_features.last_index], "s5x5_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Db_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dl_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 5;
host_features.submodel[host_features.last_index] = 34;
strcpy(host_features.name[host_features.last_index], "s5x5_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Du_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dl_;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.index[++host_features.last_index] = 6;
host_features.submodel[host_features.last_index] = 34;
strcpy(host_features.name[host_features.last_index], "s5x5_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Db_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dr_;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.index[++host_features.last_index] = 7;
host_features.submodel[host_features.last_index] = 34;
strcpy(host_features.name[host_features.last_index], "s5x5_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Du_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dr_;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.index[++host_features.last_index] = 8;
host_features.submodel[host_features.last_index] = 34;
strcpy(host_features.name[host_features.last_index], "s5x5_min24"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Db_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dl_;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*Dl = 20 Du = 21 Dr = 22 Db = 23 D = 24
[UEq_min, REq_min] = deal(min(Du, Db), min(Dr, Dl));
g.min22h = reshape(ProjHistMinMax(UEq_min, 'hor', q) + ProjHistMinMax(REq_min, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.min22v = reshape(ProjHistMinMax(UEq_min, 'ver', q) + ProjHistMinMax(REq_min, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex - 1;
[UEq_max, REq_max] = deal(max(Du, Db), max(Dr, Dl));
g.max22h = reshape(ProjHistMinMax(UEq_max, 'hor', q) + ProjHistMinMax(REq_max, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;
g.max22v = reshape(ProjHistMinMax(UEq_max, 'ver', q) + ProjHistMinMax(REq_max, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 35;
strcpy(host_features.name[host_features.last_index], "s5x5_min22v"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Du_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Db_;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 35;
strcpy(host_features.name[host_features.last_index], "s5x5_min22v"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Dr_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dl_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 36;
strcpy(host_features.name[host_features.last_index], "s5x5_min22h"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Du_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Db_;
COOC_HIST_MIN_MAX(2, false, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 36;
strcpy(host_features.name[host_features.last_index], "s5x5_min22h"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Dr_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Dl_;
COOC_HIST_MIN_MAX(2, true, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*Dl = 20 Du = 21 Dr = 22 Db = 23 D = 24
[Dmin5, Dmax5] = deal(min(Dmin1, Dmin2), max(Dmax1, Dmax2));
g.min41 = reshape(ProjHistMinMax(Dmin5, 'ver', q) + ProjHistMinMax(Dmin5, 'hor', q), [], 1);
g.max41 = reshape(ProjHistMinMax(Dmax5, 'ver', q) + ProjHistMinMax(Dmax5, 'hor', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 37;
strcpy(host_features.name[host_features.last_index], "s5x5_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Du_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Db_;
residuals_indexes[residual_offset][2] = RESIDUALS_5x5::Dr_; residuals_indexes[residual_offset][3] = RESIDUALS_5x5::Dl_;
COOC_HIST_MIN_MAX(4, true, 4);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 37;
strcpy(host_features.name[host_features.last_index], "s5x5_min41"); residuals_indexes[residual_offset][0] = RESIDUALS_5x5::Du_; residuals_indexes[residual_offset][1] = RESIDUALS_5x5::Db_;
residuals_indexes[residual_offset][2] = RESIDUALS_5x5::Dr_; residuals_indexes[residual_offset][3] = RESIDUALS_5x5::Dl_;
COOC_HIST_MIN_MAX(4, false, 4);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
/*Dl = 25 Du = 26 Dr = 27 Db = 28 D = 29
D = Residual(X, 3, 'KV');
g.spam11 = reshape(ProjHistSpam(D, 'hor', q) + ProjHistSpam(D, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
host_features.index[++host_features.last_index] = 1;
host_features.sub_model_index[++host_features.submodel_index] = host_features.last_index;
host_features.submodel[host_features.last_index] = 32;
strcpy(host_features.name[host_features.last_index], "s5x5_spam11");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::D_5st], false, true, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 32;
strcpy(host_features.name[host_features.last_index], "s5x5_spam11");
COOC_HIST_SPAM(host_residuals[RESIDUALS_5x5::D_5st], true, true, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], q, src_width, src_height, tile_width, tile_height);
/*Dl = 20 Du = 21 Dr = 22 Db = 23 D = 24
D = Residual(X, 2, 'KB');
g.spam11 = reshape(ProjHistSpam(D, 'hor', q) + ProjHistSpam(D, 'ver', q), [], 1); settings.seedIndex = settings.seedIndex + 1;*/
q = 4;
host_features.index[++host_features.last_index] = 1;
host_features.submodel[host_features.last_index] = 26;
strcpy(host_features.name[host_features.last_index], "s3x3_spam11");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::D_4st], false, false, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], 4, src_width, src_height, tile_width, tile_height);
host_features.index[++host_features.last_index] = 2;
host_features.submodel[host_features.last_index] = 26;
strcpy(host_features.name[host_features.last_index], "s3x3_spam11");
COOC_HIST_SPAM(host_residuals[RESIDUALS_3x3::D_4st], true, false, 4);// , dev_kernels, dev_kernels_t, host_features.hists[host_features.last_index], 4, src_width, src_height, tile_width, tile_height);
host_features.sub_model_count[host_features.submodel_index] = host_features.last_index - host_features.sub_model_index[host_features.submodel_index] + 1;
return;
}
__global__ void cooc_hist_min_max(float** dev_residuals, int*residuals_index, int residual_count, int *dev_MINMAXsymmCoord, int *dev_SPAMsymmCoord, bool trans, int* out_hist, int q, int src_width, int src_height, int tile_width, int tile_height, int border)
{
__shared__ int hist0[SPAM_SYM_COUNT * 2];
const float multi[] = { 1, 5, 25, 125 };
register float ptr_min[12][12];
register float ptr_max[12][12];
register float ptr_r[12][12];
register float ptr_l[12][12];
float res1;
float min_max;
int i, j, w, z, m, n;
int tile_top_left, tile_top_left0, row, col;
int feaNumber = 0;
int dimToIncrease = 0;
int o = 0;
float*residuals[5];
for (i = 0; i < residual_count; i++)
{
residuals[i] = dev_residuals[residuals_index[i]];
//printf("\n%d\t %d, %d\t%d\n", i, threadIdx.x, threadIdx.y, residuals_index[i]);
}
__syncthreads();
if (!threadIdx.x && !threadIdx.y)
{
memset(hist0, 0, SPAM_SYM_COUNT * 2 * sizeof(int));
}
__syncthreads();
tile_top_left =
(blockIdx.y * tile_height * blockDim.y + threadIdx.y * tile_height) * (src_width)+
blockIdx.x * (blockDim.x * tile_width) +
threadIdx.x * tile_width;
tile_top_left0 = tile_top_left;
row = tile_top_left / src_width + tile_height - 1;
col = tile_top_left % src_width + tile_width - 1;
int endx = src_width - border - 1;
int endy = src_height - border - 1;
if ((col > (endx) - ORDER + 1) && !trans)
{
tile_width = (endx)-tile_top_left % src_width - ORDER + 2;
if (tile_width < 0)
return;
}
if ((row > (endy)) && !trans)
{
tile_height = (endy)-tile_top_left / src_width + 1;
}
if ((row > (endy)- ORDER + 1) && trans)
{
tile_height = (endy)-tile_top_left / src_width - ORDER + 2;
if (tile_height < 0)
return;
}
if ((col > (endx)) && trans)
{
tile_width = (endx)-tile_top_left % src_width + 1;
}
//max
{
min_max = -1000000.f;
for (i = 0; i < tile_height + KERNEL_RIGHT_BOTTOM_PADD; i++)//+3 for 4*4 kernel
{
for (j = 0; j < tile_width + KERNEL_RIGHT_BOTTOM_PADD; j++)//+3 for 4*4 kernel
{
min_max = -1000000.0f;
for (m = 0; m < residual_count; m++)
{
//res1 = residuals[m][tile_top_left0 + j];
ptr_r[i][j] = residuals[0][tile_top_left0 + j];
ptr_l[i][j] = residuals[1][tile_top_left0 + j];
res1 = (residuals[m][tile_top_left0 + j] / q);
if (res1 - floorf(res1) > 0.5) res1 = ceilf(res1);
else res1 = floorf(res1);
res1 = res1 < -T ? -T : (res1 > T ? T : res1);
if (res1 > min_max)
{
min_max = res1;
}
}
//res1 = roundf(min_max / q);
ptr_max[i][j] = min_max;
}
tile_top_left0 += src_width;
}
}
//min
{
min_max = 10000.0f;
tile_top_left0 = tile_top_left;
//printf("\t%d\n", tile_top_left0);
for (i = 0; i < tile_height + KERNEL_RIGHT_BOTTOM_PADD; i++)//+3 for 4*4 kernel
{
//printf("\n");
for (j = 0; j < tile_width + KERNEL_RIGHT_BOTTOM_PADD; j++)//+3 for 4*4 kernel
{
min_max = 10000.0f;
for (m = 0; m < residual_count; m++)
{
//res1 = residuals[m][tile_top_left0 + j];
res1 = (residuals[m][tile_top_left0 + j] / q);
if (res1 - floorf(res1) > 0.5) res1 =ceilf(res1);
else res1 = floorf(res1);
res1 = res1 < -T ? -T : (res1 > T ? T : res1);
//printf(" %f", res1);
if (res1 < min_max)
{
min_max = res1;
}
}
//res1 = roundf(min_max/ q) ;
//ptr_min[i][j] = res1 < -T ? -T : res1 > T ? T : res1;
ptr_min[i][j] = min_max;
}
tile_top_left0 += src_width;
}
}
/*if (blockIdx.x == 0 && blockIdx.y == 7 && threadIdx.x == 0 && threadIdx.y == 7)
{
printf("\ntile_height = %d\n", tile_height);
printf("\n\n");
for (i = 0; i < tile_height + 3; i++)
{
printf("\n");
for (j = 0; j < tile_width + 3; j++)
{
printf(" %f", ptr_l[i][j]);
}
}
printf("\n\n");
for (i = 0; i < tile_height + 3; i++)
{
printf("\n");
for (j = 0; j < tile_width + 3; j++)
{
printf(" %f", ptr_r[i][j]);
}
}
printf("\n\n");
printf("\n\n");
for (i = 0; i < tile_height + 3; i++)
{
printf("\n");
for (j = 0; j < tile_width + 3; j++)
{
printf(" %f", ptr_min[i][j]);
}
}
printf("\n\n");
for (i = 0; i < tile_height + 3; i++)
{
printf("\n");
for (j = 0; j < tile_width + 3; j++)
{
printf(" %f", ptr_max[i][j]);
}
}
printf("\n\n");
}*/
if (!trans)
{
for (i = 0; i < tile_height; i++)
{
for (j = 0; j < tile_width; j++)
{
feaNumber = 0;
for (o = 0; o < ORDER; o++)
feaNumber += (ptr_min[i][j + o] + T) * multi[o];
dimToIncrease = dev_MINMAXsymmCoord[feaNumber];
atomicAdd(&hist0[dimToIncrease], 1);
// MAX
feaNumber = 0;
for (o = 0; o < ORDER; o++)
feaNumber += (ptr_max[i][j + o] + T) * multi[o];
feaNumber += FULL_DIM;
dimToIncrease = dev_MINMAXsymmCoord[feaNumber];
atomicAdd(&hist0[dimToIncrease], 1);
}
}
}
else
{
for (i = 0; i < tile_height; i++)
{
for (j = 0; j < tile_width; j++)
{
feaNumber = 0;
for (o = 0; o < ORDER; o++)
feaNumber += (ptr_min[i + o][j] + T)* multi[o];
dimToIncrease = dev_MINMAXsymmCoord[feaNumber];
atomicAdd(&hist0[dimToIncrease], 1);
// MAX
feaNumber = 0;
for (o = 0; o < ORDER; o++)
feaNumber += (ptr_max[i + o][j] + T)* multi[o];
feaNumber += FULL_DIM;
dimToIncrease = dev_MINMAXsymmCoord[feaNumber];
atomicAdd(&hist0[dimToIncrease], 1);
}
}
}
__syncthreads();
if (!threadIdx.x && !threadIdx.y)
{
for (i = 0; i < SPAM_SYM_COUNT * 2; i++)
{
atomicAdd(&out_hist[i], hist0[i]);
}
}
return;
}
__global__ void cooc_hist_spam(float* first_residual, int *dev_MINMAXsymmCoord, int *dev_SPAMsymmCoord, bool trans, bool hist_position, int* out_hist, int q, int src_width, int src_height, int tile_width, int tile_height, int border)
{
//return;
__shared__ int hist0[SPAM_SYM_COUNT];
const float multi[] = { 1, 5, 25, 125 };
int feaNumber = 0;
int dimToIncrease = 0;
int o = 0;
register float ptr_spam[12][12];
register float ptr_l[12][12];
int i, j, w, z, m, n;
int tile_top_left, tile_top_left0, row, col;
int hist_pos = (hist_position == false) ? 0 : SPAM_SYM_COUNT;
float res1 = 0;
__syncthreads();
if (!threadIdx.x && !threadIdx.y)
{
memset(hist0, 0, SPAM_SYM_COUNT * sizeof(int));
}
__syncthreads();
tile_top_left =
(blockIdx.y * tile_height * blockDim.y + threadIdx.y * tile_height) * (src_width)+
blockIdx.x * (blockDim.x * tile_width) +
threadIdx.x * tile_width;
tile_top_left0 = tile_top_left;
row = tile_top_left / src_width + tile_height - 1;
col = tile_top_left % src_width + tile_width - 1;
if ((col >= (src_width - border) - ORDER) && !trans)
{
tile_width = (src_width - border) - tile_top_left % src_width + 1 - ORDER;
if (tile_width < 0)
return;
}
if ((row >= (src_height - border) ) && !trans)
{
tile_height = (src_height - border) - tile_top_left / src_width ;
}
if ((row >= (src_height - border) - ORDER) && trans)
{
tile_height = (src_height - border) - tile_top_left / src_width + 1 - ORDER;
if (tile_height < 0)
return;
}
if ((col >= (src_width - border)) && trans)
{
tile_width = (src_width - border) - tile_top_left % src_width ;
}
for (int i = 0; i < tile_height + KERNEL_RIGHT_BOTTOM_PADD; i++)//+3 for 4*4 kernel
{
for (int j = 0; j < tile_width + KERNEL_RIGHT_BOTTOM_PADD; j++)//+3 for 4*4 kernel
{
res1 = (first_residual[tile_top_left0 + j] / q);
ptr_l[i][j] = first_residual[tile_top_left0 + j];
if (res1 - floorf(res1) > 0.5) res1 = ceilf(res1);
else res1 = floorf(res1);
res1 = res1 < -T ? -T : (res1 > T ? T : res1);
ptr_spam[i][j] = res1 ;
}
tile_top_left0 += src_width;
}
/*if (!blockIdx.x && !blockIdx.y && !threadIdx.x && !threadIdx.y)
{
printf("\ntile_height = %d\n", tile_height);
printf("\n\n");
for (i = 0; i < tile_height + 3; i++)
{
printf("\n");
for (j = 0; j < tile_width + 3; j++)
{
printf(" %f", ptr_spam[i][j]);
}
}
printf("\n\n");
printf("\n\n");
for (i = 0; i < tile_height + 3; i++)
{
printf("\n");
for (j = 0; j < tile_width + 3; j++)
{
printf(" %f", ptr_l[i][j]);
}
}
printf("\n\n");
}*/
//return;
if (!trans)
{
for (i = 0; i < tile_height; i++)
{
for (j = 0; j < tile_width; j++)
{
feaNumber = 0;
for (o = 0; o < ORDER; o++)
feaNumber += (ptr_spam[i][j + o] + T)* multi[o];
dimToIncrease = dev_SPAMsymmCoord[feaNumber];
//hist0[dimToIncrease]++;
/*if (dimToIncrease > 168)
{
printf("############### %d , %d", blockIdx.x, blockIdx.y);
}*/
atomicAdd(&hist0[dimToIncrease], 1);
}
}
}
else
{
for (i = 0; i < tile_height; i++)
{
for (j = 0; j < tile_width; j++)
{
feaNumber = 0;
for (o = 0; o < ORDER; o++)
feaNumber += (ptr_spam[i + o][j] + T)* multi[o];
dimToIncrease = dev_SPAMsymmCoord[feaNumber];
//hist0[dimToIncrease]++;
atomicAdd(&hist0[dimToIncrease], 1);
}
}
}
__syncthreads();
if (!threadIdx.x && !threadIdx.y)
{
for (i = 0; i < SPAM_SYM_COUNT; i++)
{
atomicAdd(&out_hist[i + hist_pos], hist0[i]);
}
}
return;
} |
8,536 | #include <stdio.h>
#define N 100
#define T 20
__global__ void MatrixIncrement (int *a){
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
int index = y * N + x;
a[index] = a[index] + 1;
}
int main(int argc, char *argv[]){
int size = N * N * sizeof(int);
int a[N][N] , *devA;
srand(1234);
printf("Original A array\n");
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
a[i][j] = rand() % 1000;
printf("%d ",a[i][j]);
}
printf("\n");
}
cudaMalloc((void**)&devA, size);
cudaMemcpy(devA, a, size, cudaMemcpyHostToDevice);
dim3 dimBlock(T,T);
dim3 dimGrid(N/dimBlock.x,N/dimBlock.y);
MatrixIncrement<<<dimGrid,dimBlock>>>(devA);
cudaMemcpy(a, devA, size, cudaMemcpyDeviceToHost);
cudaFree(devA);
printf("\nNew A array \n");
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
printf("%d ",a[i][j]);
}
printf("\n");
}
} |
8,537 | #include "includes.h"
// Device input vectors
int *d_a;
//Device output vector
int *d_b;
__global__ void downSweep(int *A, int size, int iteration) {
const int index = blockIdx.x * blockDim.x + threadIdx.x;
if (index < size) {
int aux;
if (!((index + 1) % (1 << (iteration + 1)))) {
aux = A[index - (1<<iteration)];
A[index - (1<<iteration)] = A[index];
A[index] = aux + A[index];
}
}
} |
8,538 | #include <stdio.h>
#include <stdlib.h>
void initVector(double *u, int n, double c) {
int i;
for (i=0; i<n; i++)
u[i] = c;
}
__global__ void gpuVectAdd(double *u, double *v, double *z, int N)
{
// define index
int i = blockIdx.x * blockDim.x + threadIdx.x;
// check that the thread is not out of the vector boundary
if (i >= N ) return;
int index = i;
// write the operation for the sum of vectors
z[index] = u[index] + v[index];
}
int main(int argc, char *argv[]) {
// size of vectors
const int N = 1000;
// allocate memory on host
double * u = (double *) malloc(N * sizeof(double));
double * v = (double *) malloc(N * sizeof(double));
double * z = (double *) malloc(N * sizeof(double));
initVector((double *) u, N, 1.0);
initVector((double *) v, N, 2.0);
initVector((double *) z, N, 0.0);
// allocate memory on device
double *u_dev, *v_dev, *z_dev;
cudaMalloc((void **) &u_dev, N*sizeof(double));
cudaMalloc((void **) &v_dev, N*sizeof(double));
cudaMalloc((void **) &z_dev, N*sizeof(double));
// copy data from host to device
cudaMemcpy(u_dev, u, N*sizeof(double), cudaMemcpyHostToDevice);
cudaMemcpy(v_dev, v, N*sizeof(double), cudaMemcpyHostToDevice);
dim3 block(32);
dim3 grid((N-1)/block.x + 1);
// define the execution configuration
gpuVectAdd<<<grid, block>>>(u_dev, v_dev, z_dev, N);
// copy data from device to host
cudaMemcpy(z, z_dev, N*sizeof(double), cudaMemcpyDeviceToHost);
printf("%f %f %f\n", z[0], z[1], z[1]);
// free resources on device
cudaFree(u_dev);
cudaFree(v_dev);
cudaFree(z_dev);
// free resources on host
free(u);
free(v);
free(z);
return 0;
}
|
8,539 | #include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <time.h>
using namespace std;
__global__ void BankConfKernel(unsigned long long *time)
{
__shared__ float shared[1024];
unsigned long long startTime = clock();
// shared[0]++; // a race condition, but neverthelesss a broadcast
// shared[threadIdx.x*2]
shared[threadIdx.x*32]++;
unsigned long long finishTime = clock();
*time = (finishTime - startTime);
}
int main()
{
// do we need unsigned long long to represent the clock ticks?
unsigned long long time;
unsigned long long *timeDevice;
cudaMalloc(&timeDevice, sizeof(unsigned long long));
// there is an overhead for calling clock which should be subtracted from the time being displayed
// number of runs
for (int i = 0; i < 20; i++)
{
BankConfKernel<<<1, 32>>>(timeDevice);
cudaMemcpy(&time, timeDevice, sizeof(unsigned long long), cudaMemcpyDeviceToHost);
cout << "Time is " << (time) / 32 << endl;
}
cudaFree(timeDevice);
cudaDeviceReset(); // used if you want to use the profiler
return 0;
} |
8,540 | #include "includes.h"
__global__ void callOperation(int *a, int *result, int k, int n)
{
int tidx = blockDim.x * blockIdx.x + threadIdx.x;
int tidy = blockDim.y * blockIdx.y + threadIdx.y;
if (tidx >= n || tidy >= n)
{
return;
}
int tid = tidx * n + tidy;
if (a[tid] == k)
{
atomicAdd(result, 1);
}
} |
8,541 | #include <stdio.h>
__global__ void kernel( int *a )
{
int ix = blockIdx.x*blockDim.x + threadIdx.x;
int iy = blockIdx.y*blockDim.y + threadIdx.y;
int idx = iy * blockDim.x * gridDim.x + ix;
a[idx] = a[idx] + 1;
}
int main()
{
int *host_array;
int *dev_array;
host_array = (int *) malloc(sizeof(int)*16);
cudaMalloc(&dev_array, sizeof(int)*16);
cudaMemset(dev_array, 0, 16);
dim3 block(2,2);
dim3 threadPerBlock(2,2);
kernel<<<block, threadPerBlock>>>(dev_array);
cudaMemcpy(host_array, dev_array, sizeof(int)*16, cudaMemcpyDeviceToHost);
for(int i = 0; i < 16; i++) printf(" %d ", host_array[i]);
printf("\n");
free(host_array);
cudaFree(dev_array);
cudaDeviceReset();
return 0;
}
|
8,542 | #include "cuda.h"
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
__global__ void run_on_gpu() {
printf("GPU thread info X:%d Y:%d Z:%d\t block info X:%d Y:%d Z:%d\n",
threadIdx.x, threadIdx.y, threadIdx.z, blockIdx.x, blockIdx.y, blockIdx.z);
}
int main() {
dim3 threadsPerBlock(2, 3, 4);
int blocksPerGrid = 1;
run_on_gpu<<<blocksPerGrid, threadsPerBlock>>>();
cudaDeviceReset();
return 0;
}
|
8,543 | #define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <float.h>
#include <ctype.h>
#define MAXCHAR 1024
/* Returns if character is a valid numeric character i.e. can be found in a string representation of a number
* '?' is included since it may take the place of an unknown value
*/
bool isNumeric(char a) {
return (a == '.' || a == '-' || a == '?' || isdigit(a));
}
/* Returns if character is a seperator between two elements
*/
bool isSeperator(char a) {
return (a == ' ' || a == ',');
}
/* Returns if character is any character in valid representation of data
*/
bool isValid(char a) {
return (isSeperator(a) || isNumeric(a) || a == '\0' || a == '\n');
}
/* Removes all invalid character from given string and returns number of valid elements
*/
int cleanString(char* str) {
int j = 0;
int count = 0;
for(int i = 0; i < MAXCHAR; i++) {
if(str[i] == '\0') {
break;
}
// remove all sets of invalid characters with
if(!isValid(str[i])) {
int l;
for(l = i; l < MAXCHAR && str[l] != '\0' && str[l] != '\n'; l++) {
if(isSeperator(str[l])) {
break;
}
}
i = l-1;
// remove all invalid characters and valid characters surrounded by
// invalid characters from string in place.
} else if(isValid(str[i]) && (i == 0 || isValid(str[i-1])) && ((i == MAXCHAR || str[i] == '\0') || isValid(str[i+1]))) {
str[j] = str[i];
j++;
}
}
if (!isNumeric(str[j]) || str[j] == '-') {
str[j] = '\0';
}
j = 0;
// remove all non-numeric and non-seperator characters and condense seperators
for(int i = 0; i < MAXCHAR; i++) {
// if numeric character, move to end of cleaned string
if(isNumeric(str[i])) {
if(count == 0) count = 1;
str[j] = str[i];
j++;
// if seperator character, add comma to end of cleaned string
// and ignore all consecutive seperators
} else if(isSeperator(str[i])) {
if(count != 0) count++;
int l;
for(l = i; l < MAXCHAR && str[l] != '\0' && isSeperator(str[l]); l++);
i = l-1;
str[j] = ',';
j++;
} else if(str[i] == '?') {
str[i] = '0';
} else if(str[i] == '\0') {
break;
}
}
// ensure string is null terminated
str[j] = '\0';
//remove leading comma if exists
if(str[0] == ',') {
for(int i = 0; i < MAXCHAR-1; i++) {
str[i] = str[i+1];
}
count--;
}
return count;
}
/* Return the number of lines in the file
* Line count is determined by number of new-line characters,
* thus dataset files may need to end in empty line for proper function
*/
int getFileLineCount(char* path) {
FILE* fp = fopen(path, "r");
if (fp == NULL){
fprintf(stderr, "\n:::: Could not open file %s\n", path);
exit(1);
}
char ch = 0;
int lines = 0;
if (fp == NULL) {
return 0;
}
while(!feof(fp)) {
ch = fgetc(fp);
if(ch == '\n') {
lines++;
}
}
fclose(fp);
return lines;
}
/* Load matrix data from file into flattened array
* Dataset files may need to end in empty line for proper function
*/
void readMatrix(char* path, float** matrix, int* m, int* n) {
int line_read_error_count = 0;
int current_line = 0;
*n = 0;
*m = 0;
int elements = 0;
FILE* fp;
char str[MAXCHAR];
*m = getFileLineCount(path);
*matrix = NULL;
fp = fopen(path, "r");
if (fp == NULL){
fprintf(stderr, "\n:::: Could not open file %s\n", path);
exit(1);
}
while (fgets(str, MAXCHAR, fp) != NULL) {
int values_count = cleanString(str);
// if string is empty or too short to contain anything meaningful
// ignore it and decrement line count by 1
if(strlen(str) < 2) {
(*m)--;
} else {
// ensure all lines have equal number of values
if(values_count != *n && *n != 0) {
fprintf(stderr, "\n:::: Not a valid matrix: unequal row lengths. Line will be skipped.\n");
fprintf(stderr, "\n:::: ''%s''\n", str);
line_read_error_count++;
if(line_read_error_count > 5) {
fprintf(stderr, "\n:::: Excess of line read errors: something must be wrong with the file.\n");
exit(1);
}
} else {
if(*n == 0) {
*n = values_count;
}
}
// ensure matrix has been allocated
if(*matrix == NULL) {
(*matrix) = (float*)malloc(*n * *m * sizeof(float));
}
// create array of float values from string
char* str_ptr = str;
char* num = strtok(str_ptr, ",");
for(int i = (*n * current_line); i < (*n * (current_line+1)) && num; i++) {
((*matrix)[i]) = strtof(num, NULL);
num = strtok(NULL, ",");
elements++;
}
// line number of current line
current_line++;
}
}
if (fp) {
fclose(fp);
}
} |
8,544 | #include <stdio.h>
#include <stdlib.h>
#define BLOCK_SIZE 2
#define GRID_SIZE 2
#define N GRID_SIZE * BLOCK_SIZE
__global__ void MatrixMul(float *A, float *B, float *C, int n)
{
// Each thread computes a single element of C
int row = blockIdx.y*blockDim.y + threadIdx.y;
int col = blockIdx.x*blockDim.x + threadIdx.x;
float sum = 0;
for (int i = 0; i < n; ++i) {
sum += (A[row*n + i] * B[i*n + col]);
}
C[row*n + col] = sum;
printf("\n Block[%d][%d] : Thread[%d][%d] : Product = %.2f\n", blockIdx.x, blockIdx.y, threadIdx.x, threadIdx.y, sum);
}
int main()
{
// Perform matrix multiplication C = A*B
// where A, B and C are NxN matrices
// Restricted to matrices where N = GRID_SIZE*BLOCGRID_SIZE_SIZE;
float *hA, *hB, *hC;
float *dA, *dB, *dC;
int size = N * N * sizeof(float);
printf("Executing Matrix Multiplcation\n");
printf("Matrix size: %d x %d\n", N,N);
// Allocate memory on the host
hA = (float *) malloc(size);
hB = (float *) malloc(size);
hC = (float *) malloc(size);
// Initialize matrices on the host
for (int j = 0; j<N; j++){
for (int i = 0; i<N; i++){
hA[j*N + i] = 2;
hB[j*N + i] = 1;
}
}
printf("Matrix 1:\n");
for (int j = 0; j<N; j++){
for (int i = 0; i<N; i++){
printf("%.2f ", hA[j*N + i]);
}
printf("\n");
}
printf("\nMatrix 2:\n");
for (int j = 0; j<N; j++){
for (int i = 0; i<N; i++){
printf("%.2f ", hB[j*N + i]);
}
printf("\n");
}
// Allocate memory on the device
cudaMalloc(&dA, size);
cudaMalloc(&dB, size);
cudaMalloc(&dC, size);
dim3 threadBlock(BLOCK_SIZE, BLOCK_SIZE);
dim3 grid(GRID_SIZE, GRID_SIZE);
// Copy matrices from the host to device
cudaMemcpy(dA, hA, size, cudaMemcpyHostToDevice);
cudaMemcpy(dB, hB, size, cudaMemcpyHostToDevice);
//Execute the matrix multiplication kernel
printf("\n Launching Gird of size ( %dx%d ) with Blocks of size (%d x %d)\n", GRID_SIZE, GRID_SIZE, BLOCK_SIZE, BLOCK_SIZE);
MatrixMul <<<grid, threadBlock >>>(dA, dB, dC, N);
// Now copy the GPU result back to CPU
cudaMemcpy(hC, dC, size, cudaMemcpyDeviceToHost);
printf("\n The Product of A and B is:\n");
for (int j = 0; j<N; j++){
for (int i = 0; i<N; i++){
printf("%.2f ", hC[j*N + i]);
}
printf("\n");
}
return 0;
}
/*
output:
student@B4L0106:~$ nvcc kernel.cu
student@B4L0106:~$ ./a.out
Executing Matrix Multiplcation
Matrix size: 4 x 4<
Matrix 1:
2.00 2.00 2.00 2.00
2.00 2.00 2.00 2.00
2.00 2.00 2.00 2.00
2.00 2.00 2.00 2.00
Matrix 2:
1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00
1.00 1.00 1.00 1.00
Launching Gird of size ( 2x2 ) with Blocks of size (2 x 2)
Block[0][0] : Thread[0][0] : Product = 8.00
Block[0][0] : Thread[1][0] : Product = 8.00
Block[0][0] : Thread[0][1] : Product = 8.00
Block[0][0] : Thread[1][1] : Product = 8.00
Block[0][1] : Thread[0][0] : Product = 8.00
Block[0][1] : Thread[1][0] : Product = 8.00
Block[0][1] : Thread[0][1] : Product = 8.00
Block[0][1] : Thread[1][1] : Product = 8.00
Block[1][1] : Thread[0][0] : Product = 8.00
Block[1][1] : Thread[1][0] : Product = 8.00
Block[1][1] : Thread[0][1] : Product = 8.00
Block[1][1] : Thread[1][1] : Product = 8.00
Block[1][0] : Thread[0][0] : Product = 8.00
Block[1][0] : Thread[1][0] : Product = 8.00
Block[1][0] : Thread[0][1] : Product = 8.00
Block[1][0] : Thread[1][1] : Product = 8.00
The Product of A and B is:
8.00 8.00 8.00 8.00
8.00 8.00 8.00 8.00
8.00 8.00 8.00 8.00
8.00 8.00 8.00 8.00 */
|
8,545 | #include "includes.h"
/// Copyright (C) 2016 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
/// License: GPLv3
#define restrict __restrict__
typedef unsigned int uint;
typedef unsigned int hashKey;
typedef ushort4 particleinfo;
__global__ void initParticles( particleinfo * restrict infoArray, hashKey * restrict hashArray, uint * restrict idxArray, uint numParticles)
{
uint idx = threadIdx.x + blockIdx.x*blockDim.x;
if (idx > numParticles)
return;
idxArray[idx] = idx;
particleinfo info;
info.x = idx % 4;
info.y = 0;
info.z = (ushort)(idx & 0xffff);
info.w = (ushort)(idx >> 16);
infoArray[idx] = info;
hashArray[idx] = idx/17 + (idx % (idx & 17));
} |
8,546 | #include "slicer.cuh"
#include <thrust/sort.h>
#include <thrust/functional.h>
__device__ __forceinline__ void triangleCopy(void* src, void* dest, int id);
__device__ __forceinline__ double min3(double a, double b, double c);
__device__ __forceinline__ double max3(double a, double b, double c);
__global__
void pps(triangle* triangles_global, size_t num_triangles, bool* out) {
size_t idx = (size_t)blockDim.x * (size_t)blockIdx.x + (size_t)threadIdx.x;
int x_idx = idx & (X_DIM-1);
int y_idx = idx / X_DIM;
int x = x_idx - (X_DIM >> 1);
int y = y_idx - (Y_DIM >> 1);
// Copy triangles to shared memory
// Each block has a shared memory storing some triangles.
__shared__ triangle tri_base[THREADS_PER_BLOCK];
layer_t layers_local[MAX_TRUNK_SIZE];
__shared__ bool yNotInside[THREADS_PER_BLOCK];
triangle* triangles = (triangle*) tri_base;
size_t num_iters = num_triangles / THREADS_PER_BLOCK;
int length = 0;
double y_pos = y * RESOLUTION;
layer_t* layers = &layers_local[0];
for (size_t i = 0; i < num_iters; i++) {
triangle t = triangles_global[i*THREADS_PER_BLOCK + threadIdx.x];
triangles[threadIdx.x] = t;
double yMin = min3(t.p1.y, t.p2.y, t.p3.y);
double yMax = max3(t.p1.y, t.p2.y, t.p3.y);
yNotInside[threadIdx.x] = (y_pos < yMin) || (y_pos > yMax);
__syncthreads();
if (y_idx < Y_DIM) {
for (size_t tri_idx = 0; tri_idx < THREADS_PER_BLOCK; tri_idx++) {
layer_t curr_intersection = yNotInside[tri_idx] ? NONE : pixelRayIntersection(tri_base[tri_idx], x, y);
if (curr_intersection >= 0 && curr_intersection < NUM_LAYERS) {
layers[length] = curr_intersection;
length++;
}
}
}
__syncthreads();
}
__syncthreads();
size_t remaining = num_triangles - (num_iters * THREADS_PER_BLOCK);
// Copy the remaining triangles to shared memory
if (threadIdx.x < remaining) {
triangles[threadIdx.x] = triangles_global[threadIdx.x + (num_iters * THREADS_PER_BLOCK)];
triangle t = triangles[threadIdx.x];
double yMin = min3(t.p1.y, t.p2.y, t.p3.y);
double yMax = max3(t.p1.y, t.p2.y, t.p3.y);
yNotInside[threadIdx.x] = (y_pos < yMin) || (y_pos > yMax);
}
__syncthreads();
if (remaining) {
if (y_idx < Y_DIM) {
for (size_t tri_idx = 0; tri_idx < remaining; tri_idx++) {
layer_t curr_intersection = yNotInside[tri_idx] ? NONE : pixelRayIntersection(tri_base[tri_idx], x, y);
if (curr_intersection >= 0 && curr_intersection < NUM_LAYERS) {
layers[length] = curr_intersection;
length++;
}
}
}
}
if (y_idx >= Y_DIM) return;
thrust::sort(thrust::device, &layers[0], &layers[length]);
layers[length] = NUM_LAYERS;
bool flag = false;
int layerIdx = 0;
for (layer_t z = 0; z < NUM_LAYERS; z++) {
// If intersect
while (layers[layerIdx] < z) layerIdx++;
bool intersect = (z == layers[layerIdx]);
flag = (bool) (layerIdx & 1);
out[z*Y_DIM*X_DIM + y_idx*X_DIM + x_idx] = intersect || flag;
}
}
/**
* pixelRayIntersection: helper function, computes the intersection of given triangle and pixel ray
* Inputs:
* t -- input triangle
* x, y -- coordinates of the input pixel ray
* Returns:
* The layer on which they intersect, or -1 if no intersection
*/
__device__ __forceinline__
layer_t pixelRayIntersection(triangle t, int x, int y) {
/*
Let A, B, C be the 3 vertices of the given triangle
Let S(x,y,z) be the intersection, where x,y are given
We want to find some a, b such that AS = a*AB + b*AC
If a >= 0, b >= 0, and a+b <= 1, S is a valid intersection.
*/
double x_pos = x * RESOLUTION;
double y_pos = y * RESOLUTION;
double x_max = max(t.p1.x, max(t.p2.x, t.p3.x));
double x_min = min(t.p1.x, min(t.p2.x, t.p3.x));
// double y_max = max(t.p1.y, max(t.p2.y, t.p3.y));
// double y_min = min(t.p1.y, min(t.p2.y, t.p3.y));
// if ((x_pos < x_min) || (x_pos > x_max) || (y_pos < y_min) || (y_pos > y_max)) return NONE;
if ((x_pos < x_min) || (x_pos > x_max)) return NONE;
double x_d = x_pos - t.p1.x;
double y_d = y_pos - t.p1.y;
double x1 = t.p2.x - t.p1.x;
double y1 = t.p2.y - t.p1.y;
double z1 = t.p2.z - t.p1.z;
double x2 = t.p3.x - t.p1.x;
double y2 = t.p3.y - t.p1.y;
double z2 = t.p3.z - t.p1.z;
double a = (x_d * y2 - x2 * y_d) / (x1 * y2 - x2 * y1);
double b = (x_d * y1 - x1 * y_d) / (x2 * y1 - x1 * y2);
bool inside = (a >= 0) && (b >= 0) && (a+b <= 1);
double intersection = (a * z1 + b * z2) + t.p1.z;
// // divide by layer width
layer_t layer = inside ? (intersection / RESOLUTION) : NONE;
return layer;
}
// Copy (THREADS_PER_BLOCK) triangles from src to dest
// Achieves 100% memory efficiency
__device__ __forceinline__
void triangleCopy(void* src, void* dest, int id) {
copy_unit_t* src_ptr = (copy_unit_t*) src;
copy_unit_t* dest_ptr = (copy_unit_t*) dest;
#pragma unroll
for (int d = 0; d < unit_per_tri; d++) {
size_t offset = d * THREADS_PER_BLOCK;
dest_ptr[id + offset] = src_ptr[id + offset];
}
}
__device__ __forceinline__
double min3(double a, double b, double c) {
thrust::minimum<double> min;
return min(a, min(b, c));
}
__device__ __forceinline__
double max3(double a, double b, double c) {
thrust::maximum<double> max;
return max(a, max(b, c));
}
|
8,547 | #include <cassert>
#include <cstdio>
#include <string>
#include <sys/time.h>
#define check(f) assert(f == cudaSuccess)
constexpr int N = 1024 * 1024 * 1024;
constexpr int STRIDE = 1024;
class Timer {
public:
Timer(std::string tag) : tag_(std::move(tag)) {
timeval tv;
gettimeofday(&tv, nullptr);
begin_ms_ = tv.tv_sec * 1E3 + tv.tv_usec / 1E3;
}
~Timer() {
timeval tv;
gettimeofday(&tv, nullptr);
printf("[%s] %3.2f ms\n",
tag_.c_str(),
(tv.tv_sec * 1E3 + tv.tv_usec / 1E3) - begin_ms_);
}
private:
std::string tag_;
double begin_ms_;
};
__global__ void vec_add(float* a, float* b, float *c) {
const int base = (blockIdx.x * blockDim.x + threadIdx.x) * STRIDE;
for (int i = base; i < base + STRIDE; ++i) {
c[i] = a[i] + b[i];
}
}
__global__ void init(float* a, float* b, float* c) {
const int base = (blockIdx.x * blockDim.x + threadIdx.x) * STRIDE;
for (int i = base; i < base + STRIDE; ++i) {
a[i] = i;
b[i] = 1.0f;
c[i] = 0.0f;
}
}
int main() {
int devId;
cudaDeviceProp props;
check(cudaGetDeviceCount(&devId));
check(cudaGetDeviceProperties(&props, devId - 1));
printf("Device %d: \"%s\" with Compute %d.%d capability\n",
devId, props.name, props.major, props.minor);
const int num_threads_in_block = props.maxThreadsPerBlock;
printf("Num of threads in a block: %d\n", num_threads_in_block);
float* A, *B, *C, *D;
// Allocate |A|, |B|, and |C|.
check(cudaMallocManaged(reinterpret_cast<void **>(&A), sizeof(float) * N));
check(cudaMallocManaged(reinterpret_cast<void **>(&B), sizeof(float) * N));
check(cudaMallocManaged(reinterpret_cast<void **>(&C), sizeof(float) * N));
check(cudaMallocManaged(reinterpret_cast<void **>(&D), sizeof(float) * N));
// Determine grid size and block size. They are single dimension.
dim3 dimGrid(N / num_threads_in_block / STRIDE);
dim3 dimBlock(num_threads_in_block);
// Initialize vectors.
{
Timer t("init");
init<<<dimGrid, dimBlock>>>(A, B, C);
check(cudaDeviceSynchronize());
}
// Calculate vectors.
{
Timer t("vec_add (GPU)");
vec_add<<<dimGrid, dimBlock>>>(A, B, C);
check(cudaDeviceSynchronize());
}
{
Timer t("vec_add (CPU)");
for (int i = 0; i < N; ++i)
D[i] = A[i] + B[i];
}
// Verify the answers.
int wrong_num = 0;
int wrong_pos = -1;
for (int i = 0; i < N; ++i) {
if (C[i] != D[i]) {
wrong_num++;
if (wrong_pos < 0)
wrong_pos = i;
}
}
if (wrong_num) {
printf("wrong_num: %d, wrong_pos: %d\n", wrong_num, wrong_pos);
printf("[%d] %3.1f + %3.1f = (%3.1f, %3.1f)\n", wrong_pos, A[wrong_pos], B[wrong_pos], C[wrong_pos], D[wrong_pos]);
} else {
printf("Good!\n");
}
check(cudaFree(A));
check(cudaFree(B));
check(cudaFree(C));
return 0;
} |
8,548 | #include <stdio.h>
#include <math.h>
#ifndef gpuAssert
#define gpuAssert( condition ) { if( (condition) != cudaSuccess ) { fprintf( stderr, "\n FAILURE %s in %s, line %d\n", cudaGetErrorString(condition), __FILE__, __LINE__ ); exit( 1 ); } }
#endif
#define PREC 8
// I've used a snippet of someone elses code, and one condition of use is
// to retain this licensing message
// I obtained the code from:
// https://github.com/parallel-forall/code-samples/blob/master/posts/cuda-aware-mpi-example/src/Device.cu
/* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************/
/* borrowed just one function for AtomicMax on floats from github */
/**
* @brief Compute the maximum of 2 single-precision floating point values using an atomic operation
*
* @param[in] address The address of the reference value which might get updated with the maximum
* @param[in] value The value that is compared to the reference in order to determine the maximum
*/
static __device__ void AtomicMax(float * const address, float value)
{
if (*address >= value)
{
return;
}
int * const address_as_i = (int *)address;
int old = *address_as_i, assumed;
do
{
assumed = old;
if (__int_as_float(assumed) >= value)
{
break;
}
old = atomicCAS(address_as_i, assumed, __float_as_int(value));
} while (assumed != old);
}
/******************************************************************/
// don't actually need this, as you can & with offsets instead
//#define B01_MASK 0b0000000000000001
//#define B02_MASK 0b0000000000000011
//#define B03_MASK 0b0000000000000111
//#define B04_MASK 0b0000000000001111
//#define B05_MASK 0b0000000000011111
//#define B06_MASK 0b0000000000111111
//#define B07_MASK 0b0000000001111111
//#define B08_MASK 0b0000000011111111
//#define B09_MASK 0b0000000111111111
//#define B10_MASK 0b0000001111111111
// * bitwise div of power 2 num (i\n): i >> log2(n)
// * bitwise modulo of power of 2 num(i % n) : i & (n - 1)
// much of the efficiency of this implementation hinges of being able to apply
// very fast bitwise manipulations which will only be reliable in cases where
// the fundamental dimensionality of the data is strictly by powers of 2
// happily this is the case in this application, and for fft in general
// more specifically, exploiting the luxury of powers of 2 enables the construction
// of blocks that should be (theoretically) entirely divergence free, which also means
// that the __syncthreads statements, though necessary to ensure correctness, are in practice
// often a "formality", as all warps should be finishing at the same time, provided all
// memory accesses to shared and constant memory can be performed in the same number of
// clock cycles, this is also one of the reasons behind using constant and shared memory.
// though this implementation fixes on 2048 point fft, it could easily be generalised
// to any 2^s point fft needed. There is a happy coincidence, where my particular GPU
// is limited to 1024 threads per block, and a 2048 point iterative fft unrolls its
// two inner loops to 1024 every time. This is optimal, but only by coincidence. Were
// this happy coincidence not to be relied upon, then further optimisations which take
// intra-block synchronisation, and possibly where warp boundaries will cross, might need
// to be included.
// precision: it must also be mentioned that a loss of precision is being spent on performance
// Nvidia GPUs with Compute Cabaility 5.0 can only assure atomic arithmetic for single precision
// floats, and the registers available to the threads are also 32 bit registers. For this reason,
// the decision was made to reduce the precision from double to single
#define TWIDDLES_LEN 2047
#define LGSAMP 11
#define WSAMP 2048
#define HWSAMP (WSAMP / 2)
#define IDX_SHIFT (32 - LGSAMP)
//typedef float3 Complex; // padding to avoid bank conflicts - might not be needed in CUDA 9.0
typedef float2 Complex;
static __device__ inline Complex ComplexCast(float a, float b);
static __device__ inline Complex ComplexAdd(Complex a, Complex b);
static __device__ inline Complex ComplexSub(Complex a, Complex b);
static __device__ inline Complex ComplexMul(Complex a, Complex b);
static __device__ inline float ComplexNorm(Complex a);
static __device__ inline Complex ComplexCast(float a, float b)
{
Complex c;
c.x = a; c.y = b;
//c.z = 0;
return c;
}
// Complex addition
static __device__ inline Complex ComplexAdd(Complex a, Complex b)
{
Complex c;
c.x = a.x + b.x;
c.y = a.y + b.y;
//c.z = 0; // padding to avoid bank conflicts - might not be needed in CUDA 9.0
return c;
}
// Complex subtraction
static __device__ inline Complex ComplexSub(Complex a, Complex b)
{
Complex c;
c.x = a.x - b.x;
c.y = a.y - b.y;
//c.z = 0; // padding to avoid bank conflicts - might not be needed in CUDA 9.0
return c;
}
// Complex multiplication
static __device__ inline Complex ComplexMul(Complex a, Complex b)
{
Complex c;
c.x = a.x * b.x - a.y * b.y;
c.y = a.x * b.y + a.y * b.x;
//c.z = 0; // padding to avoid bank conflicts - might not be needed in CUDA 9.0
return c;
}
// Fast calc of Norm of a Complex Number
static __device__ inline float ComplexNorm(Complex a) { return sqrt(a.x*a.x + a.y*a.y); }
__device__ __constant__ int offsets[LGSAMP];
__device__ __constant__ float twiddles_re[TWIDDLES_LEN];
__device__ __constant__ float twiddles_im[TWIDDLES_LEN];
__device__ float * in_re;
__device__ float * in_im;
static __device__ float maxFFT = 0;
// would be really good to use this with Pinned Memory
__global__ void core(float * out, int size, int gridNum, int gridWidth)
{
extern __shared__ Complex signalChunk[]; // twice the size of 1024 threads in block
int tidx0, tidx1, rtidx0, rtidx1, stridx0, stridx1, idx_twid;
Complex radius;
int start = (gridNum * gridWidth + blockIdx.x) * blockDim.x; // start of the block, threadIdx.x == 0
tidx0 = threadIdx.x;
tidx1 = threadIdx.x + HWSAMP;
rtidx0 = __brev(tidx0) >> IDX_SHIFT;
rtidx1 = __brev(tidx1) >> IDX_SHIFT;
stridx0 = rtidx0 + start;
stridx1 = rtidx1 + start;
if(tidx0 + start < size){
// permutation by bit reversal of array indices as 11 bit numbers, requires 32-11 bit shift
signalChunk[tidx0] = ComplexCast(in_re[stridx0], in_im[stridx0]);
signalChunk[tidx1] = ComplexCast(in_re[stridx1], in_im[stridx1]);
__syncthreads();
for (unsigned int s = 0; s < LGSAMP; s++) // 11 values of s as per iterative algorithm for fft (2048 point)
{
tidx0 = threadIdx.x + (threadIdx.x & (~offsets[s]));
tidx1 = tidx0 + offsets[s] + 1;
idx_twid = offsets[s] + (threadIdx.x & offsets[s]);
radius = ComplexMul(signalChunk[tidx1], ComplexCast(twiddles_re[idx_twid], twiddles_im[idx_twid])); // A[j + k + m/2]*w
signalChunk[tidx0] = ComplexAdd(signalChunk[tidx0], radius); // A[j + k] = A[j + k] + A[j + k + m/2]*w
signalChunk[tidx1] = ComplexSub(signalChunk[tidx0], radius); // A[j + k + m/2] = A[j + k] - A[j + k + m/2]*w
__syncthreads();
}
tidx0 = threadIdx.x;
out[tidx0 + start] = ComplexNorm(signalChunk[tidx0]);
// eval for maxFFT, use AtomicMax() here
AtomicMax(&maxFFT, out[tidx0 + start]);
}
}
// use kernel termination as sync point to launch this next kernel named normaliseFinal
__global__ void normaliseFinal(float * out, int size, int gridNum, int gridWidth)
{
int tidx = (gridNum * gridWidth + blockIdx.x) * blockDim.x + threadIdx.x;
if(tidx < size){
out[tidx] = out[tidx] / maxFFT;
}
}
// would be really good to use this with Pinned Memory
// since CPU will be busy reading in wavefile while this is happening
// this doesn't need to be all that optimised, it could even be as sequential
// as the CPU version
// NOTE: this should be 1 block, 11 threads
__global__ void calcTwiddles(float * out_re, float * out_im, float * zerothTwiddles_re, float * zerothTwiddles_im)
{
int tid = threadIdx.x;
Complex runVal; runVal.x = 1; runVal.y = 0; //runVal.z = 0;
for (int i = offsets[tid]; i < 2 * offsets[tid] + 1; i++)
{
out_re[i] = runVal.x;
out_im[i] = runVal.y;
runVal = ComplexMul(runVal, ComplexCast(zerothTwiddles_re[tid], zerothTwiddles_im[tid]));
}
}
void writeBinFile(const char * file_name, float * bin_data, size_t nmemb){
FILE * fp = fopen(file_name, "wb");
printf("writing %s is writing %d in %lu bytes\n",file_name, nmemb, sizeof(float) * nmemb);
fflush(stdout);
fwrite(bin_data, sizeof(float), nmemb, fp);
fflush(fp);
fclose(fp);
}
size_t readBinFile(const char * file_name, float ** bin_data){
FILE * fp = fopen(file_name,"r");
fseek(fp, 0, SEEK_END);
size_t sz = ftell(fp);
size_t nmemb = sz/sizeof(**bin_data);
printf("file %s is %lu elements in %lu bytes\n", file_name, nmemb, sz);
fflush(stdout);
rewind(fp);
*bin_data = (float*)malloc(sz);
fread(*bin_data, sizeof(float), nmemb, fp);
fflush(fp);
fclose(fp);
return nmemb;
}
int main(int argc, char ** argv){
printf("hello\n");
fflush(stdout);
const float pi = 3.1415927410;
const char * wave_bin = "wave_out";
const char * timefreq_ref = "timefreq_out";
const char * timefreq_cmp = "timefreq_done";
const int h_offsets[LGSAMP] = {0,1,3,7,15,31,63,127,255,511,1023};
for(int i = 0; i < LGSAMP; i++) printf("h_offsets[%d] = %d, ", i, h_offsets[i]);
printf("\n");
fflush(stdout);
float h_zerothTwiddles_re[LGSAMP];
float h_zerothTwiddles_im[LGSAMP];
float h_twiddles_re[TWIDDLES_LEN];
float h_twiddles_im[TWIDDLES_LEN];
float a;
float * h_wave_data;
float * h_timefreq_ref_data;
size_t wave_num_els = readBinFile(wave_bin, &h_wave_data);
size_t timefreq_num_els = readBinFile(timefreq_ref, &h_timefreq_ref_data);
// testing bit reversal
float * out;
if((out = (float*)malloc(timefreq_num_els * sizeof(*out))) == NULL)
printf("failed to allocate out");
float * h_timefreq_cmp_data;
printf("Allocating h_timefreq_cmp_data\n");
fflush(stdout);
if((h_timefreq_cmp_data = (float*)malloc(timefreq_num_els * sizeof(*h_timefreq_cmp_data))) == NULL)
printf("failed to allocate h_timefreq_cmp_data");
size_t wave_num_pels = ((size_t)ceil((double)wave_num_els / (double)WSAMP)) * WSAMP;
printf("wave_num_els = %d, wave_num_pels = %d\n", wave_num_els, wave_num_pels);
fflush(stdout);
float ** h_sig_data;
printf("Allocating h_sig_data\n");
fflush(stdout);
if(h_sig_data = (float**)malloc(2 * sizeof(*h_sig_data))){
for(int i = 0; i < 2; i++){
printf("Allocating h_sig_data[%d]\n", i);
if((h_sig_data[i] = (float*)malloc(wave_num_pels * sizeof(**h_sig_data))) == NULL)
printf("failed to allocate h_sig_data[%d]\n", i);
}
}
else printf("failed to allocate h_sig_data\n");
// cast wave data to complex and add padding
printf("Casting wave to complex and padding with zeros\n");
fflush(stdout);
for(int i = 0; i < wave_num_pels; i++)
{
h_sig_data[1][i] = 0;
if(i < wave_num_els){
h_sig_data[0][i] = h_wave_data[i];
}
else h_sig_data[0][i] = 0;
}
// calc zerothTwiddles
printf("Calculating the zeroth twiddles\n");
fflush(stdout);
for (int ii = 0; ii < LGSAMP; ii++)
{
a = -2 * pi / ((double)(2*(h_offsets[ii] + 1)));
//printf("2 * pi * ii = %f, (float)h_offsets[ii] + 1 = %f\n", 2 * pi * ii, (float)h_offsets[ii] + 1);
//fflush(stdout);
h_zerothTwiddles_re[ii] = (float)cos(a);
h_zerothTwiddles_im[ii] = (float)sin(a);
//printf("a = %f, h_zerothTwiddles_re[%d] = %f, h_zerothTwiddles_im[%d] = %f\n",a,ii,h_zerothTwiddles_re[ii],ii,h_zerothTwiddles_im[ii]);
//fflush(stdout);
}
//float chk_twiddles_re[TWIDDLES_LEN];
//float chk_twiddles_im[TWIDDLES_LEN];
//
//for(int s = 0; s < LGSAMP; s++){
// float runVal_re = 1.0f; float temp1;
// float runVal_im = 0.0f;
// for (int i = h_offsets[s]; i < 2 * h_offsets[s] + 1; i++)
// {
// chk_twiddles_re[i] = runVal_re;
// chk_twiddles_im[i] = runVal_im;
// temp1 = runVal_re;
// runVal_re = runVal_re * h_zerothTwiddles_re[s] - runVal_im * h_zerothTwiddles_im[s];
// runVal_im = temp1 * h_zerothTwiddles_im[s] + runVal_im * h_zerothTwiddles_re[s];
// }
//}
/********************** kernel stuff **********************/
// wave data in
printf("Allocating memory on device\n");
fflush(stdout);
float * d_sig_data_re; cudaMalloc(&d_sig_data_re, wave_num_pels * sizeof(*d_sig_data_re));
float * d_sig_data_im; cudaMalloc(&d_sig_data_im, wave_num_pels * sizeof(*d_sig_data_im));
// timefreq data out
//float * d_timefreq_cmp_data; cudaMalloc(&d_timefreq_cmp_data, timefreq_num_els * sizeof(*d_timefreq_cmp_data));
float * d_out; cudaMalloc(&d_out, timefreq_num_els * sizeof(*d_out));
// supporting structures
float * d_zerothTwiddles_re; cudaMalloc(&d_zerothTwiddles_re, TWIDDLES_LEN * sizeof(*d_zerothTwiddles_re));
float * d_zerothTwiddles_im; cudaMalloc(&d_zerothTwiddles_im, TWIDDLES_LEN * sizeof(*d_zerothTwiddles_im));
float * d_twiddles_re; cudaMalloc(&d_twiddles_re, TWIDDLES_LEN * sizeof(*d_twiddles_re));
float * d_twiddles_im; cudaMalloc(&d_twiddles_im, TWIDDLES_LEN * sizeof(*d_twiddles_im));
//int * d_offsets; cudaMalloc(&d_offsets, LGSAMP * sizeof(*d_offsets));
// copy to device
printf("Copying data over to device\n");
fflush(stdout);
gpuAssert( cudaMemcpyToSymbol(offsets, h_offsets, LGSAMP * sizeof(*h_offsets), 0, cudaMemcpyHostToDevice) );
//cudaMemcpy( d_offsets, h_offsets, LGSAMP * sizeof(*d_offsets), cudaMemcpyHostToDevice );
gpuAssert( cudaMemcpy( d_zerothTwiddles_re, h_zerothTwiddles_re, LGSAMP * sizeof(*d_zerothTwiddles_re), cudaMemcpyHostToDevice ) );
gpuAssert( cudaMemcpy( d_zerothTwiddles_im, h_zerothTwiddles_im, LGSAMP * sizeof(*d_zerothTwiddles_im), cudaMemcpyHostToDevice ) );
gpuAssert( cudaMemcpy( d_sig_data_re, h_sig_data[0], wave_num_pels * sizeof(*d_sig_data_re), cudaMemcpyHostToDevice ) );
gpuAssert( cudaMemcpy( d_sig_data_im, h_sig_data[1], wave_num_pels * sizeof(*d_sig_data_im), cudaMemcpyHostToDevice ) );
gpuAssert( cudaMemcpyToSymbol(in_re, &d_sig_data_re, sizeof(float *)) );
gpuAssert( cudaMemcpyToSymbol(in_im, &d_sig_data_im, sizeof(float *)) );
// launch prep kernel
printf("Launching kernel to calc twiddles\n");
fflush(stdout);
calcTwiddles<<<1,11>>>(d_twiddles_re, d_twiddles_im, d_zerothTwiddles_re, d_zerothTwiddles_im);
cudaDeviceSynchronize();
/* this copy to host then back to device may not be necessary */
// copy twiddles back to host
gpuAssert( cudaMemcpy(h_twiddles_re, d_twiddles_re, TWIDDLES_LEN * sizeof(*h_twiddles_re), cudaMemcpyDeviceToHost ) );
gpuAssert( cudaMemcpy(h_twiddles_im, d_twiddles_im, TWIDDLES_LEN * sizeof(*h_twiddles_im), cudaMemcpyDeviceToHost ) );
// copy twiddles back to device
gpuAssert( cudaMemcpyToSymbol(twiddles_re, h_twiddles_re, TWIDDLES_LEN * sizeof(*d_twiddles_re), 0, cudaMemcpyHostToDevice) );
gpuAssert( cudaMemcpyToSymbol(twiddles_im, h_twiddles_im, TWIDDLES_LEN * sizeof(*d_twiddles_im), 0, cudaMemcpyHostToDevice) );
// launch core kernel
int threadsPerBlock = HWSAMP;
int blocksPerGrid = wave_num_pels / (2 * threadsPerBlock);
printf("launching kernel with %d blocks and %d threads per block\n", blocksPerGrid, threadsPerBlock);
fflush(stdout);
int blockEachLaunch = 32;
int iter = 0;
for(; iter < blocksPerGrid/blockEachLaunch; iter++){
core<<<blockEachLaunch, threadsPerBlock, WSAMP * PREC>>>(d_out, timefreq_num_els, iter, blockEachLaunch);
}
if(blocksPerGrid % blockEachLaunch > 0) core<<<blocksPerGrid % blockEachLaunch, threadsPerBlock, WSAMP * PREC>>>(d_out, timefreq_num_els, iter, blockEachLaunch);
cudaDeviceSynchronize();
/* this copy to host then back to device may not be necessary */
//// copy results back from device
//cudaMemcpy(h_timefreq_cmp_data, d_timefreq_cmp_data, timefreq_num_els * sizeof(*h_timefreq_cmp_data), cudaMemcpyDeviceToHost );
//
//// copy results back to device
//cudaMemcpy(d_timefreq_cmp_data, h_timefreq_data, timefreq_num_els * sizeof(*d_timefreq_cmp_data), cudaMemcpyHostToDevice );
// launch kernel to normalise the data
iter = 0;
for(; iter < blocksPerGrid/blockEachLaunch; iter++){
normaliseFinal<<<blockEachLaunch, threadsPerBlock>>>(d_out, timefreq_num_els, iter, blockEachLaunch);
}
if(blocksPerGrid % blockEachLaunch > 0) normaliseFinal<<<blocksPerGrid % blockEachLaunch, threadsPerBlock>>>(d_out, timefreq_num_els, iter, blockEachLaunch);
cudaDeviceSynchronize();
// copy final results back to host
//cudaMemcpy(h_timefreq_cmp_data, d_timefreq_cmp_data, timefreq_num_els * sizeof(*h_timefreq_cmp_data), cudaMemcpyDeviceToHost );
gpuAssert( cudaMemcpy(out, d_out, timefreq_num_els * sizeof(*out), cudaMemcpyDeviceToHost ) );
gpuAssert( cudaFree(d_out) );
// clean up device memory
gpuAssert( cudaFree(d_sig_data_re) );
gpuAssert( cudaFree(d_sig_data_im) );
gpuAssert( cudaFree(d_zerothTwiddles_re) );
gpuAssert( cudaFree(d_zerothTwiddles_im) );
gpuAssert( cudaFree(d_twiddles_re) );
gpuAssert( cudaFree(d_twiddles_im) );
/********************** /kernel stuff **********************/
//for(int i = 0; i < timefreq_num_els; i++) printf("%f ", out[i]);
//printf("Writing results to timefreq_done. int is %lu bytes.\n", sizeof(int));
writeBinFile(timefreq_cmp, out, timefreq_num_els);
free(out);
free(h_timefreq_ref_data);
free(h_timefreq_cmp_data);
free(h_wave_data);
}
// -gencode arch=compute_50,code=sm_50
|
8,549 | #include <thrust/device_vector.h>
#include <thrust/transform_reduce.h>
#include <thrust/sequence.h>
#include <thrust/random.h>
#include <thrust/gather.h>
#include <thrust/extrema.h>
#include <thrust/sort.h>
#include <stdio.h>
using namespace thrust::placeholders;
/****************************************************/
/* POWER DIFFERENCE FUNCTOR FOR EUCLIDEAN DISTANCES */
/****************************************************/
struct PowerDifference {
__host__ __device__ float operator()(const float& a, const float& b) const {
if ( a == 0.0f || b == 0.0f) {
return 0.0f;
} else {
return pow(a - b, 2);
}
}
};
struct countIfNoZeros {
__host__ __device__ float operator()(const float& a, const float& b) const {
if ( a > 0.0f && b > 0.0f) {
return 1.0f;
} else {
return 0.0f;
}
}
};
/*******************/
/* EXPAND OPERATOR */
/*******************/
template <typename InputIterator1, typename InputIterator2, typename OutputIterator>
OutputIterator expand(InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
OutputIterator output)
{
typedef typename thrust::iterator_difference<InputIterator1>::type difference_type;
difference_type input_size = thrust::distance(first1, last1);
difference_type output_size = thrust::reduce(first1, last1);
// scan the counts to obtain output offsets for each input element
thrust::device_vector<difference_type> output_offsets(input_size, 0);
thrust::exclusive_scan(first1, last1, output_offsets.begin());
// scatter the nonzero counts into their corresponding output positions
thrust::device_vector<difference_type> output_indices(output_size, 0);
thrust::scatter_if(thrust::counting_iterator<difference_type>(0), thrust::counting_iterator<difference_type>(input_size),
output_offsets.begin(), first1, output_indices.begin());
// compute max-scan over the output indices, filling in the holes
thrust::inclusive_scan(output_indices.begin(), output_indices.end(), output_indices.begin(), thrust::maximum<difference_type>());
// gather input values according to index array (output = first2[output_indices])
OutputIterator output_end = output; thrust::advance(output_end, output_size);
thrust::gather(output_indices.begin(), output_indices.end(), first2, output);
// return output + output_size
thrust::advance(output, output_size);
return output;
}
/********/
/* MAIN */
/********/
int main()
{
/**************************/
/* SETTING UP THE PROBLEM */
/**************************/
const int N = 80; // --- Number of vector elements
const int Nvec = 100; // --- Number of vectors for each matrix
// --- Random uniform integer distribution between 0 and 100
thrust::default_random_engine rng;
thrust::uniform_int_distribution<int> dist(0, 20);
// --- Matrix allocation and initialization
thrust::device_vector<float> d_matrix1(Nvec * N);
thrust::device_vector<float> d_matrix2(Nvec * N);
d_matrix2[0] = 0; d_matrix2[1] = 0; d_matrix2[2] = 0; d_matrix2[3] = 0; d_matrix2[4] = 0; d_matrix2[5] = 0; d_matrix2[6] = 0; d_matrix2[7] = 0; d_matrix2[8] = 0; d_matrix2[9] = 0; d_matrix2[10] = 0; d_matrix2[11] = 0; d_matrix2[12] = 0; d_matrix2[13] = 0; d_matrix2[14] = 0; d_matrix2[15] = 0; d_matrix2[16] = 0; d_matrix2[17] = 0; d_matrix2[18] = 0; d_matrix2[19] = 0; d_matrix2[20] = 0; d_matrix2[21] = 0; d_matrix2[22] = 0; d_matrix2[23] = 0; d_matrix2[24] = 0; d_matrix2[25] = 0; d_matrix2[26] = 0; d_matrix2[27] = 0; d_matrix2[28] = 0; d_matrix2[29] = 0; d_matrix2[30] = 0; d_matrix2[31] = 0; d_matrix2[32] = 0; d_matrix2[33] = 0; d_matrix2[34] = 0; d_matrix2[35] = 0; d_matrix2[36] = 0; d_matrix2[37] = 0; d_matrix2[38] = 0; d_matrix2[39] = 0; d_matrix2[40] = 0; d_matrix2[41] = 0; d_matrix2[42] = 0; d_matrix2[43] = 0; d_matrix2[44] = 0; d_matrix2[45] = 0; d_matrix2[46] = 0; d_matrix2[47] = 0; d_matrix2[48] = 0; d_matrix2[49] = 0; d_matrix2[50] = 0; d_matrix2[51] = 0; d_matrix2[52] = 0; d_matrix2[53] = 0; d_matrix2[54] = 0; d_matrix2[55] = 0; d_matrix2[56] = 0; d_matrix2[57] = 0; d_matrix2[58] = 0; d_matrix2[59] = 0; d_matrix2[60] = 0; d_matrix2[61] = 0; d_matrix2[62] = 0; d_matrix2[63] = 0; d_matrix2[64] = 0; d_matrix2[65] = 0; d_matrix2[66] = 0; d_matrix2[67] = 0; d_matrix2[68] = 0; d_matrix2[69] = 0; d_matrix2[70] = 0; d_matrix2[71] = 0; d_matrix2[72] = 0; d_matrix2[73] = 0; d_matrix2[74] = 0; d_matrix2[75] = 0; d_matrix2[76] = 0; d_matrix2[77] = 0; d_matrix2[78] = 0; d_matrix2[79] = 0;
d_matrix2[80] = 0; d_matrix2[81] = 0; d_matrix2[82] = 0; d_matrix2[83] = 0; d_matrix2[84] = 0; d_matrix2[85] = 0; d_matrix2[86] = 0; d_matrix2[87] = 0; d_matrix2[88] = 0; d_matrix2[89] = 0; d_matrix2[90] = 0; d_matrix2[91] = 0; d_matrix2[92] = 0; d_matrix2[93] = 0; d_matrix2[94] = 0; d_matrix2[95] = 0; d_matrix2[96] = 0; d_matrix2[97] = 0; d_matrix2[98] = 0; d_matrix2[99] = 0; d_matrix2[100] = 0; d_matrix2[101] = 0; d_matrix2[102] = 0; d_matrix2[103] = 0; d_matrix2[104] = 0; d_matrix2[105] = 0; d_matrix2[106] = 0; d_matrix2[107] = 0; d_matrix2[108] = 0; d_matrix2[109] = 0; d_matrix2[110] = 0; d_matrix2[111] = 0; d_matrix2[112] = 0; d_matrix2[113] = 0; d_matrix2[114] = 0; d_matrix2[115] = 0; d_matrix2[116] = 0; d_matrix2[117] = 0; d_matrix2[118] = 0; d_matrix2[119] = 0; d_matrix2[120] = 0; d_matrix2[121] = 0; d_matrix2[122] = 0; d_matrix2[123] = 0; d_matrix2[124] = 0; d_matrix2[125] = 0; d_matrix2[126] = 0; d_matrix2[127] = 0; d_matrix2[128] = 0; d_matrix2[129] = 0; d_matrix2[130] = 0; d_matrix2[131] = 0; d_matrix2[132] = 0; d_matrix2[133] = 0; d_matrix2[134] = 0; d_matrix2[135] = 0; d_matrix2[136] = 0; d_matrix2[137] = 0; d_matrix2[138] = 0; d_matrix2[139] = 0; d_matrix2[140] = 0; d_matrix2[141] = 0; d_matrix2[142] = 0; d_matrix2[143] = 0; d_matrix2[144] = 0; d_matrix2[145] = 0; d_matrix2[146] = 0; d_matrix2[147] = 0; d_matrix2[148] = 0; d_matrix2[149] = 0; d_matrix2[150] = 0; d_matrix2[151] = 0; d_matrix2[152] = 0; d_matrix2[153] = 0; d_matrix2[154] = 0; d_matrix2[155] = 0; d_matrix2[156] = 0; d_matrix2[157] = 0; d_matrix2[158] = 0; d_matrix2[159] = 0;
d_matrix2[160] = 0; d_matrix2[161] = 0; d_matrix2[162] = 5; d_matrix2[163] = 3; d_matrix2[164] = 4; d_matrix2[165] = 3; d_matrix2[166] = 3; d_matrix2[167] = 5; d_matrix2[168] = 4; d_matrix2[169] = 1; d_matrix2[170] = 5; d_matrix2[171] = 3; d_matrix2[172] = 2; d_matrix2[173] = 5; d_matrix2[174] = 5; d_matrix2[175] = 5; d_matrix2[176] = 5; d_matrix2[177] = 5; d_matrix2[178] = 3; d_matrix2[179] = 4; d_matrix2[180] = 5; d_matrix2[181] = 4; d_matrix2[182] = 1; d_matrix2[183] = 4; d_matrix2[184] = 4; d_matrix2[185] = 3; d_matrix2[186] = 4; d_matrix2[187] = 3; d_matrix2[188] = 2; d_matrix2[189] = 4; d_matrix2[190] = 1; d_matrix2[191] = 3; d_matrix2[192] = 3; d_matrix2[193] = 5; d_matrix2[194] = 4; d_matrix2[195] = 2; d_matrix2[196] = 1; d_matrix2[197] = 2; d_matrix2[198] = 2; d_matrix2[199] = 3; d_matrix2[200] = 4; d_matrix2[201] = 3; d_matrix2[202] = 2; d_matrix2[203] = 5; d_matrix2[204] = 4; d_matrix2[205] = 5; d_matrix2[206] = 5; d_matrix2[207] = 4; d_matrix2[208] = 4; d_matrix2[209] = 5; d_matrix2[210] = 3; d_matrix2[211] = 5; d_matrix2[212] = 4; d_matrix2[213] = 4; d_matrix2[214] = 3; d_matrix2[215] = 3; d_matrix2[216] = 5; d_matrix2[217] = 4; d_matrix2[218] = 5; d_matrix2[219] = 4; d_matrix2[220] = 5; d_matrix2[221] = 5; d_matrix2[222] = 4; d_matrix2[223] = 3; d_matrix2[224] = 2; d_matrix2[225] = 5; d_matrix2[226] = 4; d_matrix2[227] = 4; d_matrix2[228] = 3; d_matrix2[229] = 4; d_matrix2[230] = 3; d_matrix2[231] = 3; d_matrix2[232] = 3; d_matrix2[233] = 4; d_matrix2[234] = 3; d_matrix2[235] = 1; d_matrix2[236] = 4; d_matrix2[237] = 4; d_matrix2[238] = 4; d_matrix2[239] = 1;
d_matrix2[240] = 0; d_matrix2[241] = 0; d_matrix2[242] = 4; d_matrix2[243] = 0; d_matrix2[244] = 0; d_matrix2[245] = 0; d_matrix2[246] = 0; d_matrix2[247] = 0; d_matrix2[248] = 0; d_matrix2[249] = 0; d_matrix2[250] = 0; d_matrix2[251] = 2; d_matrix2[252] = 0; d_matrix2[253] = 0; d_matrix2[254] = 4; d_matrix2[255] = 4; d_matrix2[256] = 0; d_matrix2[257] = 0; d_matrix2[258] = 0; d_matrix2[259] = 0; d_matrix2[260] = 3; d_matrix2[261] = 0; d_matrix2[262] = 0; d_matrix2[263] = 0; d_matrix2[264] = 0; d_matrix2[265] = 0; d_matrix2[266] = 4; d_matrix2[267] = 0; d_matrix2[268] = 0; d_matrix2[269] = 0; d_matrix2[270] = 0; d_matrix2[271] = 0; d_matrix2[272] = 0; d_matrix2[273] = 0; d_matrix2[274] = 0; d_matrix2[275] = 0; d_matrix2[276] = 0; d_matrix2[277] = 0; d_matrix2[278] = 0; d_matrix2[279] = 0; d_matrix2[280] = 0; d_matrix2[281] = 0; d_matrix2[282] = 0; d_matrix2[283] = 0; d_matrix2[284] = 0; d_matrix2[285] = 0; d_matrix2[286] = 0; d_matrix2[287] = 0; d_matrix2[288] = 0; d_matrix2[289] = 0; d_matrix2[290] = 0; d_matrix2[291] = 5; d_matrix2[292] = 0; d_matrix2[293] = 0; d_matrix2[294] = 0; d_matrix2[295] = 0; d_matrix2[296] = 0; d_matrix2[297] = 0; d_matrix2[298] = 0; d_matrix2[299] = 0; d_matrix2[300] = 0; d_matrix2[301] = 0; d_matrix2[302] = 0; d_matrix2[303] = 0; d_matrix2[304] = 0; d_matrix2[305] = 0; d_matrix2[306] = 0; d_matrix2[307] = 0; d_matrix2[308] = 0; d_matrix2[309] = 0; d_matrix2[310] = 0; d_matrix2[311] = 0; d_matrix2[312] = 0; d_matrix2[313] = 0; d_matrix2[314] = 0; d_matrix2[315] = 0; d_matrix2[316] = 0; d_matrix2[317] = 0; d_matrix2[318] = 0; d_matrix2[319] = 0;
d_matrix2[320] = 0; d_matrix2[321] = 0; d_matrix2[322] = 0; d_matrix2[323] = 0; d_matrix2[324] = 0; d_matrix2[325] = 0; d_matrix2[326] = 0; d_matrix2[327] = 0; d_matrix2[328] = 0; d_matrix2[329] = 0; d_matrix2[330] = 0; d_matrix2[331] = 0; d_matrix2[332] = 0; d_matrix2[333] = 0; d_matrix2[334] = 0; d_matrix2[335] = 0; d_matrix2[336] = 0; d_matrix2[337] = 0; d_matrix2[338] = 0; d_matrix2[339] = 0; d_matrix2[340] = 0; d_matrix2[341] = 0; d_matrix2[342] = 0; d_matrix2[343] = 0; d_matrix2[344] = 0; d_matrix2[345] = 0; d_matrix2[346] = 0; d_matrix2[347] = 0; d_matrix2[348] = 0; d_matrix2[349] = 0; d_matrix2[350] = 0; d_matrix2[351] = 0; d_matrix2[352] = 0; d_matrix2[353] = 0; d_matrix2[354] = 0; d_matrix2[355] = 0; d_matrix2[356] = 0; d_matrix2[357] = 0; d_matrix2[358] = 0; d_matrix2[359] = 0; d_matrix2[360] = 0; d_matrix2[361] = 0; d_matrix2[362] = 0; d_matrix2[363] = 0; d_matrix2[364] = 0; d_matrix2[365] = 0; d_matrix2[366] = 0; d_matrix2[367] = 0; d_matrix2[368] = 0; d_matrix2[369] = 0; d_matrix2[370] = 0; d_matrix2[371] = 0; d_matrix2[372] = 0; d_matrix2[373] = 0; d_matrix2[374] = 0; d_matrix2[375] = 0; d_matrix2[376] = 0; d_matrix2[377] = 0; d_matrix2[378] = 0; d_matrix2[379] = 0; d_matrix2[380] = 0; d_matrix2[381] = 0; d_matrix2[382] = 0; d_matrix2[383] = 0; d_matrix2[384] = 0; d_matrix2[385] = 0; d_matrix2[386] = 0; d_matrix2[387] = 0; d_matrix2[388] = 0; d_matrix2[389] = 0; d_matrix2[390] = 0; d_matrix2[391] = 0; d_matrix2[392] = 0; d_matrix2[393] = 0; d_matrix2[394] = 0; d_matrix2[395] = 0; d_matrix2[396] = 0; d_matrix2[397] = 0; d_matrix2[398] = 0; d_matrix2[399] = 0;
d_matrix2[400] = 0; d_matrix2[401] = 0; d_matrix2[402] = 0; d_matrix2[403] = 0; d_matrix2[404] = 0; d_matrix2[405] = 0; d_matrix2[406] = 0; d_matrix2[407] = 0; d_matrix2[408] = 0; d_matrix2[409] = 0; d_matrix2[410] = 0; d_matrix2[411] = 0; d_matrix2[412] = 4; d_matrix2[413] = 0; d_matrix2[414] = 0; d_matrix2[415] = 0; d_matrix2[416] = 0; d_matrix2[417] = 0; d_matrix2[418] = 0; d_matrix2[419] = 0; d_matrix2[420] = 0; d_matrix2[421] = 0; d_matrix2[422] = 0; d_matrix2[423] = 0; d_matrix2[424] = 0; d_matrix2[425] = 0; d_matrix2[426] = 0; d_matrix2[427] = 0; d_matrix2[428] = 0; d_matrix2[429] = 0; d_matrix2[430] = 0; d_matrix2[431] = 0; d_matrix2[432] = 0; d_matrix2[433] = 0; d_matrix2[434] = 0; d_matrix2[435] = 0; d_matrix2[436] = 0; d_matrix2[437] = 0; d_matrix2[438] = 0; d_matrix2[439] = 0; d_matrix2[440] = 0; d_matrix2[441] = 0; d_matrix2[442] = 0; d_matrix2[443] = 0; d_matrix2[444] = 0; d_matrix2[445] = 0; d_matrix2[446] = 0; d_matrix2[447] = 0; d_matrix2[448] = 0; d_matrix2[449] = 0; d_matrix2[450] = 0; d_matrix2[451] = 5; d_matrix2[452] = 0; d_matrix2[453] = 0; d_matrix2[454] = 0; d_matrix2[455] = 0; d_matrix2[456] = 0; d_matrix2[457] = 0; d_matrix2[458] = 0; d_matrix2[459] = 0; d_matrix2[460] = 0; d_matrix2[461] = 0; d_matrix2[462] = 0; d_matrix2[463] = 0; d_matrix2[464] = 0; d_matrix2[465] = 0; d_matrix2[466] = 0; d_matrix2[467] = 0; d_matrix2[468] = 0; d_matrix2[469] = 0; d_matrix2[470] = 0; d_matrix2[471] = 0; d_matrix2[472] = 0; d_matrix2[473] = 0; d_matrix2[474] = 0; d_matrix2[475] = 0; d_matrix2[476] = 0; d_matrix2[477] = 0; d_matrix2[478] = 0; d_matrix2[479] = 0;
d_matrix2[480] = 0; d_matrix2[481] = 0; d_matrix2[482] = 4; d_matrix2[483] = 3; d_matrix2[484] = 0; d_matrix2[485] = 0; d_matrix2[486] = 0; d_matrix2[487] = 0; d_matrix2[488] = 0; d_matrix2[489] = 0; d_matrix2[490] = 0; d_matrix2[491] = 0; d_matrix2[492] = 0; d_matrix2[493] = 0; d_matrix2[494] = 0; d_matrix2[495] = 0; d_matrix2[496] = 0; d_matrix2[497] = 0; d_matrix2[498] = 4; d_matrix2[499] = 0; d_matrix2[500] = 0; d_matrix2[501] = 0; d_matrix2[502] = 3; d_matrix2[503] = 0; d_matrix2[504] = 0; d_matrix2[505] = 4; d_matrix2[506] = 3; d_matrix2[507] = 0; d_matrix2[508] = 0; d_matrix2[509] = 0; d_matrix2[510] = 4; d_matrix2[511] = 0; d_matrix2[512] = 0; d_matrix2[513] = 0; d_matrix2[514] = 0; d_matrix2[515] = 0; d_matrix2[516] = 0; d_matrix2[517] = 0; d_matrix2[518] = 0; d_matrix2[519] = 0; d_matrix2[520] = 0; d_matrix2[521] = 4; d_matrix2[522] = 0; d_matrix2[523] = 5; d_matrix2[524] = 0; d_matrix2[525] = 0; d_matrix2[526] = 0; d_matrix2[527] = 0; d_matrix2[528] = 0; d_matrix2[529] = 0; d_matrix2[530] = 0; d_matrix2[531] = 4; d_matrix2[532] = 0; d_matrix2[533] = 0; d_matrix2[534] = 0; d_matrix2[535] = 0; d_matrix2[536] = 0; d_matrix2[537] = 0; d_matrix2[538] = 0; d_matrix2[539] = 0; d_matrix2[540] = 0; d_matrix2[541] = 0; d_matrix2[542] = 0; d_matrix2[543] = 4; d_matrix2[544] = 1; d_matrix2[545] = 0; d_matrix2[546] = 0; d_matrix2[547] = 1; d_matrix2[548] = 0; d_matrix2[549] = 0; d_matrix2[550] = 1; d_matrix2[551] = 4; d_matrix2[552] = 0; d_matrix2[553] = 0; d_matrix2[554] = 0; d_matrix2[555] = 0; d_matrix2[556] = 0; d_matrix2[557] = 0; d_matrix2[558] = 0; d_matrix2[559] = 0;
d_matrix2[560] = 0; d_matrix2[561] = 0; d_matrix2[562] = 4; d_matrix2[563] = 0; d_matrix2[564] = 0; d_matrix2[565] = 0; d_matrix2[566] = 0; d_matrix2[567] = 0; d_matrix2[568] = 2; d_matrix2[569] = 4; d_matrix2[570] = 4; d_matrix2[571] = 0; d_matrix2[572] = 0; d_matrix2[573] = 4; d_matrix2[574] = 2; d_matrix2[575] = 5; d_matrix2[576] = 3; d_matrix2[577] = 0; d_matrix2[578] = 0; d_matrix2[579] = 0; d_matrix2[580] = 4; d_matrix2[581] = 0; d_matrix2[582] = 3; d_matrix2[583] = 3; d_matrix2[584] = 4; d_matrix2[585] = 0; d_matrix2[586] = 0; d_matrix2[587] = 0; d_matrix2[588] = 0; d_matrix2[589] = 2; d_matrix2[590] = 0; d_matrix2[591] = 0; d_matrix2[592] = 0; d_matrix2[593] = 4; d_matrix2[594] = 0; d_matrix2[595] = 0; d_matrix2[596] = 0; d_matrix2[597] = 0; d_matrix2[598] = 0; d_matrix2[599] = 0; d_matrix2[600] = 0; d_matrix2[601] = 0; d_matrix2[602] = 0; d_matrix2[603] = 0; d_matrix2[604] = 0; d_matrix2[605] = 0; d_matrix2[606] = 0; d_matrix2[607] = 0; d_matrix2[608] = 3; d_matrix2[609] = 0; d_matrix2[610] = 0; d_matrix2[611] = 4; d_matrix2[612] = 0; d_matrix2[613] = 0; d_matrix2[614] = 0; d_matrix2[615] = 0; d_matrix2[616] = 0; d_matrix2[617] = 4; d_matrix2[618] = 0; d_matrix2[619] = 0; d_matrix2[620] = 5; d_matrix2[621] = 0; d_matrix2[622] = 0; d_matrix2[623] = 0; d_matrix2[624] = 0; d_matrix2[625] = 4; d_matrix2[626] = 0; d_matrix2[627] = 0; d_matrix2[628] = 0; d_matrix2[629] = 0; d_matrix2[630] = 3; d_matrix2[631] = 3; d_matrix2[632] = 4; d_matrix2[633] = 0; d_matrix2[634] = 0; d_matrix2[635] = 0; d_matrix2[636] = 0; d_matrix2[637] = 0; d_matrix2[638] = 0; d_matrix2[639] = 0;
d_matrix2[640] = 0; d_matrix2[641] = 0; d_matrix2[642] = 0; d_matrix2[643] = 0; d_matrix2[644] = 0; d_matrix2[645] = 5; d_matrix2[646] = 0; d_matrix2[647] = 0; d_matrix2[648] = 5; d_matrix2[649] = 5; d_matrix2[650] = 5; d_matrix2[651] = 4; d_matrix2[652] = 3; d_matrix2[653] = 5; d_matrix2[654] = 0; d_matrix2[655] = 0; d_matrix2[656] = 0; d_matrix2[657] = 0; d_matrix2[658] = 0; d_matrix2[659] = 0; d_matrix2[660] = 0; d_matrix2[661] = 0; d_matrix2[662] = 0; d_matrix2[663] = 5; d_matrix2[664] = 3; d_matrix2[665] = 0; d_matrix2[666] = 3; d_matrix2[667] = 0; d_matrix2[668] = 4; d_matrix2[669] = 5; d_matrix2[670] = 3; d_matrix2[671] = 0; d_matrix2[672] = 4; d_matrix2[673] = 4; d_matrix2[674] = 0; d_matrix2[675] = 0; d_matrix2[676] = 0; d_matrix2[677] = 0; d_matrix2[678] = 0; d_matrix2[679] = 0; d_matrix2[680] = 5; d_matrix2[681] = 0; d_matrix2[682] = 0; d_matrix2[683] = 0; d_matrix2[684] = 0; d_matrix2[685] = 5; d_matrix2[686] = 0; d_matrix2[687] = 0; d_matrix2[688] = 5; d_matrix2[689] = 0; d_matrix2[690] = 0; d_matrix2[691] = 5; d_matrix2[692] = 2; d_matrix2[693] = 4; d_matrix2[694] = 5; d_matrix2[695] = 3; d_matrix2[696] = 0; d_matrix2[697] = 5; d_matrix2[698] = 0; d_matrix2[699] = 0; d_matrix2[700] = 0; d_matrix2[701] = 0; d_matrix2[702] = 0; d_matrix2[703] = 3; d_matrix2[704] = 0; d_matrix2[705] = 5; d_matrix2[706] = 0; d_matrix2[707] = 0; d_matrix2[708] = 0; d_matrix2[709] = 4; d_matrix2[710] = 5; d_matrix2[711] = 1; d_matrix2[712] = 5; d_matrix2[713] = 5; d_matrix2[714] = 3; d_matrix2[715] = 0; d_matrix2[716] = 0; d_matrix2[717] = 0; d_matrix2[718] = 5; d_matrix2[719] = 3;
d_matrix2[720] = 0; d_matrix2[721] = 0; d_matrix2[722] = 0; d_matrix2[723] = 0; d_matrix2[724] = 0; d_matrix2[725] = 0; d_matrix2[726] = 0; d_matrix2[727] = 0; d_matrix2[728] = 3; d_matrix2[729] = 0; d_matrix2[730] = 0; d_matrix2[731] = 0; d_matrix2[732] = 3; d_matrix2[733] = 0; d_matrix2[734] = 0; d_matrix2[735] = 0; d_matrix2[736] = 0; d_matrix2[737] = 0; d_matrix2[738] = 0; d_matrix2[739] = 0; d_matrix2[740] = 0; d_matrix2[741] = 0; d_matrix2[742] = 0; d_matrix2[743] = 5; d_matrix2[744] = 0; d_matrix2[745] = 0; d_matrix2[746] = 0; d_matrix2[747] = 0; d_matrix2[748] = 0; d_matrix2[749] = 0; d_matrix2[750] = 0; d_matrix2[751] = 0; d_matrix2[752] = 0; d_matrix2[753] = 0; d_matrix2[754] = 0; d_matrix2[755] = 0; d_matrix2[756] = 0; d_matrix2[757] = 0; d_matrix2[758] = 0; d_matrix2[759] = 0; d_matrix2[760] = 0; d_matrix2[761] = 0; d_matrix2[762] = 0; d_matrix2[763] = 0; d_matrix2[764] = 0; d_matrix2[765] = 0; d_matrix2[766] = 0; d_matrix2[767] = 0; d_matrix2[768] = 0; d_matrix2[769] = 0; d_matrix2[770] = 0; d_matrix2[771] = 5; d_matrix2[772] = 0; d_matrix2[773] = 0; d_matrix2[774] = 0; d_matrix2[775] = 0; d_matrix2[776] = 5; d_matrix2[777] = 5; d_matrix2[778] = 0; d_matrix2[779] = 0; d_matrix2[780] = 0; d_matrix2[781] = 0; d_matrix2[782] = 0; d_matrix2[783] = 0; d_matrix2[784] = 0; d_matrix2[785] = 0; d_matrix2[786] = 0; d_matrix2[787] = 0; d_matrix2[788] = 0; d_matrix2[789] = 0; d_matrix2[790] = 0; d_matrix2[791] = 0; d_matrix2[792] = 0; d_matrix2[793] = 0; d_matrix2[794] = 0; d_matrix2[795] = 0; d_matrix2[796] = 0; d_matrix2[797] = 0; d_matrix2[798] = 0; d_matrix2[799] = 0;
d_matrix2[800] = 0; d_matrix2[801] = 0; d_matrix2[802] = 0; d_matrix2[803] = 0; d_matrix2[804] = 0; d_matrix2[805] = 0; d_matrix2[806] = 0; d_matrix2[807] = 5; d_matrix2[808] = 4; d_matrix2[809] = 0; d_matrix2[810] = 0; d_matrix2[811] = 0; d_matrix2[812] = 0; d_matrix2[813] = 0; d_matrix2[814] = 0; d_matrix2[815] = 0; d_matrix2[816] = 0; d_matrix2[817] = 0; d_matrix2[818] = 0; d_matrix2[819] = 0; d_matrix2[820] = 0; d_matrix2[821] = 0; d_matrix2[822] = 0; d_matrix2[823] = 0; d_matrix2[824] = 0; d_matrix2[825] = 0; d_matrix2[826] = 0; d_matrix2[827] = 0; d_matrix2[828] = 0; d_matrix2[829] = 0; d_matrix2[830] = 0; d_matrix2[831] = 0; d_matrix2[832] = 0; d_matrix2[833] = 0; d_matrix2[834] = 0; d_matrix2[835] = 0; d_matrix2[836] = 0; d_matrix2[837] = 0; d_matrix2[838] = 0; d_matrix2[839] = 0; d_matrix2[840] = 0; d_matrix2[841] = 0; d_matrix2[842] = 0; d_matrix2[843] = 0; d_matrix2[844] = 0; d_matrix2[845] = 0; d_matrix2[846] = 0; d_matrix2[847] = 0; d_matrix2[848] = 0; d_matrix2[849] = 0; d_matrix2[850] = 0; d_matrix2[851] = 5; d_matrix2[852] = 0; d_matrix2[853] = 0; d_matrix2[854] = 0; d_matrix2[855] = 0; d_matrix2[856] = 0; d_matrix2[857] = 0; d_matrix2[858] = 0; d_matrix2[859] = 0; d_matrix2[860] = 0; d_matrix2[861] = 0; d_matrix2[862] = 0; d_matrix2[863] = 0; d_matrix2[864] = 0; d_matrix2[865] = 0; d_matrix2[866] = 0; d_matrix2[867] = 0; d_matrix2[868] = 0; d_matrix2[869] = 0; d_matrix2[870] = 0; d_matrix2[871] = 0; d_matrix2[872] = 0; d_matrix2[873] = 0; d_matrix2[874] = 0; d_matrix2[875] = 0; d_matrix2[876] = 0; d_matrix2[877] = 0; d_matrix2[878] = 0; d_matrix2[879] = 0;
d_matrix2[880] = 0; d_matrix2[881] = 0; d_matrix2[882] = 4; d_matrix2[883] = 0; d_matrix2[884] = 0; d_matrix2[885] = 4; d_matrix2[886] = 0; d_matrix2[887] = 0; d_matrix2[888] = 4; d_matrix2[889] = 0; d_matrix2[890] = 4; d_matrix2[891] = 0; d_matrix2[892] = 4; d_matrix2[893] = 5; d_matrix2[894] = 3; d_matrix2[895] = 0; d_matrix2[896] = 0; d_matrix2[897] = 4; d_matrix2[898] = 0; d_matrix2[899] = 0; d_matrix2[900] = 0; d_matrix2[901] = 0; d_matrix2[902] = 0; d_matrix2[903] = 5; d_matrix2[904] = 5; d_matrix2[905] = 0; d_matrix2[906] = 0; d_matrix2[907] = 0; d_matrix2[908] = 0; d_matrix2[909] = 0; d_matrix2[910] = 0; d_matrix2[911] = 0; d_matrix2[912] = 0; d_matrix2[913] = 4; d_matrix2[914] = 4; d_matrix2[915] = 0; d_matrix2[916] = 0; d_matrix2[917] = 0; d_matrix2[918] = 0; d_matrix2[919] = 0; d_matrix2[920] = 0; d_matrix2[921] = 4; d_matrix2[922] = 0; d_matrix2[923] = 0; d_matrix2[924] = 0; d_matrix2[925] = 0; d_matrix2[926] = 0; d_matrix2[927] = 0; d_matrix2[928] = 0; d_matrix2[929] = 4; d_matrix2[930] = 0; d_matrix2[931] = 5; d_matrix2[932] = 0; d_matrix2[933] = 0; d_matrix2[934] = 0; d_matrix2[935] = 0; d_matrix2[936] = 0; d_matrix2[937] = 5; d_matrix2[938] = 0; d_matrix2[939] = 0; d_matrix2[940] = 4; d_matrix2[941] = 3; d_matrix2[942] = 0; d_matrix2[943] = 0; d_matrix2[944] = 0; d_matrix2[945] = 4; d_matrix2[946] = 0; d_matrix2[947] = 0; d_matrix2[948] = 0; d_matrix2[949] = 0; d_matrix2[950] = 4; d_matrix2[951] = 4; d_matrix2[952] = 0; d_matrix2[953] = 0; d_matrix2[954] = 0; d_matrix2[955] = 0; d_matrix2[956] = 0; d_matrix2[957] = 0; d_matrix2[958] = 0; d_matrix2[959] = 0;
d_matrix2[960] = 0; d_matrix2[961] = 0; d_matrix2[962] = 0; d_matrix2[963] = 0; d_matrix2[964] = 0; d_matrix2[965] = 0; d_matrix2[966] = 0; d_matrix2[967] = 0; d_matrix2[968] = 0; d_matrix2[969] = 4; d_matrix2[970] = 5; d_matrix2[971] = 0; d_matrix2[972] = 2; d_matrix2[973] = 2; d_matrix2[974] = 0; d_matrix2[975] = 0; d_matrix2[976] = 5; d_matrix2[977] = 0; d_matrix2[978] = 0; d_matrix2[979] = 0; d_matrix2[980] = 0; d_matrix2[981] = 0; d_matrix2[982] = 0; d_matrix2[983] = 4; d_matrix2[984] = 0; d_matrix2[985] = 3; d_matrix2[986] = 3; d_matrix2[987] = 0; d_matrix2[988] = 0; d_matrix2[989] = 5; d_matrix2[990] = 3; d_matrix2[991] = 0; d_matrix2[992] = 0; d_matrix2[993] = 0; d_matrix2[994] = 0; d_matrix2[995] = 0; d_matrix2[996] = 0; d_matrix2[997] = 0; d_matrix2[998] = 0; d_matrix2[999] = 3; d_matrix2[1000] = 3; d_matrix2[1001] = 3; d_matrix2[1002] = 0; d_matrix2[1003] = 3; d_matrix2[1004] = 0; d_matrix2[1005] = 0; d_matrix2[1006] = 0; d_matrix2[1007] = 0; d_matrix2[1008] = 4; d_matrix2[1009] = 0; d_matrix2[1010] = 0; d_matrix2[1011] = 0; d_matrix2[1012] = 4; d_matrix2[1013] = 3; d_matrix2[1014] = 0; d_matrix2[1015] = 3; d_matrix2[1016] = 0; d_matrix2[1017] = 4; d_matrix2[1018] = 2; d_matrix2[1019] = 3; d_matrix2[1020] = 0; d_matrix2[1021] = 0; d_matrix2[1022] = 0; d_matrix2[1023] = 0; d_matrix2[1024] = 0; d_matrix2[1025] = 0; d_matrix2[1026] = 0; d_matrix2[1027] = 0; d_matrix2[1028] = 0; d_matrix2[1029] = 0; d_matrix2[1030] = 3; d_matrix2[1031] = 4; d_matrix2[1032] = 0; d_matrix2[1033] = 0; d_matrix2[1034] = 0; d_matrix2[1035] = 0; d_matrix2[1036] = 0; d_matrix2[1037] = 0; d_matrix2[1038] = 0; d_matrix2[1039] = 0;
d_matrix2[1040] = 0; d_matrix2[1041] = 0; d_matrix2[1042] = 0; d_matrix2[1043] = 0; d_matrix2[1044] = 0; d_matrix2[1045] = 5; d_matrix2[1046] = 0; d_matrix2[1047] = 0; d_matrix2[1048] = 0; d_matrix2[1049] = 0; d_matrix2[1050] = 0; d_matrix2[1051] = 0; d_matrix2[1052] = 0; d_matrix2[1053] = 0; d_matrix2[1054] = 0; d_matrix2[1055] = 0; d_matrix2[1056] = 5; d_matrix2[1057] = 0; d_matrix2[1058] = 0; d_matrix2[1059] = 0; d_matrix2[1060] = 0; d_matrix2[1061] = 0; d_matrix2[1062] = 0; d_matrix2[1063] = 0; d_matrix2[1064] = 0; d_matrix2[1065] = 0; d_matrix2[1066] = 0; d_matrix2[1067] = 0; d_matrix2[1068] = 0; d_matrix2[1069] = 5; d_matrix2[1070] = 0; d_matrix2[1071] = 0; d_matrix2[1072] = 0; d_matrix2[1073] = 0; d_matrix2[1074] = 0; d_matrix2[1075] = 0; d_matrix2[1076] = 0; d_matrix2[1077] = 0; d_matrix2[1078] = 0; d_matrix2[1079] = 0; d_matrix2[1080] = 0; d_matrix2[1081] = 0; d_matrix2[1082] = 0; d_matrix2[1083] = 0; d_matrix2[1084] = 0; d_matrix2[1085] = 0; d_matrix2[1086] = 0; d_matrix2[1087] = 0; d_matrix2[1088] = 0; d_matrix2[1089] = 0; d_matrix2[1090] = 0; d_matrix2[1091] = 4; d_matrix2[1092] = 0; d_matrix2[1093] = 0; d_matrix2[1094] = 0; d_matrix2[1095] = 0; d_matrix2[1096] = 0; d_matrix2[1097] = 0; d_matrix2[1098] = 0; d_matrix2[1099] = 0; d_matrix2[1100] = 0; d_matrix2[1101] = 0; d_matrix2[1102] = 0; d_matrix2[1103] = 0; d_matrix2[1104] = 0; d_matrix2[1105] = 0; d_matrix2[1106] = 0; d_matrix2[1107] = 0; d_matrix2[1108] = 0; d_matrix2[1109] = 0; d_matrix2[1110] = 5; d_matrix2[1111] = 0; d_matrix2[1112] = 4; d_matrix2[1113] = 0; d_matrix2[1114] = 0; d_matrix2[1115] = 0; d_matrix2[1116] = 0; d_matrix2[1117] = 0; d_matrix2[1118] = 0; d_matrix2[1119] = 0;
d_matrix2[1120] = 0; d_matrix2[1121] = 0; d_matrix2[1122] = 3; d_matrix2[1123] = 3; d_matrix2[1124] = 0; d_matrix2[1125] = 5; d_matrix2[1126] = 1; d_matrix2[1127] = 0; d_matrix2[1128] = 2; d_matrix2[1129] = 4; d_matrix2[1130] = 3; d_matrix2[1131] = 0; d_matrix2[1132] = 1; d_matrix2[1133] = 5; d_matrix2[1134] = 5; d_matrix2[1135] = 4; d_matrix2[1136] = 0; d_matrix2[1137] = 0; d_matrix2[1138] = 1; d_matrix2[1139] = 0; d_matrix2[1140] = 0; d_matrix2[1141] = 0; d_matrix2[1142] = 3; d_matrix2[1143] = 4; d_matrix2[1144] = 5; d_matrix2[1145] = 1; d_matrix2[1146] = 1; d_matrix2[1147] = 0; d_matrix2[1148] = 3; d_matrix2[1149] = 5; d_matrix2[1150] = 2; d_matrix2[1151] = 0; d_matrix2[1152] = 0; d_matrix2[1153] = 4; d_matrix2[1154] = 5; d_matrix2[1155] = 0; d_matrix2[1156] = 0; d_matrix2[1157] = 0; d_matrix2[1158] = 1; d_matrix2[1159] = 3; d_matrix2[1160] = 3; d_matrix2[1161] = 2; d_matrix2[1162] = 0; d_matrix2[1163] = 4; d_matrix2[1164] = 0; d_matrix2[1165] = 0; d_matrix2[1166] = 3; d_matrix2[1167] = 0; d_matrix2[1168] = 0; d_matrix2[1169] = 5; d_matrix2[1170] = 4; d_matrix2[1171] = 5; d_matrix2[1172] = 3; d_matrix2[1173] = 0; d_matrix2[1174] = 1; d_matrix2[1175] = 0; d_matrix2[1176] = 0; d_matrix2[1177] = 5; d_matrix2[1178] = 0; d_matrix2[1179] = 4; d_matrix2[1180] = 4; d_matrix2[1181] = 4; d_matrix2[1182] = 4; d_matrix2[1183] = 5; d_matrix2[1184] = 0; d_matrix2[1185] = 5; d_matrix2[1186] = 0; d_matrix2[1187] = 3; d_matrix2[1188] = 1; d_matrix2[1189] = 3; d_matrix2[1190] = 4; d_matrix2[1191] = 3; d_matrix2[1192] = 4; d_matrix2[1193] = 4; d_matrix2[1194] = 3; d_matrix2[1195] = 0; d_matrix2[1196] = 0; d_matrix2[1197] = 0; d_matrix2[1198] = 0; d_matrix2[1199] = 1;
d_matrix2[1200] = 0; d_matrix2[1201] = 0; d_matrix2[1202] = 0; d_matrix2[1203] = 0; d_matrix2[1204] = 0; d_matrix2[1205] = 0; d_matrix2[1206] = 0; d_matrix2[1207] = 0; d_matrix2[1208] = 5; d_matrix2[1209] = 0; d_matrix2[1210] = 4; d_matrix2[1211] = 0; d_matrix2[1212] = 0; d_matrix2[1213] = 5; d_matrix2[1214] = 4; d_matrix2[1215] = 3; d_matrix2[1216] = 4; d_matrix2[1217] = 0; d_matrix2[1218] = 0; d_matrix2[1219] = 3; d_matrix2[1220] = 5; d_matrix2[1221] = 0; d_matrix2[1222] = 0; d_matrix2[1223] = 3; d_matrix2[1224] = 5; d_matrix2[1225] = 0; d_matrix2[1226] = 2; d_matrix2[1227] = 0; d_matrix2[1228] = 0; d_matrix2[1229] = 0; d_matrix2[1230] = 0; d_matrix2[1231] = 0; d_matrix2[1232] = 0; d_matrix2[1233] = 5; d_matrix2[1234] = 0; d_matrix2[1235] = 0; d_matrix2[1236] = 0; d_matrix2[1237] = 0; d_matrix2[1238] = 0; d_matrix2[1239] = 0; d_matrix2[1240] = 0; d_matrix2[1241] = 0; d_matrix2[1242] = 0; d_matrix2[1243] = 4; d_matrix2[1244] = 0; d_matrix2[1245] = 0; d_matrix2[1246] = 0; d_matrix2[1247] = 0; d_matrix2[1248] = 0; d_matrix2[1249] = 0; d_matrix2[1250] = 0; d_matrix2[1251] = 5; d_matrix2[1252] = 0; d_matrix2[1253] = 0; d_matrix2[1254] = 0; d_matrix2[1255] = 0; d_matrix2[1256] = 0; d_matrix2[1257] = 5; d_matrix2[1258] = 0; d_matrix2[1259] = 0; d_matrix2[1260] = 0; d_matrix2[1261] = 0; d_matrix2[1262] = 0; d_matrix2[1263] = 0; d_matrix2[1264] = 0; d_matrix2[1265] = 0; d_matrix2[1266] = 0; d_matrix2[1267] = 0; d_matrix2[1268] = 0; d_matrix2[1269] = 0; d_matrix2[1270] = 0; d_matrix2[1271] = 1; d_matrix2[1272] = 0; d_matrix2[1273] = 0; d_matrix2[1274] = 0; d_matrix2[1275] = 0; d_matrix2[1276] = 0; d_matrix2[1277] = 0; d_matrix2[1278] = 0; d_matrix2[1279] = 0;
d_matrix2[1280] = 0; d_matrix2[1281] = 0; d_matrix2[1282] = 1; d_matrix2[1283] = 0; d_matrix2[1284] = 0; d_matrix2[1285] = 0; d_matrix2[1286] = 0; d_matrix2[1287] = 0; d_matrix2[1288] = 1; d_matrix2[1289] = 0; d_matrix2[1290] = 4; d_matrix2[1291] = 0; d_matrix2[1292] = 0; d_matrix2[1293] = 0; d_matrix2[1294] = 1; d_matrix2[1295] = 4; d_matrix2[1296] = 4; d_matrix2[1297] = 0; d_matrix2[1298] = 0; d_matrix2[1299] = 1; d_matrix2[1300] = 0; d_matrix2[1301] = 3; d_matrix2[1302] = 0; d_matrix2[1303] = 0; d_matrix2[1304] = 0; d_matrix2[1305] = 0; d_matrix2[1306] = 3; d_matrix2[1307] = 0; d_matrix2[1308] = 0; d_matrix2[1309] = 0; d_matrix2[1310] = 0; d_matrix2[1311] = 0; d_matrix2[1312] = 0; d_matrix2[1313] = 0; d_matrix2[1314] = 0; d_matrix2[1315] = 0; d_matrix2[1316] = 0; d_matrix2[1317] = 0; d_matrix2[1318] = 0; d_matrix2[1319] = 0; d_matrix2[1320] = 0; d_matrix2[1321] = 0; d_matrix2[1322] = 0; d_matrix2[1323] = 0; d_matrix2[1324] = 0; d_matrix2[1325] = 0; d_matrix2[1326] = 0; d_matrix2[1327] = 0; d_matrix2[1328] = 0; d_matrix2[1329] = 0; d_matrix2[1330] = 0; d_matrix2[1331] = 5; d_matrix2[1332] = 0; d_matrix2[1333] = 0; d_matrix2[1334] = 0; d_matrix2[1335] = 0; d_matrix2[1336] = 0; d_matrix2[1337] = 0; d_matrix2[1338] = 0; d_matrix2[1339] = 0; d_matrix2[1340] = 0; d_matrix2[1341] = 0; d_matrix2[1342] = 0; d_matrix2[1343] = 0; d_matrix2[1344] = 0; d_matrix2[1345] = 0; d_matrix2[1346] = 0; d_matrix2[1347] = 0; d_matrix2[1348] = 0; d_matrix2[1349] = 0; d_matrix2[1350] = 0; d_matrix2[1351] = 0; d_matrix2[1352] = 0; d_matrix2[1353] = 0; d_matrix2[1354] = 0; d_matrix2[1355] = 0; d_matrix2[1356] = 0; d_matrix2[1357] = 0; d_matrix2[1358] = 0; d_matrix2[1359] = 0;
d_matrix2[1360] = 0; d_matrix2[1361] = 0; d_matrix2[1362] = 5; d_matrix2[1363] = 0; d_matrix2[1364] = 0; d_matrix2[1365] = 5; d_matrix2[1366] = 0; d_matrix2[1367] = 0; d_matrix2[1368] = 5; d_matrix2[1369] = 5; d_matrix2[1370] = 5; d_matrix2[1371] = 0; d_matrix2[1372] = 5; d_matrix2[1373] = 5; d_matrix2[1374] = 0; d_matrix2[1375] = 0; d_matrix2[1376] = 5; d_matrix2[1377] = 0; d_matrix2[1378] = 0; d_matrix2[1379] = 0; d_matrix2[1380] = 0; d_matrix2[1381] = 0; d_matrix2[1382] = 0; d_matrix2[1383] = 5; d_matrix2[1384] = 0; d_matrix2[1385] = 0; d_matrix2[1386] = 0; d_matrix2[1387] = 0; d_matrix2[1388] = 2; d_matrix2[1389] = 5; d_matrix2[1390] = 0; d_matrix2[1391] = 0; d_matrix2[1392] = 5; d_matrix2[1393] = 0; d_matrix2[1394] = 2; d_matrix2[1395] = 0; d_matrix2[1396] = 0; d_matrix2[1397] = 0; d_matrix2[1398] = 0; d_matrix2[1399] = 0; d_matrix2[1400] = 5; d_matrix2[1401] = 0; d_matrix2[1402] = 0; d_matrix2[1403] = 0; d_matrix2[1404] = 0; d_matrix2[1405] = 0; d_matrix2[1406] = 0; d_matrix2[1407] = 0; d_matrix2[1408] = 0; d_matrix2[1409] = 0; d_matrix2[1410] = 0; d_matrix2[1411] = 0; d_matrix2[1412] = 4; d_matrix2[1413] = 0; d_matrix2[1414] = 0; d_matrix2[1415] = 0; d_matrix2[1416] = 5; d_matrix2[1417] = 5; d_matrix2[1418] = 0; d_matrix2[1419] = 4; d_matrix2[1420] = 0; d_matrix2[1421] = 0; d_matrix2[1422] = 0; d_matrix2[1423] = 0; d_matrix2[1424] = 0; d_matrix2[1425] = 5; d_matrix2[1426] = 0; d_matrix2[1427] = 4; d_matrix2[1428] = 0; d_matrix2[1429] = 0; d_matrix2[1430] = 5; d_matrix2[1431] = 4; d_matrix2[1432] = 5; d_matrix2[1433] = 0; d_matrix2[1434] = 0; d_matrix2[1435] = 0; d_matrix2[1436] = 0; d_matrix2[1437] = 5; d_matrix2[1438] = 0; d_matrix2[1439] = 0;
d_matrix2[1440] = 0; d_matrix2[1441] = 0; d_matrix2[1442] = 4; d_matrix2[1443] = 0; d_matrix2[1444] = 0; d_matrix2[1445] = 0; d_matrix2[1446] = 0; d_matrix2[1447] = 0; d_matrix2[1448] = 4; d_matrix2[1449] = 0; d_matrix2[1450] = 3; d_matrix2[1451] = 0; d_matrix2[1452] = 0; d_matrix2[1453] = 0; d_matrix2[1454] = 3; d_matrix2[1455] = 0; d_matrix2[1456] = 0; d_matrix2[1457] = 0; d_matrix2[1458] = 0; d_matrix2[1459] = 0; d_matrix2[1460] = 0; d_matrix2[1461] = 0; d_matrix2[1462] = 0; d_matrix2[1463] = 0; d_matrix2[1464] = 0; d_matrix2[1465] = 0; d_matrix2[1466] = 0; d_matrix2[1467] = 0; d_matrix2[1468] = 0; d_matrix2[1469] = 0; d_matrix2[1470] = 0; d_matrix2[1471] = 0; d_matrix2[1472] = 0; d_matrix2[1473] = 0; d_matrix2[1474] = 0; d_matrix2[1475] = 0; d_matrix2[1476] = 0; d_matrix2[1477] = 0; d_matrix2[1478] = 0; d_matrix2[1479] = 0; d_matrix2[1480] = 0; d_matrix2[1481] = 0; d_matrix2[1482] = 0; d_matrix2[1483] = 0; d_matrix2[1484] = 0; d_matrix2[1485] = 0; d_matrix2[1486] = 0; d_matrix2[1487] = 0; d_matrix2[1488] = 0; d_matrix2[1489] = 0; d_matrix2[1490] = 0; d_matrix2[1491] = 0; d_matrix2[1492] = 0; d_matrix2[1493] = 0; d_matrix2[1494] = 0; d_matrix2[1495] = 0; d_matrix2[1496] = 0; d_matrix2[1497] = 0; d_matrix2[1498] = 0; d_matrix2[1499] = 0; d_matrix2[1500] = 0; d_matrix2[1501] = 0; d_matrix2[1502] = 0; d_matrix2[1503] = 0; d_matrix2[1504] = 0; d_matrix2[1505] = 0; d_matrix2[1506] = 0; d_matrix2[1507] = 0; d_matrix2[1508] = 0; d_matrix2[1509] = 0; d_matrix2[1510] = 0; d_matrix2[1511] = 0; d_matrix2[1512] = 0; d_matrix2[1513] = 0; d_matrix2[1514] = 0; d_matrix2[1515] = 0; d_matrix2[1516] = 0; d_matrix2[1517] = 0; d_matrix2[1518] = 0; d_matrix2[1519] = 0;
d_matrix2[1520] = 0; d_matrix2[1521] = 0; d_matrix2[1522] = 5; d_matrix2[1523] = 0; d_matrix2[1524] = 0; d_matrix2[1525] = 3; d_matrix2[1526] = 0; d_matrix2[1527] = 5; d_matrix2[1528] = 0; d_matrix2[1529] = 5; d_matrix2[1530] = 5; d_matrix2[1531] = 0; d_matrix2[1532] = 0; d_matrix2[1533] = 5; d_matrix2[1534] = 5; d_matrix2[1535] = 5; d_matrix2[1536] = 4; d_matrix2[1537] = 0; d_matrix2[1538] = 0; d_matrix2[1539] = 0; d_matrix2[1540] = 3; d_matrix2[1541] = 0; d_matrix2[1542] = 0; d_matrix2[1543] = 5; d_matrix2[1544] = 4; d_matrix2[1545] = 0; d_matrix2[1546] = 3; d_matrix2[1547] = 4; d_matrix2[1548] = 0; d_matrix2[1549] = 3; d_matrix2[1550] = 0; d_matrix2[1551] = 0; d_matrix2[1552] = 0; d_matrix2[1553] = 2; d_matrix2[1554] = 0; d_matrix2[1555] = 0; d_matrix2[1556] = 0; d_matrix2[1557] = 0; d_matrix2[1558] = 0; d_matrix2[1559] = 0; d_matrix2[1560] = 0; d_matrix2[1561] = 0; d_matrix2[1562] = 0; d_matrix2[1563] = 3; d_matrix2[1564] = 0; d_matrix2[1565] = 0; d_matrix2[1566] = 5; d_matrix2[1567] = 0; d_matrix2[1568] = 3; d_matrix2[1569] = 4; d_matrix2[1570] = 0; d_matrix2[1571] = 4; d_matrix2[1572] = 0; d_matrix2[1573] = 5; d_matrix2[1574] = 0; d_matrix2[1575] = 0; d_matrix2[1576] = 0; d_matrix2[1577] = 5; d_matrix2[1578] = 4; d_matrix2[1579] = 4; d_matrix2[1580] = 4; d_matrix2[1581] = 4; d_matrix2[1582] = 4; d_matrix2[1583] = 0; d_matrix2[1584] = 0; d_matrix2[1585] = 5; d_matrix2[1586] = 5; d_matrix2[1587] = 3; d_matrix2[1588] = 0; d_matrix2[1589] = 0; d_matrix2[1590] = 3; d_matrix2[1591] = 4; d_matrix2[1592] = 4; d_matrix2[1593] = 3; d_matrix2[1594] = 0; d_matrix2[1595] = 0; d_matrix2[1596] = 0; d_matrix2[1597] = 0; d_matrix2[1598] = 0; d_matrix2[1599] = 0;
d_matrix2[1600] = 0; d_matrix2[1601] = 0; d_matrix2[1602] = 0; d_matrix2[1603] = 0; d_matrix2[1604] = 0; d_matrix2[1605] = 4; d_matrix2[1606] = 0; d_matrix2[1607] = 0; d_matrix2[1608] = 0; d_matrix2[1609] = 5; d_matrix2[1610] = 0; d_matrix2[1611] = 0; d_matrix2[1612] = 0; d_matrix2[1613] = 0; d_matrix2[1614] = 0; d_matrix2[1615] = 0; d_matrix2[1616] = 0; d_matrix2[1617] = 0; d_matrix2[1618] = 0; d_matrix2[1619] = 0; d_matrix2[1620] = 0; d_matrix2[1621] = 0; d_matrix2[1622] = 0; d_matrix2[1623] = 0; d_matrix2[1624] = 0; d_matrix2[1625] = 0; d_matrix2[1626] = 0; d_matrix2[1627] = 0; d_matrix2[1628] = 0; d_matrix2[1629] = 0; d_matrix2[1630] = 0; d_matrix2[1631] = 0; d_matrix2[1632] = 0; d_matrix2[1633] = 0; d_matrix2[1634] = 0; d_matrix2[1635] = 0; d_matrix2[1636] = 0; d_matrix2[1637] = 0; d_matrix2[1638] = 0; d_matrix2[1639] = 0; d_matrix2[1640] = 0; d_matrix2[1641] = 0; d_matrix2[1642] = 0; d_matrix2[1643] = 0; d_matrix2[1644] = 0; d_matrix2[1645] = 0; d_matrix2[1646] = 0; d_matrix2[1647] = 0; d_matrix2[1648] = 0; d_matrix2[1649] = 0; d_matrix2[1650] = 0; d_matrix2[1651] = 0; d_matrix2[1652] = 0; d_matrix2[1653] = 0; d_matrix2[1654] = 0; d_matrix2[1655] = 0; d_matrix2[1656] = 0; d_matrix2[1657] = 0; d_matrix2[1658] = 0; d_matrix2[1659] = 0; d_matrix2[1660] = 0; d_matrix2[1661] = 0; d_matrix2[1662] = 0; d_matrix2[1663] = 0; d_matrix2[1664] = 0; d_matrix2[1665] = 0; d_matrix2[1666] = 0; d_matrix2[1667] = 0; d_matrix2[1668] = 0; d_matrix2[1669] = 0; d_matrix2[1670] = 0; d_matrix2[1671] = 0; d_matrix2[1672] = 0; d_matrix2[1673] = 0; d_matrix2[1674] = 0; d_matrix2[1675] = 0; d_matrix2[1676] = 0; d_matrix2[1677] = 0; d_matrix2[1678] = 0; d_matrix2[1679] = 0;
d_matrix2[1680] = 0; d_matrix2[1681] = 0; d_matrix2[1682] = 3; d_matrix2[1683] = 0; d_matrix2[1684] = 0; d_matrix2[1685] = 0; d_matrix2[1686] = 0; d_matrix2[1687] = 0; d_matrix2[1688] = 0; d_matrix2[1689] = 0; d_matrix2[1690] = 0; d_matrix2[1691] = 0; d_matrix2[1692] = 2; d_matrix2[1693] = 0; d_matrix2[1694] = 0; d_matrix2[1695] = 0; d_matrix2[1696] = 4; d_matrix2[1697] = 0; d_matrix2[1698] = 0; d_matrix2[1699] = 0; d_matrix2[1700] = 0; d_matrix2[1701] = 0; d_matrix2[1702] = 0; d_matrix2[1703] = 5; d_matrix2[1704] = 0; d_matrix2[1705] = 0; d_matrix2[1706] = 0; d_matrix2[1707] = 0; d_matrix2[1708] = 0; d_matrix2[1709] = 0; d_matrix2[1710] = 0; d_matrix2[1711] = 0; d_matrix2[1712] = 0; d_matrix2[1713] = 0; d_matrix2[1714] = 0; d_matrix2[1715] = 0; d_matrix2[1716] = 0; d_matrix2[1717] = 0; d_matrix2[1718] = 0; d_matrix2[1719] = 0; d_matrix2[1720] = 0; d_matrix2[1721] = 0; d_matrix2[1722] = 0; d_matrix2[1723] = 0; d_matrix2[1724] = 0; d_matrix2[1725] = 0; d_matrix2[1726] = 0; d_matrix2[1727] = 0; d_matrix2[1728] = 0; d_matrix2[1729] = 0; d_matrix2[1730] = 0; d_matrix2[1731] = 3; d_matrix2[1732] = 0; d_matrix2[1733] = 0; d_matrix2[1734] = 0; d_matrix2[1735] = 0; d_matrix2[1736] = 0; d_matrix2[1737] = 0; d_matrix2[1738] = 0; d_matrix2[1739] = 0; d_matrix2[1740] = 0; d_matrix2[1741] = 0; d_matrix2[1742] = 0; d_matrix2[1743] = 0; d_matrix2[1744] = 0; d_matrix2[1745] = 0; d_matrix2[1746] = 0; d_matrix2[1747] = 0; d_matrix2[1748] = 0; d_matrix2[1749] = 0; d_matrix2[1750] = 1; d_matrix2[1751] = 0; d_matrix2[1752] = 0; d_matrix2[1753] = 0; d_matrix2[1754] = 0; d_matrix2[1755] = 0; d_matrix2[1756] = 0; d_matrix2[1757] = 0; d_matrix2[1758] = 0; d_matrix2[1759] = 0;
d_matrix2[1760] = 0; d_matrix2[1761] = 0; d_matrix2[1762] = 5; d_matrix2[1763] = 0; d_matrix2[1764] = 0; d_matrix2[1765] = 0; d_matrix2[1766] = 2; d_matrix2[1767] = 0; d_matrix2[1768] = 5; d_matrix2[1769] = 0; d_matrix2[1770] = 5; d_matrix2[1771] = 0; d_matrix2[1772] = 0; d_matrix2[1773] = 0; d_matrix2[1774] = 0; d_matrix2[1775] = 0; d_matrix2[1776] = 4; d_matrix2[1777] = 0; d_matrix2[1778] = 4; d_matrix2[1779] = 0; d_matrix2[1780] = 0; d_matrix2[1781] = 0; d_matrix2[1782] = 0; d_matrix2[1783] = 0; d_matrix2[1784] = 0; d_matrix2[1785] = 0; d_matrix2[1786] = 0; d_matrix2[1787] = 0; d_matrix2[1788] = 0; d_matrix2[1789] = 0; d_matrix2[1790] = 0; d_matrix2[1791] = 0; d_matrix2[1792] = 0; d_matrix2[1793] = 0; d_matrix2[1794] = 0; d_matrix2[1795] = 0; d_matrix2[1796] = 0; d_matrix2[1797] = 0; d_matrix2[1798] = 0; d_matrix2[1799] = 0; d_matrix2[1800] = 0; d_matrix2[1801] = 0; d_matrix2[1802] = 0; d_matrix2[1803] = 0; d_matrix2[1804] = 0; d_matrix2[1805] = 0; d_matrix2[1806] = 0; d_matrix2[1807] = 0; d_matrix2[1808] = 0; d_matrix2[1809] = 0; d_matrix2[1810] = 0; d_matrix2[1811] = 3; d_matrix2[1812] = 0; d_matrix2[1813] = 0; d_matrix2[1814] = 4; d_matrix2[1815] = 0; d_matrix2[1816] = 0; d_matrix2[1817] = 5; d_matrix2[1818] = 0; d_matrix2[1819] = 0; d_matrix2[1820] = 0; d_matrix2[1821] = 0; d_matrix2[1822] = 0; d_matrix2[1823] = 0; d_matrix2[1824] = 0; d_matrix2[1825] = 0; d_matrix2[1826] = 0; d_matrix2[1827] = 0; d_matrix2[1828] = 0; d_matrix2[1829] = 0; d_matrix2[1830] = 0; d_matrix2[1831] = 0; d_matrix2[1832] = 0; d_matrix2[1833] = 0; d_matrix2[1834] = 0; d_matrix2[1835] = 0; d_matrix2[1836] = 0; d_matrix2[1837] = 0; d_matrix2[1838] = 0; d_matrix2[1839] = 0;
d_matrix2[1840] = 0; d_matrix2[1841] = 0; d_matrix2[1842] = 0; d_matrix2[1843] = 2; d_matrix2[1844] = 0; d_matrix2[1845] = 5; d_matrix2[1846] = 0; d_matrix2[1847] = 0; d_matrix2[1848] = 0; d_matrix2[1849] = 0; d_matrix2[1850] = 0; d_matrix2[1851] = 0; d_matrix2[1852] = 0; d_matrix2[1853] = 0; d_matrix2[1854] = 0; d_matrix2[1855] = 0; d_matrix2[1856] = 0; d_matrix2[1857] = 0; d_matrix2[1858] = 4; d_matrix2[1859] = 0; d_matrix2[1860] = 0; d_matrix2[1861] = 0; d_matrix2[1862] = 4; d_matrix2[1863] = 0; d_matrix2[1864] = 0; d_matrix2[1865] = 5; d_matrix2[1866] = 0; d_matrix2[1867] = 0; d_matrix2[1868] = 0; d_matrix2[1869] = 0; d_matrix2[1870] = 1; d_matrix2[1871] = 0; d_matrix2[1872] = 0; d_matrix2[1873] = 0; d_matrix2[1874] = 0; d_matrix2[1875] = 0; d_matrix2[1876] = 0; d_matrix2[1877] = 0; d_matrix2[1878] = 0; d_matrix2[1879] = 0; d_matrix2[1880] = 0; d_matrix2[1881] = 0; d_matrix2[1882] = 0; d_matrix2[1883] = 0; d_matrix2[1884] = 0; d_matrix2[1885] = 0; d_matrix2[1886] = 0; d_matrix2[1887] = 0; d_matrix2[1888] = 0; d_matrix2[1889] = 0; d_matrix2[1890] = 0; d_matrix2[1891] = 5; d_matrix2[1892] = 0; d_matrix2[1893] = 0; d_matrix2[1894] = 3; d_matrix2[1895] = 0; d_matrix2[1896] = 0; d_matrix2[1897] = 0; d_matrix2[1898] = 0; d_matrix2[1899] = 0; d_matrix2[1900] = 0; d_matrix2[1901] = 0; d_matrix2[1902] = 0; d_matrix2[1903] = 4; d_matrix2[1904] = 0; d_matrix2[1905] = 0; d_matrix2[1906] = 0; d_matrix2[1907] = 0; d_matrix2[1908] = 0; d_matrix2[1909] = 4; d_matrix2[1910] = 0; d_matrix2[1911] = 0; d_matrix2[1912] = 0; d_matrix2[1913] = 0; d_matrix2[1914] = 0; d_matrix2[1915] = 0; d_matrix2[1916] = 0; d_matrix2[1917] = 0; d_matrix2[1918] = 0; d_matrix2[1919] = 0;
d_matrix2[1920] = 0; d_matrix2[1921] = 0; d_matrix2[1922] = 5; d_matrix2[1923] = 0; d_matrix2[1924] = 0; d_matrix2[1925] = 0; d_matrix2[1926] = 0; d_matrix2[1927] = 0; d_matrix2[1928] = 4; d_matrix2[1929] = 4; d_matrix2[1930] = 0; d_matrix2[1931] = 0; d_matrix2[1932] = 0; d_matrix2[1933] = 0; d_matrix2[1934] = 4; d_matrix2[1935] = 4; d_matrix2[1936] = 0; d_matrix2[1937] = 0; d_matrix2[1938] = 0; d_matrix2[1939] = 0; d_matrix2[1940] = 4; d_matrix2[1941] = 0; d_matrix2[1942] = 0; d_matrix2[1943] = 0; d_matrix2[1944] = 0; d_matrix2[1945] = 0; d_matrix2[1946] = 0; d_matrix2[1947] = 0; d_matrix2[1948] = 0; d_matrix2[1949] = 3; d_matrix2[1950] = 0; d_matrix2[1951] = 0; d_matrix2[1952] = 0; d_matrix2[1953] = 3; d_matrix2[1954] = 0; d_matrix2[1955] = 0; d_matrix2[1956] = 0; d_matrix2[1957] = 0; d_matrix2[1958] = 0; d_matrix2[1959] = 0; d_matrix2[1960] = 0; d_matrix2[1961] = 0; d_matrix2[1962] = 0; d_matrix2[1963] = 0; d_matrix2[1964] = 0; d_matrix2[1965] = 0; d_matrix2[1966] = 0; d_matrix2[1967] = 0; d_matrix2[1968] = 0; d_matrix2[1969] = 0; d_matrix2[1970] = 0; d_matrix2[1971] = 4; d_matrix2[1972] = 0; d_matrix2[1973] = 0; d_matrix2[1974] = 0; d_matrix2[1975] = 0; d_matrix2[1976] = 4; d_matrix2[1977] = 4; d_matrix2[1978] = 0; d_matrix2[1979] = 0; d_matrix2[1980] = 4; d_matrix2[1981] = 0; d_matrix2[1982] = 0; d_matrix2[1983] = 3; d_matrix2[1984] = 0; d_matrix2[1985] = 0; d_matrix2[1986] = 0; d_matrix2[1987] = 0; d_matrix2[1988] = 0; d_matrix2[1989] = 0; d_matrix2[1990] = 0; d_matrix2[1991] = 2; d_matrix2[1992] = 3; d_matrix2[1993] = 0; d_matrix2[1994] = 3; d_matrix2[1995] = 0; d_matrix2[1996] = 0; d_matrix2[1997] = 0; d_matrix2[1998] = 0; d_matrix2[1999] = 0;
d_matrix2[2000] = 0; d_matrix2[2001] = 0; d_matrix2[2002] = 0; d_matrix2[2003] = 0; d_matrix2[2004] = 0; d_matrix2[2005] = 0; d_matrix2[2006] = 0; d_matrix2[2007] = 0; d_matrix2[2008] = 4; d_matrix2[2009] = 5; d_matrix2[2010] = 5; d_matrix2[2011] = 0; d_matrix2[2012] = 5; d_matrix2[2013] = 5; d_matrix2[2014] = 0; d_matrix2[2015] = 0; d_matrix2[2016] = 0; d_matrix2[2017] = 0; d_matrix2[2018] = 0; d_matrix2[2019] = 0; d_matrix2[2020] = 0; d_matrix2[2021] = 0; d_matrix2[2022] = 0; d_matrix2[2023] = 0; d_matrix2[2024] = 0; d_matrix2[2025] = 0; d_matrix2[2026] = 4; d_matrix2[2027] = 0; d_matrix2[2028] = 0; d_matrix2[2029] = 0; d_matrix2[2030] = 0; d_matrix2[2031] = 0; d_matrix2[2032] = 0; d_matrix2[2033] = 0; d_matrix2[2034] = 0; d_matrix2[2035] = 0; d_matrix2[2036] = 0; d_matrix2[2037] = 0; d_matrix2[2038] = 0; d_matrix2[2039] = 0; d_matrix2[2040] = 0; d_matrix2[2041] = 0; d_matrix2[2042] = 5; d_matrix2[2043] = 0; d_matrix2[2044] = 0; d_matrix2[2045] = 0; d_matrix2[2046] = 0; d_matrix2[2047] = 0; d_matrix2[2048] = 0; d_matrix2[2049] = 0; d_matrix2[2050] = 0; d_matrix2[2051] = 0; d_matrix2[2052] = 0; d_matrix2[2053] = 0; d_matrix2[2054] = 0; d_matrix2[2055] = 0; d_matrix2[2056] = 5; d_matrix2[2057] = 4; d_matrix2[2058] = 0; d_matrix2[2059] = 3; d_matrix2[2060] = 0; d_matrix2[2061] = 0; d_matrix2[2062] = 0; d_matrix2[2063] = 0; d_matrix2[2064] = 0; d_matrix2[2065] = 5; d_matrix2[2066] = 0; d_matrix2[2067] = 0; d_matrix2[2068] = 0; d_matrix2[2069] = 0; d_matrix2[2070] = 5; d_matrix2[2071] = 0; d_matrix2[2072] = 5; d_matrix2[2073] = 0; d_matrix2[2074] = 0; d_matrix2[2075] = 0; d_matrix2[2076] = 0; d_matrix2[2077] = 0; d_matrix2[2078] = 0; d_matrix2[2079] = 0;
d_matrix2[2080] = 0; d_matrix2[2081] = 0; d_matrix2[2082] = 5; d_matrix2[2083] = 0; d_matrix2[2084] = 0; d_matrix2[2085] = 0; d_matrix2[2086] = 0; d_matrix2[2087] = 0; d_matrix2[2088] = 4; d_matrix2[2089] = 4; d_matrix2[2090] = 0; d_matrix2[2091] = 0; d_matrix2[2092] = 0; d_matrix2[2093] = 0; d_matrix2[2094] = 4; d_matrix2[2095] = 0; d_matrix2[2096] = 0; d_matrix2[2097] = 0; d_matrix2[2098] = 0; d_matrix2[2099] = 0; d_matrix2[2100] = 0; d_matrix2[2101] = 0; d_matrix2[2102] = 0; d_matrix2[2103] = 0; d_matrix2[2104] = 4; d_matrix2[2105] = 0; d_matrix2[2106] = 5; d_matrix2[2107] = 0; d_matrix2[2108] = 0; d_matrix2[2109] = 0; d_matrix2[2110] = 0; d_matrix2[2111] = 0; d_matrix2[2112] = 0; d_matrix2[2113] = 0; d_matrix2[2114] = 0; d_matrix2[2115] = 0; d_matrix2[2116] = 0; d_matrix2[2117] = 0; d_matrix2[2118] = 0; d_matrix2[2119] = 0; d_matrix2[2120] = 0; d_matrix2[2121] = 0; d_matrix2[2122] = 0; d_matrix2[2123] = 0; d_matrix2[2124] = 0; d_matrix2[2125] = 0; d_matrix2[2126] = 0; d_matrix2[2127] = 0; d_matrix2[2128] = 0; d_matrix2[2129] = 0; d_matrix2[2130] = 0; d_matrix2[2131] = 5; d_matrix2[2132] = 0; d_matrix2[2133] = 0; d_matrix2[2134] = 0; d_matrix2[2135] = 0; d_matrix2[2136] = 0; d_matrix2[2137] = 0; d_matrix2[2138] = 0; d_matrix2[2139] = 0; d_matrix2[2140] = 0; d_matrix2[2141] = 0; d_matrix2[2142] = 0; d_matrix2[2143] = 0; d_matrix2[2144] = 0; d_matrix2[2145] = 0; d_matrix2[2146] = 0; d_matrix2[2147] = 0; d_matrix2[2148] = 0; d_matrix2[2149] = 0; d_matrix2[2150] = 0; d_matrix2[2151] = 0; d_matrix2[2152] = 0; d_matrix2[2153] = 0; d_matrix2[2154] = 0; d_matrix2[2155] = 0; d_matrix2[2156] = 0; d_matrix2[2157] = 0; d_matrix2[2158] = 0; d_matrix2[2159] = 0;
d_matrix2[2160] = 0; d_matrix2[2161] = 0; d_matrix2[2162] = 3; d_matrix2[2163] = 0; d_matrix2[2164] = 0; d_matrix2[2165] = 0; d_matrix2[2166] = 0; d_matrix2[2167] = 0; d_matrix2[2168] = 3; d_matrix2[2169] = 0; d_matrix2[2170] = 4; d_matrix2[2171] = 0; d_matrix2[2172] = 0; d_matrix2[2173] = 0; d_matrix2[2174] = 3; d_matrix2[2175] = 3; d_matrix2[2176] = 4; d_matrix2[2177] = 0; d_matrix2[2178] = 0; d_matrix2[2179] = 0; d_matrix2[2180] = 0; d_matrix2[2181] = 0; d_matrix2[2182] = 0; d_matrix2[2183] = 0; d_matrix2[2184] = 0; d_matrix2[2185] = 3; d_matrix2[2186] = 3; d_matrix2[2187] = 0; d_matrix2[2188] = 0; d_matrix2[2189] = 0; d_matrix2[2190] = 0; d_matrix2[2191] = 0; d_matrix2[2192] = 0; d_matrix2[2193] = 0; d_matrix2[2194] = 0; d_matrix2[2195] = 0; d_matrix2[2196] = 0; d_matrix2[2197] = 0; d_matrix2[2198] = 0; d_matrix2[2199] = 0; d_matrix2[2200] = 0; d_matrix2[2201] = 0; d_matrix2[2202] = 0; d_matrix2[2203] = 0; d_matrix2[2204] = 0; d_matrix2[2205] = 0; d_matrix2[2206] = 0; d_matrix2[2207] = 0; d_matrix2[2208] = 0; d_matrix2[2209] = 0; d_matrix2[2210] = 0; d_matrix2[2211] = 4; d_matrix2[2212] = 0; d_matrix2[2213] = 0; d_matrix2[2214] = 0; d_matrix2[2215] = 0; d_matrix2[2216] = 0; d_matrix2[2217] = 0; d_matrix2[2218] = 0; d_matrix2[2219] = 0; d_matrix2[2220] = 0; d_matrix2[2221] = 0; d_matrix2[2222] = 0; d_matrix2[2223] = 0; d_matrix2[2224] = 0; d_matrix2[2225] = 0; d_matrix2[2226] = 0; d_matrix2[2227] = 0; d_matrix2[2228] = 0; d_matrix2[2229] = 0; d_matrix2[2230] = 0; d_matrix2[2231] = 0; d_matrix2[2232] = 0; d_matrix2[2233] = 0; d_matrix2[2234] = 0; d_matrix2[2235] = 0; d_matrix2[2236] = 0; d_matrix2[2237] = 0; d_matrix2[2238] = 0; d_matrix2[2239] = 0;
d_matrix2[2240] = 0; d_matrix2[2241] = 0; d_matrix2[2242] = 0; d_matrix2[2243] = 0; d_matrix2[2244] = 0; d_matrix2[2245] = 0; d_matrix2[2246] = 0; d_matrix2[2247] = 0; d_matrix2[2248] = 0; d_matrix2[2249] = 0; d_matrix2[2250] = 4; d_matrix2[2251] = 0; d_matrix2[2252] = 0; d_matrix2[2253] = 0; d_matrix2[2254] = 0; d_matrix2[2255] = 0; d_matrix2[2256] = 0; d_matrix2[2257] = 0; d_matrix2[2258] = 0; d_matrix2[2259] = 0; d_matrix2[2260] = 0; d_matrix2[2261] = 0; d_matrix2[2262] = 0; d_matrix2[2263] = 0; d_matrix2[2264] = 0; d_matrix2[2265] = 0; d_matrix2[2266] = 0; d_matrix2[2267] = 0; d_matrix2[2268] = 0; d_matrix2[2269] = 0; d_matrix2[2270] = 0; d_matrix2[2271] = 0; d_matrix2[2272] = 0; d_matrix2[2273] = 0; d_matrix2[2274] = 0; d_matrix2[2275] = 0; d_matrix2[2276] = 0; d_matrix2[2277] = 0; d_matrix2[2278] = 0; d_matrix2[2279] = 0; d_matrix2[2280] = 0; d_matrix2[2281] = 0; d_matrix2[2282] = 0; d_matrix2[2283] = 0; d_matrix2[2284] = 0; d_matrix2[2285] = 0; d_matrix2[2286] = 0; d_matrix2[2287] = 0; d_matrix2[2288] = 0; d_matrix2[2289] = 0; d_matrix2[2290] = 0; d_matrix2[2291] = 3; d_matrix2[2292] = 0; d_matrix2[2293] = 0; d_matrix2[2294] = 0; d_matrix2[2295] = 0; d_matrix2[2296] = 0; d_matrix2[2297] = 0; d_matrix2[2298] = 0; d_matrix2[2299] = 0; d_matrix2[2300] = 0; d_matrix2[2301] = 0; d_matrix2[2302] = 0; d_matrix2[2303] = 0; d_matrix2[2304] = 0; d_matrix2[2305] = 0; d_matrix2[2306] = 0; d_matrix2[2307] = 0; d_matrix2[2308] = 0; d_matrix2[2309] = 0; d_matrix2[2310] = 0; d_matrix2[2311] = 0; d_matrix2[2312] = 0; d_matrix2[2313] = 0; d_matrix2[2314] = 0; d_matrix2[2315] = 0; d_matrix2[2316] = 0; d_matrix2[2317] = 0; d_matrix2[2318] = 0; d_matrix2[2319] = 0;
d_matrix2[2320] = 0; d_matrix2[2321] = 0; d_matrix2[2322] = 0; d_matrix2[2323] = 0; d_matrix2[2324] = 0; d_matrix2[2325] = 0; d_matrix2[2326] = 3; d_matrix2[2327] = 0; d_matrix2[2328] = 5; d_matrix2[2329] = 0; d_matrix2[2330] = 0; d_matrix2[2331] = 0; d_matrix2[2332] = 4; d_matrix2[2333] = 4; d_matrix2[2334] = 0; d_matrix2[2335] = 0; d_matrix2[2336] = 0; d_matrix2[2337] = 0; d_matrix2[2338] = 0; d_matrix2[2339] = 0; d_matrix2[2340] = 0; d_matrix2[2341] = 0; d_matrix2[2342] = 0; d_matrix2[2343] = 0; d_matrix2[2344] = 0; d_matrix2[2345] = 0; d_matrix2[2346] = 0; d_matrix2[2347] = 0; d_matrix2[2348] = 0; d_matrix2[2349] = 4; d_matrix2[2350] = 0; d_matrix2[2351] = 0; d_matrix2[2352] = 4; d_matrix2[2353] = 0; d_matrix2[2354] = 0; d_matrix2[2355] = 0; d_matrix2[2356] = 0; d_matrix2[2357] = 0; d_matrix2[2358] = 0; d_matrix2[2359] = 0; d_matrix2[2360] = 0; d_matrix2[2361] = 0; d_matrix2[2362] = 0; d_matrix2[2363] = 0; d_matrix2[2364] = 0; d_matrix2[2365] = 0; d_matrix2[2366] = 0; d_matrix2[2367] = 0; d_matrix2[2368] = 0; d_matrix2[2369] = 0; d_matrix2[2370] = 0; d_matrix2[2371] = 4; d_matrix2[2372] = 0; d_matrix2[2373] = 0; d_matrix2[2374] = 0; d_matrix2[2375] = 0; d_matrix2[2376] = 0; d_matrix2[2377] = 5; d_matrix2[2378] = 0; d_matrix2[2379] = 0; d_matrix2[2380] = 0; d_matrix2[2381] = 0; d_matrix2[2382] = 0; d_matrix2[2383] = 0; d_matrix2[2384] = 0; d_matrix2[2385] = 0; d_matrix2[2386] = 0; d_matrix2[2387] = 0; d_matrix2[2388] = 0; d_matrix2[2389] = 0; d_matrix2[2390] = 0; d_matrix2[2391] = 4; d_matrix2[2392] = 0; d_matrix2[2393] = 0; d_matrix2[2394] = 0; d_matrix2[2395] = 0; d_matrix2[2396] = 0; d_matrix2[2397] = 0; d_matrix2[2398] = 0; d_matrix2[2399] = 0;
d_matrix2[2400] = 0; d_matrix2[2401] = 0; d_matrix2[2402] = 0; d_matrix2[2403] = 0; d_matrix2[2404] = 0; d_matrix2[2405] = 0; d_matrix2[2406] = 0; d_matrix2[2407] = 0; d_matrix2[2408] = 0; d_matrix2[2409] = 0; d_matrix2[2410] = 0; d_matrix2[2411] = 0; d_matrix2[2412] = 0; d_matrix2[2413] = 5; d_matrix2[2414] = 0; d_matrix2[2415] = 0; d_matrix2[2416] = 0; d_matrix2[2417] = 0; d_matrix2[2418] = 0; d_matrix2[2419] = 0; d_matrix2[2420] = 0; d_matrix2[2421] = 0; d_matrix2[2422] = 0; d_matrix2[2423] = 0; d_matrix2[2424] = 0; d_matrix2[2425] = 0; d_matrix2[2426] = 0; d_matrix2[2427] = 0; d_matrix2[2428] = 0; d_matrix2[2429] = 0; d_matrix2[2430] = 0; d_matrix2[2431] = 0; d_matrix2[2432] = 0; d_matrix2[2433] = 0; d_matrix2[2434] = 0; d_matrix2[2435] = 0; d_matrix2[2436] = 0; d_matrix2[2437] = 0; d_matrix2[2438] = 0; d_matrix2[2439] = 0; d_matrix2[2440] = 0; d_matrix2[2441] = 0; d_matrix2[2442] = 0; d_matrix2[2443] = 0; d_matrix2[2444] = 0; d_matrix2[2445] = 0; d_matrix2[2446] = 0; d_matrix2[2447] = 0; d_matrix2[2448] = 0; d_matrix2[2449] = 0; d_matrix2[2450] = 0; d_matrix2[2451] = 0; d_matrix2[2452] = 0; d_matrix2[2453] = 0; d_matrix2[2454] = 0; d_matrix2[2455] = 0; d_matrix2[2456] = 0; d_matrix2[2457] = 0; d_matrix2[2458] = 0; d_matrix2[2459] = 0; d_matrix2[2460] = 0; d_matrix2[2461] = 0; d_matrix2[2462] = 0; d_matrix2[2463] = 0; d_matrix2[2464] = 0; d_matrix2[2465] = 0; d_matrix2[2466] = 0; d_matrix2[2467] = 0; d_matrix2[2468] = 0; d_matrix2[2469] = 0; d_matrix2[2470] = 0; d_matrix2[2471] = 0; d_matrix2[2472] = 0; d_matrix2[2473] = 0; d_matrix2[2474] = 0; d_matrix2[2475] = 0; d_matrix2[2476] = 0; d_matrix2[2477] = 0; d_matrix2[2478] = 0; d_matrix2[2479] = 0;
d_matrix2[2480] = 0; d_matrix2[2481] = 0; d_matrix2[2482] = 0; d_matrix2[2483] = 3; d_matrix2[2484] = 0; d_matrix2[2485] = 0; d_matrix2[2486] = 0; d_matrix2[2487] = 0; d_matrix2[2488] = 4; d_matrix2[2489] = 0; d_matrix2[2490] = 0; d_matrix2[2491] = 0; d_matrix2[2492] = 0; d_matrix2[2493] = 0; d_matrix2[2494] = 0; d_matrix2[2495] = 0; d_matrix2[2496] = 0; d_matrix2[2497] = 0; d_matrix2[2498] = 0; d_matrix2[2499] = 0; d_matrix2[2500] = 0; d_matrix2[2501] = 0; d_matrix2[2502] = 0; d_matrix2[2503] = 0; d_matrix2[2504] = 0; d_matrix2[2505] = 0; d_matrix2[2506] = 0; d_matrix2[2507] = 0; d_matrix2[2508] = 0; d_matrix2[2509] = 4; d_matrix2[2510] = 3; d_matrix2[2511] = 0; d_matrix2[2512] = 0; d_matrix2[2513] = 0; d_matrix2[2514] = 0; d_matrix2[2515] = 0; d_matrix2[2516] = 0; d_matrix2[2517] = 0; d_matrix2[2518] = 0; d_matrix2[2519] = 0; d_matrix2[2520] = 0; d_matrix2[2521] = 0; d_matrix2[2522] = 0; d_matrix2[2523] = 0; d_matrix2[2524] = 0; d_matrix2[2525] = 0; d_matrix2[2526] = 0; d_matrix2[2527] = 0; d_matrix2[2528] = 0; d_matrix2[2529] = 0; d_matrix2[2530] = 0; d_matrix2[2531] = 3; d_matrix2[2532] = 0; d_matrix2[2533] = 0; d_matrix2[2534] = 0; d_matrix2[2535] = 0; d_matrix2[2536] = 0; d_matrix2[2537] = 0; d_matrix2[2538] = 0; d_matrix2[2539] = 0; d_matrix2[2540] = 0; d_matrix2[2541] = 0; d_matrix2[2542] = 0; d_matrix2[2543] = 0; d_matrix2[2544] = 0; d_matrix2[2545] = 0; d_matrix2[2546] = 0; d_matrix2[2547] = 0; d_matrix2[2548] = 0; d_matrix2[2549] = 0; d_matrix2[2550] = 5; d_matrix2[2551] = 0; d_matrix2[2552] = 0; d_matrix2[2553] = 0; d_matrix2[2554] = 0; d_matrix2[2555] = 0; d_matrix2[2556] = 0; d_matrix2[2557] = 0; d_matrix2[2558] = 0; d_matrix2[2559] = 0;
d_matrix2[2560] = 0; d_matrix2[2561] = 0; d_matrix2[2562] = 0; d_matrix2[2563] = 0; d_matrix2[2564] = 0; d_matrix2[2565] = 0; d_matrix2[2566] = 0; d_matrix2[2567] = 0; d_matrix2[2568] = 0; d_matrix2[2569] = 0; d_matrix2[2570] = 0; d_matrix2[2571] = 0; d_matrix2[2572] = 0; d_matrix2[2573] = 0; d_matrix2[2574] = 0; d_matrix2[2575] = 0; d_matrix2[2576] = 0; d_matrix2[2577] = 0; d_matrix2[2578] = 0; d_matrix2[2579] = 0; d_matrix2[2580] = 0; d_matrix2[2581] = 0; d_matrix2[2582] = 0; d_matrix2[2583] = 0; d_matrix2[2584] = 0; d_matrix2[2585] = 0; d_matrix2[2586] = 0; d_matrix2[2587] = 0; d_matrix2[2588] = 0; d_matrix2[2589] = 0; d_matrix2[2590] = 0; d_matrix2[2591] = 0; d_matrix2[2592] = 0; d_matrix2[2593] = 5; d_matrix2[2594] = 0; d_matrix2[2595] = 0; d_matrix2[2596] = 0; d_matrix2[2597] = 0; d_matrix2[2598] = 0; d_matrix2[2599] = 0; d_matrix2[2600] = 0; d_matrix2[2601] = 0; d_matrix2[2602] = 0; d_matrix2[2603] = 0; d_matrix2[2604] = 0; d_matrix2[2605] = 0; d_matrix2[2606] = 0; d_matrix2[2607] = 0; d_matrix2[2608] = 0; d_matrix2[2609] = 0; d_matrix2[2610] = 0; d_matrix2[2611] = 0; d_matrix2[2612] = 0; d_matrix2[2613] = 0; d_matrix2[2614] = 0; d_matrix2[2615] = 0; d_matrix2[2616] = 0; d_matrix2[2617] = 0; d_matrix2[2618] = 0; d_matrix2[2619] = 0; d_matrix2[2620] = 0; d_matrix2[2621] = 0; d_matrix2[2622] = 0; d_matrix2[2623] = 0; d_matrix2[2624] = 0; d_matrix2[2625] = 0; d_matrix2[2626] = 0; d_matrix2[2627] = 0; d_matrix2[2628] = 0; d_matrix2[2629] = 0; d_matrix2[2630] = 0; d_matrix2[2631] = 0; d_matrix2[2632] = 0; d_matrix2[2633] = 0; d_matrix2[2634] = 0; d_matrix2[2635] = 0; d_matrix2[2636] = 0; d_matrix2[2637] = 0; d_matrix2[2638] = 0; d_matrix2[2639] = 0;
d_matrix2[2640] = 0; d_matrix2[2641] = 0; d_matrix2[2642] = 0; d_matrix2[2643] = 0; d_matrix2[2644] = 0; d_matrix2[2645] = 0; d_matrix2[2646] = 0; d_matrix2[2647] = 0; d_matrix2[2648] = 4; d_matrix2[2649] = 0; d_matrix2[2650] = 3; d_matrix2[2651] = 0; d_matrix2[2652] = 0; d_matrix2[2653] = 0; d_matrix2[2654] = 0; d_matrix2[2655] = 0; d_matrix2[2656] = 0; d_matrix2[2657] = 0; d_matrix2[2658] = 0; d_matrix2[2659] = 0; d_matrix2[2660] = 0; d_matrix2[2661] = 0; d_matrix2[2662] = 0; d_matrix2[2663] = 0; d_matrix2[2664] = 0; d_matrix2[2665] = 0; d_matrix2[2666] = 0; d_matrix2[2667] = 0; d_matrix2[2668] = 0; d_matrix2[2669] = 0; d_matrix2[2670] = 0; d_matrix2[2671] = 0; d_matrix2[2672] = 0; d_matrix2[2673] = 0; d_matrix2[2674] = 0; d_matrix2[2675] = 0; d_matrix2[2676] = 0; d_matrix2[2677] = 0; d_matrix2[2678] = 0; d_matrix2[2679] = 0; d_matrix2[2680] = 0; d_matrix2[2681] = 0; d_matrix2[2682] = 0; d_matrix2[2683] = 0; d_matrix2[2684] = 0; d_matrix2[2685] = 0; d_matrix2[2686] = 0; d_matrix2[2687] = 0; d_matrix2[2688] = 0; d_matrix2[2689] = 0; d_matrix2[2690] = 0; d_matrix2[2691] = 4; d_matrix2[2692] = 0; d_matrix2[2693] = 0; d_matrix2[2694] = 0; d_matrix2[2695] = 0; d_matrix2[2696] = 0; d_matrix2[2697] = 0; d_matrix2[2698] = 0; d_matrix2[2699] = 0; d_matrix2[2700] = 0; d_matrix2[2701] = 0; d_matrix2[2702] = 0; d_matrix2[2703] = 0; d_matrix2[2704] = 0; d_matrix2[2705] = 0; d_matrix2[2706] = 0; d_matrix2[2707] = 0; d_matrix2[2708] = 0; d_matrix2[2709] = 0; d_matrix2[2710] = 0; d_matrix2[2711] = 0; d_matrix2[2712] = 0; d_matrix2[2713] = 0; d_matrix2[2714] = 0; d_matrix2[2715] = 0; d_matrix2[2716] = 0; d_matrix2[2717] = 0; d_matrix2[2718] = 0; d_matrix2[2719] = 0;
d_matrix2[2720] = 0; d_matrix2[2721] = 0; d_matrix2[2722] = 0; d_matrix2[2723] = 0; d_matrix2[2724] = 0; d_matrix2[2725] = 0; d_matrix2[2726] = 0; d_matrix2[2727] = 0; d_matrix2[2728] = 0; d_matrix2[2729] = 0; d_matrix2[2730] = 0; d_matrix2[2731] = 0; d_matrix2[2732] = 0; d_matrix2[2733] = 0; d_matrix2[2734] = 0; d_matrix2[2735] = 0; d_matrix2[2736] = 0; d_matrix2[2737] = 0; d_matrix2[2738] = 0; d_matrix2[2739] = 0; d_matrix2[2740] = 0; d_matrix2[2741] = 0; d_matrix2[2742] = 0; d_matrix2[2743] = 0; d_matrix2[2744] = 0; d_matrix2[2745] = 0; d_matrix2[2746] = 0; d_matrix2[2747] = 0; d_matrix2[2748] = 0; d_matrix2[2749] = 0; d_matrix2[2750] = 0; d_matrix2[2751] = 0; d_matrix2[2752] = 0; d_matrix2[2753] = 0; d_matrix2[2754] = 0; d_matrix2[2755] = 0; d_matrix2[2756] = 0; d_matrix2[2757] = 0; d_matrix2[2758] = 0; d_matrix2[2759] = 0; d_matrix2[2760] = 0; d_matrix2[2761] = 0; d_matrix2[2762] = 0; d_matrix2[2763] = 0; d_matrix2[2764] = 0; d_matrix2[2765] = 0; d_matrix2[2766] = 0; d_matrix2[2767] = 0; d_matrix2[2768] = 0; d_matrix2[2769] = 0; d_matrix2[2770] = 0; d_matrix2[2771] = 0; d_matrix2[2772] = 0; d_matrix2[2773] = 0; d_matrix2[2774] = 0; d_matrix2[2775] = 0; d_matrix2[2776] = 0; d_matrix2[2777] = 0; d_matrix2[2778] = 0; d_matrix2[2779] = 0; d_matrix2[2780] = 0; d_matrix2[2781] = 0; d_matrix2[2782] = 0; d_matrix2[2783] = 0; d_matrix2[2784] = 0; d_matrix2[2785] = 0; d_matrix2[2786] = 0; d_matrix2[2787] = 0; d_matrix2[2788] = 0; d_matrix2[2789] = 0; d_matrix2[2790] = 0; d_matrix2[2791] = 0; d_matrix2[2792] = 0; d_matrix2[2793] = 0; d_matrix2[2794] = 0; d_matrix2[2795] = 0; d_matrix2[2796] = 0; d_matrix2[2797] = 0; d_matrix2[2798] = 0; d_matrix2[2799] = 0;
d_matrix2[2800] = 0; d_matrix2[2801] = 0; d_matrix2[2802] = 0; d_matrix2[2803] = 0; d_matrix2[2804] = 0; d_matrix2[2805] = 0; d_matrix2[2806] = 0; d_matrix2[2807] = 0; d_matrix2[2808] = 0; d_matrix2[2809] = 0; d_matrix2[2810] = 0; d_matrix2[2811] = 0; d_matrix2[2812] = 0; d_matrix2[2813] = 0; d_matrix2[2814] = 0; d_matrix2[2815] = 0; d_matrix2[2816] = 0; d_matrix2[2817] = 0; d_matrix2[2818] = 0; d_matrix2[2819] = 0; d_matrix2[2820] = 0; d_matrix2[2821] = 0; d_matrix2[2822] = 0; d_matrix2[2823] = 0; d_matrix2[2824] = 0; d_matrix2[2825] = 0; d_matrix2[2826] = 0; d_matrix2[2827] = 0; d_matrix2[2828] = 0; d_matrix2[2829] = 0; d_matrix2[2830] = 0; d_matrix2[2831] = 0; d_matrix2[2832] = 0; d_matrix2[2833] = 0; d_matrix2[2834] = 0; d_matrix2[2835] = 0; d_matrix2[2836] = 0; d_matrix2[2837] = 0; d_matrix2[2838] = 0; d_matrix2[2839] = 0; d_matrix2[2840] = 0; d_matrix2[2841] = 0; d_matrix2[2842] = 0; d_matrix2[2843] = 0; d_matrix2[2844] = 0; d_matrix2[2845] = 0; d_matrix2[2846] = 0; d_matrix2[2847] = 0; d_matrix2[2848] = 0; d_matrix2[2849] = 0; d_matrix2[2850] = 0; d_matrix2[2851] = 0; d_matrix2[2852] = 0; d_matrix2[2853] = 0; d_matrix2[2854] = 0; d_matrix2[2855] = 0; d_matrix2[2856] = 0; d_matrix2[2857] = 0; d_matrix2[2858] = 0; d_matrix2[2859] = 0; d_matrix2[2860] = 0; d_matrix2[2861] = 0; d_matrix2[2862] = 0; d_matrix2[2863] = 0; d_matrix2[2864] = 0; d_matrix2[2865] = 0; d_matrix2[2866] = 0; d_matrix2[2867] = 0; d_matrix2[2868] = 0; d_matrix2[2869] = 0; d_matrix2[2870] = 0; d_matrix2[2871] = 0; d_matrix2[2872] = 0; d_matrix2[2873] = 0; d_matrix2[2874] = 0; d_matrix2[2875] = 0; d_matrix2[2876] = 0; d_matrix2[2877] = 0; d_matrix2[2878] = 0; d_matrix2[2879] = 0;
d_matrix2[2880] = 0; d_matrix2[2881] = 0; d_matrix2[2882] = 0; d_matrix2[2883] = 0; d_matrix2[2884] = 0; d_matrix2[2885] = 0; d_matrix2[2886] = 0; d_matrix2[2887] = 0; d_matrix2[2888] = 0; d_matrix2[2889] = 0; d_matrix2[2890] = 0; d_matrix2[2891] = 0; d_matrix2[2892] = 0; d_matrix2[2893] = 0; d_matrix2[2894] = 0; d_matrix2[2895] = 0; d_matrix2[2896] = 0; d_matrix2[2897] = 0; d_matrix2[2898] = 0; d_matrix2[2899] = 0; d_matrix2[2900] = 0; d_matrix2[2901] = 0; d_matrix2[2902] = 0; d_matrix2[2903] = 0; d_matrix2[2904] = 0; d_matrix2[2905] = 0; d_matrix2[2906] = 0; d_matrix2[2907] = 0; d_matrix2[2908] = 0; d_matrix2[2909] = 0; d_matrix2[2910] = 0; d_matrix2[2911] = 0; d_matrix2[2912] = 0; d_matrix2[2913] = 0; d_matrix2[2914] = 0; d_matrix2[2915] = 0; d_matrix2[2916] = 0; d_matrix2[2917] = 0; d_matrix2[2918] = 0; d_matrix2[2919] = 0; d_matrix2[2920] = 0; d_matrix2[2921] = 0; d_matrix2[2922] = 0; d_matrix2[2923] = 0; d_matrix2[2924] = 0; d_matrix2[2925] = 0; d_matrix2[2926] = 0; d_matrix2[2927] = 0; d_matrix2[2928] = 0; d_matrix2[2929] = 0; d_matrix2[2930] = 0; d_matrix2[2931] = 0; d_matrix2[2932] = 0; d_matrix2[2933] = 0; d_matrix2[2934] = 0; d_matrix2[2935] = 0; d_matrix2[2936] = 0; d_matrix2[2937] = 0; d_matrix2[2938] = 0; d_matrix2[2939] = 0; d_matrix2[2940] = 0; d_matrix2[2941] = 0; d_matrix2[2942] = 0; d_matrix2[2943] = 0; d_matrix2[2944] = 0; d_matrix2[2945] = 0; d_matrix2[2946] = 0; d_matrix2[2947] = 0; d_matrix2[2948] = 0; d_matrix2[2949] = 0; d_matrix2[2950] = 0; d_matrix2[2951] = 0; d_matrix2[2952] = 0; d_matrix2[2953] = 0; d_matrix2[2954] = 0; d_matrix2[2955] = 0; d_matrix2[2956] = 0; d_matrix2[2957] = 0; d_matrix2[2958] = 0; d_matrix2[2959] = 0;
d_matrix2[2960] = 0; d_matrix2[2961] = 0; d_matrix2[2962] = 0; d_matrix2[2963] = 0; d_matrix2[2964] = 0; d_matrix2[2965] = 0; d_matrix2[2966] = 0; d_matrix2[2967] = 0; d_matrix2[2968] = 0; d_matrix2[2969] = 0; d_matrix2[2970] = 0; d_matrix2[2971] = 0; d_matrix2[2972] = 0; d_matrix2[2973] = 0; d_matrix2[2974] = 0; d_matrix2[2975] = 0; d_matrix2[2976] = 0; d_matrix2[2977] = 0; d_matrix2[2978] = 0; d_matrix2[2979] = 0; d_matrix2[2980] = 0; d_matrix2[2981] = 0; d_matrix2[2982] = 0; d_matrix2[2983] = 0; d_matrix2[2984] = 0; d_matrix2[2985] = 0; d_matrix2[2986] = 0; d_matrix2[2987] = 0; d_matrix2[2988] = 0; d_matrix2[2989] = 0; d_matrix2[2990] = 0; d_matrix2[2991] = 0; d_matrix2[2992] = 0; d_matrix2[2993] = 0; d_matrix2[2994] = 0; d_matrix2[2995] = 0; d_matrix2[2996] = 0; d_matrix2[2997] = 0; d_matrix2[2998] = 0; d_matrix2[2999] = 0; d_matrix2[3000] = 0; d_matrix2[3001] = 0; d_matrix2[3002] = 0; d_matrix2[3003] = 0; d_matrix2[3004] = 0; d_matrix2[3005] = 0; d_matrix2[3006] = 0; d_matrix2[3007] = 0; d_matrix2[3008] = 0; d_matrix2[3009] = 0; d_matrix2[3010] = 0; d_matrix2[3011] = 0; d_matrix2[3012] = 0; d_matrix2[3013] = 0; d_matrix2[3014] = 0; d_matrix2[3015] = 0; d_matrix2[3016] = 0; d_matrix2[3017] = 0; d_matrix2[3018] = 0; d_matrix2[3019] = 0; d_matrix2[3020] = 0; d_matrix2[3021] = 0; d_matrix2[3022] = 0; d_matrix2[3023] = 0; d_matrix2[3024] = 0; d_matrix2[3025] = 0; d_matrix2[3026] = 0; d_matrix2[3027] = 0; d_matrix2[3028] = 0; d_matrix2[3029] = 0; d_matrix2[3030] = 0; d_matrix2[3031] = 0; d_matrix2[3032] = 0; d_matrix2[3033] = 0; d_matrix2[3034] = 0; d_matrix2[3035] = 0; d_matrix2[3036] = 0; d_matrix2[3037] = 0; d_matrix2[3038] = 0; d_matrix2[3039] = 0;
d_matrix2[3040] = 0; d_matrix2[3041] = 0; d_matrix2[3042] = 0; d_matrix2[3043] = 0; d_matrix2[3044] = 0; d_matrix2[3045] = 0; d_matrix2[3046] = 0; d_matrix2[3047] = 0; d_matrix2[3048] = 4; d_matrix2[3049] = 0; d_matrix2[3050] = 0; d_matrix2[3051] = 0; d_matrix2[3052] = 4; d_matrix2[3053] = 0; d_matrix2[3054] = 0; d_matrix2[3055] = 0; d_matrix2[3056] = 0; d_matrix2[3057] = 0; d_matrix2[3058] = 0; d_matrix2[3059] = 0; d_matrix2[3060] = 0; d_matrix2[3061] = 0; d_matrix2[3062] = 0; d_matrix2[3063] = 5; d_matrix2[3064] = 0; d_matrix2[3065] = 4; d_matrix2[3066] = 0; d_matrix2[3067] = 0; d_matrix2[3068] = 4; d_matrix2[3069] = 0; d_matrix2[3070] = 0; d_matrix2[3071] = 0; d_matrix2[3072] = 0; d_matrix2[3073] = 0; d_matrix2[3074] = 0; d_matrix2[3075] = 0; d_matrix2[3076] = 0; d_matrix2[3077] = 0; d_matrix2[3078] = 0; d_matrix2[3079] = 0; d_matrix2[3080] = 0; d_matrix2[3081] = 0; d_matrix2[3082] = 0; d_matrix2[3083] = 0; d_matrix2[3084] = 0; d_matrix2[3085] = 0; d_matrix2[3086] = 0; d_matrix2[3087] = 0; d_matrix2[3088] = 0; d_matrix2[3089] = 0; d_matrix2[3090] = 0; d_matrix2[3091] = 5; d_matrix2[3092] = 0; d_matrix2[3093] = 0; d_matrix2[3094] = 0; d_matrix2[3095] = 0; d_matrix2[3096] = 3; d_matrix2[3097] = 5; d_matrix2[3098] = 0; d_matrix2[3099] = 0; d_matrix2[3100] = 0; d_matrix2[3101] = 0; d_matrix2[3102] = 0; d_matrix2[3103] = 5; d_matrix2[3104] = 0; d_matrix2[3105] = 0; d_matrix2[3106] = 0; d_matrix2[3107] = 0; d_matrix2[3108] = 0; d_matrix2[3109] = 5; d_matrix2[3110] = 0; d_matrix2[3111] = 0; d_matrix2[3112] = 0; d_matrix2[3113] = 0; d_matrix2[3114] = 0; d_matrix2[3115] = 0; d_matrix2[3116] = 0; d_matrix2[3117] = 0; d_matrix2[3118] = 0; d_matrix2[3119] = 0;
d_matrix2[3120] = 0; d_matrix2[3121] = 0; d_matrix2[3122] = 5; d_matrix2[3123] = 0; d_matrix2[3124] = 0; d_matrix2[3125] = 0; d_matrix2[3126] = 0; d_matrix2[3127] = 0; d_matrix2[3128] = 0; d_matrix2[3129] = 0; d_matrix2[3130] = 0; d_matrix2[3131] = 0; d_matrix2[3132] = 0; d_matrix2[3133] = 0; d_matrix2[3134] = 0; d_matrix2[3135] = 0; d_matrix2[3136] = 0; d_matrix2[3137] = 0; d_matrix2[3138] = 0; d_matrix2[3139] = 0; d_matrix2[3140] = 0; d_matrix2[3141] = 0; d_matrix2[3142] = 0; d_matrix2[3143] = 5; d_matrix2[3144] = 0; d_matrix2[3145] = 0; d_matrix2[3146] = 0; d_matrix2[3147] = 0; d_matrix2[3148] = 0; d_matrix2[3149] = 4; d_matrix2[3150] = 0; d_matrix2[3151] = 0; d_matrix2[3152] = 0; d_matrix2[3153] = 0; d_matrix2[3154] = 0; d_matrix2[3155] = 0; d_matrix2[3156] = 5; d_matrix2[3157] = 0; d_matrix2[3158] = 0; d_matrix2[3159] = 0; d_matrix2[3160] = 0; d_matrix2[3161] = 0; d_matrix2[3162] = 0; d_matrix2[3163] = 0; d_matrix2[3164] = 0; d_matrix2[3165] = 0; d_matrix2[3166] = 0; d_matrix2[3167] = 0; d_matrix2[3168] = 0; d_matrix2[3169] = 0; d_matrix2[3170] = 0; d_matrix2[3171] = 0; d_matrix2[3172] = 0; d_matrix2[3173] = 0; d_matrix2[3174] = 0; d_matrix2[3175] = 0; d_matrix2[3176] = 0; d_matrix2[3177] = 0; d_matrix2[3178] = 0; d_matrix2[3179] = 0; d_matrix2[3180] = 0; d_matrix2[3181] = 0; d_matrix2[3182] = 0; d_matrix2[3183] = 0; d_matrix2[3184] = 0; d_matrix2[3185] = 0; d_matrix2[3186] = 0; d_matrix2[3187] = 0; d_matrix2[3188] = 4; d_matrix2[3189] = 0; d_matrix2[3190] = 5; d_matrix2[3191] = 5; d_matrix2[3192] = 5; d_matrix2[3193] = 0; d_matrix2[3194] = 0; d_matrix2[3195] = 0; d_matrix2[3196] = 0; d_matrix2[3197] = 0; d_matrix2[3198] = 0; d_matrix2[3199] = 5;
d_matrix2[3200] = 0; d_matrix2[3201] = 0; d_matrix2[3202] = 0; d_matrix2[3203] = 0; d_matrix2[3204] = 0; d_matrix2[3205] = 0; d_matrix2[3206] = 0; d_matrix2[3207] = 0; d_matrix2[3208] = 0; d_matrix2[3209] = 0; d_matrix2[3210] = 0; d_matrix2[3211] = 0; d_matrix2[3212] = 0; d_matrix2[3213] = 0; d_matrix2[3214] = 0; d_matrix2[3215] = 0; d_matrix2[3216] = 0; d_matrix2[3217] = 0; d_matrix2[3218] = 0; d_matrix2[3219] = 0; d_matrix2[3220] = 0; d_matrix2[3221] = 0; d_matrix2[3222] = 0; d_matrix2[3223] = 0; d_matrix2[3224] = 0; d_matrix2[3225] = 0; d_matrix2[3226] = 0; d_matrix2[3227] = 0; d_matrix2[3228] = 0; d_matrix2[3229] = 0; d_matrix2[3230] = 0; d_matrix2[3231] = 0; d_matrix2[3232] = 0; d_matrix2[3233] = 0; d_matrix2[3234] = 0; d_matrix2[3235] = 0; d_matrix2[3236] = 0; d_matrix2[3237] = 0; d_matrix2[3238] = 0; d_matrix2[3239] = 0; d_matrix2[3240] = 0; d_matrix2[3241] = 0; d_matrix2[3242] = 0; d_matrix2[3243] = 0; d_matrix2[3244] = 0; d_matrix2[3245] = 0; d_matrix2[3246] = 0; d_matrix2[3247] = 0; d_matrix2[3248] = 0; d_matrix2[3249] = 0; d_matrix2[3250] = 0; d_matrix2[3251] = 0; d_matrix2[3252] = 0; d_matrix2[3253] = 0; d_matrix2[3254] = 0; d_matrix2[3255] = 0; d_matrix2[3256] = 0; d_matrix2[3257] = 0; d_matrix2[3258] = 0; d_matrix2[3259] = 0; d_matrix2[3260] = 0; d_matrix2[3261] = 0; d_matrix2[3262] = 0; d_matrix2[3263] = 0; d_matrix2[3264] = 0; d_matrix2[3265] = 0; d_matrix2[3266] = 0; d_matrix2[3267] = 0; d_matrix2[3268] = 0; d_matrix2[3269] = 0; d_matrix2[3270] = 0; d_matrix2[3271] = 0; d_matrix2[3272] = 0; d_matrix2[3273] = 0; d_matrix2[3274] = 0; d_matrix2[3275] = 0; d_matrix2[3276] = 0; d_matrix2[3277] = 0; d_matrix2[3278] = 0; d_matrix2[3279] = 0;
d_matrix2[3280] = 0; d_matrix2[3281] = 0; d_matrix2[3282] = 0; d_matrix2[3283] = 0; d_matrix2[3284] = 0; d_matrix2[3285] = 0; d_matrix2[3286] = 0; d_matrix2[3287] = 0; d_matrix2[3288] = 0; d_matrix2[3289] = 0; d_matrix2[3290] = 0; d_matrix2[3291] = 0; d_matrix2[3292] = 0; d_matrix2[3293] = 0; d_matrix2[3294] = 0; d_matrix2[3295] = 0; d_matrix2[3296] = 0; d_matrix2[3297] = 0; d_matrix2[3298] = 0; d_matrix2[3299] = 0; d_matrix2[3300] = 0; d_matrix2[3301] = 0; d_matrix2[3302] = 0; d_matrix2[3303] = 0; d_matrix2[3304] = 0; d_matrix2[3305] = 0; d_matrix2[3306] = 0; d_matrix2[3307] = 0; d_matrix2[3308] = 0; d_matrix2[3309] = 0; d_matrix2[3310] = 0; d_matrix2[3311] = 0; d_matrix2[3312] = 0; d_matrix2[3313] = 0; d_matrix2[3314] = 0; d_matrix2[3315] = 0; d_matrix2[3316] = 0; d_matrix2[3317] = 0; d_matrix2[3318] = 0; d_matrix2[3319] = 0; d_matrix2[3320] = 0; d_matrix2[3321] = 0; d_matrix2[3322] = 0; d_matrix2[3323] = 0; d_matrix2[3324] = 0; d_matrix2[3325] = 0; d_matrix2[3326] = 0; d_matrix2[3327] = 0; d_matrix2[3328] = 0; d_matrix2[3329] = 0; d_matrix2[3330] = 0; d_matrix2[3331] = 0; d_matrix2[3332] = 0; d_matrix2[3333] = 0; d_matrix2[3334] = 0; d_matrix2[3335] = 0; d_matrix2[3336] = 0; d_matrix2[3337] = 0; d_matrix2[3338] = 0; d_matrix2[3339] = 0; d_matrix2[3340] = 0; d_matrix2[3341] = 0; d_matrix2[3342] = 0; d_matrix2[3343] = 0; d_matrix2[3344] = 0; d_matrix2[3345] = 0; d_matrix2[3346] = 0; d_matrix2[3347] = 0; d_matrix2[3348] = 0; d_matrix2[3349] = 0; d_matrix2[3350] = 0; d_matrix2[3351] = 0; d_matrix2[3352] = 0; d_matrix2[3353] = 0; d_matrix2[3354] = 0; d_matrix2[3355] = 0; d_matrix2[3356] = 0; d_matrix2[3357] = 0; d_matrix2[3358] = 0; d_matrix2[3359] = 0;
d_matrix2[3360] = 0; d_matrix2[3361] = 0; d_matrix2[3362] = 4; d_matrix2[3363] = 0; d_matrix2[3364] = 0; d_matrix2[3365] = 0; d_matrix2[3366] = 0; d_matrix2[3367] = 0; d_matrix2[3368] = 0; d_matrix2[3369] = 0; d_matrix2[3370] = 0; d_matrix2[3371] = 0; d_matrix2[3372] = 0; d_matrix2[3373] = 0; d_matrix2[3374] = 0; d_matrix2[3375] = 0; d_matrix2[3376] = 0; d_matrix2[3377] = 0; d_matrix2[3378] = 0; d_matrix2[3379] = 0; d_matrix2[3380] = 0; d_matrix2[3381] = 0; d_matrix2[3382] = 0; d_matrix2[3383] = 0; d_matrix2[3384] = 0; d_matrix2[3385] = 0; d_matrix2[3386] = 0; d_matrix2[3387] = 0; d_matrix2[3388] = 0; d_matrix2[3389] = 4; d_matrix2[3390] = 0; d_matrix2[3391] = 0; d_matrix2[3392] = 3; d_matrix2[3393] = 0; d_matrix2[3394] = 0; d_matrix2[3395] = 0; d_matrix2[3396] = 0; d_matrix2[3397] = 0; d_matrix2[3398] = 0; d_matrix2[3399] = 0; d_matrix2[3400] = 0; d_matrix2[3401] = 0; d_matrix2[3402] = 0; d_matrix2[3403] = 0; d_matrix2[3404] = 0; d_matrix2[3405] = 0; d_matrix2[3406] = 0; d_matrix2[3407] = 0; d_matrix2[3408] = 0; d_matrix2[3409] = 0; d_matrix2[3410] = 0; d_matrix2[3411] = 5; d_matrix2[3412] = 0; d_matrix2[3413] = 0; d_matrix2[3414] = 0; d_matrix2[3415] = 0; d_matrix2[3416] = 0; d_matrix2[3417] = 4; d_matrix2[3418] = 0; d_matrix2[3419] = 3; d_matrix2[3420] = 0; d_matrix2[3421] = 0; d_matrix2[3422] = 0; d_matrix2[3423] = 0; d_matrix2[3424] = 0; d_matrix2[3425] = 0; d_matrix2[3426] = 0; d_matrix2[3427] = 0; d_matrix2[3428] = 0; d_matrix2[3429] = 0; d_matrix2[3430] = 4; d_matrix2[3431] = 0; d_matrix2[3432] = 0; d_matrix2[3433] = 0; d_matrix2[3434] = 0; d_matrix2[3435] = 0; d_matrix2[3436] = 0; d_matrix2[3437] = 0; d_matrix2[3438] = 0; d_matrix2[3439] = 0;
d_matrix2[3440] = 0; d_matrix2[3441] = 0; d_matrix2[3442] = 5; d_matrix2[3443] = 5; d_matrix2[3444] = 0; d_matrix2[3445] = 0; d_matrix2[3446] = 0; d_matrix2[3447] = 0; d_matrix2[3448] = 0; d_matrix2[3449] = 0; d_matrix2[3450] = 0; d_matrix2[3451] = 0; d_matrix2[3452] = 0; d_matrix2[3453] = 4; d_matrix2[3454] = 0; d_matrix2[3455] = 0; d_matrix2[3456] = 4; d_matrix2[3457] = 0; d_matrix2[3458] = 0; d_matrix2[3459] = 0; d_matrix2[3460] = 0; d_matrix2[3461] = 0; d_matrix2[3462] = 0; d_matrix2[3463] = 0; d_matrix2[3464] = 0; d_matrix2[3465] = 0; d_matrix2[3466] = 3; d_matrix2[3467] = 0; d_matrix2[3468] = 0; d_matrix2[3469] = 5; d_matrix2[3470] = 0; d_matrix2[3471] = 0; d_matrix2[3472] = 0; d_matrix2[3473] = 0; d_matrix2[3474] = 0; d_matrix2[3475] = 0; d_matrix2[3476] = 0; d_matrix2[3477] = 0; d_matrix2[3478] = 0; d_matrix2[3479] = 3; d_matrix2[3480] = 0; d_matrix2[3481] = 0; d_matrix2[3482] = 0; d_matrix2[3483] = 0; d_matrix2[3484] = 2; d_matrix2[3485] = 3; d_matrix2[3486] = 0; d_matrix2[3487] = 0; d_matrix2[3488] = 0; d_matrix2[3489] = 5; d_matrix2[3490] = 0; d_matrix2[3491] = 5; d_matrix2[3492] = 0; d_matrix2[3493] = 0; d_matrix2[3494] = 0; d_matrix2[3495] = 4; d_matrix2[3496] = 0; d_matrix2[3497] = 0; d_matrix2[3498] = 0; d_matrix2[3499] = 5; d_matrix2[3500] = 0; d_matrix2[3501] = 0; d_matrix2[3502] = 0; d_matrix2[3503] = 0; d_matrix2[3504] = 4; d_matrix2[3505] = 5; d_matrix2[3506] = 0; d_matrix2[3507] = 4; d_matrix2[3508] = 0; d_matrix2[3509] = 0; d_matrix2[3510] = 4; d_matrix2[3511] = 3; d_matrix2[3512] = 4; d_matrix2[3513] = 3; d_matrix2[3514] = 4; d_matrix2[3515] = 0; d_matrix2[3516] = 0; d_matrix2[3517] = 0; d_matrix2[3518] = 5; d_matrix2[3519] = 0;
d_matrix2[3520] = 0; d_matrix2[3521] = 0; d_matrix2[3522] = 5; d_matrix2[3523] = 0; d_matrix2[3524] = 2; d_matrix2[3525] = 4; d_matrix2[3526] = 4; d_matrix2[3527] = 0; d_matrix2[3528] = 4; d_matrix2[3529] = 4; d_matrix2[3530] = 4; d_matrix2[3531] = 0; d_matrix2[3532] = 5; d_matrix2[3533] = 5; d_matrix2[3534] = 0; d_matrix2[3535] = 2; d_matrix2[3536] = 5; d_matrix2[3537] = 0; d_matrix2[3538] = 3; d_matrix2[3539] = 0; d_matrix2[3540] = 0; d_matrix2[3541] = 0; d_matrix2[3542] = 0; d_matrix2[3543] = 0; d_matrix2[3544] = 0; d_matrix2[3545] = 0; d_matrix2[3546] = 5; d_matrix2[3547] = 5; d_matrix2[3548] = 0; d_matrix2[3549] = 4; d_matrix2[3550] = 0; d_matrix2[3551] = 0; d_matrix2[3552] = 0; d_matrix2[3553] = 0; d_matrix2[3554] = 0; d_matrix2[3555] = 0; d_matrix2[3556] = 0; d_matrix2[3557] = 0; d_matrix2[3558] = 0; d_matrix2[3559] = 0; d_matrix2[3560] = 0; d_matrix2[3561] = 3; d_matrix2[3562] = 0; d_matrix2[3563] = 0; d_matrix2[3564] = 0; d_matrix2[3565] = 0; d_matrix2[3566] = 0; d_matrix2[3567] = 0; d_matrix2[3568] = 1; d_matrix2[3569] = 0; d_matrix2[3570] = 4; d_matrix2[3571] = 4; d_matrix2[3572] = 1; d_matrix2[3573] = 4; d_matrix2[3574] = 0; d_matrix2[3575] = 3; d_matrix2[3576] = 0; d_matrix2[3577] = 5; d_matrix2[3578] = 0; d_matrix2[3579] = 3; d_matrix2[3580] = 0; d_matrix2[3581] = 0; d_matrix2[3582] = 0; d_matrix2[3583] = 0; d_matrix2[3584] = 3; d_matrix2[3585] = 5; d_matrix2[3586] = 0; d_matrix2[3587] = 4; d_matrix2[3588] = 0; d_matrix2[3589] = 0; d_matrix2[3590] = 4; d_matrix2[3591] = 4; d_matrix2[3592] = 4; d_matrix2[3593] = 0; d_matrix2[3594] = 4; d_matrix2[3595] = 0; d_matrix2[3596] = 0; d_matrix2[3597] = 0; d_matrix2[3598] = 3; d_matrix2[3599] = 0;
d_matrix2[3600] = 0; d_matrix2[3601] = 0; d_matrix2[3602] = 4; d_matrix2[3603] = 0; d_matrix2[3604] = 0; d_matrix2[3605] = 0; d_matrix2[3606] = 4; d_matrix2[3607] = 0; d_matrix2[3608] = 5; d_matrix2[3609] = 0; d_matrix2[3610] = 5; d_matrix2[3611] = 0; d_matrix2[3612] = 3; d_matrix2[3613] = 0; d_matrix2[3614] = 0; d_matrix2[3615] = 0; d_matrix2[3616] = 4; d_matrix2[3617] = 0; d_matrix2[3618] = 0; d_matrix2[3619] = 0; d_matrix2[3620] = 0; d_matrix2[3621] = 0; d_matrix2[3622] = 2; d_matrix2[3623] = 4; d_matrix2[3624] = 0; d_matrix2[3625] = 3; d_matrix2[3626] = 2; d_matrix2[3627] = 0; d_matrix2[3628] = 0; d_matrix2[3629] = 0; d_matrix2[3630] = 0; d_matrix2[3631] = 0; d_matrix2[3632] = 4; d_matrix2[3633] = 0; d_matrix2[3634] = 0; d_matrix2[3635] = 0; d_matrix2[3636] = 0; d_matrix2[3637] = 0; d_matrix2[3638] = 0; d_matrix2[3639] = 0; d_matrix2[3640] = 0; d_matrix2[3641] = 0; d_matrix2[3642] = 0; d_matrix2[3643] = 0; d_matrix2[3644] = 0; d_matrix2[3645] = 0; d_matrix2[3646] = 0; d_matrix2[3647] = 0; d_matrix2[3648] = 0; d_matrix2[3649] = 0; d_matrix2[3650] = 0; d_matrix2[3651] = 5; d_matrix2[3652] = 0; d_matrix2[3653] = 0; d_matrix2[3654] = 0; d_matrix2[3655] = 0; d_matrix2[3656] = 4; d_matrix2[3657] = 2; d_matrix2[3658] = 0; d_matrix2[3659] = 0; d_matrix2[3660] = 0; d_matrix2[3661] = 0; d_matrix2[3662] = 0; d_matrix2[3663] = 0; d_matrix2[3664] = 0; d_matrix2[3665] = 5; d_matrix2[3666] = 0; d_matrix2[3667] = 0; d_matrix2[3668] = 3; d_matrix2[3669] = 0; d_matrix2[3670] = 4; d_matrix2[3671] = 0; d_matrix2[3672] = 3; d_matrix2[3673] = 0; d_matrix2[3674] = 0; d_matrix2[3675] = 0; d_matrix2[3676] = 0; d_matrix2[3677] = 0; d_matrix2[3678] = 0; d_matrix2[3679] = 0;
d_matrix2[3680] = 0; d_matrix2[3681] = 0; d_matrix2[3682] = 5; d_matrix2[3683] = 0; d_matrix2[3684] = 0; d_matrix2[3685] = 0; d_matrix2[3686] = 0; d_matrix2[3687] = 0; d_matrix2[3688] = 3; d_matrix2[3689] = 0; d_matrix2[3690] = 0; d_matrix2[3691] = 0; d_matrix2[3692] = 0; d_matrix2[3693] = 0; d_matrix2[3694] = 5; d_matrix2[3695] = 0; d_matrix2[3696] = 4; d_matrix2[3697] = 0; d_matrix2[3698] = 0; d_matrix2[3699] = 0; d_matrix2[3700] = 0; d_matrix2[3701] = 0; d_matrix2[3702] = 3; d_matrix2[3703] = 0; d_matrix2[3704] = 0; d_matrix2[3705] = 3; d_matrix2[3706] = 4; d_matrix2[3707] = 0; d_matrix2[3708] = 0; d_matrix2[3709] = 0; d_matrix2[3710] = 0; d_matrix2[3711] = 0; d_matrix2[3712] = 0; d_matrix2[3713] = 0; d_matrix2[3714] = 0; d_matrix2[3715] = 0; d_matrix2[3716] = 0; d_matrix2[3717] = 0; d_matrix2[3718] = 0; d_matrix2[3719] = 0; d_matrix2[3720] = 0; d_matrix2[3721] = 0; d_matrix2[3722] = 0; d_matrix2[3723] = 0; d_matrix2[3724] = 0; d_matrix2[3725] = 0; d_matrix2[3726] = 0; d_matrix2[3727] = 0; d_matrix2[3728] = 0; d_matrix2[3729] = 0; d_matrix2[3730] = 0; d_matrix2[3731] = 5; d_matrix2[3732] = 0; d_matrix2[3733] = 0; d_matrix2[3734] = 0; d_matrix2[3735] = 0; d_matrix2[3736] = 0; d_matrix2[3737] = 0; d_matrix2[3738] = 0; d_matrix2[3739] = 0; d_matrix2[3740] = 0; d_matrix2[3741] = 0; d_matrix2[3742] = 0; d_matrix2[3743] = 0; d_matrix2[3744] = 0; d_matrix2[3745] = 0; d_matrix2[3746] = 0; d_matrix2[3747] = 0; d_matrix2[3748] = 0; d_matrix2[3749] = 0; d_matrix2[3750] = 0; d_matrix2[3751] = 0; d_matrix2[3752] = 0; d_matrix2[3753] = 0; d_matrix2[3754] = 0; d_matrix2[3755] = 0; d_matrix2[3756] = 0; d_matrix2[3757] = 0; d_matrix2[3758] = 0; d_matrix2[3759] = 0;
d_matrix2[3760] = 0; d_matrix2[3761] = 0; d_matrix2[3762] = 0; d_matrix2[3763] = 0; d_matrix2[3764] = 0; d_matrix2[3765] = 0; d_matrix2[3766] = 0; d_matrix2[3767] = 0; d_matrix2[3768] = 4; d_matrix2[3769] = 0; d_matrix2[3770] = 0; d_matrix2[3771] = 0; d_matrix2[3772] = 0; d_matrix2[3773] = 0; d_matrix2[3774] = 0; d_matrix2[3775] = 0; d_matrix2[3776] = 0; d_matrix2[3777] = 0; d_matrix2[3778] = 0; d_matrix2[3779] = 0; d_matrix2[3780] = 0; d_matrix2[3781] = 0; d_matrix2[3782] = 0; d_matrix2[3783] = 0; d_matrix2[3784] = 0; d_matrix2[3785] = 0; d_matrix2[3786] = 0; d_matrix2[3787] = 0; d_matrix2[3788] = 0; d_matrix2[3789] = 0; d_matrix2[3790] = 0; d_matrix2[3791] = 0; d_matrix2[3792] = 0; d_matrix2[3793] = 0; d_matrix2[3794] = 0; d_matrix2[3795] = 0; d_matrix2[3796] = 0; d_matrix2[3797] = 0; d_matrix2[3798] = 0; d_matrix2[3799] = 0; d_matrix2[3800] = 0; d_matrix2[3801] = 0; d_matrix2[3802] = 0; d_matrix2[3803] = 0; d_matrix2[3804] = 0; d_matrix2[3805] = 0; d_matrix2[3806] = 0; d_matrix2[3807] = 0; d_matrix2[3808] = 0; d_matrix2[3809] = 0; d_matrix2[3810] = 0; d_matrix2[3811] = 4; d_matrix2[3812] = 0; d_matrix2[3813] = 0; d_matrix2[3814] = 0; d_matrix2[3815] = 0; d_matrix2[3816] = 0; d_matrix2[3817] = 0; d_matrix2[3818] = 0; d_matrix2[3819] = 0; d_matrix2[3820] = 0; d_matrix2[3821] = 0; d_matrix2[3822] = 0; d_matrix2[3823] = 0; d_matrix2[3824] = 0; d_matrix2[3825] = 0; d_matrix2[3826] = 0; d_matrix2[3827] = 0; d_matrix2[3828] = 0; d_matrix2[3829] = 0; d_matrix2[3830] = 0; d_matrix2[3831] = 0; d_matrix2[3832] = 0; d_matrix2[3833] = 0; d_matrix2[3834] = 0; d_matrix2[3835] = 0; d_matrix2[3836] = 0; d_matrix2[3837] = 0; d_matrix2[3838] = 0; d_matrix2[3839] = 0;
d_matrix2[3840] = 0; d_matrix2[3841] = 0; d_matrix2[3842] = 0; d_matrix2[3843] = 0; d_matrix2[3844] = 0; d_matrix2[3845] = 0; d_matrix2[3846] = 0; d_matrix2[3847] = 0; d_matrix2[3848] = 0; d_matrix2[3849] = 0; d_matrix2[3850] = 0; d_matrix2[3851] = 0; d_matrix2[3852] = 0; d_matrix2[3853] = 0; d_matrix2[3854] = 0; d_matrix2[3855] = 0; d_matrix2[3856] = 0; d_matrix2[3857] = 0; d_matrix2[3858] = 0; d_matrix2[3859] = 0; d_matrix2[3860] = 0; d_matrix2[3861] = 0; d_matrix2[3862] = 0; d_matrix2[3863] = 0; d_matrix2[3864] = 0; d_matrix2[3865] = 0; d_matrix2[3866] = 0; d_matrix2[3867] = 0; d_matrix2[3868] = 0; d_matrix2[3869] = 0; d_matrix2[3870] = 0; d_matrix2[3871] = 0; d_matrix2[3872] = 0; d_matrix2[3873] = 0; d_matrix2[3874] = 0; d_matrix2[3875] = 0; d_matrix2[3876] = 0; d_matrix2[3877] = 0; d_matrix2[3878] = 0; d_matrix2[3879] = 0; d_matrix2[3880] = 0; d_matrix2[3881] = 0; d_matrix2[3882] = 0; d_matrix2[3883] = 0; d_matrix2[3884] = 0; d_matrix2[3885] = 0; d_matrix2[3886] = 0; d_matrix2[3887] = 0; d_matrix2[3888] = 0; d_matrix2[3889] = 0; d_matrix2[3890] = 0; d_matrix2[3891] = 0; d_matrix2[3892] = 0; d_matrix2[3893] = 0; d_matrix2[3894] = 0; d_matrix2[3895] = 0; d_matrix2[3896] = 0; d_matrix2[3897] = 0; d_matrix2[3898] = 0; d_matrix2[3899] = 0; d_matrix2[3900] = 0; d_matrix2[3901] = 0; d_matrix2[3902] = 0; d_matrix2[3903] = 0; d_matrix2[3904] = 0; d_matrix2[3905] = 0; d_matrix2[3906] = 0; d_matrix2[3907] = 0; d_matrix2[3908] = 0; d_matrix2[3909] = 0; d_matrix2[3910] = 0; d_matrix2[3911] = 0; d_matrix2[3912] = 0; d_matrix2[3913] = 0; d_matrix2[3914] = 0; d_matrix2[3915] = 0; d_matrix2[3916] = 0; d_matrix2[3917] = 0; d_matrix2[3918] = 0; d_matrix2[3919] = 0;
d_matrix2[3920] = 0; d_matrix2[3921] = 0; d_matrix2[3922] = 0; d_matrix2[3923] = 0; d_matrix2[3924] = 0; d_matrix2[3925] = 0; d_matrix2[3926] = 0; d_matrix2[3927] = 0; d_matrix2[3928] = 0; d_matrix2[3929] = 0; d_matrix2[3930] = 0; d_matrix2[3931] = 0; d_matrix2[3932] = 0; d_matrix2[3933] = 0; d_matrix2[3934] = 0; d_matrix2[3935] = 0; d_matrix2[3936] = 0; d_matrix2[3937] = 0; d_matrix2[3938] = 0; d_matrix2[3939] = 0; d_matrix2[3940] = 0; d_matrix2[3941] = 0; d_matrix2[3942] = 0; d_matrix2[3943] = 0; d_matrix2[3944] = 0; d_matrix2[3945] = 0; d_matrix2[3946] = 0; d_matrix2[3947] = 0; d_matrix2[3948] = 0; d_matrix2[3949] = 2; d_matrix2[3950] = 0; d_matrix2[3951] = 0; d_matrix2[3952] = 0; d_matrix2[3953] = 0; d_matrix2[3954] = 0; d_matrix2[3955] = 0; d_matrix2[3956] = 0; d_matrix2[3957] = 0; d_matrix2[3958] = 0; d_matrix2[3959] = 0; d_matrix2[3960] = 0; d_matrix2[3961] = 0; d_matrix2[3962] = 0; d_matrix2[3963] = 0; d_matrix2[3964] = 0; d_matrix2[3965] = 0; d_matrix2[3966] = 0; d_matrix2[3967] = 0; d_matrix2[3968] = 0; d_matrix2[3969] = 0; d_matrix2[3970] = 0; d_matrix2[3971] = 4; d_matrix2[3972] = 0; d_matrix2[3973] = 0; d_matrix2[3974] = 0; d_matrix2[3975] = 0; d_matrix2[3976] = 0; d_matrix2[3977] = 3; d_matrix2[3978] = 0; d_matrix2[3979] = 0; d_matrix2[3980] = 0; d_matrix2[3981] = 0; d_matrix2[3982] = 0; d_matrix2[3983] = 0; d_matrix2[3984] = 0; d_matrix2[3985] = 0; d_matrix2[3986] = 0; d_matrix2[3987] = 0; d_matrix2[3988] = 0; d_matrix2[3989] = 0; d_matrix2[3990] = 0; d_matrix2[3991] = 0; d_matrix2[3992] = 3; d_matrix2[3993] = 0; d_matrix2[3994] = 0; d_matrix2[3995] = 0; d_matrix2[3996] = 0; d_matrix2[3997] = 0; d_matrix2[3998] = 0; d_matrix2[3999] = 0;
d_matrix2[4000] = 0; d_matrix2[4001] = 0; d_matrix2[4002] = 2; d_matrix2[4003] = 1; d_matrix2[4004] = 3; d_matrix2[4005] = 2; d_matrix2[4006] = 0; d_matrix2[4007] = 0; d_matrix2[4008] = 4; d_matrix2[4009] = 3; d_matrix2[4010] = 0; d_matrix2[4011] = 3; d_matrix2[4012] = 3; d_matrix2[4013] = 4; d_matrix2[4014] = 3; d_matrix2[4015] = 0; d_matrix2[4016] = 0; d_matrix2[4017] = 0; d_matrix2[4018] = 2; d_matrix2[4019] = 0; d_matrix2[4020] = 0; d_matrix2[4021] = 0; d_matrix2[4022] = 0; d_matrix2[4023] = 0; d_matrix2[4024] = 0; d_matrix2[4025] = 0; d_matrix2[4026] = 2; d_matrix2[4027] = 0; d_matrix2[4028] = 0; d_matrix2[4029] = 0; d_matrix2[4030] = 0; d_matrix2[4031] = 0; d_matrix2[4032] = 0; d_matrix2[4033] = 0; d_matrix2[4034] = 0; d_matrix2[4035] = 0; d_matrix2[4036] = 0; d_matrix2[4037] = 0; d_matrix2[4038] = 0; d_matrix2[4039] = 1; d_matrix2[4040] = 2; d_matrix2[4041] = 1; d_matrix2[4042] = 0; d_matrix2[4043] = 4; d_matrix2[4044] = 0; d_matrix2[4045] = 0; d_matrix2[4046] = 0; d_matrix2[4047] = 0; d_matrix2[4048] = 5; d_matrix2[4049] = 0; d_matrix2[4050] = 2; d_matrix2[4051] = 1; d_matrix2[4052] = 0; d_matrix2[4053] = 2; d_matrix2[4054] = 4; d_matrix2[4055] = 2; d_matrix2[4056] = 4; d_matrix2[4057] = 5; d_matrix2[4058] = 4; d_matrix2[4059] = 0; d_matrix2[4060] = 0; d_matrix2[4061] = 0; d_matrix2[4062] = 0; d_matrix2[4063] = 2; d_matrix2[4064] = 0; d_matrix2[4065] = 0; d_matrix2[4066] = 0; d_matrix2[4067] = 0; d_matrix2[4068] = 0; d_matrix2[4069] = 1; d_matrix2[4070] = 0; d_matrix2[4071] = 2; d_matrix2[4072] = 3; d_matrix2[4073] = 2; d_matrix2[4074] = 0; d_matrix2[4075] = 0; d_matrix2[4076] = 0; d_matrix2[4077] = 0; d_matrix2[4078] = 1; d_matrix2[4079] = 0;
d_matrix2[4080] = 0; d_matrix2[4081] = 0; d_matrix2[4082] = 0; d_matrix2[4083] = 0; d_matrix2[4084] = 0; d_matrix2[4085] = 0; d_matrix2[4086] = 0; d_matrix2[4087] = 0; d_matrix2[4088] = 0; d_matrix2[4089] = 0; d_matrix2[4090] = 4; d_matrix2[4091] = 0; d_matrix2[4092] = 0; d_matrix2[4093] = 0; d_matrix2[4094] = 0; d_matrix2[4095] = 0; d_matrix2[4096] = 2; d_matrix2[4097] = 0; d_matrix2[4098] = 0; d_matrix2[4099] = 0; d_matrix2[4100] = 0; d_matrix2[4101] = 0; d_matrix2[4102] = 0; d_matrix2[4103] = 0; d_matrix2[4104] = 0; d_matrix2[4105] = 0; d_matrix2[4106] = 0; d_matrix2[4107] = 0; d_matrix2[4108] = 0; d_matrix2[4109] = 0; d_matrix2[4110] = 0; d_matrix2[4111] = 0; d_matrix2[4112] = 0; d_matrix2[4113] = 0; d_matrix2[4114] = 0; d_matrix2[4115] = 0; d_matrix2[4116] = 0; d_matrix2[4117] = 0; d_matrix2[4118] = 0; d_matrix2[4119] = 0; d_matrix2[4120] = 0; d_matrix2[4121] = 0; d_matrix2[4122] = 0; d_matrix2[4123] = 0; d_matrix2[4124] = 0; d_matrix2[4125] = 0; d_matrix2[4126] = 0; d_matrix2[4127] = 0; d_matrix2[4128] = 0; d_matrix2[4129] = 0; d_matrix2[4130] = 0; d_matrix2[4131] = 0; d_matrix2[4132] = 0; d_matrix2[4133] = 0; d_matrix2[4134] = 0; d_matrix2[4135] = 0; d_matrix2[4136] = 0; d_matrix2[4137] = 0; d_matrix2[4138] = 0; d_matrix2[4139] = 0; d_matrix2[4140] = 0; d_matrix2[4141] = 0; d_matrix2[4142] = 0; d_matrix2[4143] = 0; d_matrix2[4144] = 0; d_matrix2[4145] = 0; d_matrix2[4146] = 0; d_matrix2[4147] = 0; d_matrix2[4148] = 0; d_matrix2[4149] = 0; d_matrix2[4150] = 0; d_matrix2[4151] = 0; d_matrix2[4152] = 0; d_matrix2[4153] = 0; d_matrix2[4154] = 0; d_matrix2[4155] = 0; d_matrix2[4156] = 0; d_matrix2[4157] = 0; d_matrix2[4158] = 0; d_matrix2[4159] = 0;
d_matrix2[4160] = 0; d_matrix2[4161] = 0; d_matrix2[4162] = 0; d_matrix2[4163] = 0; d_matrix2[4164] = 0; d_matrix2[4165] = 0; d_matrix2[4166] = 0; d_matrix2[4167] = 0; d_matrix2[4168] = 0; d_matrix2[4169] = 0; d_matrix2[4170] = 0; d_matrix2[4171] = 0; d_matrix2[4172] = 0; d_matrix2[4173] = 0; d_matrix2[4174] = 0; d_matrix2[4175] = 0; d_matrix2[4176] = 0; d_matrix2[4177] = 0; d_matrix2[4178] = 0; d_matrix2[4179] = 0; d_matrix2[4180] = 0; d_matrix2[4181] = 0; d_matrix2[4182] = 0; d_matrix2[4183] = 0; d_matrix2[4184] = 0; d_matrix2[4185] = 0; d_matrix2[4186] = 0; d_matrix2[4187] = 0; d_matrix2[4188] = 0; d_matrix2[4189] = 0; d_matrix2[4190] = 0; d_matrix2[4191] = 0; d_matrix2[4192] = 0; d_matrix2[4193] = 0; d_matrix2[4194] = 0; d_matrix2[4195] = 0; d_matrix2[4196] = 0; d_matrix2[4197] = 0; d_matrix2[4198] = 0; d_matrix2[4199] = 0; d_matrix2[4200] = 0; d_matrix2[4201] = 0; d_matrix2[4202] = 0; d_matrix2[4203] = 0; d_matrix2[4204] = 0; d_matrix2[4205] = 0; d_matrix2[4206] = 0; d_matrix2[4207] = 0; d_matrix2[4208] = 0; d_matrix2[4209] = 0; d_matrix2[4210] = 0; d_matrix2[4211] = 5; d_matrix2[4212] = 0; d_matrix2[4213] = 0; d_matrix2[4214] = 0; d_matrix2[4215] = 0; d_matrix2[4216] = 0; d_matrix2[4217] = 0; d_matrix2[4218] = 0; d_matrix2[4219] = 0; d_matrix2[4220] = 0; d_matrix2[4221] = 0; d_matrix2[4222] = 0; d_matrix2[4223] = 0; d_matrix2[4224] = 0; d_matrix2[4225] = 4; d_matrix2[4226] = 0; d_matrix2[4227] = 0; d_matrix2[4228] = 0; d_matrix2[4229] = 0; d_matrix2[4230] = 0; d_matrix2[4231] = 0; d_matrix2[4232] = 0; d_matrix2[4233] = 0; d_matrix2[4234] = 0; d_matrix2[4235] = 0; d_matrix2[4236] = 0; d_matrix2[4237] = 0; d_matrix2[4238] = 0; d_matrix2[4239] = 0;
d_matrix2[4240] = 0; d_matrix2[4241] = 0; d_matrix2[4242] = 0; d_matrix2[4243] = 0; d_matrix2[4244] = 0; d_matrix2[4245] = 0; d_matrix2[4246] = 0; d_matrix2[4247] = 0; d_matrix2[4248] = 5; d_matrix2[4249] = 0; d_matrix2[4250] = 0; d_matrix2[4251] = 0; d_matrix2[4252] = 0; d_matrix2[4253] = 0; d_matrix2[4254] = 5; d_matrix2[4255] = 0; d_matrix2[4256] = 5; d_matrix2[4257] = 0; d_matrix2[4258] = 0; d_matrix2[4259] = 0; d_matrix2[4260] = 5; d_matrix2[4261] = 0; d_matrix2[4262] = 0; d_matrix2[4263] = 5; d_matrix2[4264] = 0; d_matrix2[4265] = 0; d_matrix2[4266] = 5; d_matrix2[4267] = 0; d_matrix2[4268] = 0; d_matrix2[4269] = 0; d_matrix2[4270] = 0; d_matrix2[4271] = 0; d_matrix2[4272] = 0; d_matrix2[4273] = 0; d_matrix2[4274] = 0; d_matrix2[4275] = 0; d_matrix2[4276] = 0; d_matrix2[4277] = 0; d_matrix2[4278] = 0; d_matrix2[4279] = 0; d_matrix2[4280] = 0; d_matrix2[4281] = 0; d_matrix2[4282] = 0; d_matrix2[4283] = 0; d_matrix2[4284] = 0; d_matrix2[4285] = 0; d_matrix2[4286] = 0; d_matrix2[4287] = 0; d_matrix2[4288] = 0; d_matrix2[4289] = 0; d_matrix2[4290] = 0; d_matrix2[4291] = 0; d_matrix2[4292] = 0; d_matrix2[4293] = 0; d_matrix2[4294] = 0; d_matrix2[4295] = 0; d_matrix2[4296] = 0; d_matrix2[4297] = 0; d_matrix2[4298] = 0; d_matrix2[4299] = 0; d_matrix2[4300] = 0; d_matrix2[4301] = 0; d_matrix2[4302] = 0; d_matrix2[4303] = 0; d_matrix2[4304] = 0; d_matrix2[4305] = 0; d_matrix2[4306] = 0; d_matrix2[4307] = 0; d_matrix2[4308] = 0; d_matrix2[4309] = 0; d_matrix2[4310] = 0; d_matrix2[4311] = 0; d_matrix2[4312] = 0; d_matrix2[4313] = 0; d_matrix2[4314] = 0; d_matrix2[4315] = 0; d_matrix2[4316] = 0; d_matrix2[4317] = 0; d_matrix2[4318] = 0; d_matrix2[4319] = 0;
d_matrix2[4320] = 0; d_matrix2[4321] = 0; d_matrix2[4322] = 0; d_matrix2[4323] = 0; d_matrix2[4324] = 0; d_matrix2[4325] = 0; d_matrix2[4326] = 0; d_matrix2[4327] = 0; d_matrix2[4328] = 3; d_matrix2[4329] = 0; d_matrix2[4330] = 0; d_matrix2[4331] = 0; d_matrix2[4332] = 0; d_matrix2[4333] = 0; d_matrix2[4334] = 0; d_matrix2[4335] = 0; d_matrix2[4336] = 5; d_matrix2[4337] = 0; d_matrix2[4338] = 0; d_matrix2[4339] = 0; d_matrix2[4340] = 0; d_matrix2[4341] = 0; d_matrix2[4342] = 0; d_matrix2[4343] = 0; d_matrix2[4344] = 0; d_matrix2[4345] = 3; d_matrix2[4346] = 4; d_matrix2[4347] = 0; d_matrix2[4348] = 0; d_matrix2[4349] = 0; d_matrix2[4350] = 0; d_matrix2[4351] = 0; d_matrix2[4352] = 0; d_matrix2[4353] = 0; d_matrix2[4354] = 0; d_matrix2[4355] = 0; d_matrix2[4356] = 0; d_matrix2[4357] = 0; d_matrix2[4358] = 0; d_matrix2[4359] = 0; d_matrix2[4360] = 0; d_matrix2[4361] = 0; d_matrix2[4362] = 0; d_matrix2[4363] = 0; d_matrix2[4364] = 0; d_matrix2[4365] = 0; d_matrix2[4366] = 0; d_matrix2[4367] = 0; d_matrix2[4368] = 0; d_matrix2[4369] = 0; d_matrix2[4370] = 0; d_matrix2[4371] = 4; d_matrix2[4372] = 0; d_matrix2[4373] = 0; d_matrix2[4374] = 0; d_matrix2[4375] = 0; d_matrix2[4376] = 0; d_matrix2[4377] = 0; d_matrix2[4378] = 0; d_matrix2[4379] = 0; d_matrix2[4380] = 0; d_matrix2[4381] = 0; d_matrix2[4382] = 0; d_matrix2[4383] = 0; d_matrix2[4384] = 0; d_matrix2[4385] = 5; d_matrix2[4386] = 0; d_matrix2[4387] = 0; d_matrix2[4388] = 0; d_matrix2[4389] = 0; d_matrix2[4390] = 0; d_matrix2[4391] = 0; d_matrix2[4392] = 0; d_matrix2[4393] = 0; d_matrix2[4394] = 0; d_matrix2[4395] = 0; d_matrix2[4396] = 0; d_matrix2[4397] = 0; d_matrix2[4398] = 0; d_matrix2[4399] = 0;
d_matrix2[4400] = 0; d_matrix2[4401] = 0; d_matrix2[4402] = 4; d_matrix2[4403] = 0; d_matrix2[4404] = 0; d_matrix2[4405] = 0; d_matrix2[4406] = 0; d_matrix2[4407] = 0; d_matrix2[4408] = 4; d_matrix2[4409] = 0; d_matrix2[4410] = 0; d_matrix2[4411] = 0; d_matrix2[4412] = 0; d_matrix2[4413] = 0; d_matrix2[4414] = 0; d_matrix2[4415] = 0; d_matrix2[4416] = 0; d_matrix2[4417] = 0; d_matrix2[4418] = 0; d_matrix2[4419] = 0; d_matrix2[4420] = 0; d_matrix2[4421] = 0; d_matrix2[4422] = 0; d_matrix2[4423] = 0; d_matrix2[4424] = 0; d_matrix2[4425] = 1; d_matrix2[4426] = 4; d_matrix2[4427] = 0; d_matrix2[4428] = 0; d_matrix2[4429] = 0; d_matrix2[4430] = 0; d_matrix2[4431] = 0; d_matrix2[4432] = 0; d_matrix2[4433] = 0; d_matrix2[4434] = 0; d_matrix2[4435] = 0; d_matrix2[4436] = 0; d_matrix2[4437] = 0; d_matrix2[4438] = 0; d_matrix2[4439] = 0; d_matrix2[4440] = 0; d_matrix2[4441] = 0; d_matrix2[4442] = 0; d_matrix2[4443] = 0; d_matrix2[4444] = 0; d_matrix2[4445] = 0; d_matrix2[4446] = 0; d_matrix2[4447] = 0; d_matrix2[4448] = 0; d_matrix2[4449] = 0; d_matrix2[4450] = 0; d_matrix2[4451] = 5; d_matrix2[4452] = 0; d_matrix2[4453] = 0; d_matrix2[4454] = 0; d_matrix2[4455] = 0; d_matrix2[4456] = 0; d_matrix2[4457] = 0; d_matrix2[4458] = 0; d_matrix2[4459] = 0; d_matrix2[4460] = 0; d_matrix2[4461] = 0; d_matrix2[4462] = 0; d_matrix2[4463] = 0; d_matrix2[4464] = 0; d_matrix2[4465] = 0; d_matrix2[4466] = 0; d_matrix2[4467] = 0; d_matrix2[4468] = 0; d_matrix2[4469] = 0; d_matrix2[4470] = 0; d_matrix2[4471] = 0; d_matrix2[4472] = 0; d_matrix2[4473] = 0; d_matrix2[4474] = 0; d_matrix2[4475] = 0; d_matrix2[4476] = 0; d_matrix2[4477] = 0; d_matrix2[4478] = 0; d_matrix2[4479] = 0;
d_matrix2[4480] = 0; d_matrix2[4481] = 0; d_matrix2[4482] = 0; d_matrix2[4483] = 0; d_matrix2[4484] = 0; d_matrix2[4485] = 0; d_matrix2[4486] = 0; d_matrix2[4487] = 0; d_matrix2[4488] = 3; d_matrix2[4489] = 0; d_matrix2[4490] = 0; d_matrix2[4491] = 0; d_matrix2[4492] = 0; d_matrix2[4493] = 0; d_matrix2[4494] = 0; d_matrix2[4495] = 0; d_matrix2[4496] = 0; d_matrix2[4497] = 0; d_matrix2[4498] = 0; d_matrix2[4499] = 0; d_matrix2[4500] = 0; d_matrix2[4501] = 0; d_matrix2[4502] = 0; d_matrix2[4503] = 5; d_matrix2[4504] = 0; d_matrix2[4505] = 0; d_matrix2[4506] = 0; d_matrix2[4507] = 0; d_matrix2[4508] = 0; d_matrix2[4509] = 0; d_matrix2[4510] = 0; d_matrix2[4511] = 0; d_matrix2[4512] = 0; d_matrix2[4513] = 0; d_matrix2[4514] = 0; d_matrix2[4515] = 0; d_matrix2[4516] = 0; d_matrix2[4517] = 0; d_matrix2[4518] = 0; d_matrix2[4519] = 0; d_matrix2[4520] = 0; d_matrix2[4521] = 0; d_matrix2[4522] = 0; d_matrix2[4523] = 0; d_matrix2[4524] = 0; d_matrix2[4525] = 0; d_matrix2[4526] = 0; d_matrix2[4527] = 0; d_matrix2[4528] = 0; d_matrix2[4529] = 0; d_matrix2[4530] = 0; d_matrix2[4531] = 4; d_matrix2[4532] = 0; d_matrix2[4533] = 0; d_matrix2[4534] = 0; d_matrix2[4535] = 0; d_matrix2[4536] = 0; d_matrix2[4537] = 4; d_matrix2[4538] = 0; d_matrix2[4539] = 0; d_matrix2[4540] = 0; d_matrix2[4541] = 0; d_matrix2[4542] = 0; d_matrix2[4543] = 0; d_matrix2[4544] = 0; d_matrix2[4545] = 0; d_matrix2[4546] = 0; d_matrix2[4547] = 0; d_matrix2[4548] = 0; d_matrix2[4549] = 0; d_matrix2[4550] = 0; d_matrix2[4551] = 0; d_matrix2[4552] = 0; d_matrix2[4553] = 0; d_matrix2[4554] = 0; d_matrix2[4555] = 0; d_matrix2[4556] = 0; d_matrix2[4557] = 0; d_matrix2[4558] = 0; d_matrix2[4559] = 0;
d_matrix2[4560] = 0; d_matrix2[4561] = 0; d_matrix2[4562] = 4; d_matrix2[4563] = 0; d_matrix2[4564] = 0; d_matrix2[4565] = 0; d_matrix2[4566] = 0; d_matrix2[4567] = 0; d_matrix2[4568] = 5; d_matrix2[4569] = 0; d_matrix2[4570] = 0; d_matrix2[4571] = 0; d_matrix2[4572] = 4; d_matrix2[4573] = 0; d_matrix2[4574] = 0; d_matrix2[4575] = 0; d_matrix2[4576] = 0; d_matrix2[4577] = 0; d_matrix2[4578] = 0; d_matrix2[4579] = 0; d_matrix2[4580] = 0; d_matrix2[4581] = 0; d_matrix2[4582] = 0; d_matrix2[4583] = 5; d_matrix2[4584] = 0; d_matrix2[4585] = 0; d_matrix2[4586] = 4; d_matrix2[4587] = 0; d_matrix2[4588] = 0; d_matrix2[4589] = 5; d_matrix2[4590] = 3; d_matrix2[4591] = 0; d_matrix2[4592] = 4; d_matrix2[4593] = 0; d_matrix2[4594] = 0; d_matrix2[4595] = 0; d_matrix2[4596] = 0; d_matrix2[4597] = 0; d_matrix2[4598] = 0; d_matrix2[4599] = 2; d_matrix2[4600] = 0; d_matrix2[4601] = 0; d_matrix2[4602] = 0; d_matrix2[4603] = 4; d_matrix2[4604] = 0; d_matrix2[4605] = 4; d_matrix2[4606] = 0; d_matrix2[4607] = 0; d_matrix2[4608] = 0; d_matrix2[4609] = 0; d_matrix2[4610] = 0; d_matrix2[4611] = 5; d_matrix2[4612] = 3; d_matrix2[4613] = 0; d_matrix2[4614] = 3; d_matrix2[4615] = 0; d_matrix2[4616] = 0; d_matrix2[4617] = 5; d_matrix2[4618] = 0; d_matrix2[4619] = 0; d_matrix2[4620] = 0; d_matrix2[4621] = 0; d_matrix2[4622] = 0; d_matrix2[4623] = 5; d_matrix2[4624] = 3; d_matrix2[4625] = 5; d_matrix2[4626] = 0; d_matrix2[4627] = 3; d_matrix2[4628] = 2; d_matrix2[4629] = 3; d_matrix2[4630] = 4; d_matrix2[4631] = 4; d_matrix2[4632] = 4; d_matrix2[4633] = 0; d_matrix2[4634] = 4; d_matrix2[4635] = 0; d_matrix2[4636] = 0; d_matrix2[4637] = 0; d_matrix2[4638] = 3; d_matrix2[4639] = 3;
d_matrix2[4640] = 0; d_matrix2[4641] = 0; d_matrix2[4642] = 5; d_matrix2[4643] = 0; d_matrix2[4644] = 0; d_matrix2[4645] = 0; d_matrix2[4646] = 0; d_matrix2[4647] = 0; d_matrix2[4648] = 4; d_matrix2[4649] = 4; d_matrix2[4650] = 0; d_matrix2[4651] = 0; d_matrix2[4652] = 3; d_matrix2[4653] = 0; d_matrix2[4654] = 0; d_matrix2[4655] = 0; d_matrix2[4656] = 4; d_matrix2[4657] = 0; d_matrix2[4658] = 0; d_matrix2[4659] = 0; d_matrix2[4660] = 0; d_matrix2[4661] = 0; d_matrix2[4662] = 0; d_matrix2[4663] = 0; d_matrix2[4664] = 0; d_matrix2[4665] = 3; d_matrix2[4666] = 0; d_matrix2[4667] = 0; d_matrix2[4668] = 0; d_matrix2[4669] = 4; d_matrix2[4670] = 0; d_matrix2[4671] = 0; d_matrix2[4672] = 0; d_matrix2[4673] = 0; d_matrix2[4674] = 0; d_matrix2[4675] = 0; d_matrix2[4676] = 0; d_matrix2[4677] = 0; d_matrix2[4678] = 0; d_matrix2[4679] = 0; d_matrix2[4680] = 0; d_matrix2[4681] = 0; d_matrix2[4682] = 0; d_matrix2[4683] = 5; d_matrix2[4684] = 0; d_matrix2[4685] = 0; d_matrix2[4686] = 0; d_matrix2[4687] = 0; d_matrix2[4688] = 0; d_matrix2[4689] = 0; d_matrix2[4690] = 0; d_matrix2[4691] = 5; d_matrix2[4692] = 0; d_matrix2[4693] = 0; d_matrix2[4694] = 0; d_matrix2[4695] = 0; d_matrix2[4696] = 0; d_matrix2[4697] = 3; d_matrix2[4698] = 0; d_matrix2[4699] = 0; d_matrix2[4700] = 0; d_matrix2[4701] = 0; d_matrix2[4702] = 0; d_matrix2[4703] = 0; d_matrix2[4704] = 0; d_matrix2[4705] = 5; d_matrix2[4706] = 0; d_matrix2[4707] = 0; d_matrix2[4708] = 0; d_matrix2[4709] = 0; d_matrix2[4710] = 0; d_matrix2[4711] = 0; d_matrix2[4712] = 0; d_matrix2[4713] = 0; d_matrix2[4714] = 0; d_matrix2[4715] = 0; d_matrix2[4716] = 0; d_matrix2[4717] = 0; d_matrix2[4718] = 0; d_matrix2[4719] = 0;
d_matrix2[4720] = 0; d_matrix2[4721] = 0; d_matrix2[4722] = 5; d_matrix2[4723] = 0; d_matrix2[4724] = 0; d_matrix2[4725] = 0; d_matrix2[4726] = 0; d_matrix2[4727] = 0; d_matrix2[4728] = 5; d_matrix2[4729] = 4; d_matrix2[4730] = 4; d_matrix2[4731] = 0; d_matrix2[4732] = 5; d_matrix2[4733] = 5; d_matrix2[4734] = 3; d_matrix2[4735] = 0; d_matrix2[4736] = 0; d_matrix2[4737] = 0; d_matrix2[4738] = 0; d_matrix2[4739] = 0; d_matrix2[4740] = 0; d_matrix2[4741] = 1; d_matrix2[4742] = 0; d_matrix2[4743] = 0; d_matrix2[4744] = 0; d_matrix2[4745] = 0; d_matrix2[4746] = 4; d_matrix2[4747] = 0; d_matrix2[4748] = 0; d_matrix2[4749] = 0; d_matrix2[4750] = 0; d_matrix2[4751] = 0; d_matrix2[4752] = 0; d_matrix2[4753] = 5; d_matrix2[4754] = 0; d_matrix2[4755] = 0; d_matrix2[4756] = 0; d_matrix2[4757] = 0; d_matrix2[4758] = 0; d_matrix2[4759] = 0; d_matrix2[4760] = 0; d_matrix2[4761] = 0; d_matrix2[4762] = 0; d_matrix2[4763] = 4; d_matrix2[4764] = 0; d_matrix2[4765] = 0; d_matrix2[4766] = 5; d_matrix2[4767] = 0; d_matrix2[4768] = 0; d_matrix2[4769] = 0; d_matrix2[4770] = 0; d_matrix2[4771] = 4; d_matrix2[4772] = 0; d_matrix2[4773] = 0; d_matrix2[4774] = 0; d_matrix2[4775] = 0; d_matrix2[4776] = 0; d_matrix2[4777] = 5; d_matrix2[4778] = 0; d_matrix2[4779] = 0; d_matrix2[4780] = 0; d_matrix2[4781] = 0; d_matrix2[4782] = 5; d_matrix2[4783] = 0; d_matrix2[4784] = 0; d_matrix2[4785] = 5; d_matrix2[4786] = 0; d_matrix2[4787] = 0; d_matrix2[4788] = 0; d_matrix2[4789] = 0; d_matrix2[4790] = 1; d_matrix2[4791] = 4; d_matrix2[4792] = 0; d_matrix2[4793] = 0; d_matrix2[4794] = 0; d_matrix2[4795] = 0; d_matrix2[4796] = 0; d_matrix2[4797] = 0; d_matrix2[4798] = 0; d_matrix2[4799] = 0;
d_matrix2[4800] = 0; d_matrix2[4801] = 0; d_matrix2[4802] = 2; d_matrix2[4803] = 0; d_matrix2[4804] = 4; d_matrix2[4805] = 4; d_matrix2[4806] = 0; d_matrix2[4807] = 0; d_matrix2[4808] = 4; d_matrix2[4809] = 0; d_matrix2[4810] = 4; d_matrix2[4811] = 4; d_matrix2[4812] = 5; d_matrix2[4813] = 5; d_matrix2[4814] = 5; d_matrix2[4815] = 5; d_matrix2[4816] = 5; d_matrix2[4817] = 0; d_matrix2[4818] = 0; d_matrix2[4819] = 4; d_matrix2[4820] = 0; d_matrix2[4821] = 0; d_matrix2[4822] = 0; d_matrix2[4823] = 4; d_matrix2[4824] = 5; d_matrix2[4825] = 4; d_matrix2[4826] = 4; d_matrix2[4827] = 0; d_matrix2[4828] = 0; d_matrix2[4829] = 5; d_matrix2[4830] = 0; d_matrix2[4831] = 5; d_matrix2[4832] = 0; d_matrix2[4833] = 4; d_matrix2[4834] = 3; d_matrix2[4835] = 0; d_matrix2[4836] = 0; d_matrix2[4837] = 0; d_matrix2[4838] = 0; d_matrix2[4839] = 0; d_matrix2[4840] = 4; d_matrix2[4841] = 0; d_matrix2[4842] = 0; d_matrix2[4843] = 5; d_matrix2[4844] = 0; d_matrix2[4845] = 4; d_matrix2[4846] = 5; d_matrix2[4847] = 0; d_matrix2[4848] = 5; d_matrix2[4849] = 5; d_matrix2[4850] = 0; d_matrix2[4851] = 5; d_matrix2[4852] = 5; d_matrix2[4853] = 4; d_matrix2[4854] = 5; d_matrix2[4855] = 4; d_matrix2[4856] = 5; d_matrix2[4857] = 5; d_matrix2[4858] = 0; d_matrix2[4859] = 4; d_matrix2[4860] = 5; d_matrix2[4861] = 5; d_matrix2[4862] = 4; d_matrix2[4863] = 0; d_matrix2[4864] = 0; d_matrix2[4865] = 5; d_matrix2[4866] = 4; d_matrix2[4867] = 0; d_matrix2[4868] = 0; d_matrix2[4869] = 2; d_matrix2[4870] = 5; d_matrix2[4871] = 3; d_matrix2[4872] = 3; d_matrix2[4873] = 0; d_matrix2[4874] = 4; d_matrix2[4875] = 0; d_matrix2[4876] = 0; d_matrix2[4877] = 0; d_matrix2[4878] = 4; d_matrix2[4879] = 0;
d_matrix2[4880] = 0; d_matrix2[4881] = 0; d_matrix2[4882] = 0; d_matrix2[4883] = 0; d_matrix2[4884] = 0; d_matrix2[4885] = 0; d_matrix2[4886] = 0; d_matrix2[4887] = 0; d_matrix2[4888] = 5; d_matrix2[4889] = 3; d_matrix2[4890] = 5; d_matrix2[4891] = 0; d_matrix2[4892] = 0; d_matrix2[4893] = 4; d_matrix2[4894] = 4; d_matrix2[4895] = 0; d_matrix2[4896] = 4; d_matrix2[4897] = 0; d_matrix2[4898] = 0; d_matrix2[4899] = 0; d_matrix2[4900] = 0; d_matrix2[4901] = 0; d_matrix2[4902] = 3; d_matrix2[4903] = 0; d_matrix2[4904] = 4; d_matrix2[4905] = 0; d_matrix2[4906] = 0; d_matrix2[4907] = 0; d_matrix2[4908] = 0; d_matrix2[4909] = 5; d_matrix2[4910] = 0; d_matrix2[4911] = 5; d_matrix2[4912] = 0; d_matrix2[4913] = 0; d_matrix2[4914] = 0; d_matrix2[4915] = 0; d_matrix2[4916] = 0; d_matrix2[4917] = 0; d_matrix2[4918] = 0; d_matrix2[4919] = 0; d_matrix2[4920] = 0; d_matrix2[4921] = 0; d_matrix2[4922] = 0; d_matrix2[4923] = 0; d_matrix2[4924] = 0; d_matrix2[4925] = 0; d_matrix2[4926] = 0; d_matrix2[4927] = 0; d_matrix2[4928] = 4; d_matrix2[4929] = 0; d_matrix2[4930] = 0; d_matrix2[4931] = 5; d_matrix2[4932] = 0; d_matrix2[4933] = 0; d_matrix2[4934] = 0; d_matrix2[4935] = 0; d_matrix2[4936] = 0; d_matrix2[4937] = 4; d_matrix2[4938] = 0; d_matrix2[4939] = 0; d_matrix2[4940] = 5; d_matrix2[4941] = 5; d_matrix2[4942] = 4; d_matrix2[4943] = 0; d_matrix2[4944] = 0; d_matrix2[4945] = 4; d_matrix2[4946] = 0; d_matrix2[4947] = 0; d_matrix2[4948] = 0; d_matrix2[4949] = 0; d_matrix2[4950] = 4; d_matrix2[4951] = 4; d_matrix2[4952] = 3; d_matrix2[4953] = 0; d_matrix2[4954] = 4; d_matrix2[4955] = 0; d_matrix2[4956] = 0; d_matrix2[4957] = 0; d_matrix2[4958] = 4; d_matrix2[4959] = 0;
d_matrix2[4960] = 0; d_matrix2[4961] = 0; d_matrix2[4962] = 0; d_matrix2[4963] = 0; d_matrix2[4964] = 0; d_matrix2[4965] = 0; d_matrix2[4966] = 0; d_matrix2[4967] = 0; d_matrix2[4968] = 0; d_matrix2[4969] = 0; d_matrix2[4970] = 0; d_matrix2[4971] = 0; d_matrix2[4972] = 0; d_matrix2[4973] = 0; d_matrix2[4974] = 0; d_matrix2[4975] = 0; d_matrix2[4976] = 0; d_matrix2[4977] = 0; d_matrix2[4978] = 0; d_matrix2[4979] = 0; d_matrix2[4980] = 0; d_matrix2[4981] = 0; d_matrix2[4982] = 0; d_matrix2[4983] = 0; d_matrix2[4984] = 0; d_matrix2[4985] = 0; d_matrix2[4986] = 0; d_matrix2[4987] = 0; d_matrix2[4988] = 0; d_matrix2[4989] = 0; d_matrix2[4990] = 0; d_matrix2[4991] = 0; d_matrix2[4992] = 0; d_matrix2[4993] = 0; d_matrix2[4994] = 0; d_matrix2[4995] = 0; d_matrix2[4996] = 0; d_matrix2[4997] = 0; d_matrix2[4998] = 0; d_matrix2[4999] = 0; d_matrix2[5000] = 0; d_matrix2[5001] = 0; d_matrix2[5002] = 0; d_matrix2[5003] = 0; d_matrix2[5004] = 0; d_matrix2[5005] = 0; d_matrix2[5006] = 0; d_matrix2[5007] = 0; d_matrix2[5008] = 0; d_matrix2[5009] = 0; d_matrix2[5010] = 0; d_matrix2[5011] = 0; d_matrix2[5012] = 0; d_matrix2[5013] = 0; d_matrix2[5014] = 0; d_matrix2[5015] = 0; d_matrix2[5016] = 0; d_matrix2[5017] = 0; d_matrix2[5018] = 0; d_matrix2[5019] = 0; d_matrix2[5020] = 0; d_matrix2[5021] = 0; d_matrix2[5022] = 0; d_matrix2[5023] = 0; d_matrix2[5024] = 0; d_matrix2[5025] = 0; d_matrix2[5026] = 0; d_matrix2[5027] = 0; d_matrix2[5028] = 0; d_matrix2[5029] = 0; d_matrix2[5030] = 0; d_matrix2[5031] = 0; d_matrix2[5032] = 0; d_matrix2[5033] = 0; d_matrix2[5034] = 0; d_matrix2[5035] = 0; d_matrix2[5036] = 0; d_matrix2[5037] = 0; d_matrix2[5038] = 0; d_matrix2[5039] = 0;
d_matrix2[5040] = 0; d_matrix2[5041] = 0; d_matrix2[5042] = 2; d_matrix2[5043] = 0; d_matrix2[5044] = 3; d_matrix2[5045] = 4; d_matrix2[5046] = 0; d_matrix2[5047] = 0; d_matrix2[5048] = 4; d_matrix2[5049] = 5; d_matrix2[5050] = 4; d_matrix2[5051] = 0; d_matrix2[5052] = 0; d_matrix2[5053] = 4; d_matrix2[5054] = 4; d_matrix2[5055] = 4; d_matrix2[5056] = 2; d_matrix2[5057] = 0; d_matrix2[5058] = 0; d_matrix2[5059] = 0; d_matrix2[5060] = 0; d_matrix2[5061] = 4; d_matrix2[5062] = 3; d_matrix2[5063] = 4; d_matrix2[5064] = 0; d_matrix2[5065] = 4; d_matrix2[5066] = 0; d_matrix2[5067] = 0; d_matrix2[5068] = 0; d_matrix2[5069] = 3; d_matrix2[5070] = 0; d_matrix2[5071] = 0; d_matrix2[5072] = 0; d_matrix2[5073] = 0; d_matrix2[5074] = 1; d_matrix2[5075] = 0; d_matrix2[5076] = 0; d_matrix2[5077] = 0; d_matrix2[5078] = 0; d_matrix2[5079] = 0; d_matrix2[5080] = 0; d_matrix2[5081] = 0; d_matrix2[5082] = 0; d_matrix2[5083] = 0; d_matrix2[5084] = 0; d_matrix2[5085] = 3; d_matrix2[5086] = 0; d_matrix2[5087] = 0; d_matrix2[5088] = 4; d_matrix2[5089] = 0; d_matrix2[5090] = 0; d_matrix2[5091] = 5; d_matrix2[5092] = 0; d_matrix2[5093] = 0; d_matrix2[5094] = 2; d_matrix2[5095] = 0; d_matrix2[5096] = 5; d_matrix2[5097] = 5; d_matrix2[5098] = 0; d_matrix2[5099] = 0; d_matrix2[5100] = 4; d_matrix2[5101] = 0; d_matrix2[5102] = 0; d_matrix2[5103] = 3; d_matrix2[5104] = 0; d_matrix2[5105] = 4; d_matrix2[5106] = 4; d_matrix2[5107] = 0; d_matrix2[5108] = 0; d_matrix2[5109] = 1; d_matrix2[5110] = 4; d_matrix2[5111] = 3; d_matrix2[5112] = 4; d_matrix2[5113] = 3; d_matrix2[5114] = 0; d_matrix2[5115] = 0; d_matrix2[5116] = 0; d_matrix2[5117] = 4; d_matrix2[5118] = 0; d_matrix2[5119] = 2;
d_matrix2[5120] = 0; d_matrix2[5121] = 0; d_matrix2[5122] = 3; d_matrix2[5123] = 0; d_matrix2[5124] = 2; d_matrix2[5125] = 0; d_matrix2[5126] = 0; d_matrix2[5127] = 3; d_matrix2[5128] = 0; d_matrix2[5129] = 0; d_matrix2[5130] = 0; d_matrix2[5131] = 4; d_matrix2[5132] = 0; d_matrix2[5133] = 0; d_matrix2[5134] = 4; d_matrix2[5135] = 4; d_matrix2[5136] = 3; d_matrix2[5137] = 0; d_matrix2[5138] = 0; d_matrix2[5139] = 0; d_matrix2[5140] = 0; d_matrix2[5141] = 3; d_matrix2[5142] = 0; d_matrix2[5143] = 0; d_matrix2[5144] = 0; d_matrix2[5145] = 0; d_matrix2[5146] = 4; d_matrix2[5147] = 0; d_matrix2[5148] = 0; d_matrix2[5149] = 0; d_matrix2[5150] = 0; d_matrix2[5151] = 0; d_matrix2[5152] = 0; d_matrix2[5153] = 0; d_matrix2[5154] = 0; d_matrix2[5155] = 0; d_matrix2[5156] = 0; d_matrix2[5157] = 0; d_matrix2[5158] = 0; d_matrix2[5159] = 0; d_matrix2[5160] = 0; d_matrix2[5161] = 0; d_matrix2[5162] = 0; d_matrix2[5163] = 0; d_matrix2[5164] = 0; d_matrix2[5165] = 0; d_matrix2[5166] = 0; d_matrix2[5167] = 0; d_matrix2[5168] = 0; d_matrix2[5169] = 0; d_matrix2[5170] = 0; d_matrix2[5171] = 4; d_matrix2[5172] = 0; d_matrix2[5173] = 0; d_matrix2[5174] = 0; d_matrix2[5175] = 0; d_matrix2[5176] = 0; d_matrix2[5177] = 0; d_matrix2[5178] = 0; d_matrix2[5179] = 0; d_matrix2[5180] = 0; d_matrix2[5181] = 0; d_matrix2[5182] = 0; d_matrix2[5183] = 0; d_matrix2[5184] = 0; d_matrix2[5185] = 0; d_matrix2[5186] = 0; d_matrix2[5187] = 0; d_matrix2[5188] = 0; d_matrix2[5189] = 0; d_matrix2[5190] = 0; d_matrix2[5191] = 0; d_matrix2[5192] = 0; d_matrix2[5193] = 0; d_matrix2[5194] = 0; d_matrix2[5195] = 0; d_matrix2[5196] = 0; d_matrix2[5197] = 0; d_matrix2[5198] = 0; d_matrix2[5199] = 0;
d_matrix2[5200] = 0; d_matrix2[5201] = 0; d_matrix2[5202] = 4; d_matrix2[5203] = 3; d_matrix2[5204] = 0; d_matrix2[5205] = 3; d_matrix2[5206] = 0; d_matrix2[5207] = 0; d_matrix2[5208] = 4; d_matrix2[5209] = 4; d_matrix2[5210] = 4; d_matrix2[5211] = 5; d_matrix2[5212] = 4; d_matrix2[5213] = 5; d_matrix2[5214] = 0; d_matrix2[5215] = 0; d_matrix2[5216] = 0; d_matrix2[5217] = 0; d_matrix2[5218] = 3; d_matrix2[5219] = 0; d_matrix2[5220] = 0; d_matrix2[5221] = 0; d_matrix2[5222] = 0; d_matrix2[5223] = 4; d_matrix2[5224] = 0; d_matrix2[5225] = 0; d_matrix2[5226] = 0; d_matrix2[5227] = 0; d_matrix2[5228] = 0; d_matrix2[5229] = 4; d_matrix2[5230] = 0; d_matrix2[5231] = 0; d_matrix2[5232] = 4; d_matrix2[5233] = 1; d_matrix2[5234] = 0; d_matrix2[5235] = 0; d_matrix2[5236] = 0; d_matrix2[5237] = 0; d_matrix2[5238] = 0; d_matrix2[5239] = 3; d_matrix2[5240] = 0; d_matrix2[5241] = 0; d_matrix2[5242] = 0; d_matrix2[5243] = 0; d_matrix2[5244] = 0; d_matrix2[5245] = 0; d_matrix2[5246] = 0; d_matrix2[5247] = 0; d_matrix2[5248] = 0; d_matrix2[5249] = 5; d_matrix2[5250] = 0; d_matrix2[5251] = 5; d_matrix2[5252] = 0; d_matrix2[5253] = 3; d_matrix2[5254] = 0; d_matrix2[5255] = 0; d_matrix2[5256] = 0; d_matrix2[5257] = 5; d_matrix2[5258] = 0; d_matrix2[5259] = 3; d_matrix2[5260] = 0; d_matrix2[5261] = 0; d_matrix2[5262] = 0; d_matrix2[5263] = 2; d_matrix2[5264] = 0; d_matrix2[5265] = 4; d_matrix2[5266] = 0; d_matrix2[5267] = 0; d_matrix2[5268] = 0; d_matrix2[5269] = 0; d_matrix2[5270] = 4; d_matrix2[5271] = 5; d_matrix2[5272] = 3; d_matrix2[5273] = 4; d_matrix2[5274] = 0; d_matrix2[5275] = 0; d_matrix2[5276] = 0; d_matrix2[5277] = 0; d_matrix2[5278] = 3; d_matrix2[5279] = 0;
d_matrix2[5280] = 0; d_matrix2[5281] = 0; d_matrix2[5282] = 3; d_matrix2[5283] = 0; d_matrix2[5284] = 0; d_matrix2[5285] = 0; d_matrix2[5286] = 0; d_matrix2[5287] = 0; d_matrix2[5288] = 1; d_matrix2[5289] = 0; d_matrix2[5290] = 5; d_matrix2[5291] = 0; d_matrix2[5292] = 0; d_matrix2[5293] = 0; d_matrix2[5294] = 0; d_matrix2[5295] = 0; d_matrix2[5296] = 5; d_matrix2[5297] = 0; d_matrix2[5298] = 0; d_matrix2[5299] = 0; d_matrix2[5300] = 0; d_matrix2[5301] = 0; d_matrix2[5302] = 0; d_matrix2[5303] = 0; d_matrix2[5304] = 0; d_matrix2[5305] = 0; d_matrix2[5306] = 4; d_matrix2[5307] = 0; d_matrix2[5308] = 0; d_matrix2[5309] = 4; d_matrix2[5310] = 0; d_matrix2[5311] = 0; d_matrix2[5312] = 0; d_matrix2[5313] = 0; d_matrix2[5314] = 0; d_matrix2[5315] = 0; d_matrix2[5316] = 0; d_matrix2[5317] = 0; d_matrix2[5318] = 0; d_matrix2[5319] = 0; d_matrix2[5320] = 0; d_matrix2[5321] = 0; d_matrix2[5322] = 0; d_matrix2[5323] = 0; d_matrix2[5324] = 0; d_matrix2[5325] = 0; d_matrix2[5326] = 0; d_matrix2[5327] = 0; d_matrix2[5328] = 2; d_matrix2[5329] = 5; d_matrix2[5330] = 0; d_matrix2[5331] = 5; d_matrix2[5332] = 0; d_matrix2[5333] = 0; d_matrix2[5334] = 0; d_matrix2[5335] = 0; d_matrix2[5336] = 0; d_matrix2[5337] = 3; d_matrix2[5338] = 0; d_matrix2[5339] = 0; d_matrix2[5340] = 0; d_matrix2[5341] = 0; d_matrix2[5342] = 0; d_matrix2[5343] = 0; d_matrix2[5344] = 2; d_matrix2[5345] = 5; d_matrix2[5346] = 3; d_matrix2[5347] = 3; d_matrix2[5348] = 0; d_matrix2[5349] = 0; d_matrix2[5350] = 3; d_matrix2[5351] = 1; d_matrix2[5352] = 0; d_matrix2[5353] = 0; d_matrix2[5354] = 4; d_matrix2[5355] = 0; d_matrix2[5356] = 0; d_matrix2[5357] = 0; d_matrix2[5358] = 5; d_matrix2[5359] = 0;
d_matrix2[5360] = 0; d_matrix2[5361] = 0; d_matrix2[5362] = 3; d_matrix2[5363] = 0; d_matrix2[5364] = 0; d_matrix2[5365] = 0; d_matrix2[5366] = 0; d_matrix2[5367] = 0; d_matrix2[5368] = 3; d_matrix2[5369] = 0; d_matrix2[5370] = 4; d_matrix2[5371] = 0; d_matrix2[5372] = 0; d_matrix2[5373] = 0; d_matrix2[5374] = 0; d_matrix2[5375] = 0; d_matrix2[5376] = 3; d_matrix2[5377] = 0; d_matrix2[5378] = 0; d_matrix2[5379] = 0; d_matrix2[5380] = 0; d_matrix2[5381] = 0; d_matrix2[5382] = 1; d_matrix2[5383] = 0; d_matrix2[5384] = 0; d_matrix2[5385] = 3; d_matrix2[5386] = 0; d_matrix2[5387] = 0; d_matrix2[5388] = 0; d_matrix2[5389] = 0; d_matrix2[5390] = 0; d_matrix2[5391] = 0; d_matrix2[5392] = 0; d_matrix2[5393] = 0; d_matrix2[5394] = 0; d_matrix2[5395] = 0; d_matrix2[5396] = 0; d_matrix2[5397] = 0; d_matrix2[5398] = 0; d_matrix2[5399] = 0; d_matrix2[5400] = 0; d_matrix2[5401] = 0; d_matrix2[5402] = 0; d_matrix2[5403] = 0; d_matrix2[5404] = 0; d_matrix2[5405] = 0; d_matrix2[5406] = 0; d_matrix2[5407] = 0; d_matrix2[5408] = 0; d_matrix2[5409] = 0; d_matrix2[5410] = 0; d_matrix2[5411] = 5; d_matrix2[5412] = 0; d_matrix2[5413] = 0; d_matrix2[5414] = 0; d_matrix2[5415] = 0; d_matrix2[5416] = 0; d_matrix2[5417] = 0; d_matrix2[5418] = 0; d_matrix2[5419] = 0; d_matrix2[5420] = 0; d_matrix2[5421] = 0; d_matrix2[5422] = 0; d_matrix2[5423] = 0; d_matrix2[5424] = 0; d_matrix2[5425] = 0; d_matrix2[5426] = 0; d_matrix2[5427] = 0; d_matrix2[5428] = 0; d_matrix2[5429] = 0; d_matrix2[5430] = 0; d_matrix2[5431] = 0; d_matrix2[5432] = 0; d_matrix2[5433] = 0; d_matrix2[5434] = 0; d_matrix2[5435] = 0; d_matrix2[5436] = 0; d_matrix2[5437] = 0; d_matrix2[5438] = 0; d_matrix2[5439] = 0;
d_matrix2[5440] = 0; d_matrix2[5441] = 0; d_matrix2[5442] = 3; d_matrix2[5443] = 0; d_matrix2[5444] = 0; d_matrix2[5445] = 0; d_matrix2[5446] = 0; d_matrix2[5447] = 0; d_matrix2[5448] = 5; d_matrix2[5449] = 0; d_matrix2[5450] = 0; d_matrix2[5451] = 0; d_matrix2[5452] = 0; d_matrix2[5453] = 0; d_matrix2[5454] = 0; d_matrix2[5455] = 0; d_matrix2[5456] = 0; d_matrix2[5457] = 0; d_matrix2[5458] = 0; d_matrix2[5459] = 0; d_matrix2[5460] = 0; d_matrix2[5461] = 0; d_matrix2[5462] = 0; d_matrix2[5463] = 0; d_matrix2[5464] = 0; d_matrix2[5465] = 4; d_matrix2[5466] = 4; d_matrix2[5467] = 0; d_matrix2[5468] = 0; d_matrix2[5469] = 0; d_matrix2[5470] = 0; d_matrix2[5471] = 0; d_matrix2[5472] = 0; d_matrix2[5473] = 0; d_matrix2[5474] = 0; d_matrix2[5475] = 0; d_matrix2[5476] = 0; d_matrix2[5477] = 0; d_matrix2[5478] = 0; d_matrix2[5479] = 0; d_matrix2[5480] = 0; d_matrix2[5481] = 0; d_matrix2[5482] = 0; d_matrix2[5483] = 0; d_matrix2[5484] = 0; d_matrix2[5485] = 0; d_matrix2[5486] = 0; d_matrix2[5487] = 0; d_matrix2[5488] = 0; d_matrix2[5489] = 0; d_matrix2[5490] = 0; d_matrix2[5491] = 0; d_matrix2[5492] = 0; d_matrix2[5493] = 0; d_matrix2[5494] = 0; d_matrix2[5495] = 0; d_matrix2[5496] = 0; d_matrix2[5497] = 0; d_matrix2[5498] = 0; d_matrix2[5499] = 0; d_matrix2[5500] = 0; d_matrix2[5501] = 0; d_matrix2[5502] = 0; d_matrix2[5503] = 0; d_matrix2[5504] = 0; d_matrix2[5505] = 5; d_matrix2[5506] = 0; d_matrix2[5507] = 0; d_matrix2[5508] = 0; d_matrix2[5509] = 0; d_matrix2[5510] = 0; d_matrix2[5511] = 0; d_matrix2[5512] = 0; d_matrix2[5513] = 0; d_matrix2[5514] = 0; d_matrix2[5515] = 0; d_matrix2[5516] = 0; d_matrix2[5517] = 0; d_matrix2[5518] = 0; d_matrix2[5519] = 0;
d_matrix2[5520] = 0; d_matrix2[5521] = 0; d_matrix2[5522] = 0; d_matrix2[5523] = 0; d_matrix2[5524] = 0; d_matrix2[5525] = 0; d_matrix2[5526] = 0; d_matrix2[5527] = 0; d_matrix2[5528] = 3; d_matrix2[5529] = 0; d_matrix2[5530] = 4; d_matrix2[5531] = 0; d_matrix2[5532] = 0; d_matrix2[5533] = 0; d_matrix2[5534] = 0; d_matrix2[5535] = 0; d_matrix2[5536] = 0; d_matrix2[5537] = 0; d_matrix2[5538] = 0; d_matrix2[5539] = 0; d_matrix2[5540] = 0; d_matrix2[5541] = 0; d_matrix2[5542] = 0; d_matrix2[5543] = 0; d_matrix2[5544] = 0; d_matrix2[5545] = 0; d_matrix2[5546] = 4; d_matrix2[5547] = 0; d_matrix2[5548] = 0; d_matrix2[5549] = 0; d_matrix2[5550] = 0; d_matrix2[5551] = 0; d_matrix2[5552] = 0; d_matrix2[5553] = 0; d_matrix2[5554] = 0; d_matrix2[5555] = 0; d_matrix2[5556] = 0; d_matrix2[5557] = 0; d_matrix2[5558] = 0; d_matrix2[5559] = 0; d_matrix2[5560] = 0; d_matrix2[5561] = 0; d_matrix2[5562] = 0; d_matrix2[5563] = 0; d_matrix2[5564] = 0; d_matrix2[5565] = 0; d_matrix2[5566] = 0; d_matrix2[5567] = 0; d_matrix2[5568] = 0; d_matrix2[5569] = 0; d_matrix2[5570] = 0; d_matrix2[5571] = 5; d_matrix2[5572] = 0; d_matrix2[5573] = 0; d_matrix2[5574] = 0; d_matrix2[5575] = 0; d_matrix2[5576] = 0; d_matrix2[5577] = 0; d_matrix2[5578] = 0; d_matrix2[5579] = 0; d_matrix2[5580] = 0; d_matrix2[5581] = 0; d_matrix2[5582] = 0; d_matrix2[5583] = 0; d_matrix2[5584] = 0; d_matrix2[5585] = 0; d_matrix2[5586] = 0; d_matrix2[5587] = 0; d_matrix2[5588] = 0; d_matrix2[5589] = 0; d_matrix2[5590] = 0; d_matrix2[5591] = 0; d_matrix2[5592] = 0; d_matrix2[5593] = 0; d_matrix2[5594] = 0; d_matrix2[5595] = 0; d_matrix2[5596] = 0; d_matrix2[5597] = 0; d_matrix2[5598] = 0; d_matrix2[5599] = 0;
d_matrix2[5600] = 0; d_matrix2[5601] = 0; d_matrix2[5602] = 0; d_matrix2[5603] = 0; d_matrix2[5604] = 0; d_matrix2[5605] = 0; d_matrix2[5606] = 0; d_matrix2[5607] = 0; d_matrix2[5608] = 5; d_matrix2[5609] = 0; d_matrix2[5610] = 4; d_matrix2[5611] = 0; d_matrix2[5612] = 0; d_matrix2[5613] = 5; d_matrix2[5614] = 0; d_matrix2[5615] = 0; d_matrix2[5616] = 0; d_matrix2[5617] = 0; d_matrix2[5618] = 0; d_matrix2[5619] = 0; d_matrix2[5620] = 0; d_matrix2[5621] = 0; d_matrix2[5622] = 0; d_matrix2[5623] = 0; d_matrix2[5624] = 0; d_matrix2[5625] = 0; d_matrix2[5626] = 0; d_matrix2[5627] = 0; d_matrix2[5628] = 0; d_matrix2[5629] = 0; d_matrix2[5630] = 0; d_matrix2[5631] = 0; d_matrix2[5632] = 0; d_matrix2[5633] = 0; d_matrix2[5634] = 0; d_matrix2[5635] = 0; d_matrix2[5636] = 0; d_matrix2[5637] = 0; d_matrix2[5638] = 0; d_matrix2[5639] = 0; d_matrix2[5640] = 0; d_matrix2[5641] = 0; d_matrix2[5642] = 0; d_matrix2[5643] = 5; d_matrix2[5644] = 0; d_matrix2[5645] = 0; d_matrix2[5646] = 0; d_matrix2[5647] = 0; d_matrix2[5648] = 0; d_matrix2[5649] = 5; d_matrix2[5650] = 0; d_matrix2[5651] = 5; d_matrix2[5652] = 0; d_matrix2[5653] = 0; d_matrix2[5654] = 0; d_matrix2[5655] = 0; d_matrix2[5656] = 0; d_matrix2[5657] = 5; d_matrix2[5658] = 0; d_matrix2[5659] = 0; d_matrix2[5660] = 0; d_matrix2[5661] = 0; d_matrix2[5662] = 0; d_matrix2[5663] = 0; d_matrix2[5664] = 0; d_matrix2[5665] = 0; d_matrix2[5666] = 0; d_matrix2[5667] = 0; d_matrix2[5668] = 0; d_matrix2[5669] = 0; d_matrix2[5670] = 0; d_matrix2[5671] = 0; d_matrix2[5672] = 0; d_matrix2[5673] = 0; d_matrix2[5674] = 0; d_matrix2[5675] = 0; d_matrix2[5676] = 0; d_matrix2[5677] = 0; d_matrix2[5678] = 0; d_matrix2[5679] = 0;
d_matrix2[5680] = 0; d_matrix2[5681] = 0; d_matrix2[5682] = 4; d_matrix2[5683] = 0; d_matrix2[5684] = 0; d_matrix2[5685] = 0; d_matrix2[5686] = 0; d_matrix2[5687] = 0; d_matrix2[5688] = 0; d_matrix2[5689] = 4; d_matrix2[5690] = 0; d_matrix2[5691] = 0; d_matrix2[5692] = 0; d_matrix2[5693] = 0; d_matrix2[5694] = 0; d_matrix2[5695] = 0; d_matrix2[5696] = 3; d_matrix2[5697] = 0; d_matrix2[5698] = 0; d_matrix2[5699] = 0; d_matrix2[5700] = 0; d_matrix2[5701] = 0; d_matrix2[5702] = 0; d_matrix2[5703] = 0; d_matrix2[5704] = 0; d_matrix2[5705] = 4; d_matrix2[5706] = 0; d_matrix2[5707] = 0; d_matrix2[5708] = 0; d_matrix2[5709] = 4; d_matrix2[5710] = 0; d_matrix2[5711] = 0; d_matrix2[5712] = 0; d_matrix2[5713] = 0; d_matrix2[5714] = 0; d_matrix2[5715] = 0; d_matrix2[5716] = 0; d_matrix2[5717] = 0; d_matrix2[5718] = 0; d_matrix2[5719] = 0; d_matrix2[5720] = 0; d_matrix2[5721] = 0; d_matrix2[5722] = 0; d_matrix2[5723] = 0; d_matrix2[5724] = 0; d_matrix2[5725] = 0; d_matrix2[5726] = 0; d_matrix2[5727] = 0; d_matrix2[5728] = 0; d_matrix2[5729] = 4; d_matrix2[5730] = 0; d_matrix2[5731] = 4; d_matrix2[5732] = 0; d_matrix2[5733] = 0; d_matrix2[5734] = 0; d_matrix2[5735] = 0; d_matrix2[5736] = 0; d_matrix2[5737] = 0; d_matrix2[5738] = 0; d_matrix2[5739] = 0; d_matrix2[5740] = 0; d_matrix2[5741] = 0; d_matrix2[5742] = 0; d_matrix2[5743] = 0; d_matrix2[5744] = 3; d_matrix2[5745] = 0; d_matrix2[5746] = 0; d_matrix2[5747] = 0; d_matrix2[5748] = 0; d_matrix2[5749] = 0; d_matrix2[5750] = 4; d_matrix2[5751] = 0; d_matrix2[5752] = 3; d_matrix2[5753] = 0; d_matrix2[5754] = 0; d_matrix2[5755] = 0; d_matrix2[5756] = 0; d_matrix2[5757] = 0; d_matrix2[5758] = 0; d_matrix2[5759] = 0;
d_matrix2[5760] = 0; d_matrix2[5761] = 0; d_matrix2[5762] = 0; d_matrix2[5763] = 0; d_matrix2[5764] = 0; d_matrix2[5765] = 0; d_matrix2[5766] = 0; d_matrix2[5767] = 3; d_matrix2[5768] = 0; d_matrix2[5769] = 0; d_matrix2[5770] = 0; d_matrix2[5771] = 0; d_matrix2[5772] = 0; d_matrix2[5773] = 0; d_matrix2[5774] = 0; d_matrix2[5775] = 5; d_matrix2[5776] = 0; d_matrix2[5777] = 0; d_matrix2[5778] = 0; d_matrix2[5779] = 0; d_matrix2[5780] = 0; d_matrix2[5781] = 0; d_matrix2[5782] = 0; d_matrix2[5783] = 0; d_matrix2[5784] = 0; d_matrix2[5785] = 0; d_matrix2[5786] = 0; d_matrix2[5787] = 0; d_matrix2[5788] = 0; d_matrix2[5789] = 0; d_matrix2[5790] = 0; d_matrix2[5791] = 0; d_matrix2[5792] = 0; d_matrix2[5793] = 0; d_matrix2[5794] = 0; d_matrix2[5795] = 0; d_matrix2[5796] = 0; d_matrix2[5797] = 0; d_matrix2[5798] = 0; d_matrix2[5799] = 0; d_matrix2[5800] = 0; d_matrix2[5801] = 0; d_matrix2[5802] = 0; d_matrix2[5803] = 0; d_matrix2[5804] = 0; d_matrix2[5805] = 0; d_matrix2[5806] = 0; d_matrix2[5807] = 0; d_matrix2[5808] = 0; d_matrix2[5809] = 0; d_matrix2[5810] = 0; d_matrix2[5811] = 3; d_matrix2[5812] = 0; d_matrix2[5813] = 4; d_matrix2[5814] = 0; d_matrix2[5815] = 0; d_matrix2[5816] = 0; d_matrix2[5817] = 5; d_matrix2[5818] = 0; d_matrix2[5819] = 0; d_matrix2[5820] = 0; d_matrix2[5821] = 0; d_matrix2[5822] = 0; d_matrix2[5823] = 0; d_matrix2[5824] = 0; d_matrix2[5825] = 4; d_matrix2[5826] = 5; d_matrix2[5827] = 0; d_matrix2[5828] = 0; d_matrix2[5829] = 0; d_matrix2[5830] = 0; d_matrix2[5831] = 0; d_matrix2[5832] = 0; d_matrix2[5833] = 0; d_matrix2[5834] = 0; d_matrix2[5835] = 0; d_matrix2[5836] = 0; d_matrix2[5837] = 0; d_matrix2[5838] = 0; d_matrix2[5839] = 0;
d_matrix2[5840] = 0; d_matrix2[5841] = 0; d_matrix2[5842] = 4; d_matrix2[5843] = 3; d_matrix2[5844] = 0; d_matrix2[5845] = 0; d_matrix2[5846] = 4; d_matrix2[5847] = 0; d_matrix2[5848] = 1; d_matrix2[5849] = 0; d_matrix2[5850] = 5; d_matrix2[5851] = 0; d_matrix2[5852] = 0; d_matrix2[5853] = 5; d_matrix2[5854] = 0; d_matrix2[5855] = 0; d_matrix2[5856] = 5; d_matrix2[5857] = 0; d_matrix2[5858] = 0; d_matrix2[5859] = 0; d_matrix2[5860] = 0; d_matrix2[5861] = 0; d_matrix2[5862] = 0; d_matrix2[5863] = 0; d_matrix2[5864] = 4; d_matrix2[5865] = 0; d_matrix2[5866] = 5; d_matrix2[5867] = 0; d_matrix2[5868] = 0; d_matrix2[5869] = 4; d_matrix2[5870] = 0; d_matrix2[5871] = 0; d_matrix2[5872] = 0; d_matrix2[5873] = 0; d_matrix2[5874] = 0; d_matrix2[5875] = 0; d_matrix2[5876] = 0; d_matrix2[5877] = 0; d_matrix2[5878] = 0; d_matrix2[5879] = 3; d_matrix2[5880] = 0; d_matrix2[5881] = 0; d_matrix2[5882] = 0; d_matrix2[5883] = 0; d_matrix2[5884] = 0; d_matrix2[5885] = 0; d_matrix2[5886] = 5; d_matrix2[5887] = 0; d_matrix2[5888] = 0; d_matrix2[5889] = 4; d_matrix2[5890] = 0; d_matrix2[5891] = 2; d_matrix2[5892] = 4; d_matrix2[5893] = 0; d_matrix2[5894] = 0; d_matrix2[5895] = 3; d_matrix2[5896] = 0; d_matrix2[5897] = 5; d_matrix2[5898] = 0; d_matrix2[5899] = 4; d_matrix2[5900] = 0; d_matrix2[5901] = 0; d_matrix2[5902] = 0; d_matrix2[5903] = 0; d_matrix2[5904] = 0; d_matrix2[5905] = 5; d_matrix2[5906] = 0; d_matrix2[5907] = 0; d_matrix2[5908] = 0; d_matrix2[5909] = 3; d_matrix2[5910] = 4; d_matrix2[5911] = 4; d_matrix2[5912] = 0; d_matrix2[5913] = 0; d_matrix2[5914] = 0; d_matrix2[5915] = 0; d_matrix2[5916] = 0; d_matrix2[5917] = 0; d_matrix2[5918] = 4; d_matrix2[5919] = 0;
d_matrix2[5920] = 0; d_matrix2[5921] = 0; d_matrix2[5922] = 2; d_matrix2[5923] = 0; d_matrix2[5924] = 0; d_matrix2[5925] = 0; d_matrix2[5926] = 0; d_matrix2[5927] = 0; d_matrix2[5928] = 4; d_matrix2[5929] = 0; d_matrix2[5930] = 0; d_matrix2[5931] = 0; d_matrix2[5932] = 0; d_matrix2[5933] = 5; d_matrix2[5934] = 0; d_matrix2[5935] = 0; d_matrix2[5936] = 0; d_matrix2[5937] = 0; d_matrix2[5938] = 0; d_matrix2[5939] = 0; d_matrix2[5940] = 0; d_matrix2[5941] = 0; d_matrix2[5942] = 0; d_matrix2[5943] = 0; d_matrix2[5944] = 0; d_matrix2[5945] = 0; d_matrix2[5946] = 0; d_matrix2[5947] = 0; d_matrix2[5948] = 0; d_matrix2[5949] = 3; d_matrix2[5950] = 0; d_matrix2[5951] = 0; d_matrix2[5952] = 0; d_matrix2[5953] = 4; d_matrix2[5954] = 0; d_matrix2[5955] = 0; d_matrix2[5956] = 0; d_matrix2[5957] = 0; d_matrix2[5958] = 0; d_matrix2[5959] = 0; d_matrix2[5960] = 0; d_matrix2[5961] = 0; d_matrix2[5962] = 0; d_matrix2[5963] = 0; d_matrix2[5964] = 0; d_matrix2[5965] = 0; d_matrix2[5966] = 0; d_matrix2[5967] = 0; d_matrix2[5968] = 0; d_matrix2[5969] = 2; d_matrix2[5970] = 0; d_matrix2[5971] = 0; d_matrix2[5972] = 0; d_matrix2[5973] = 0; d_matrix2[5974] = 0; d_matrix2[5975] = 0; d_matrix2[5976] = 0; d_matrix2[5977] = 4; d_matrix2[5978] = 0; d_matrix2[5979] = 0; d_matrix2[5980] = 5; d_matrix2[5981] = 0; d_matrix2[5982] = 0; d_matrix2[5983] = 0; d_matrix2[5984] = 0; d_matrix2[5985] = 5; d_matrix2[5986] = 0; d_matrix2[5987] = 0; d_matrix2[5988] = 0; d_matrix2[5989] = 0; d_matrix2[5990] = 0; d_matrix2[5991] = 0; d_matrix2[5992] = 0; d_matrix2[5993] = 0; d_matrix2[5994] = 0; d_matrix2[5995] = 0; d_matrix2[5996] = 0; d_matrix2[5997] = 0; d_matrix2[5998] = 0; d_matrix2[5999] = 0;
d_matrix2[6000] = 0; d_matrix2[6001] = 0; d_matrix2[6002] = 0; d_matrix2[6003] = 0; d_matrix2[6004] = 0; d_matrix2[6005] = 0; d_matrix2[6006] = 0; d_matrix2[6007] = 0; d_matrix2[6008] = 4; d_matrix2[6009] = 0; d_matrix2[6010] = 4; d_matrix2[6011] = 0; d_matrix2[6012] = 0; d_matrix2[6013] = 0; d_matrix2[6014] = 4; d_matrix2[6015] = 0; d_matrix2[6016] = 4; d_matrix2[6017] = 0; d_matrix2[6018] = 0; d_matrix2[6019] = 0; d_matrix2[6020] = 0; d_matrix2[6021] = 0; d_matrix2[6022] = 0; d_matrix2[6023] = 0; d_matrix2[6024] = 0; d_matrix2[6025] = 0; d_matrix2[6026] = 0; d_matrix2[6027] = 0; d_matrix2[6028] = 0; d_matrix2[6029] = 0; d_matrix2[6030] = 0; d_matrix2[6031] = 0; d_matrix2[6032] = 0; d_matrix2[6033] = 0; d_matrix2[6034] = 0; d_matrix2[6035] = 0; d_matrix2[6036] = 0; d_matrix2[6037] = 0; d_matrix2[6038] = 0; d_matrix2[6039] = 0; d_matrix2[6040] = 0; d_matrix2[6041] = 0; d_matrix2[6042] = 0; d_matrix2[6043] = 0; d_matrix2[6044] = 0; d_matrix2[6045] = 0; d_matrix2[6046] = 0; d_matrix2[6047] = 0; d_matrix2[6048] = 0; d_matrix2[6049] = 0; d_matrix2[6050] = 0; d_matrix2[6051] = 0; d_matrix2[6052] = 0; d_matrix2[6053] = 0; d_matrix2[6054] = 0; d_matrix2[6055] = 0; d_matrix2[6056] = 0; d_matrix2[6057] = 0; d_matrix2[6058] = 0; d_matrix2[6059] = 0; d_matrix2[6060] = 0; d_matrix2[6061] = 0; d_matrix2[6062] = 0; d_matrix2[6063] = 0; d_matrix2[6064] = 0; d_matrix2[6065] = 0; d_matrix2[6066] = 0; d_matrix2[6067] = 0; d_matrix2[6068] = 0; d_matrix2[6069] = 0; d_matrix2[6070] = 0; d_matrix2[6071] = 0; d_matrix2[6072] = 0; d_matrix2[6073] = 0; d_matrix2[6074] = 0; d_matrix2[6075] = 0; d_matrix2[6076] = 0; d_matrix2[6077] = 0; d_matrix2[6078] = 0; d_matrix2[6079] = 0;
d_matrix2[6080] = 0; d_matrix2[6081] = 0; d_matrix2[6082] = 4; d_matrix2[6083] = 0; d_matrix2[6084] = 0; d_matrix2[6085] = 0; d_matrix2[6086] = 0; d_matrix2[6087] = 0; d_matrix2[6088] = 0; d_matrix2[6089] = 0; d_matrix2[6090] = 0; d_matrix2[6091] = 0; d_matrix2[6092] = 0; d_matrix2[6093] = 0; d_matrix2[6094] = 5; d_matrix2[6095] = 0; d_matrix2[6096] = 0; d_matrix2[6097] = 0; d_matrix2[6098] = 0; d_matrix2[6099] = 0; d_matrix2[6100] = 0; d_matrix2[6101] = 0; d_matrix2[6102] = 0; d_matrix2[6103] = 0; d_matrix2[6104] = 0; d_matrix2[6105] = 0; d_matrix2[6106] = 5; d_matrix2[6107] = 0; d_matrix2[6108] = 0; d_matrix2[6109] = 0; d_matrix2[6110] = 0; d_matrix2[6111] = 0; d_matrix2[6112] = 0; d_matrix2[6113] = 0; d_matrix2[6114] = 0; d_matrix2[6115] = 0; d_matrix2[6116] = 0; d_matrix2[6117] = 0; d_matrix2[6118] = 0; d_matrix2[6119] = 0; d_matrix2[6120] = 0; d_matrix2[6121] = 0; d_matrix2[6122] = 0; d_matrix2[6123] = 0; d_matrix2[6124] = 0; d_matrix2[6125] = 0; d_matrix2[6126] = 0; d_matrix2[6127] = 0; d_matrix2[6128] = 0; d_matrix2[6129] = 0; d_matrix2[6130] = 0; d_matrix2[6131] = 0; d_matrix2[6132] = 0; d_matrix2[6133] = 0; d_matrix2[6134] = 0; d_matrix2[6135] = 0; d_matrix2[6136] = 0; d_matrix2[6137] = 5; d_matrix2[6138] = 0; d_matrix2[6139] = 0; d_matrix2[6140] = 0; d_matrix2[6141] = 0; d_matrix2[6142] = 0; d_matrix2[6143] = 0; d_matrix2[6144] = 0; d_matrix2[6145] = 0; d_matrix2[6146] = 0; d_matrix2[6147] = 0; d_matrix2[6148] = 0; d_matrix2[6149] = 0; d_matrix2[6150] = 0; d_matrix2[6151] = 0; d_matrix2[6152] = 0; d_matrix2[6153] = 0; d_matrix2[6154] = 0; d_matrix2[6155] = 0; d_matrix2[6156] = 0; d_matrix2[6157] = 0; d_matrix2[6158] = 0; d_matrix2[6159] = 0;
d_matrix2[6160] = 0; d_matrix2[6161] = 0; d_matrix2[6162] = 0; d_matrix2[6163] = 0; d_matrix2[6164] = 0; d_matrix2[6165] = 0; d_matrix2[6166] = 0; d_matrix2[6167] = 5; d_matrix2[6168] = 4; d_matrix2[6169] = 0; d_matrix2[6170] = 0; d_matrix2[6171] = 0; d_matrix2[6172] = 0; d_matrix2[6173] = 3; d_matrix2[6174] = 0; d_matrix2[6175] = 0; d_matrix2[6176] = 0; d_matrix2[6177] = 0; d_matrix2[6178] = 0; d_matrix2[6179] = 0; d_matrix2[6180] = 0; d_matrix2[6181] = 0; d_matrix2[6182] = 0; d_matrix2[6183] = 0; d_matrix2[6184] = 5; d_matrix2[6185] = 2; d_matrix2[6186] = 0; d_matrix2[6187] = 0; d_matrix2[6188] = 0; d_matrix2[6189] = 0; d_matrix2[6190] = 0; d_matrix2[6191] = 0; d_matrix2[6192] = 0; d_matrix2[6193] = 0; d_matrix2[6194] = 0; d_matrix2[6195] = 0; d_matrix2[6196] = 0; d_matrix2[6197] = 0; d_matrix2[6198] = 0; d_matrix2[6199] = 0; d_matrix2[6200] = 0; d_matrix2[6201] = 0; d_matrix2[6202] = 0; d_matrix2[6203] = 3; d_matrix2[6204] = 0; d_matrix2[6205] = 0; d_matrix2[6206] = 0; d_matrix2[6207] = 0; d_matrix2[6208] = 0; d_matrix2[6209] = 0; d_matrix2[6210] = 0; d_matrix2[6211] = 0; d_matrix2[6212] = 0; d_matrix2[6213] = 0; d_matrix2[6214] = 0; d_matrix2[6215] = 0; d_matrix2[6216] = 0; d_matrix2[6217] = 5; d_matrix2[6218] = 0; d_matrix2[6219] = 0; d_matrix2[6220] = 4; d_matrix2[6221] = 4; d_matrix2[6222] = 4; d_matrix2[6223] = 0; d_matrix2[6224] = 0; d_matrix2[6225] = 5; d_matrix2[6226] = 0; d_matrix2[6227] = 0; d_matrix2[6228] = 0; d_matrix2[6229] = 0; d_matrix2[6230] = 0; d_matrix2[6231] = 4; d_matrix2[6232] = 0; d_matrix2[6233] = 0; d_matrix2[6234] = 0; d_matrix2[6235] = 0; d_matrix2[6236] = 0; d_matrix2[6237] = 0; d_matrix2[6238] = 2; d_matrix2[6239] = 0;
d_matrix2[6240] = 0; d_matrix2[6241] = 0; d_matrix2[6242] = 5; d_matrix2[6243] = 0; d_matrix2[6244] = 0; d_matrix2[6245] = 3; d_matrix2[6246] = 0; d_matrix2[6247] = 0; d_matrix2[6248] = 0; d_matrix2[6249] = 0; d_matrix2[6250] = 0; d_matrix2[6251] = 0; d_matrix2[6252] = 0; d_matrix2[6253] = 0; d_matrix2[6254] = 0; d_matrix2[6255] = 0; d_matrix2[6256] = 2; d_matrix2[6257] = 0; d_matrix2[6258] = 0; d_matrix2[6259] = 0; d_matrix2[6260] = 0; d_matrix2[6261] = 0; d_matrix2[6262] = 0; d_matrix2[6263] = 0; d_matrix2[6264] = 4; d_matrix2[6265] = 0; d_matrix2[6266] = 2; d_matrix2[6267] = 0; d_matrix2[6268] = 0; d_matrix2[6269] = 5; d_matrix2[6270] = 0; d_matrix2[6271] = 0; d_matrix2[6272] = 3; d_matrix2[6273] = 0; d_matrix2[6274] = 0; d_matrix2[6275] = 0; d_matrix2[6276] = 0; d_matrix2[6277] = 0; d_matrix2[6278] = 0; d_matrix2[6279] = 0; d_matrix2[6280] = 0; d_matrix2[6281] = 0; d_matrix2[6282] = 0; d_matrix2[6283] = 5; d_matrix2[6284] = 0; d_matrix2[6285] = 0; d_matrix2[6286] = 0; d_matrix2[6287] = 0; d_matrix2[6288] = 0; d_matrix2[6289] = 0; d_matrix2[6290] = 0; d_matrix2[6291] = 4; d_matrix2[6292] = 0; d_matrix2[6293] = 5; d_matrix2[6294] = 0; d_matrix2[6295] = 0; d_matrix2[6296] = 0; d_matrix2[6297] = 4; d_matrix2[6298] = 0; d_matrix2[6299] = 0; d_matrix2[6300] = 0; d_matrix2[6301] = 0; d_matrix2[6302] = 0; d_matrix2[6303] = 0; d_matrix2[6304] = 0; d_matrix2[6305] = 0; d_matrix2[6306] = 0; d_matrix2[6307] = 0; d_matrix2[6308] = 0; d_matrix2[6309] = 0; d_matrix2[6310] = 3; d_matrix2[6311] = 0; d_matrix2[6312] = 0; d_matrix2[6313] = 0; d_matrix2[6314] = 0; d_matrix2[6315] = 0; d_matrix2[6316] = 0; d_matrix2[6317] = 0; d_matrix2[6318] = 0; d_matrix2[6319] = 0;
d_matrix2[6320] = 0; d_matrix2[6321] = 0; d_matrix2[6322] = 0; d_matrix2[6323] = 0; d_matrix2[6324] = 0; d_matrix2[6325] = 0; d_matrix2[6326] = 0; d_matrix2[6327] = 0; d_matrix2[6328] = 0; d_matrix2[6329] = 0; d_matrix2[6330] = 0; d_matrix2[6331] = 0; d_matrix2[6332] = 0; d_matrix2[6333] = 0; d_matrix2[6334] = 0; d_matrix2[6335] = 0; d_matrix2[6336] = 0; d_matrix2[6337] = 0; d_matrix2[6338] = 0; d_matrix2[6339] = 0; d_matrix2[6340] = 0; d_matrix2[6341] = 0; d_matrix2[6342] = 0; d_matrix2[6343] = 0; d_matrix2[6344] = 0; d_matrix2[6345] = 0; d_matrix2[6346] = 3; d_matrix2[6347] = 0; d_matrix2[6348] = 0; d_matrix2[6349] = 0; d_matrix2[6350] = 0; d_matrix2[6351] = 0; d_matrix2[6352] = 0; d_matrix2[6353] = 0; d_matrix2[6354] = 0; d_matrix2[6355] = 0; d_matrix2[6356] = 0; d_matrix2[6357] = 0; d_matrix2[6358] = 0; d_matrix2[6359] = 0; d_matrix2[6360] = 0; d_matrix2[6361] = 0; d_matrix2[6362] = 0; d_matrix2[6363] = 0; d_matrix2[6364] = 0; d_matrix2[6365] = 0; d_matrix2[6366] = 0; d_matrix2[6367] = 0; d_matrix2[6368] = 0; d_matrix2[6369] = 0; d_matrix2[6370] = 0; d_matrix2[6371] = 0; d_matrix2[6372] = 0; d_matrix2[6373] = 0; d_matrix2[6374] = 0; d_matrix2[6375] = 0; d_matrix2[6376] = 0; d_matrix2[6377] = 0; d_matrix2[6378] = 0; d_matrix2[6379] = 0; d_matrix2[6380] = 0; d_matrix2[6381] = 0; d_matrix2[6382] = 0; d_matrix2[6383] = 0; d_matrix2[6384] = 0; d_matrix2[6385] = 0; d_matrix2[6386] = 0; d_matrix2[6387] = 0; d_matrix2[6388] = 0; d_matrix2[6389] = 0; d_matrix2[6390] = 0; d_matrix2[6391] = 0; d_matrix2[6392] = 0; d_matrix2[6393] = 0; d_matrix2[6394] = 0; d_matrix2[6395] = 0; d_matrix2[6396] = 0; d_matrix2[6397] = 0; d_matrix2[6398] = 0; d_matrix2[6399] = 0;
d_matrix2[6400] = 0; d_matrix2[6401] = 0; d_matrix2[6402] = 4; d_matrix2[6403] = 0; d_matrix2[6404] = 0; d_matrix2[6405] = 0; d_matrix2[6406] = 0; d_matrix2[6407] = 4; d_matrix2[6408] = 5; d_matrix2[6409] = 0; d_matrix2[6410] = 0; d_matrix2[6411] = 5; d_matrix2[6412] = 0; d_matrix2[6413] = 0; d_matrix2[6414] = 3; d_matrix2[6415] = 0; d_matrix2[6416] = 0; d_matrix2[6417] = 0; d_matrix2[6418] = 0; d_matrix2[6419] = 0; d_matrix2[6420] = 5; d_matrix2[6421] = 0; d_matrix2[6422] = 0; d_matrix2[6423] = 0; d_matrix2[6424] = 0; d_matrix2[6425] = 0; d_matrix2[6426] = 0; d_matrix2[6427] = 0; d_matrix2[6428] = 0; d_matrix2[6429] = 0; d_matrix2[6430] = 0; d_matrix2[6431] = 0; d_matrix2[6432] = 0; d_matrix2[6433] = 0; d_matrix2[6434] = 0; d_matrix2[6435] = 0; d_matrix2[6436] = 0; d_matrix2[6437] = 0; d_matrix2[6438] = 0; d_matrix2[6439] = 0; d_matrix2[6440] = 0; d_matrix2[6441] = 0; d_matrix2[6442] = 0; d_matrix2[6443] = 0; d_matrix2[6444] = 0; d_matrix2[6445] = 0; d_matrix2[6446] = 0; d_matrix2[6447] = 0; d_matrix2[6448] = 0; d_matrix2[6449] = 0; d_matrix2[6450] = 0; d_matrix2[6451] = 4; d_matrix2[6452] = 0; d_matrix2[6453] = 0; d_matrix2[6454] = 0; d_matrix2[6455] = 0; d_matrix2[6456] = 0; d_matrix2[6457] = 0; d_matrix2[6458] = 0; d_matrix2[6459] = 0; d_matrix2[6460] = 0; d_matrix2[6461] = 0; d_matrix2[6462] = 0; d_matrix2[6463] = 0; d_matrix2[6464] = 0; d_matrix2[6465] = 0; d_matrix2[6466] = 0; d_matrix2[6467] = 0; d_matrix2[6468] = 0; d_matrix2[6469] = 0; d_matrix2[6470] = 0; d_matrix2[6471] = 0; d_matrix2[6472] = 0; d_matrix2[6473] = 0; d_matrix2[6474] = 0; d_matrix2[6475] = 0; d_matrix2[6476] = 0; d_matrix2[6477] = 0; d_matrix2[6478] = 0; d_matrix2[6479] = 0;
d_matrix2[6480] = 0; d_matrix2[6481] = 0; d_matrix2[6482] = 0; d_matrix2[6483] = 0; d_matrix2[6484] = 0; d_matrix2[6485] = 0; d_matrix2[6486] = 0; d_matrix2[6487] = 0; d_matrix2[6488] = 0; d_matrix2[6489] = 0; d_matrix2[6490] = 0; d_matrix2[6491] = 0; d_matrix2[6492] = 0; d_matrix2[6493] = 0; d_matrix2[6494] = 0; d_matrix2[6495] = 0; d_matrix2[6496] = 0; d_matrix2[6497] = 0; d_matrix2[6498] = 0; d_matrix2[6499] = 0; d_matrix2[6500] = 0; d_matrix2[6501] = 0; d_matrix2[6502] = 0; d_matrix2[6503] = 0; d_matrix2[6504] = 0; d_matrix2[6505] = 0; d_matrix2[6506] = 0; d_matrix2[6507] = 0; d_matrix2[6508] = 0; d_matrix2[6509] = 0; d_matrix2[6510] = 0; d_matrix2[6511] = 0; d_matrix2[6512] = 0; d_matrix2[6513] = 0; d_matrix2[6514] = 0; d_matrix2[6515] = 0; d_matrix2[6516] = 0; d_matrix2[6517] = 0; d_matrix2[6518] = 0; d_matrix2[6519] = 0; d_matrix2[6520] = 0; d_matrix2[6521] = 0; d_matrix2[6522] = 0; d_matrix2[6523] = 0; d_matrix2[6524] = 0; d_matrix2[6525] = 0; d_matrix2[6526] = 4; d_matrix2[6527] = 0; d_matrix2[6528] = 0; d_matrix2[6529] = 0; d_matrix2[6530] = 0; d_matrix2[6531] = 3; d_matrix2[6532] = 0; d_matrix2[6533] = 0; d_matrix2[6534] = 0; d_matrix2[6535] = 0; d_matrix2[6536] = 0; d_matrix2[6537] = 0; d_matrix2[6538] = 0; d_matrix2[6539] = 4; d_matrix2[6540] = 0; d_matrix2[6541] = 0; d_matrix2[6542] = 0; d_matrix2[6543] = 0; d_matrix2[6544] = 0; d_matrix2[6545] = 5; d_matrix2[6546] = 0; d_matrix2[6547] = 0; d_matrix2[6548] = 0; d_matrix2[6549] = 0; d_matrix2[6550] = 0; d_matrix2[6551] = 0; d_matrix2[6552] = 0; d_matrix2[6553] = 0; d_matrix2[6554] = 0; d_matrix2[6555] = 0; d_matrix2[6556] = 0; d_matrix2[6557] = 0; d_matrix2[6558] = 0; d_matrix2[6559] = 0;
d_matrix2[6560] = 0; d_matrix2[6561] = 0; d_matrix2[6562] = 4; d_matrix2[6563] = 0; d_matrix2[6564] = 4; d_matrix2[6565] = 0; d_matrix2[6566] = 0; d_matrix2[6567] = 0; d_matrix2[6568] = 4; d_matrix2[6569] = 0; d_matrix2[6570] = 0; d_matrix2[6571] = 0; d_matrix2[6572] = 0; d_matrix2[6573] = 0; d_matrix2[6574] = 0; d_matrix2[6575] = 0; d_matrix2[6576] = 0; d_matrix2[6577] = 0; d_matrix2[6578] = 0; d_matrix2[6579] = 0; d_matrix2[6580] = 0; d_matrix2[6581] = 0; d_matrix2[6582] = 0; d_matrix2[6583] = 0; d_matrix2[6584] = 0; d_matrix2[6585] = 0; d_matrix2[6586] = 5; d_matrix2[6587] = 0; d_matrix2[6588] = 0; d_matrix2[6589] = 0; d_matrix2[6590] = 0; d_matrix2[6591] = 0; d_matrix2[6592] = 0; d_matrix2[6593] = 0; d_matrix2[6594] = 0; d_matrix2[6595] = 0; d_matrix2[6596] = 0; d_matrix2[6597] = 0; d_matrix2[6598] = 0; d_matrix2[6599] = 0; d_matrix2[6600] = 0; d_matrix2[6601] = 0; d_matrix2[6602] = 0; d_matrix2[6603] = 4; d_matrix2[6604] = 0; d_matrix2[6605] = 0; d_matrix2[6606] = 0; d_matrix2[6607] = 0; d_matrix2[6608] = 0; d_matrix2[6609] = 0; d_matrix2[6610] = 0; d_matrix2[6611] = 0; d_matrix2[6612] = 0; d_matrix2[6613] = 0; d_matrix2[6614] = 0; d_matrix2[6615] = 0; d_matrix2[6616] = 0; d_matrix2[6617] = 0; d_matrix2[6618] = 0; d_matrix2[6619] = 0; d_matrix2[6620] = 0; d_matrix2[6621] = 0; d_matrix2[6622] = 0; d_matrix2[6623] = 0; d_matrix2[6624] = 0; d_matrix2[6625] = 0; d_matrix2[6626] = 0; d_matrix2[6627] = 0; d_matrix2[6628] = 0; d_matrix2[6629] = 0; d_matrix2[6630] = 0; d_matrix2[6631] = 0; d_matrix2[6632] = 0; d_matrix2[6633] = 0; d_matrix2[6634] = 0; d_matrix2[6635] = 0; d_matrix2[6636] = 0; d_matrix2[6637] = 0; d_matrix2[6638] = 0; d_matrix2[6639] = 0;
d_matrix2[6640] = 0; d_matrix2[6641] = 0; d_matrix2[6642] = 4; d_matrix2[6643] = 0; d_matrix2[6644] = 2; d_matrix2[6645] = 0; d_matrix2[6646] = 0; d_matrix2[6647] = 0; d_matrix2[6648] = 3; d_matrix2[6649] = 4; d_matrix2[6650] = 4; d_matrix2[6651] = 0; d_matrix2[6652] = 4; d_matrix2[6653] = 0; d_matrix2[6654] = 2; d_matrix2[6655] = 4; d_matrix2[6656] = 3; d_matrix2[6657] = 0; d_matrix2[6658] = 0; d_matrix2[6659] = 0; d_matrix2[6660] = 0; d_matrix2[6661] = 0; d_matrix2[6662] = 1; d_matrix2[6663] = 3; d_matrix2[6664] = 0; d_matrix2[6665] = 0; d_matrix2[6666] = 2; d_matrix2[6667] = 0; d_matrix2[6668] = 0; d_matrix2[6669] = 3; d_matrix2[6670] = 0; d_matrix2[6671] = 0; d_matrix2[6672] = 0; d_matrix2[6673] = 0; d_matrix2[6674] = 0; d_matrix2[6675] = 0; d_matrix2[6676] = 0; d_matrix2[6677] = 0; d_matrix2[6678] = 0; d_matrix2[6679] = 0; d_matrix2[6680] = 0; d_matrix2[6681] = 0; d_matrix2[6682] = 0; d_matrix2[6683] = 0; d_matrix2[6684] = 0; d_matrix2[6685] = 0; d_matrix2[6686] = 0; d_matrix2[6687] = 0; d_matrix2[6688] = 0; d_matrix2[6689] = 0; d_matrix2[6690] = 0; d_matrix2[6691] = 5; d_matrix2[6692] = 0; d_matrix2[6693] = 0; d_matrix2[6694] = 0; d_matrix2[6695] = 0; d_matrix2[6696] = 0; d_matrix2[6697] = 3; d_matrix2[6698] = 0; d_matrix2[6699] = 0; d_matrix2[6700] = 0; d_matrix2[6701] = 0; d_matrix2[6702] = 0; d_matrix2[6703] = 0; d_matrix2[6704] = 0; d_matrix2[6705] = 5; d_matrix2[6706] = 0; d_matrix2[6707] = 0; d_matrix2[6708] = 0; d_matrix2[6709] = 0; d_matrix2[6710] = 4; d_matrix2[6711] = 4; d_matrix2[6712] = 4; d_matrix2[6713] = 0; d_matrix2[6714] = 4; d_matrix2[6715] = 0; d_matrix2[6716] = 0; d_matrix2[6717] = 0; d_matrix2[6718] = 0; d_matrix2[6719] = 0;
d_matrix2[6720] = 0; d_matrix2[6721] = 0; d_matrix2[6722] = 4; d_matrix2[6723] = 4; d_matrix2[6724] = 0; d_matrix2[6725] = 2; d_matrix2[6726] = 0; d_matrix2[6727] = 0; d_matrix2[6728] = 0; d_matrix2[6729] = 0; d_matrix2[6730] = 0; d_matrix2[6731] = 0; d_matrix2[6732] = 0; d_matrix2[6733] = 0; d_matrix2[6734] = 0; d_matrix2[6735] = 0; d_matrix2[6736] = 4; d_matrix2[6737] = 0; d_matrix2[6738] = 0; d_matrix2[6739] = 0; d_matrix2[6740] = 0; d_matrix2[6741] = 0; d_matrix2[6742] = 0; d_matrix2[6743] = 5; d_matrix2[6744] = 0; d_matrix2[6745] = 0; d_matrix2[6746] = 2; d_matrix2[6747] = 0; d_matrix2[6748] = 0; d_matrix2[6749] = 4; d_matrix2[6750] = 0; d_matrix2[6751] = 0; d_matrix2[6752] = 5; d_matrix2[6753] = 0; d_matrix2[6754] = 0; d_matrix2[6755] = 0; d_matrix2[6756] = 1; d_matrix2[6757] = 0; d_matrix2[6758] = 0; d_matrix2[6759] = 5; d_matrix2[6760] = 0; d_matrix2[6761] = 0; d_matrix2[6762] = 0; d_matrix2[6763] = 0; d_matrix2[6764] = 4; d_matrix2[6765] = 0; d_matrix2[6766] = 0; d_matrix2[6767] = 0; d_matrix2[6768] = 0; d_matrix2[6769] = 0; d_matrix2[6770] = 0; d_matrix2[6771] = 3; d_matrix2[6772] = 0; d_matrix2[6773] = 0; d_matrix2[6774] = 0; d_matrix2[6775] = 0; d_matrix2[6776] = 0; d_matrix2[6777] = 1; d_matrix2[6778] = 0; d_matrix2[6779] = 0; d_matrix2[6780] = 0; d_matrix2[6781] = 0; d_matrix2[6782] = 0; d_matrix2[6783] = 0; d_matrix2[6784] = 4; d_matrix2[6785] = 5; d_matrix2[6786] = 0; d_matrix2[6787] = 4; d_matrix2[6788] = 0; d_matrix2[6789] = 0; d_matrix2[6790] = 4; d_matrix2[6791] = 4; d_matrix2[6792] = 3; d_matrix2[6793] = 0; d_matrix2[6794] = 0; d_matrix2[6795] = 0; d_matrix2[6796] = 0; d_matrix2[6797] = 0; d_matrix2[6798] = 4; d_matrix2[6799] = 2;
d_matrix2[6800] = 0; d_matrix2[6801] = 0; d_matrix2[6802] = 2; d_matrix2[6803] = 0; d_matrix2[6804] = 0; d_matrix2[6805] = 3; d_matrix2[6806] = 0; d_matrix2[6807] = 0; d_matrix2[6808] = 4; d_matrix2[6809] = 0; d_matrix2[6810] = 0; d_matrix2[6811] = 0; d_matrix2[6812] = 0; d_matrix2[6813] = 5; d_matrix2[6814] = 0; d_matrix2[6815] = 0; d_matrix2[6816] = 4; d_matrix2[6817] = 0; d_matrix2[6818] = 0; d_matrix2[6819] = 0; d_matrix2[6820] = 0; d_matrix2[6821] = 0; d_matrix2[6822] = 0; d_matrix2[6823] = 0; d_matrix2[6824] = 0; d_matrix2[6825] = 0; d_matrix2[6826] = 3; d_matrix2[6827] = 0; d_matrix2[6828] = 0; d_matrix2[6829] = 0; d_matrix2[6830] = 0; d_matrix2[6831] = 0; d_matrix2[6832] = 4; d_matrix2[6833] = 0; d_matrix2[6834] = 0; d_matrix2[6835] = 0; d_matrix2[6836] = 0; d_matrix2[6837] = 0; d_matrix2[6838] = 0; d_matrix2[6839] = 0; d_matrix2[6840] = 0; d_matrix2[6841] = 0; d_matrix2[6842] = 0; d_matrix2[6843] = 0; d_matrix2[6844] = 0; d_matrix2[6845] = 0; d_matrix2[6846] = 0; d_matrix2[6847] = 0; d_matrix2[6848] = 0; d_matrix2[6849] = 0; d_matrix2[6850] = 0; d_matrix2[6851] = 0; d_matrix2[6852] = 0; d_matrix2[6853] = 0; d_matrix2[6854] = 0; d_matrix2[6855] = 0; d_matrix2[6856] = 0; d_matrix2[6857] = 0; d_matrix2[6858] = 0; d_matrix2[6859] = 0; d_matrix2[6860] = 0; d_matrix2[6861] = 0; d_matrix2[6862] = 0; d_matrix2[6863] = 0; d_matrix2[6864] = 0; d_matrix2[6865] = 5; d_matrix2[6866] = 0; d_matrix2[6867] = 0; d_matrix2[6868] = 0; d_matrix2[6869] = 0; d_matrix2[6870] = 0; d_matrix2[6871] = 5; d_matrix2[6872] = 0; d_matrix2[6873] = 0; d_matrix2[6874] = 0; d_matrix2[6875] = 0; d_matrix2[6876] = 0; d_matrix2[6877] = 0; d_matrix2[6878] = 0; d_matrix2[6879] = 0;
d_matrix2[6880] = 0; d_matrix2[6881] = 0; d_matrix2[6882] = 0; d_matrix2[6883] = 0; d_matrix2[6884] = 0; d_matrix2[6885] = 0; d_matrix2[6886] = 0; d_matrix2[6887] = 0; d_matrix2[6888] = 0; d_matrix2[6889] = 4; d_matrix2[6890] = 4; d_matrix2[6891] = 4; d_matrix2[6892] = 0; d_matrix2[6893] = 0; d_matrix2[6894] = 3; d_matrix2[6895] = 4; d_matrix2[6896] = 0; d_matrix2[6897] = 0; d_matrix2[6898] = 0; d_matrix2[6899] = 0; d_matrix2[6900] = 0; d_matrix2[6901] = 0; d_matrix2[6902] = 0; d_matrix2[6903] = 0; d_matrix2[6904] = 4; d_matrix2[6905] = 0; d_matrix2[6906] = 2; d_matrix2[6907] = 0; d_matrix2[6908] = 4; d_matrix2[6909] = 4; d_matrix2[6910] = 0; d_matrix2[6911] = 3; d_matrix2[6912] = 0; d_matrix2[6913] = 0; d_matrix2[6914] = 0; d_matrix2[6915] = 0; d_matrix2[6916] = 0; d_matrix2[6917] = 0; d_matrix2[6918] = 0; d_matrix2[6919] = 0; d_matrix2[6920] = 0; d_matrix2[6921] = 0; d_matrix2[6922] = 0; d_matrix2[6923] = 3; d_matrix2[6924] = 0; d_matrix2[6925] = 0; d_matrix2[6926] = 3; d_matrix2[6927] = 0; d_matrix2[6928] = 0; d_matrix2[6929] = 0; d_matrix2[6930] = 0; d_matrix2[6931] = 5; d_matrix2[6932] = 2; d_matrix2[6933] = 3; d_matrix2[6934] = 3; d_matrix2[6935] = 0; d_matrix2[6936] = 0; d_matrix2[6937] = 4; d_matrix2[6938] = 5; d_matrix2[6939] = 4; d_matrix2[6940] = 0; d_matrix2[6941] = 0; d_matrix2[6942] = 0; d_matrix2[6943] = 0; d_matrix2[6944] = 0; d_matrix2[6945] = 5; d_matrix2[6946] = 3; d_matrix2[6947] = 0; d_matrix2[6948] = 0; d_matrix2[6949] = 0; d_matrix2[6950] = 4; d_matrix2[6951] = 4; d_matrix2[6952] = 4; d_matrix2[6953] = 0; d_matrix2[6954] = 0; d_matrix2[6955] = 0; d_matrix2[6956] = 0; d_matrix2[6957] = 0; d_matrix2[6958] = 0; d_matrix2[6959] = 0;
d_matrix2[6960] = 0; d_matrix2[6961] = 0; d_matrix2[6962] = 0; d_matrix2[6963] = 0; d_matrix2[6964] = 0; d_matrix2[6965] = 0; d_matrix2[6966] = 0; d_matrix2[6967] = 0; d_matrix2[6968] = 0; d_matrix2[6969] = 0; d_matrix2[6970] = 0; d_matrix2[6971] = 0; d_matrix2[6972] = 0; d_matrix2[6973] = 0; d_matrix2[6974] = 0; d_matrix2[6975] = 0; d_matrix2[6976] = 0; d_matrix2[6977] = 0; d_matrix2[6978] = 0; d_matrix2[6979] = 0; d_matrix2[6980] = 0; d_matrix2[6981] = 0; d_matrix2[6982] = 0; d_matrix2[6983] = 0; d_matrix2[6984] = 0; d_matrix2[6985] = 0; d_matrix2[6986] = 0; d_matrix2[6987] = 0; d_matrix2[6988] = 0; d_matrix2[6989] = 0; d_matrix2[6990] = 0; d_matrix2[6991] = 0; d_matrix2[6992] = 0; d_matrix2[6993] = 0; d_matrix2[6994] = 0; d_matrix2[6995] = 0; d_matrix2[6996] = 0; d_matrix2[6997] = 0; d_matrix2[6998] = 0; d_matrix2[6999] = 0; d_matrix2[7000] = 0; d_matrix2[7001] = 0; d_matrix2[7002] = 0; d_matrix2[7003] = 0; d_matrix2[7004] = 0; d_matrix2[7005] = 0; d_matrix2[7006] = 0; d_matrix2[7007] = 0; d_matrix2[7008] = 0; d_matrix2[7009] = 0; d_matrix2[7010] = 0; d_matrix2[7011] = 0; d_matrix2[7012] = 0; d_matrix2[7013] = 0; d_matrix2[7014] = 0; d_matrix2[7015] = 0; d_matrix2[7016] = 0; d_matrix2[7017] = 0; d_matrix2[7018] = 0; d_matrix2[7019] = 0; d_matrix2[7020] = 0; d_matrix2[7021] = 0; d_matrix2[7022] = 0; d_matrix2[7023] = 0; d_matrix2[7024] = 0; d_matrix2[7025] = 0; d_matrix2[7026] = 0; d_matrix2[7027] = 0; d_matrix2[7028] = 0; d_matrix2[7029] = 0; d_matrix2[7030] = 0; d_matrix2[7031] = 0; d_matrix2[7032] = 0; d_matrix2[7033] = 0; d_matrix2[7034] = 0; d_matrix2[7035] = 0; d_matrix2[7036] = 0; d_matrix2[7037] = 0; d_matrix2[7038] = 0; d_matrix2[7039] = 0;
d_matrix2[7040] = 0; d_matrix2[7041] = 0; d_matrix2[7042] = 0; d_matrix2[7043] = 4; d_matrix2[7044] = 0; d_matrix2[7045] = 5; d_matrix2[7046] = 0; d_matrix2[7047] = 0; d_matrix2[7048] = 4; d_matrix2[7049] = 5; d_matrix2[7050] = 4; d_matrix2[7051] = 0; d_matrix2[7052] = 0; d_matrix2[7053] = 0; d_matrix2[7054] = 3; d_matrix2[7055] = 0; d_matrix2[7056] = 0; d_matrix2[7057] = 0; d_matrix2[7058] = 0; d_matrix2[7059] = 0; d_matrix2[7060] = 0; d_matrix2[7061] = 0; d_matrix2[7062] = 3; d_matrix2[7063] = 4; d_matrix2[7064] = 0; d_matrix2[7065] = 0; d_matrix2[7066] = 4; d_matrix2[7067] = 0; d_matrix2[7068] = 4; d_matrix2[7069] = 0; d_matrix2[7070] = 0; d_matrix2[7071] = 0; d_matrix2[7072] = 0; d_matrix2[7073] = 0; d_matrix2[7074] = 3; d_matrix2[7075] = 0; d_matrix2[7076] = 0; d_matrix2[7077] = 0; d_matrix2[7078] = 0; d_matrix2[7079] = 5; d_matrix2[7080] = 3; d_matrix2[7081] = 3; d_matrix2[7082] = 0; d_matrix2[7083] = 0; d_matrix2[7084] = 0; d_matrix2[7085] = 0; d_matrix2[7086] = 0; d_matrix2[7087] = 0; d_matrix2[7088] = 3; d_matrix2[7089] = 4; d_matrix2[7090] = 5; d_matrix2[7091] = 5; d_matrix2[7092] = 0; d_matrix2[7093] = 0; d_matrix2[7094] = 0; d_matrix2[7095] = 0; d_matrix2[7096] = 4; d_matrix2[7097] = 4; d_matrix2[7098] = 0; d_matrix2[7099] = 0; d_matrix2[7100] = 0; d_matrix2[7101] = 0; d_matrix2[7102] = 0; d_matrix2[7103] = 5; d_matrix2[7104] = 4; d_matrix2[7105] = 5; d_matrix2[7106] = 0; d_matrix2[7107] = 5; d_matrix2[7108] = 4; d_matrix2[7109] = 3; d_matrix2[7110] = 0; d_matrix2[7111] = 5; d_matrix2[7112] = 0; d_matrix2[7113] = 3; d_matrix2[7114] = 3; d_matrix2[7115] = 0; d_matrix2[7116] = 0; d_matrix2[7117] = 0; d_matrix2[7118] = 0; d_matrix2[7119] = 0;
d_matrix2[7120] = 0; d_matrix2[7121] = 0; d_matrix2[7122] = 0; d_matrix2[7123] = 0; d_matrix2[7124] = 0; d_matrix2[7125] = 0; d_matrix2[7126] = 0; d_matrix2[7127] = 0; d_matrix2[7128] = 0; d_matrix2[7129] = 0; d_matrix2[7130] = 0; d_matrix2[7131] = 0; d_matrix2[7132] = 0; d_matrix2[7133] = 0; d_matrix2[7134] = 0; d_matrix2[7135] = 0; d_matrix2[7136] = 0; d_matrix2[7137] = 0; d_matrix2[7138] = 0; d_matrix2[7139] = 0; d_matrix2[7140] = 0; d_matrix2[7141] = 0; d_matrix2[7142] = 0; d_matrix2[7143] = 0; d_matrix2[7144] = 0; d_matrix2[7145] = 0; d_matrix2[7146] = 0; d_matrix2[7147] = 0; d_matrix2[7148] = 0; d_matrix2[7149] = 0; d_matrix2[7150] = 0; d_matrix2[7151] = 0; d_matrix2[7152] = 0; d_matrix2[7153] = 0; d_matrix2[7154] = 0; d_matrix2[7155] = 0; d_matrix2[7156] = 0; d_matrix2[7157] = 0; d_matrix2[7158] = 0; d_matrix2[7159] = 0; d_matrix2[7160] = 0; d_matrix2[7161] = 0; d_matrix2[7162] = 0; d_matrix2[7163] = 0; d_matrix2[7164] = 0; d_matrix2[7165] = 0; d_matrix2[7166] = 0; d_matrix2[7167] = 0; d_matrix2[7168] = 0; d_matrix2[7169] = 0; d_matrix2[7170] = 0; d_matrix2[7171] = 0; d_matrix2[7172] = 0; d_matrix2[7173] = 0; d_matrix2[7174] = 0; d_matrix2[7175] = 0; d_matrix2[7176] = 0; d_matrix2[7177] = 0; d_matrix2[7178] = 0; d_matrix2[7179] = 0; d_matrix2[7180] = 0; d_matrix2[7181] = 0; d_matrix2[7182] = 0; d_matrix2[7183] = 0; d_matrix2[7184] = 0; d_matrix2[7185] = 0; d_matrix2[7186] = 0; d_matrix2[7187] = 0; d_matrix2[7188] = 0; d_matrix2[7189] = 0; d_matrix2[7190] = 0; d_matrix2[7191] = 0; d_matrix2[7192] = 0; d_matrix2[7193] = 0; d_matrix2[7194] = 0; d_matrix2[7195] = 0; d_matrix2[7196] = 0; d_matrix2[7197] = 0; d_matrix2[7198] = 0; d_matrix2[7199] = 0;
d_matrix2[7200] = 0; d_matrix2[7201] = 0; d_matrix2[7202] = 5; d_matrix2[7203] = 0; d_matrix2[7204] = 0; d_matrix2[7205] = 0; d_matrix2[7206] = 0; d_matrix2[7207] = 0; d_matrix2[7208] = 5; d_matrix2[7209] = 0; d_matrix2[7210] = 0; d_matrix2[7211] = 0; d_matrix2[7212] = 0; d_matrix2[7213] = 0; d_matrix2[7214] = 2; d_matrix2[7215] = 4; d_matrix2[7216] = 5; d_matrix2[7217] = 0; d_matrix2[7218] = 0; d_matrix2[7219] = 0; d_matrix2[7220] = 0; d_matrix2[7221] = 0; d_matrix2[7222] = 0; d_matrix2[7223] = 0; d_matrix2[7224] = 0; d_matrix2[7225] = 0; d_matrix2[7226] = 5; d_matrix2[7227] = 3; d_matrix2[7228] = 0; d_matrix2[7229] = 0; d_matrix2[7230] = 0; d_matrix2[7231] = 0; d_matrix2[7232] = 0; d_matrix2[7233] = 0; d_matrix2[7234] = 0; d_matrix2[7235] = 0; d_matrix2[7236] = 0; d_matrix2[7237] = 0; d_matrix2[7238] = 0; d_matrix2[7239] = 0; d_matrix2[7240] = 0; d_matrix2[7241] = 0; d_matrix2[7242] = 0; d_matrix2[7243] = 0; d_matrix2[7244] = 0; d_matrix2[7245] = 0; d_matrix2[7246] = 0; d_matrix2[7247] = 0; d_matrix2[7248] = 0; d_matrix2[7249] = 0; d_matrix2[7250] = 4; d_matrix2[7251] = 5; d_matrix2[7252] = 0; d_matrix2[7253] = 0; d_matrix2[7254] = 0; d_matrix2[7255] = 0; d_matrix2[7256] = 0; d_matrix2[7257] = 0; d_matrix2[7258] = 0; d_matrix2[7259] = 0; d_matrix2[7260] = 0; d_matrix2[7261] = 0; d_matrix2[7262] = 0; d_matrix2[7263] = 0; d_matrix2[7264] = 0; d_matrix2[7265] = 0; d_matrix2[7266] = 0; d_matrix2[7267] = 3; d_matrix2[7268] = 0; d_matrix2[7269] = 0; d_matrix2[7270] = 0; d_matrix2[7271] = 0; d_matrix2[7272] = 0; d_matrix2[7273] = 0; d_matrix2[7274] = 0; d_matrix2[7275] = 0; d_matrix2[7276] = 0; d_matrix2[7277] = 0; d_matrix2[7278] = 0; d_matrix2[7279] = 0;
d_matrix2[7280] = 0; d_matrix2[7281] = 0; d_matrix2[7282] = 0; d_matrix2[7283] = 0; d_matrix2[7284] = 0; d_matrix2[7285] = 0; d_matrix2[7286] = 0; d_matrix2[7287] = 4; d_matrix2[7288] = 0; d_matrix2[7289] = 5; d_matrix2[7290] = 4; d_matrix2[7291] = 5; d_matrix2[7292] = 4; d_matrix2[7293] = 5; d_matrix2[7294] = 0; d_matrix2[7295] = 5; d_matrix2[7296] = 0; d_matrix2[7297] = 0; d_matrix2[7298] = 4; d_matrix2[7299] = 3; d_matrix2[7300] = 3; d_matrix2[7301] = 4; d_matrix2[7302] = 0; d_matrix2[7303] = 4; d_matrix2[7304] = 5; d_matrix2[7305] = 0; d_matrix2[7306] = 5; d_matrix2[7307] = 4; d_matrix2[7308] = 0; d_matrix2[7309] = 0; d_matrix2[7310] = 0; d_matrix2[7311] = 5; d_matrix2[7312] = 4; d_matrix2[7313] = 0; d_matrix2[7314] = 4; d_matrix2[7315] = 0; d_matrix2[7316] = 0; d_matrix2[7317] = 0; d_matrix2[7318] = 0; d_matrix2[7319] = 0; d_matrix2[7320] = 0; d_matrix2[7321] = 0; d_matrix2[7322] = 0; d_matrix2[7323] = 4; d_matrix2[7324] = 0; d_matrix2[7325] = 0; d_matrix2[7326] = 3; d_matrix2[7327] = 0; d_matrix2[7328] = 0; d_matrix2[7329] = 0; d_matrix2[7330] = 0; d_matrix2[7331] = 0; d_matrix2[7332] = 0; d_matrix2[7333] = 5; d_matrix2[7334] = 0; d_matrix2[7335] = 0; d_matrix2[7336] = 0; d_matrix2[7337] = 5; d_matrix2[7338] = 5; d_matrix2[7339] = 0; d_matrix2[7340] = 5; d_matrix2[7341] = 4; d_matrix2[7342] = 0; d_matrix2[7343] = 0; d_matrix2[7344] = 0; d_matrix2[7345] = 4; d_matrix2[7346] = 4; d_matrix2[7347] = 0; d_matrix2[7348] = 0; d_matrix2[7349] = 0; d_matrix2[7350] = 1; d_matrix2[7351] = 5; d_matrix2[7352] = 0; d_matrix2[7353] = 0; d_matrix2[7354] = 0; d_matrix2[7355] = 0; d_matrix2[7356] = 0; d_matrix2[7357] = 0; d_matrix2[7358] = 0; d_matrix2[7359] = 0;
d_matrix2[7360] = 0; d_matrix2[7361] = 0; d_matrix2[7362] = 0; d_matrix2[7363] = 0; d_matrix2[7364] = 0; d_matrix2[7365] = 0; d_matrix2[7366] = 0; d_matrix2[7367] = 0; d_matrix2[7368] = 0; d_matrix2[7369] = 0; d_matrix2[7370] = 0; d_matrix2[7371] = 0; d_matrix2[7372] = 0; d_matrix2[7373] = 0; d_matrix2[7374] = 0; d_matrix2[7375] = 0; d_matrix2[7376] = 0; d_matrix2[7377] = 0; d_matrix2[7378] = 0; d_matrix2[7379] = 0; d_matrix2[7380] = 0; d_matrix2[7381] = 0; d_matrix2[7382] = 0; d_matrix2[7383] = 5; d_matrix2[7384] = 0; d_matrix2[7385] = 0; d_matrix2[7386] = 0; d_matrix2[7387] = 0; d_matrix2[7388] = 0; d_matrix2[7389] = 4; d_matrix2[7390] = 0; d_matrix2[7391] = 0; d_matrix2[7392] = 5; d_matrix2[7393] = 0; d_matrix2[7394] = 0; d_matrix2[7395] = 0; d_matrix2[7396] = 0; d_matrix2[7397] = 0; d_matrix2[7398] = 0; d_matrix2[7399] = 0; d_matrix2[7400] = 0; d_matrix2[7401] = 0; d_matrix2[7402] = 0; d_matrix2[7403] = 0; d_matrix2[7404] = 0; d_matrix2[7405] = 0; d_matrix2[7406] = 0; d_matrix2[7407] = 0; d_matrix2[7408] = 0; d_matrix2[7409] = 0; d_matrix2[7410] = 0; d_matrix2[7411] = 5; d_matrix2[7412] = 0; d_matrix2[7413] = 0; d_matrix2[7414] = 0; d_matrix2[7415] = 0; d_matrix2[7416] = 0; d_matrix2[7417] = 1; d_matrix2[7418] = 0; d_matrix2[7419] = 0; d_matrix2[7420] = 0; d_matrix2[7421] = 0; d_matrix2[7422] = 0; d_matrix2[7423] = 0; d_matrix2[7424] = 0; d_matrix2[7425] = 4; d_matrix2[7426] = 0; d_matrix2[7427] = 0; d_matrix2[7428] = 0; d_matrix2[7429] = 0; d_matrix2[7430] = 5; d_matrix2[7431] = 0; d_matrix2[7432] = 0; d_matrix2[7433] = 0; d_matrix2[7434] = 0; d_matrix2[7435] = 0; d_matrix2[7436] = 0; d_matrix2[7437] = 0; d_matrix2[7438] = 0; d_matrix2[7439] = 0;
d_matrix2[7440] = 0; d_matrix2[7441] = 0; d_matrix2[7442] = 4; d_matrix2[7443] = 3; d_matrix2[7444] = 0; d_matrix2[7445] = 4; d_matrix2[7446] = 4; d_matrix2[7447] = 0; d_matrix2[7448] = 4; d_matrix2[7449] = 5; d_matrix2[7450] = 4; d_matrix2[7451] = 0; d_matrix2[7452] = 4; d_matrix2[7453] = 5; d_matrix2[7454] = 4; d_matrix2[7455] = 0; d_matrix2[7456] = 3; d_matrix2[7457] = 0; d_matrix2[7458] = 0; d_matrix2[7459] = 0; d_matrix2[7460] = 0; d_matrix2[7461] = 0; d_matrix2[7462] = 0; d_matrix2[7463] = 3; d_matrix2[7464] = 0; d_matrix2[7465] = 3; d_matrix2[7466] = 3; d_matrix2[7467] = 0; d_matrix2[7468] = 0; d_matrix2[7469] = 3; d_matrix2[7470] = 3; d_matrix2[7471] = 0; d_matrix2[7472] = 4; d_matrix2[7473] = 3; d_matrix2[7474] = 0; d_matrix2[7475] = 0; d_matrix2[7476] = 0; d_matrix2[7477] = 0; d_matrix2[7478] = 0; d_matrix2[7479] = 3; d_matrix2[7480] = 3; d_matrix2[7481] = 3; d_matrix2[7482] = 0; d_matrix2[7483] = 4; d_matrix2[7484] = 3; d_matrix2[7485] = 3; d_matrix2[7486] = 0; d_matrix2[7487] = 4; d_matrix2[7488] = 4; d_matrix2[7489] = 4; d_matrix2[7490] = 3; d_matrix2[7491] = 5; d_matrix2[7492] = 4; d_matrix2[7493] = 0; d_matrix2[7494] = 3; d_matrix2[7495] = 3; d_matrix2[7496] = 3; d_matrix2[7497] = 5; d_matrix2[7498] = 0; d_matrix2[7499] = 4; d_matrix2[7500] = 0; d_matrix2[7501] = 0; d_matrix2[7502] = 0; d_matrix2[7503] = 3; d_matrix2[7504] = 3; d_matrix2[7505] = 4; d_matrix2[7506] = 4; d_matrix2[7507] = 3; d_matrix2[7508] = 3; d_matrix2[7509] = 3; d_matrix2[7510] = 5; d_matrix2[7511] = 0; d_matrix2[7512] = 5; d_matrix2[7513] = 3; d_matrix2[7514] = 3; d_matrix2[7515] = 0; d_matrix2[7516] = 0; d_matrix2[7517] = 0; d_matrix2[7518] = 3; d_matrix2[7519] = 3;
d_matrix2[7520] = 0; d_matrix2[7521] = 0; d_matrix2[7522] = 5; d_matrix2[7523] = 0; d_matrix2[7524] = 0; d_matrix2[7525] = 0; d_matrix2[7526] = 0; d_matrix2[7527] = 0; d_matrix2[7528] = 0; d_matrix2[7529] = 0; d_matrix2[7530] = 0; d_matrix2[7531] = 0; d_matrix2[7532] = 0; d_matrix2[7533] = 0; d_matrix2[7534] = 0; d_matrix2[7535] = 4; d_matrix2[7536] = 5; d_matrix2[7537] = 0; d_matrix2[7538] = 0; d_matrix2[7539] = 0; d_matrix2[7540] = 0; d_matrix2[7541] = 0; d_matrix2[7542] = 0; d_matrix2[7543] = 0; d_matrix2[7544] = 0; d_matrix2[7545] = 0; d_matrix2[7546] = 0; d_matrix2[7547] = 0; d_matrix2[7548] = 0; d_matrix2[7549] = 0; d_matrix2[7550] = 0; d_matrix2[7551] = 0; d_matrix2[7552] = 0; d_matrix2[7553] = 0; d_matrix2[7554] = 0; d_matrix2[7555] = 0; d_matrix2[7556] = 0; d_matrix2[7557] = 0; d_matrix2[7558] = 0; d_matrix2[7559] = 0; d_matrix2[7560] = 0; d_matrix2[7561] = 0; d_matrix2[7562] = 0; d_matrix2[7563] = 0; d_matrix2[7564] = 0; d_matrix2[7565] = 0; d_matrix2[7566] = 0; d_matrix2[7567] = 0; d_matrix2[7568] = 0; d_matrix2[7569] = 0; d_matrix2[7570] = 0; d_matrix2[7571] = 0; d_matrix2[7572] = 0; d_matrix2[7573] = 0; d_matrix2[7574] = 0; d_matrix2[7575] = 0; d_matrix2[7576] = 0; d_matrix2[7577] = 0; d_matrix2[7578] = 0; d_matrix2[7579] = 0; d_matrix2[7580] = 0; d_matrix2[7581] = 0; d_matrix2[7582] = 0; d_matrix2[7583] = 0; d_matrix2[7584] = 0; d_matrix2[7585] = 0; d_matrix2[7586] = 0; d_matrix2[7587] = 0; d_matrix2[7588] = 0; d_matrix2[7589] = 0; d_matrix2[7590] = 0; d_matrix2[7591] = 0; d_matrix2[7592] = 0; d_matrix2[7593] = 0; d_matrix2[7594] = 0; d_matrix2[7595] = 0; d_matrix2[7596] = 0; d_matrix2[7597] = 0; d_matrix2[7598] = 0; d_matrix2[7599] = 0;
d_matrix2[7600] = 0; d_matrix2[7601] = 0; d_matrix2[7602] = 4; d_matrix2[7603] = 0; d_matrix2[7604] = 0; d_matrix2[7605] = 4; d_matrix2[7606] = 0; d_matrix2[7607] = 0; d_matrix2[7608] = 4; d_matrix2[7609] = 5; d_matrix2[7610] = 5; d_matrix2[7611] = 0; d_matrix2[7612] = 5; d_matrix2[7613] = 4; d_matrix2[7614] = 0; d_matrix2[7615] = 0; d_matrix2[7616] = 0; d_matrix2[7617] = 0; d_matrix2[7618] = 2; d_matrix2[7619] = 0; d_matrix2[7620] = 0; d_matrix2[7621] = 0; d_matrix2[7622] = 0; d_matrix2[7623] = 4; d_matrix2[7624] = 5; d_matrix2[7625] = 4; d_matrix2[7626] = 3; d_matrix2[7627] = 0; d_matrix2[7628] = 0; d_matrix2[7629] = 4; d_matrix2[7630] = 2; d_matrix2[7631] = 0; d_matrix2[7632] = 4; d_matrix2[7633] = 5; d_matrix2[7634] = 3; d_matrix2[7635] = 1; d_matrix2[7636] = 0; d_matrix2[7637] = 0; d_matrix2[7638] = 0; d_matrix2[7639] = 2; d_matrix2[7640] = 3; d_matrix2[7641] = 0; d_matrix2[7642] = 3; d_matrix2[7643] = 4; d_matrix2[7644] = 0; d_matrix2[7645] = 0; d_matrix2[7646] = 5; d_matrix2[7647] = 0; d_matrix2[7648] = 5; d_matrix2[7649] = 0; d_matrix2[7650] = 4; d_matrix2[7651] = 5; d_matrix2[7652] = 3; d_matrix2[7653] = 5; d_matrix2[7654] = 4; d_matrix2[7655] = 4; d_matrix2[7656] = 4; d_matrix2[7657] = 5; d_matrix2[7658] = 0; d_matrix2[7659] = 5; d_matrix2[7660] = 0; d_matrix2[7661] = 0; d_matrix2[7662] = 5; d_matrix2[7663] = 3; d_matrix2[7664] = 3; d_matrix2[7665] = 5; d_matrix2[7666] = 0; d_matrix2[7667] = 2; d_matrix2[7668] = 3; d_matrix2[7669] = 4; d_matrix2[7670] = 3; d_matrix2[7671] = 4; d_matrix2[7672] = 4; d_matrix2[7673] = 3; d_matrix2[7674] = 0; d_matrix2[7675] = 0; d_matrix2[7676] = 0; d_matrix2[7677] = 4; d_matrix2[7678] = 3; d_matrix2[7679] = 0;
d_matrix2[7680] = 0; d_matrix2[7681] = 0; d_matrix2[7682] = 5; d_matrix2[7683] = 2; d_matrix2[7684] = 1; d_matrix2[7685] = 0; d_matrix2[7686] = 0; d_matrix2[7687] = 0; d_matrix2[7688] = 5; d_matrix2[7689] = 5; d_matrix2[7690] = 0; d_matrix2[7691] = 0; d_matrix2[7692] = 0; d_matrix2[7693] = 0; d_matrix2[7694] = 0; d_matrix2[7695] = 5; d_matrix2[7696] = 4; d_matrix2[7697] = 0; d_matrix2[7698] = 0; d_matrix2[7699] = 0; d_matrix2[7700] = 0; d_matrix2[7701] = 0; d_matrix2[7702] = 0; d_matrix2[7703] = 4; d_matrix2[7704] = 0; d_matrix2[7705] = 3; d_matrix2[7706] = 3; d_matrix2[7707] = 3; d_matrix2[7708] = 0; d_matrix2[7709] = 4; d_matrix2[7710] = 0; d_matrix2[7711] = 0; d_matrix2[7712] = 4; d_matrix2[7713] = 1; d_matrix2[7714] = 3; d_matrix2[7715] = 0; d_matrix2[7716] = 0; d_matrix2[7717] = 0; d_matrix2[7718] = 0; d_matrix2[7719] = 0; d_matrix2[7720] = 0; d_matrix2[7721] = 0; d_matrix2[7722] = 0; d_matrix2[7723] = 0; d_matrix2[7724] = 2; d_matrix2[7725] = 0; d_matrix2[7726] = 0; d_matrix2[7727] = 0; d_matrix2[7728] = 0; d_matrix2[7729] = 4; d_matrix2[7730] = 3; d_matrix2[7731] = 5; d_matrix2[7732] = 4; d_matrix2[7733] = 4; d_matrix2[7734] = 0; d_matrix2[7735] = 0; d_matrix2[7736] = 0; d_matrix2[7737] = 0; d_matrix2[7738] = 0; d_matrix2[7739] = 3; d_matrix2[7740] = 0; d_matrix2[7741] = 0; d_matrix2[7742] = 0; d_matrix2[7743] = 4; d_matrix2[7744] = 3; d_matrix2[7745] = 5; d_matrix2[7746] = 4; d_matrix2[7747] = 0; d_matrix2[7748] = 2; d_matrix2[7749] = 4; d_matrix2[7750] = 5; d_matrix2[7751] = 4; d_matrix2[7752] = 5; d_matrix2[7753] = 2; d_matrix2[7754] = 4; d_matrix2[7755] = 0; d_matrix2[7756] = 0; d_matrix2[7757] = 0; d_matrix2[7758] = 4; d_matrix2[7759] = 3;
d_matrix2[7760] = 0; d_matrix2[7761] = 0; d_matrix2[7762] = 5; d_matrix2[7763] = 0; d_matrix2[7764] = 0; d_matrix2[7765] = 0; d_matrix2[7766] = 0; d_matrix2[7767] = 0; d_matrix2[7768] = 5; d_matrix2[7769] = 5; d_matrix2[7770] = 0; d_matrix2[7771] = 0; d_matrix2[7772] = 0; d_matrix2[7773] = 0; d_matrix2[7774] = 0; d_matrix2[7775] = 0; d_matrix2[7776] = 0; d_matrix2[7777] = 0; d_matrix2[7778] = 0; d_matrix2[7779] = 0; d_matrix2[7780] = 0; d_matrix2[7781] = 0; d_matrix2[7782] = 0; d_matrix2[7783] = 0; d_matrix2[7784] = 5; d_matrix2[7785] = 0; d_matrix2[7786] = 0; d_matrix2[7787] = 0; d_matrix2[7788] = 0; d_matrix2[7789] = 0; d_matrix2[7790] = 0; d_matrix2[7791] = 0; d_matrix2[7792] = 0; d_matrix2[7793] = 0; d_matrix2[7794] = 0; d_matrix2[7795] = 0; d_matrix2[7796] = 0; d_matrix2[7797] = 0; d_matrix2[7798] = 0; d_matrix2[7799] = 0; d_matrix2[7800] = 0; d_matrix2[7801] = 0; d_matrix2[7802] = 0; d_matrix2[7803] = 1; d_matrix2[7804] = 0; d_matrix2[7805] = 0; d_matrix2[7806] = 0; d_matrix2[7807] = 0; d_matrix2[7808] = 0; d_matrix2[7809] = 0; d_matrix2[7810] = 0; d_matrix2[7811] = 5; d_matrix2[7812] = 0; d_matrix2[7813] = 0; d_matrix2[7814] = 0; d_matrix2[7815] = 0; d_matrix2[7816] = 0; d_matrix2[7817] = 5; d_matrix2[7818] = 0; d_matrix2[7819] = 0; d_matrix2[7820] = 0; d_matrix2[7821] = 0; d_matrix2[7822] = 0; d_matrix2[7823] = 0; d_matrix2[7824] = 0; d_matrix2[7825] = 5; d_matrix2[7826] = 0; d_matrix2[7827] = 0; d_matrix2[7828] = 0; d_matrix2[7829] = 0; d_matrix2[7830] = 0; d_matrix2[7831] = 0; d_matrix2[7832] = 0; d_matrix2[7833] = 0; d_matrix2[7834] = 0; d_matrix2[7835] = 0; d_matrix2[7836] = 0; d_matrix2[7837] = 0; d_matrix2[7838] = 0; d_matrix2[7839] = 0;
d_matrix2[7840] = 0; d_matrix2[7841] = 0; d_matrix2[7842] = 4; d_matrix2[7843] = 0; d_matrix2[7844] = 0; d_matrix2[7845] = 0; d_matrix2[7846] = 0; d_matrix2[7847] = 0; d_matrix2[7848] = 5; d_matrix2[7849] = 0; d_matrix2[7850] = 0; d_matrix2[7851] = 0; d_matrix2[7852] = 0; d_matrix2[7853] = 0; d_matrix2[7854] = 0; d_matrix2[7855] = 0; d_matrix2[7856] = 0; d_matrix2[7857] = 0; d_matrix2[7858] = 0; d_matrix2[7859] = 0; d_matrix2[7860] = 0; d_matrix2[7861] = 0; d_matrix2[7862] = 0; d_matrix2[7863] = 0; d_matrix2[7864] = 5; d_matrix2[7865] = 0; d_matrix2[7866] = 0; d_matrix2[7867] = 0; d_matrix2[7868] = 0; d_matrix2[7869] = 5; d_matrix2[7870] = 0; d_matrix2[7871] = 0; d_matrix2[7872] = 0; d_matrix2[7873] = 5; d_matrix2[7874] = 0; d_matrix2[7875] = 0; d_matrix2[7876] = 0; d_matrix2[7877] = 0; d_matrix2[7878] = 0; d_matrix2[7879] = 0; d_matrix2[7880] = 0; d_matrix2[7881] = 0; d_matrix2[7882] = 0; d_matrix2[7883] = 0; d_matrix2[7884] = 0; d_matrix2[7885] = 0; d_matrix2[7886] = 0; d_matrix2[7887] = 0; d_matrix2[7888] = 0; d_matrix2[7889] = 0; d_matrix2[7890] = 0; d_matrix2[7891] = 5; d_matrix2[7892] = 0; d_matrix2[7893] = 0; d_matrix2[7894] = 0; d_matrix2[7895] = 0; d_matrix2[7896] = 0; d_matrix2[7897] = 0; d_matrix2[7898] = 0; d_matrix2[7899] = 0; d_matrix2[7900] = 0; d_matrix2[7901] = 0; d_matrix2[7902] = 0; d_matrix2[7903] = 0; d_matrix2[7904] = 0; d_matrix2[7905] = 0; d_matrix2[7906] = 0; d_matrix2[7907] = 0; d_matrix2[7908] = 0; d_matrix2[7909] = 0; d_matrix2[7910] = 5; d_matrix2[7911] = 0; d_matrix2[7912] = 0; d_matrix2[7913] = 0; d_matrix2[7914] = 0; d_matrix2[7915] = 0; d_matrix2[7916] = 0; d_matrix2[7917] = 0; d_matrix2[7918] = 0; d_matrix2[7919] = 0;
d_matrix2[7920] = 0; d_matrix2[7921] = 0; d_matrix2[7922] = 0; d_matrix2[7923] = 0; d_matrix2[7924] = 0; d_matrix2[7925] = 0; d_matrix2[7926] = 0; d_matrix2[7927] = 0; d_matrix2[7928] = 0; d_matrix2[7929] = 0; d_matrix2[7930] = 0; d_matrix2[7931] = 0; d_matrix2[7932] = 0; d_matrix2[7933] = 0; d_matrix2[7934] = 0; d_matrix2[7935] = 0; d_matrix2[7936] = 0; d_matrix2[7937] = 0; d_matrix2[7938] = 0; d_matrix2[7939] = 0; d_matrix2[7940] = 0; d_matrix2[7941] = 0; d_matrix2[7942] = 0; d_matrix2[7943] = 0; d_matrix2[7944] = 0; d_matrix2[7945] = 0; d_matrix2[7946] = 5; d_matrix2[7947] = 0; d_matrix2[7948] = 0; d_matrix2[7949] = 0; d_matrix2[7950] = 0; d_matrix2[7951] = 0; d_matrix2[7952] = 0; d_matrix2[7953] = 0; d_matrix2[7954] = 0; d_matrix2[7955] = 0; d_matrix2[7956] = 0; d_matrix2[7957] = 0; d_matrix2[7958] = 0; d_matrix2[7959] = 0; d_matrix2[7960] = 0; d_matrix2[7961] = 0; d_matrix2[7962] = 0; d_matrix2[7963] = 0; d_matrix2[7964] = 0; d_matrix2[7965] = 0; d_matrix2[7966] = 0; d_matrix2[7967] = 0; d_matrix2[7968] = 4; d_matrix2[7969] = 0; d_matrix2[7970] = 0; d_matrix2[7971] = 0; d_matrix2[7972] = 0; d_matrix2[7973] = 0; d_matrix2[7974] = 0; d_matrix2[7975] = 0; d_matrix2[7976] = 0; d_matrix2[7977] = 0; d_matrix2[7978] = 0; d_matrix2[7979] = 0; d_matrix2[7980] = 0; d_matrix2[7981] = 0; d_matrix2[7982] = 0; d_matrix2[7983] = 0; d_matrix2[7984] = 0; d_matrix2[7985] = 0; d_matrix2[7986] = 0; d_matrix2[7987] = 0; d_matrix2[7988] = 0; d_matrix2[7989] = 0; d_matrix2[7990] = 0; d_matrix2[7991] = 3; d_matrix2[7992] = 0; d_matrix2[7993] = 0; d_matrix2[7994] = 0; d_matrix2[7995] = 0; d_matrix2[7996] = 0; d_matrix2[7997] = 0; d_matrix2[7998] = 0; d_matrix2[7999] = 0;
d_matrix1[0] = 0; d_matrix1[1] = 0; d_matrix1[2] = 5; d_matrix1[3] = 3; d_matrix1[4] = 4; d_matrix1[5] = 3; d_matrix1[6] = 3; d_matrix1[7] = 5; d_matrix1[8] = 4; d_matrix1[9] = 1; d_matrix1[10] = 5; d_matrix1[11] = 3; d_matrix1[12] = 2; d_matrix1[13] = 5; d_matrix1[14] = 5; d_matrix1[15] = 5; d_matrix1[16] = 5; d_matrix1[17] = 5; d_matrix1[18] = 3; d_matrix1[19] = 4; d_matrix1[20] = 5; d_matrix1[21] = 4; d_matrix1[22] = 1; d_matrix1[23] = 4; d_matrix1[24] = 4; d_matrix1[25] = 3; d_matrix1[26] = 4; d_matrix1[27] = 3; d_matrix1[28] = 2; d_matrix1[29] = 4; d_matrix1[30] = 1; d_matrix1[31] = 3; d_matrix1[32] = 3; d_matrix1[33] = 5; d_matrix1[34] = 4; d_matrix1[35] = 2; d_matrix1[36] = 1; d_matrix1[37] = 2; d_matrix1[38] = 2; d_matrix1[39] = 3; d_matrix1[40] = 4; d_matrix1[41] = 3; d_matrix1[42] = 2; d_matrix1[43] = 5; d_matrix1[44] = 4; d_matrix1[45] = 5; d_matrix1[46] = 5; d_matrix1[47] = 4; d_matrix1[48] = 4; d_matrix1[49] = 5; d_matrix1[50] = 3; d_matrix1[51] = 5; d_matrix1[52] = 4; d_matrix1[53] = 4; d_matrix1[54] = 3; d_matrix1[55] = 3; d_matrix1[56] = 5; d_matrix1[57] = 4; d_matrix1[58] = 5; d_matrix1[59] = 4; d_matrix1[60] = 5; d_matrix1[61] = 5; d_matrix1[62] = 4; d_matrix1[63] = 3; d_matrix1[64] = 2; d_matrix1[65] = 5; d_matrix1[66] = 4; d_matrix1[67] = 4; d_matrix1[68] = 3; d_matrix1[69] = 4; d_matrix1[70] = 3; d_matrix1[71] = 3; d_matrix1[72] = 3; d_matrix1[73] = 4; d_matrix1[74] = 3; d_matrix1[75] = 1; d_matrix1[76] = 4; d_matrix1[77] = 4; d_matrix1[78] = 4; d_matrix1[79] = 1;
d_matrix1[80] = 0; d_matrix1[81] = 0; d_matrix1[82] = 5; d_matrix1[83] = 3; d_matrix1[84] = 4; d_matrix1[85] = 3; d_matrix1[86] = 3; d_matrix1[87] = 5; d_matrix1[88] = 4; d_matrix1[89] = 1; d_matrix1[90] = 5; d_matrix1[91] = 3; d_matrix1[92] = 2; d_matrix1[93] = 5; d_matrix1[94] = 5; d_matrix1[95] = 5; d_matrix1[96] = 5; d_matrix1[97] = 5; d_matrix1[98] = 3; d_matrix1[99] = 4; d_matrix1[100] = 5; d_matrix1[101] = 4; d_matrix1[102] = 1; d_matrix1[103] = 4; d_matrix1[104] = 4; d_matrix1[105] = 3; d_matrix1[106] = 4; d_matrix1[107] = 3; d_matrix1[108] = 2; d_matrix1[109] = 4; d_matrix1[110] = 1; d_matrix1[111] = 3; d_matrix1[112] = 3; d_matrix1[113] = 5; d_matrix1[114] = 4; d_matrix1[115] = 2; d_matrix1[116] = 1; d_matrix1[117] = 2; d_matrix1[118] = 2; d_matrix1[119] = 3; d_matrix1[120] = 4; d_matrix1[121] = 3; d_matrix1[122] = 2; d_matrix1[123] = 5; d_matrix1[124] = 4; d_matrix1[125] = 5; d_matrix1[126] = 5; d_matrix1[127] = 4; d_matrix1[128] = 4; d_matrix1[129] = 5; d_matrix1[130] = 3; d_matrix1[131] = 5; d_matrix1[132] = 4; d_matrix1[133] = 4; d_matrix1[134] = 3; d_matrix1[135] = 3; d_matrix1[136] = 5; d_matrix1[137] = 4; d_matrix1[138] = 5; d_matrix1[139] = 4; d_matrix1[140] = 5; d_matrix1[141] = 5; d_matrix1[142] = 4; d_matrix1[143] = 3; d_matrix1[144] = 2; d_matrix1[145] = 5; d_matrix1[146] = 4; d_matrix1[147] = 4; d_matrix1[148] = 3; d_matrix1[149] = 4; d_matrix1[150] = 3; d_matrix1[151] = 3; d_matrix1[152] = 3; d_matrix1[153] = 4; d_matrix1[154] = 3; d_matrix1[155] = 1; d_matrix1[156] = 4; d_matrix1[157] = 4; d_matrix1[158] = 4; d_matrix1[159] = 1;
d_matrix1[160] = 0; d_matrix1[161] = 0; d_matrix1[162] = 5; d_matrix1[163] = 3; d_matrix1[164] = 4; d_matrix1[165] = 3; d_matrix1[166] = 3; d_matrix1[167] = 5; d_matrix1[168] = 4; d_matrix1[169] = 1; d_matrix1[170] = 5; d_matrix1[171] = 3; d_matrix1[172] = 2; d_matrix1[173] = 5; d_matrix1[174] = 5; d_matrix1[175] = 5; d_matrix1[176] = 5; d_matrix1[177] = 5; d_matrix1[178] = 3; d_matrix1[179] = 4; d_matrix1[180] = 5; d_matrix1[181] = 4; d_matrix1[182] = 1; d_matrix1[183] = 4; d_matrix1[184] = 4; d_matrix1[185] = 3; d_matrix1[186] = 4; d_matrix1[187] = 3; d_matrix1[188] = 2; d_matrix1[189] = 4; d_matrix1[190] = 1; d_matrix1[191] = 3; d_matrix1[192] = 3; d_matrix1[193] = 5; d_matrix1[194] = 4; d_matrix1[195] = 2; d_matrix1[196] = 1; d_matrix1[197] = 2; d_matrix1[198] = 2; d_matrix1[199] = 3; d_matrix1[200] = 4; d_matrix1[201] = 3; d_matrix1[202] = 2; d_matrix1[203] = 5; d_matrix1[204] = 4; d_matrix1[205] = 5; d_matrix1[206] = 5; d_matrix1[207] = 4; d_matrix1[208] = 4; d_matrix1[209] = 5; d_matrix1[210] = 3; d_matrix1[211] = 5; d_matrix1[212] = 4; d_matrix1[213] = 4; d_matrix1[214] = 3; d_matrix1[215] = 3; d_matrix1[216] = 5; d_matrix1[217] = 4; d_matrix1[218] = 5; d_matrix1[219] = 4; d_matrix1[220] = 5; d_matrix1[221] = 5; d_matrix1[222] = 4; d_matrix1[223] = 3; d_matrix1[224] = 2; d_matrix1[225] = 5; d_matrix1[226] = 4; d_matrix1[227] = 4; d_matrix1[228] = 3; d_matrix1[229] = 4; d_matrix1[230] = 3; d_matrix1[231] = 3; d_matrix1[232] = 3; d_matrix1[233] = 4; d_matrix1[234] = 3; d_matrix1[235] = 1; d_matrix1[236] = 4; d_matrix1[237] = 4; d_matrix1[238] = 4; d_matrix1[239] = 1;
d_matrix1[240] = 0; d_matrix1[241] = 0; d_matrix1[242] = 5; d_matrix1[243] = 3; d_matrix1[244] = 4; d_matrix1[245] = 3; d_matrix1[246] = 3; d_matrix1[247] = 5; d_matrix1[248] = 4; d_matrix1[249] = 1; d_matrix1[250] = 5; d_matrix1[251] = 3; d_matrix1[252] = 2; d_matrix1[253] = 5; d_matrix1[254] = 5; d_matrix1[255] = 5; d_matrix1[256] = 5; d_matrix1[257] = 5; d_matrix1[258] = 3; d_matrix1[259] = 4; d_matrix1[260] = 5; d_matrix1[261] = 4; d_matrix1[262] = 1; d_matrix1[263] = 4; d_matrix1[264] = 4; d_matrix1[265] = 3; d_matrix1[266] = 4; d_matrix1[267] = 3; d_matrix1[268] = 2; d_matrix1[269] = 4; d_matrix1[270] = 1; d_matrix1[271] = 3; d_matrix1[272] = 3; d_matrix1[273] = 5; d_matrix1[274] = 4; d_matrix1[275] = 2; d_matrix1[276] = 1; d_matrix1[277] = 2; d_matrix1[278] = 2; d_matrix1[279] = 3; d_matrix1[280] = 4; d_matrix1[281] = 3; d_matrix1[282] = 2; d_matrix1[283] = 5; d_matrix1[284] = 4; d_matrix1[285] = 5; d_matrix1[286] = 5; d_matrix1[287] = 4; d_matrix1[288] = 4; d_matrix1[289] = 5; d_matrix1[290] = 3; d_matrix1[291] = 5; d_matrix1[292] = 4; d_matrix1[293] = 4; d_matrix1[294] = 3; d_matrix1[295] = 3; d_matrix1[296] = 5; d_matrix1[297] = 4; d_matrix1[298] = 5; d_matrix1[299] = 4; d_matrix1[300] = 5; d_matrix1[301] = 5; d_matrix1[302] = 4; d_matrix1[303] = 3; d_matrix1[304] = 2; d_matrix1[305] = 5; d_matrix1[306] = 4; d_matrix1[307] = 4; d_matrix1[308] = 3; d_matrix1[309] = 4; d_matrix1[310] = 3; d_matrix1[311] = 3; d_matrix1[312] = 3; d_matrix1[313] = 4; d_matrix1[314] = 3; d_matrix1[315] = 1; d_matrix1[316] = 4; d_matrix1[317] = 4; d_matrix1[318] = 4; d_matrix1[319] = 1;
d_matrix1[320] = 0; d_matrix1[321] = 0; d_matrix1[322] = 5; d_matrix1[323] = 3; d_matrix1[324] = 4; d_matrix1[325] = 3; d_matrix1[326] = 3; d_matrix1[327] = 5; d_matrix1[328] = 4; d_matrix1[329] = 1; d_matrix1[330] = 5; d_matrix1[331] = 3; d_matrix1[332] = 2; d_matrix1[333] = 5; d_matrix1[334] = 5; d_matrix1[335] = 5; d_matrix1[336] = 5; d_matrix1[337] = 5; d_matrix1[338] = 3; d_matrix1[339] = 4; d_matrix1[340] = 5; d_matrix1[341] = 4; d_matrix1[342] = 1; d_matrix1[343] = 4; d_matrix1[344] = 4; d_matrix1[345] = 3; d_matrix1[346] = 4; d_matrix1[347] = 3; d_matrix1[348] = 2; d_matrix1[349] = 4; d_matrix1[350] = 1; d_matrix1[351] = 3; d_matrix1[352] = 3; d_matrix1[353] = 5; d_matrix1[354] = 4; d_matrix1[355] = 2; d_matrix1[356] = 1; d_matrix1[357] = 2; d_matrix1[358] = 2; d_matrix1[359] = 3; d_matrix1[360] = 4; d_matrix1[361] = 3; d_matrix1[362] = 2; d_matrix1[363] = 5; d_matrix1[364] = 4; d_matrix1[365] = 5; d_matrix1[366] = 5; d_matrix1[367] = 4; d_matrix1[368] = 4; d_matrix1[369] = 5; d_matrix1[370] = 3; d_matrix1[371] = 5; d_matrix1[372] = 4; d_matrix1[373] = 4; d_matrix1[374] = 3; d_matrix1[375] = 3; d_matrix1[376] = 5; d_matrix1[377] = 4; d_matrix1[378] = 5; d_matrix1[379] = 4; d_matrix1[380] = 5; d_matrix1[381] = 5; d_matrix1[382] = 4; d_matrix1[383] = 3; d_matrix1[384] = 2; d_matrix1[385] = 5; d_matrix1[386] = 4; d_matrix1[387] = 4; d_matrix1[388] = 3; d_matrix1[389] = 4; d_matrix1[390] = 3; d_matrix1[391] = 3; d_matrix1[392] = 3; d_matrix1[393] = 4; d_matrix1[394] = 3; d_matrix1[395] = 1; d_matrix1[396] = 4; d_matrix1[397] = 4; d_matrix1[398] = 4; d_matrix1[399] = 1;
d_matrix1[400] = 0; d_matrix1[401] = 0; d_matrix1[402] = 5; d_matrix1[403] = 3; d_matrix1[404] = 4; d_matrix1[405] = 3; d_matrix1[406] = 3; d_matrix1[407] = 5; d_matrix1[408] = 4; d_matrix1[409] = 1; d_matrix1[410] = 5; d_matrix1[411] = 3; d_matrix1[412] = 2; d_matrix1[413] = 5; d_matrix1[414] = 5; d_matrix1[415] = 5; d_matrix1[416] = 5; d_matrix1[417] = 5; d_matrix1[418] = 3; d_matrix1[419] = 4; d_matrix1[420] = 5; d_matrix1[421] = 4; d_matrix1[422] = 1; d_matrix1[423] = 4; d_matrix1[424] = 4; d_matrix1[425] = 3; d_matrix1[426] = 4; d_matrix1[427] = 3; d_matrix1[428] = 2; d_matrix1[429] = 4; d_matrix1[430] = 1; d_matrix1[431] = 3; d_matrix1[432] = 3; d_matrix1[433] = 5; d_matrix1[434] = 4; d_matrix1[435] = 2; d_matrix1[436] = 1; d_matrix1[437] = 2; d_matrix1[438] = 2; d_matrix1[439] = 3; d_matrix1[440] = 4; d_matrix1[441] = 3; d_matrix1[442] = 2; d_matrix1[443] = 5; d_matrix1[444] = 4; d_matrix1[445] = 5; d_matrix1[446] = 5; d_matrix1[447] = 4; d_matrix1[448] = 4; d_matrix1[449] = 5; d_matrix1[450] = 3; d_matrix1[451] = 5; d_matrix1[452] = 4; d_matrix1[453] = 4; d_matrix1[454] = 3; d_matrix1[455] = 3; d_matrix1[456] = 5; d_matrix1[457] = 4; d_matrix1[458] = 5; d_matrix1[459] = 4; d_matrix1[460] = 5; d_matrix1[461] = 5; d_matrix1[462] = 4; d_matrix1[463] = 3; d_matrix1[464] = 2; d_matrix1[465] = 5; d_matrix1[466] = 4; d_matrix1[467] = 4; d_matrix1[468] = 3; d_matrix1[469] = 4; d_matrix1[470] = 3; d_matrix1[471] = 3; d_matrix1[472] = 3; d_matrix1[473] = 4; d_matrix1[474] = 3; d_matrix1[475] = 1; d_matrix1[476] = 4; d_matrix1[477] = 4; d_matrix1[478] = 4; d_matrix1[479] = 1;
d_matrix1[480] = 0; d_matrix1[481] = 0; d_matrix1[482] = 5; d_matrix1[483] = 3; d_matrix1[484] = 4; d_matrix1[485] = 3; d_matrix1[486] = 3; d_matrix1[487] = 5; d_matrix1[488] = 4; d_matrix1[489] = 1; d_matrix1[490] = 5; d_matrix1[491] = 3; d_matrix1[492] = 2; d_matrix1[493] = 5; d_matrix1[494] = 5; d_matrix1[495] = 5; d_matrix1[496] = 5; d_matrix1[497] = 5; d_matrix1[498] = 3; d_matrix1[499] = 4; d_matrix1[500] = 5; d_matrix1[501] = 4; d_matrix1[502] = 1; d_matrix1[503] = 4; d_matrix1[504] = 4; d_matrix1[505] = 3; d_matrix1[506] = 4; d_matrix1[507] = 3; d_matrix1[508] = 2; d_matrix1[509] = 4; d_matrix1[510] = 1; d_matrix1[511] = 3; d_matrix1[512] = 3; d_matrix1[513] = 5; d_matrix1[514] = 4; d_matrix1[515] = 2; d_matrix1[516] = 1; d_matrix1[517] = 2; d_matrix1[518] = 2; d_matrix1[519] = 3; d_matrix1[520] = 4; d_matrix1[521] = 3; d_matrix1[522] = 2; d_matrix1[523] = 5; d_matrix1[524] = 4; d_matrix1[525] = 5; d_matrix1[526] = 5; d_matrix1[527] = 4; d_matrix1[528] = 4; d_matrix1[529] = 5; d_matrix1[530] = 3; d_matrix1[531] = 5; d_matrix1[532] = 4; d_matrix1[533] = 4; d_matrix1[534] = 3; d_matrix1[535] = 3; d_matrix1[536] = 5; d_matrix1[537] = 4; d_matrix1[538] = 5; d_matrix1[539] = 4; d_matrix1[540] = 5; d_matrix1[541] = 5; d_matrix1[542] = 4; d_matrix1[543] = 3; d_matrix1[544] = 2; d_matrix1[545] = 5; d_matrix1[546] = 4; d_matrix1[547] = 4; d_matrix1[548] = 3; d_matrix1[549] = 4; d_matrix1[550] = 3; d_matrix1[551] = 3; d_matrix1[552] = 3; d_matrix1[553] = 4; d_matrix1[554] = 3; d_matrix1[555] = 1; d_matrix1[556] = 4; d_matrix1[557] = 4; d_matrix1[558] = 4; d_matrix1[559] = 1;
d_matrix1[560] = 0; d_matrix1[561] = 0; d_matrix1[562] = 5; d_matrix1[563] = 3; d_matrix1[564] = 4; d_matrix1[565] = 3; d_matrix1[566] = 3; d_matrix1[567] = 5; d_matrix1[568] = 4; d_matrix1[569] = 1; d_matrix1[570] = 5; d_matrix1[571] = 3; d_matrix1[572] = 2; d_matrix1[573] = 5; d_matrix1[574] = 5; d_matrix1[575] = 5; d_matrix1[576] = 5; d_matrix1[577] = 5; d_matrix1[578] = 3; d_matrix1[579] = 4; d_matrix1[580] = 5; d_matrix1[581] = 4; d_matrix1[582] = 1; d_matrix1[583] = 4; d_matrix1[584] = 4; d_matrix1[585] = 3; d_matrix1[586] = 4; d_matrix1[587] = 3; d_matrix1[588] = 2; d_matrix1[589] = 4; d_matrix1[590] = 1; d_matrix1[591] = 3; d_matrix1[592] = 3; d_matrix1[593] = 5; d_matrix1[594] = 4; d_matrix1[595] = 2; d_matrix1[596] = 1; d_matrix1[597] = 2; d_matrix1[598] = 2; d_matrix1[599] = 3; d_matrix1[600] = 4; d_matrix1[601] = 3; d_matrix1[602] = 2; d_matrix1[603] = 5; d_matrix1[604] = 4; d_matrix1[605] = 5; d_matrix1[606] = 5; d_matrix1[607] = 4; d_matrix1[608] = 4; d_matrix1[609] = 5; d_matrix1[610] = 3; d_matrix1[611] = 5; d_matrix1[612] = 4; d_matrix1[613] = 4; d_matrix1[614] = 3; d_matrix1[615] = 3; d_matrix1[616] = 5; d_matrix1[617] = 4; d_matrix1[618] = 5; d_matrix1[619] = 4; d_matrix1[620] = 5; d_matrix1[621] = 5; d_matrix1[622] = 4; d_matrix1[623] = 3; d_matrix1[624] = 2; d_matrix1[625] = 5; d_matrix1[626] = 4; d_matrix1[627] = 4; d_matrix1[628] = 3; d_matrix1[629] = 4; d_matrix1[630] = 3; d_matrix1[631] = 3; d_matrix1[632] = 3; d_matrix1[633] = 4; d_matrix1[634] = 3; d_matrix1[635] = 1; d_matrix1[636] = 4; d_matrix1[637] = 4; d_matrix1[638] = 4; d_matrix1[639] = 1;
d_matrix1[640] = 0; d_matrix1[641] = 0; d_matrix1[642] = 5; d_matrix1[643] = 3; d_matrix1[644] = 4; d_matrix1[645] = 3; d_matrix1[646] = 3; d_matrix1[647] = 5; d_matrix1[648] = 4; d_matrix1[649] = 1; d_matrix1[650] = 5; d_matrix1[651] = 3; d_matrix1[652] = 2; d_matrix1[653] = 5; d_matrix1[654] = 5; d_matrix1[655] = 5; d_matrix1[656] = 5; d_matrix1[657] = 5; d_matrix1[658] = 3; d_matrix1[659] = 4; d_matrix1[660] = 5; d_matrix1[661] = 4; d_matrix1[662] = 1; d_matrix1[663] = 4; d_matrix1[664] = 4; d_matrix1[665] = 3; d_matrix1[666] = 4; d_matrix1[667] = 3; d_matrix1[668] = 2; d_matrix1[669] = 4; d_matrix1[670] = 1; d_matrix1[671] = 3; d_matrix1[672] = 3; d_matrix1[673] = 5; d_matrix1[674] = 4; d_matrix1[675] = 2; d_matrix1[676] = 1; d_matrix1[677] = 2; d_matrix1[678] = 2; d_matrix1[679] = 3; d_matrix1[680] = 4; d_matrix1[681] = 3; d_matrix1[682] = 2; d_matrix1[683] = 5; d_matrix1[684] = 4; d_matrix1[685] = 5; d_matrix1[686] = 5; d_matrix1[687] = 4; d_matrix1[688] = 4; d_matrix1[689] = 5; d_matrix1[690] = 3; d_matrix1[691] = 5; d_matrix1[692] = 4; d_matrix1[693] = 4; d_matrix1[694] = 3; d_matrix1[695] = 3; d_matrix1[696] = 5; d_matrix1[697] = 4; d_matrix1[698] = 5; d_matrix1[699] = 4; d_matrix1[700] = 5; d_matrix1[701] = 5; d_matrix1[702] = 4; d_matrix1[703] = 3; d_matrix1[704] = 2; d_matrix1[705] = 5; d_matrix1[706] = 4; d_matrix1[707] = 4; d_matrix1[708] = 3; d_matrix1[709] = 4; d_matrix1[710] = 3; d_matrix1[711] = 3; d_matrix1[712] = 3; d_matrix1[713] = 4; d_matrix1[714] = 3; d_matrix1[715] = 1; d_matrix1[716] = 4; d_matrix1[717] = 4; d_matrix1[718] = 4; d_matrix1[719] = 1;
d_matrix1[720] = 0; d_matrix1[721] = 0; d_matrix1[722] = 5; d_matrix1[723] = 3; d_matrix1[724] = 4; d_matrix1[725] = 3; d_matrix1[726] = 3; d_matrix1[727] = 5; d_matrix1[728] = 4; d_matrix1[729] = 1; d_matrix1[730] = 5; d_matrix1[731] = 3; d_matrix1[732] = 2; d_matrix1[733] = 5; d_matrix1[734] = 5; d_matrix1[735] = 5; d_matrix1[736] = 5; d_matrix1[737] = 5; d_matrix1[738] = 3; d_matrix1[739] = 4; d_matrix1[740] = 5; d_matrix1[741] = 4; d_matrix1[742] = 1; d_matrix1[743] = 4; d_matrix1[744] = 4; d_matrix1[745] = 3; d_matrix1[746] = 4; d_matrix1[747] = 3; d_matrix1[748] = 2; d_matrix1[749] = 4; d_matrix1[750] = 1; d_matrix1[751] = 3; d_matrix1[752] = 3; d_matrix1[753] = 5; d_matrix1[754] = 4; d_matrix1[755] = 2; d_matrix1[756] = 1; d_matrix1[757] = 2; d_matrix1[758] = 2; d_matrix1[759] = 3; d_matrix1[760] = 4; d_matrix1[761] = 3; d_matrix1[762] = 2; d_matrix1[763] = 5; d_matrix1[764] = 4; d_matrix1[765] = 5; d_matrix1[766] = 5; d_matrix1[767] = 4; d_matrix1[768] = 4; d_matrix1[769] = 5; d_matrix1[770] = 3; d_matrix1[771] = 5; d_matrix1[772] = 4; d_matrix1[773] = 4; d_matrix1[774] = 3; d_matrix1[775] = 3; d_matrix1[776] = 5; d_matrix1[777] = 4; d_matrix1[778] = 5; d_matrix1[779] = 4; d_matrix1[780] = 5; d_matrix1[781] = 5; d_matrix1[782] = 4; d_matrix1[783] = 3; d_matrix1[784] = 2; d_matrix1[785] = 5; d_matrix1[786] = 4; d_matrix1[787] = 4; d_matrix1[788] = 3; d_matrix1[789] = 4; d_matrix1[790] = 3; d_matrix1[791] = 3; d_matrix1[792] = 3; d_matrix1[793] = 4; d_matrix1[794] = 3; d_matrix1[795] = 1; d_matrix1[796] = 4; d_matrix1[797] = 4; d_matrix1[798] = 4; d_matrix1[799] = 1;
d_matrix1[800] = 0; d_matrix1[801] = 0; d_matrix1[802] = 5; d_matrix1[803] = 3; d_matrix1[804] = 4; d_matrix1[805] = 3; d_matrix1[806] = 3; d_matrix1[807] = 5; d_matrix1[808] = 4; d_matrix1[809] = 1; d_matrix1[810] = 5; d_matrix1[811] = 3; d_matrix1[812] = 2; d_matrix1[813] = 5; d_matrix1[814] = 5; d_matrix1[815] = 5; d_matrix1[816] = 5; d_matrix1[817] = 5; d_matrix1[818] = 3; d_matrix1[819] = 4; d_matrix1[820] = 5; d_matrix1[821] = 4; d_matrix1[822] = 1; d_matrix1[823] = 4; d_matrix1[824] = 4; d_matrix1[825] = 3; d_matrix1[826] = 4; d_matrix1[827] = 3; d_matrix1[828] = 2; d_matrix1[829] = 4; d_matrix1[830] = 1; d_matrix1[831] = 3; d_matrix1[832] = 3; d_matrix1[833] = 5; d_matrix1[834] = 4; d_matrix1[835] = 2; d_matrix1[836] = 1; d_matrix1[837] = 2; d_matrix1[838] = 2; d_matrix1[839] = 3; d_matrix1[840] = 4; d_matrix1[841] = 3; d_matrix1[842] = 2; d_matrix1[843] = 5; d_matrix1[844] = 4; d_matrix1[845] = 5; d_matrix1[846] = 5; d_matrix1[847] = 4; d_matrix1[848] = 4; d_matrix1[849] = 5; d_matrix1[850] = 3; d_matrix1[851] = 5; d_matrix1[852] = 4; d_matrix1[853] = 4; d_matrix1[854] = 3; d_matrix1[855] = 3; d_matrix1[856] = 5; d_matrix1[857] = 4; d_matrix1[858] = 5; d_matrix1[859] = 4; d_matrix1[860] = 5; d_matrix1[861] = 5; d_matrix1[862] = 4; d_matrix1[863] = 3; d_matrix1[864] = 2; d_matrix1[865] = 5; d_matrix1[866] = 4; d_matrix1[867] = 4; d_matrix1[868] = 3; d_matrix1[869] = 4; d_matrix1[870] = 3; d_matrix1[871] = 3; d_matrix1[872] = 3; d_matrix1[873] = 4; d_matrix1[874] = 3; d_matrix1[875] = 1; d_matrix1[876] = 4; d_matrix1[877] = 4; d_matrix1[878] = 4; d_matrix1[879] = 1;
d_matrix1[880] = 0; d_matrix1[881] = 0; d_matrix1[882] = 5; d_matrix1[883] = 3; d_matrix1[884] = 4; d_matrix1[885] = 3; d_matrix1[886] = 3; d_matrix1[887] = 5; d_matrix1[888] = 4; d_matrix1[889] = 1; d_matrix1[890] = 5; d_matrix1[891] = 3; d_matrix1[892] = 2; d_matrix1[893] = 5; d_matrix1[894] = 5; d_matrix1[895] = 5; d_matrix1[896] = 5; d_matrix1[897] = 5; d_matrix1[898] = 3; d_matrix1[899] = 4; d_matrix1[900] = 5; d_matrix1[901] = 4; d_matrix1[902] = 1; d_matrix1[903] = 4; d_matrix1[904] = 4; d_matrix1[905] = 3; d_matrix1[906] = 4; d_matrix1[907] = 3; d_matrix1[908] = 2; d_matrix1[909] = 4; d_matrix1[910] = 1; d_matrix1[911] = 3; d_matrix1[912] = 3; d_matrix1[913] = 5; d_matrix1[914] = 4; d_matrix1[915] = 2; d_matrix1[916] = 1; d_matrix1[917] = 2; d_matrix1[918] = 2; d_matrix1[919] = 3; d_matrix1[920] = 4; d_matrix1[921] = 3; d_matrix1[922] = 2; d_matrix1[923] = 5; d_matrix1[924] = 4; d_matrix1[925] = 5; d_matrix1[926] = 5; d_matrix1[927] = 4; d_matrix1[928] = 4; d_matrix1[929] = 5; d_matrix1[930] = 3; d_matrix1[931] = 5; d_matrix1[932] = 4; d_matrix1[933] = 4; d_matrix1[934] = 3; d_matrix1[935] = 3; d_matrix1[936] = 5; d_matrix1[937] = 4; d_matrix1[938] = 5; d_matrix1[939] = 4; d_matrix1[940] = 5; d_matrix1[941] = 5; d_matrix1[942] = 4; d_matrix1[943] = 3; d_matrix1[944] = 2; d_matrix1[945] = 5; d_matrix1[946] = 4; d_matrix1[947] = 4; d_matrix1[948] = 3; d_matrix1[949] = 4; d_matrix1[950] = 3; d_matrix1[951] = 3; d_matrix1[952] = 3; d_matrix1[953] = 4; d_matrix1[954] = 3; d_matrix1[955] = 1; d_matrix1[956] = 4; d_matrix1[957] = 4; d_matrix1[958] = 4; d_matrix1[959] = 1;
d_matrix1[960] = 0; d_matrix1[961] = 0; d_matrix1[962] = 5; d_matrix1[963] = 3; d_matrix1[964] = 4; d_matrix1[965] = 3; d_matrix1[966] = 3; d_matrix1[967] = 5; d_matrix1[968] = 4; d_matrix1[969] = 1; d_matrix1[970] = 5; d_matrix1[971] = 3; d_matrix1[972] = 2; d_matrix1[973] = 5; d_matrix1[974] = 5; d_matrix1[975] = 5; d_matrix1[976] = 5; d_matrix1[977] = 5; d_matrix1[978] = 3; d_matrix1[979] = 4; d_matrix1[980] = 5; d_matrix1[981] = 4; d_matrix1[982] = 1; d_matrix1[983] = 4; d_matrix1[984] = 4; d_matrix1[985] = 3; d_matrix1[986] = 4; d_matrix1[987] = 3; d_matrix1[988] = 2; d_matrix1[989] = 4; d_matrix1[990] = 1; d_matrix1[991] = 3; d_matrix1[992] = 3; d_matrix1[993] = 5; d_matrix1[994] = 4; d_matrix1[995] = 2; d_matrix1[996] = 1; d_matrix1[997] = 2; d_matrix1[998] = 2; d_matrix1[999] = 3; d_matrix1[1000] = 4; d_matrix1[1001] = 3; d_matrix1[1002] = 2; d_matrix1[1003] = 5; d_matrix1[1004] = 4; d_matrix1[1005] = 5; d_matrix1[1006] = 5; d_matrix1[1007] = 4; d_matrix1[1008] = 4; d_matrix1[1009] = 5; d_matrix1[1010] = 3; d_matrix1[1011] = 5; d_matrix1[1012] = 4; d_matrix1[1013] = 4; d_matrix1[1014] = 3; d_matrix1[1015] = 3; d_matrix1[1016] = 5; d_matrix1[1017] = 4; d_matrix1[1018] = 5; d_matrix1[1019] = 4; d_matrix1[1020] = 5; d_matrix1[1021] = 5; d_matrix1[1022] = 4; d_matrix1[1023] = 3; d_matrix1[1024] = 2; d_matrix1[1025] = 5; d_matrix1[1026] = 4; d_matrix1[1027] = 4; d_matrix1[1028] = 3; d_matrix1[1029] = 4; d_matrix1[1030] = 3; d_matrix1[1031] = 3; d_matrix1[1032] = 3; d_matrix1[1033] = 4; d_matrix1[1034] = 3; d_matrix1[1035] = 1; d_matrix1[1036] = 4; d_matrix1[1037] = 4; d_matrix1[1038] = 4; d_matrix1[1039] = 1;
d_matrix1[1040] = 0; d_matrix1[1041] = 0; d_matrix1[1042] = 5; d_matrix1[1043] = 3; d_matrix1[1044] = 4; d_matrix1[1045] = 3; d_matrix1[1046] = 3; d_matrix1[1047] = 5; d_matrix1[1048] = 4; d_matrix1[1049] = 1; d_matrix1[1050] = 5; d_matrix1[1051] = 3; d_matrix1[1052] = 2; d_matrix1[1053] = 5; d_matrix1[1054] = 5; d_matrix1[1055] = 5; d_matrix1[1056] = 5; d_matrix1[1057] = 5; d_matrix1[1058] = 3; d_matrix1[1059] = 4; d_matrix1[1060] = 5; d_matrix1[1061] = 4; d_matrix1[1062] = 1; d_matrix1[1063] = 4; d_matrix1[1064] = 4; d_matrix1[1065] = 3; d_matrix1[1066] = 4; d_matrix1[1067] = 3; d_matrix1[1068] = 2; d_matrix1[1069] = 4; d_matrix1[1070] = 1; d_matrix1[1071] = 3; d_matrix1[1072] = 3; d_matrix1[1073] = 5; d_matrix1[1074] = 4; d_matrix1[1075] = 2; d_matrix1[1076] = 1; d_matrix1[1077] = 2; d_matrix1[1078] = 2; d_matrix1[1079] = 3; d_matrix1[1080] = 4; d_matrix1[1081] = 3; d_matrix1[1082] = 2; d_matrix1[1083] = 5; d_matrix1[1084] = 4; d_matrix1[1085] = 5; d_matrix1[1086] = 5; d_matrix1[1087] = 4; d_matrix1[1088] = 4; d_matrix1[1089] = 5; d_matrix1[1090] = 3; d_matrix1[1091] = 5; d_matrix1[1092] = 4; d_matrix1[1093] = 4; d_matrix1[1094] = 3; d_matrix1[1095] = 3; d_matrix1[1096] = 5; d_matrix1[1097] = 4; d_matrix1[1098] = 5; d_matrix1[1099] = 4; d_matrix1[1100] = 5; d_matrix1[1101] = 5; d_matrix1[1102] = 4; d_matrix1[1103] = 3; d_matrix1[1104] = 2; d_matrix1[1105] = 5; d_matrix1[1106] = 4; d_matrix1[1107] = 4; d_matrix1[1108] = 3; d_matrix1[1109] = 4; d_matrix1[1110] = 3; d_matrix1[1111] = 3; d_matrix1[1112] = 3; d_matrix1[1113] = 4; d_matrix1[1114] = 3; d_matrix1[1115] = 1; d_matrix1[1116] = 4; d_matrix1[1117] = 4; d_matrix1[1118] = 4; d_matrix1[1119] = 1;
d_matrix1[1120] = 0; d_matrix1[1121] = 0; d_matrix1[1122] = 5; d_matrix1[1123] = 3; d_matrix1[1124] = 4; d_matrix1[1125] = 3; d_matrix1[1126] = 3; d_matrix1[1127] = 5; d_matrix1[1128] = 4; d_matrix1[1129] = 1; d_matrix1[1130] = 5; d_matrix1[1131] = 3; d_matrix1[1132] = 2; d_matrix1[1133] = 5; d_matrix1[1134] = 5; d_matrix1[1135] = 5; d_matrix1[1136] = 5; d_matrix1[1137] = 5; d_matrix1[1138] = 3; d_matrix1[1139] = 4; d_matrix1[1140] = 5; d_matrix1[1141] = 4; d_matrix1[1142] = 1; d_matrix1[1143] = 4; d_matrix1[1144] = 4; d_matrix1[1145] = 3; d_matrix1[1146] = 4; d_matrix1[1147] = 3; d_matrix1[1148] = 2; d_matrix1[1149] = 4; d_matrix1[1150] = 1; d_matrix1[1151] = 3; d_matrix1[1152] = 3; d_matrix1[1153] = 5; d_matrix1[1154] = 4; d_matrix1[1155] = 2; d_matrix1[1156] = 1; d_matrix1[1157] = 2; d_matrix1[1158] = 2; d_matrix1[1159] = 3; d_matrix1[1160] = 4; d_matrix1[1161] = 3; d_matrix1[1162] = 2; d_matrix1[1163] = 5; d_matrix1[1164] = 4; d_matrix1[1165] = 5; d_matrix1[1166] = 5; d_matrix1[1167] = 4; d_matrix1[1168] = 4; d_matrix1[1169] = 5; d_matrix1[1170] = 3; d_matrix1[1171] = 5; d_matrix1[1172] = 4; d_matrix1[1173] = 4; d_matrix1[1174] = 3; d_matrix1[1175] = 3; d_matrix1[1176] = 5; d_matrix1[1177] = 4; d_matrix1[1178] = 5; d_matrix1[1179] = 4; d_matrix1[1180] = 5; d_matrix1[1181] = 5; d_matrix1[1182] = 4; d_matrix1[1183] = 3; d_matrix1[1184] = 2; d_matrix1[1185] = 5; d_matrix1[1186] = 4; d_matrix1[1187] = 4; d_matrix1[1188] = 3; d_matrix1[1189] = 4; d_matrix1[1190] = 3; d_matrix1[1191] = 3; d_matrix1[1192] = 3; d_matrix1[1193] = 4; d_matrix1[1194] = 3; d_matrix1[1195] = 1; d_matrix1[1196] = 4; d_matrix1[1197] = 4; d_matrix1[1198] = 4; d_matrix1[1199] = 1;
d_matrix1[1200] = 0; d_matrix1[1201] = 0; d_matrix1[1202] = 5; d_matrix1[1203] = 3; d_matrix1[1204] = 4; d_matrix1[1205] = 3; d_matrix1[1206] = 3; d_matrix1[1207] = 5; d_matrix1[1208] = 4; d_matrix1[1209] = 1; d_matrix1[1210] = 5; d_matrix1[1211] = 3; d_matrix1[1212] = 2; d_matrix1[1213] = 5; d_matrix1[1214] = 5; d_matrix1[1215] = 5; d_matrix1[1216] = 5; d_matrix1[1217] = 5; d_matrix1[1218] = 3; d_matrix1[1219] = 4; d_matrix1[1220] = 5; d_matrix1[1221] = 4; d_matrix1[1222] = 1; d_matrix1[1223] = 4; d_matrix1[1224] = 4; d_matrix1[1225] = 3; d_matrix1[1226] = 4; d_matrix1[1227] = 3; d_matrix1[1228] = 2; d_matrix1[1229] = 4; d_matrix1[1230] = 1; d_matrix1[1231] = 3; d_matrix1[1232] = 3; d_matrix1[1233] = 5; d_matrix1[1234] = 4; d_matrix1[1235] = 2; d_matrix1[1236] = 1; d_matrix1[1237] = 2; d_matrix1[1238] = 2; d_matrix1[1239] = 3; d_matrix1[1240] = 4; d_matrix1[1241] = 3; d_matrix1[1242] = 2; d_matrix1[1243] = 5; d_matrix1[1244] = 4; d_matrix1[1245] = 5; d_matrix1[1246] = 5; d_matrix1[1247] = 4; d_matrix1[1248] = 4; d_matrix1[1249] = 5; d_matrix1[1250] = 3; d_matrix1[1251] = 5; d_matrix1[1252] = 4; d_matrix1[1253] = 4; d_matrix1[1254] = 3; d_matrix1[1255] = 3; d_matrix1[1256] = 5; d_matrix1[1257] = 4; d_matrix1[1258] = 5; d_matrix1[1259] = 4; d_matrix1[1260] = 5; d_matrix1[1261] = 5; d_matrix1[1262] = 4; d_matrix1[1263] = 3; d_matrix1[1264] = 2; d_matrix1[1265] = 5; d_matrix1[1266] = 4; d_matrix1[1267] = 4; d_matrix1[1268] = 3; d_matrix1[1269] = 4; d_matrix1[1270] = 3; d_matrix1[1271] = 3; d_matrix1[1272] = 3; d_matrix1[1273] = 4; d_matrix1[1274] = 3; d_matrix1[1275] = 1; d_matrix1[1276] = 4; d_matrix1[1277] = 4; d_matrix1[1278] = 4; d_matrix1[1279] = 1;
d_matrix1[1280] = 0; d_matrix1[1281] = 0; d_matrix1[1282] = 5; d_matrix1[1283] = 3; d_matrix1[1284] = 4; d_matrix1[1285] = 3; d_matrix1[1286] = 3; d_matrix1[1287] = 5; d_matrix1[1288] = 4; d_matrix1[1289] = 1; d_matrix1[1290] = 5; d_matrix1[1291] = 3; d_matrix1[1292] = 2; d_matrix1[1293] = 5; d_matrix1[1294] = 5; d_matrix1[1295] = 5; d_matrix1[1296] = 5; d_matrix1[1297] = 5; d_matrix1[1298] = 3; d_matrix1[1299] = 4; d_matrix1[1300] = 5; d_matrix1[1301] = 4; d_matrix1[1302] = 1; d_matrix1[1303] = 4; d_matrix1[1304] = 4; d_matrix1[1305] = 3; d_matrix1[1306] = 4; d_matrix1[1307] = 3; d_matrix1[1308] = 2; d_matrix1[1309] = 4; d_matrix1[1310] = 1; d_matrix1[1311] = 3; d_matrix1[1312] = 3; d_matrix1[1313] = 5; d_matrix1[1314] = 4; d_matrix1[1315] = 2; d_matrix1[1316] = 1; d_matrix1[1317] = 2; d_matrix1[1318] = 2; d_matrix1[1319] = 3; d_matrix1[1320] = 4; d_matrix1[1321] = 3; d_matrix1[1322] = 2; d_matrix1[1323] = 5; d_matrix1[1324] = 4; d_matrix1[1325] = 5; d_matrix1[1326] = 5; d_matrix1[1327] = 4; d_matrix1[1328] = 4; d_matrix1[1329] = 5; d_matrix1[1330] = 3; d_matrix1[1331] = 5; d_matrix1[1332] = 4; d_matrix1[1333] = 4; d_matrix1[1334] = 3; d_matrix1[1335] = 3; d_matrix1[1336] = 5; d_matrix1[1337] = 4; d_matrix1[1338] = 5; d_matrix1[1339] = 4; d_matrix1[1340] = 5; d_matrix1[1341] = 5; d_matrix1[1342] = 4; d_matrix1[1343] = 3; d_matrix1[1344] = 2; d_matrix1[1345] = 5; d_matrix1[1346] = 4; d_matrix1[1347] = 4; d_matrix1[1348] = 3; d_matrix1[1349] = 4; d_matrix1[1350] = 3; d_matrix1[1351] = 3; d_matrix1[1352] = 3; d_matrix1[1353] = 4; d_matrix1[1354] = 3; d_matrix1[1355] = 1; d_matrix1[1356] = 4; d_matrix1[1357] = 4; d_matrix1[1358] = 4; d_matrix1[1359] = 1;
d_matrix1[1360] = 0; d_matrix1[1361] = 0; d_matrix1[1362] = 5; d_matrix1[1363] = 3; d_matrix1[1364] = 4; d_matrix1[1365] = 3; d_matrix1[1366] = 3; d_matrix1[1367] = 5; d_matrix1[1368] = 4; d_matrix1[1369] = 1; d_matrix1[1370] = 5; d_matrix1[1371] = 3; d_matrix1[1372] = 2; d_matrix1[1373] = 5; d_matrix1[1374] = 5; d_matrix1[1375] = 5; d_matrix1[1376] = 5; d_matrix1[1377] = 5; d_matrix1[1378] = 3; d_matrix1[1379] = 4; d_matrix1[1380] = 5; d_matrix1[1381] = 4; d_matrix1[1382] = 1; d_matrix1[1383] = 4; d_matrix1[1384] = 4; d_matrix1[1385] = 3; d_matrix1[1386] = 4; d_matrix1[1387] = 3; d_matrix1[1388] = 2; d_matrix1[1389] = 4; d_matrix1[1390] = 1; d_matrix1[1391] = 3; d_matrix1[1392] = 3; d_matrix1[1393] = 5; d_matrix1[1394] = 4; d_matrix1[1395] = 2; d_matrix1[1396] = 1; d_matrix1[1397] = 2; d_matrix1[1398] = 2; d_matrix1[1399] = 3; d_matrix1[1400] = 4; d_matrix1[1401] = 3; d_matrix1[1402] = 2; d_matrix1[1403] = 5; d_matrix1[1404] = 4; d_matrix1[1405] = 5; d_matrix1[1406] = 5; d_matrix1[1407] = 4; d_matrix1[1408] = 4; d_matrix1[1409] = 5; d_matrix1[1410] = 3; d_matrix1[1411] = 5; d_matrix1[1412] = 4; d_matrix1[1413] = 4; d_matrix1[1414] = 3; d_matrix1[1415] = 3; d_matrix1[1416] = 5; d_matrix1[1417] = 4; d_matrix1[1418] = 5; d_matrix1[1419] = 4; d_matrix1[1420] = 5; d_matrix1[1421] = 5; d_matrix1[1422] = 4; d_matrix1[1423] = 3; d_matrix1[1424] = 2; d_matrix1[1425] = 5; d_matrix1[1426] = 4; d_matrix1[1427] = 4; d_matrix1[1428] = 3; d_matrix1[1429] = 4; d_matrix1[1430] = 3; d_matrix1[1431] = 3; d_matrix1[1432] = 3; d_matrix1[1433] = 4; d_matrix1[1434] = 3; d_matrix1[1435] = 1; d_matrix1[1436] = 4; d_matrix1[1437] = 4; d_matrix1[1438] = 4; d_matrix1[1439] = 1;
d_matrix1[1440] = 0; d_matrix1[1441] = 0; d_matrix1[1442] = 5; d_matrix1[1443] = 3; d_matrix1[1444] = 4; d_matrix1[1445] = 3; d_matrix1[1446] = 3; d_matrix1[1447] = 5; d_matrix1[1448] = 4; d_matrix1[1449] = 1; d_matrix1[1450] = 5; d_matrix1[1451] = 3; d_matrix1[1452] = 2; d_matrix1[1453] = 5; d_matrix1[1454] = 5; d_matrix1[1455] = 5; d_matrix1[1456] = 5; d_matrix1[1457] = 5; d_matrix1[1458] = 3; d_matrix1[1459] = 4; d_matrix1[1460] = 5; d_matrix1[1461] = 4; d_matrix1[1462] = 1; d_matrix1[1463] = 4; d_matrix1[1464] = 4; d_matrix1[1465] = 3; d_matrix1[1466] = 4; d_matrix1[1467] = 3; d_matrix1[1468] = 2; d_matrix1[1469] = 4; d_matrix1[1470] = 1; d_matrix1[1471] = 3; d_matrix1[1472] = 3; d_matrix1[1473] = 5; d_matrix1[1474] = 4; d_matrix1[1475] = 2; d_matrix1[1476] = 1; d_matrix1[1477] = 2; d_matrix1[1478] = 2; d_matrix1[1479] = 3; d_matrix1[1480] = 4; d_matrix1[1481] = 3; d_matrix1[1482] = 2; d_matrix1[1483] = 5; d_matrix1[1484] = 4; d_matrix1[1485] = 5; d_matrix1[1486] = 5; d_matrix1[1487] = 4; d_matrix1[1488] = 4; d_matrix1[1489] = 5; d_matrix1[1490] = 3; d_matrix1[1491] = 5; d_matrix1[1492] = 4; d_matrix1[1493] = 4; d_matrix1[1494] = 3; d_matrix1[1495] = 3; d_matrix1[1496] = 5; d_matrix1[1497] = 4; d_matrix1[1498] = 5; d_matrix1[1499] = 4; d_matrix1[1500] = 5; d_matrix1[1501] = 5; d_matrix1[1502] = 4; d_matrix1[1503] = 3; d_matrix1[1504] = 2; d_matrix1[1505] = 5; d_matrix1[1506] = 4; d_matrix1[1507] = 4; d_matrix1[1508] = 3; d_matrix1[1509] = 4; d_matrix1[1510] = 3; d_matrix1[1511] = 3; d_matrix1[1512] = 3; d_matrix1[1513] = 4; d_matrix1[1514] = 3; d_matrix1[1515] = 1; d_matrix1[1516] = 4; d_matrix1[1517] = 4; d_matrix1[1518] = 4; d_matrix1[1519] = 1;
d_matrix1[1520] = 0; d_matrix1[1521] = 0; d_matrix1[1522] = 5; d_matrix1[1523] = 3; d_matrix1[1524] = 4; d_matrix1[1525] = 3; d_matrix1[1526] = 3; d_matrix1[1527] = 5; d_matrix1[1528] = 4; d_matrix1[1529] = 1; d_matrix1[1530] = 5; d_matrix1[1531] = 3; d_matrix1[1532] = 2; d_matrix1[1533] = 5; d_matrix1[1534] = 5; d_matrix1[1535] = 5; d_matrix1[1536] = 5; d_matrix1[1537] = 5; d_matrix1[1538] = 3; d_matrix1[1539] = 4; d_matrix1[1540] = 5; d_matrix1[1541] = 4; d_matrix1[1542] = 1; d_matrix1[1543] = 4; d_matrix1[1544] = 4; d_matrix1[1545] = 3; d_matrix1[1546] = 4; d_matrix1[1547] = 3; d_matrix1[1548] = 2; d_matrix1[1549] = 4; d_matrix1[1550] = 1; d_matrix1[1551] = 3; d_matrix1[1552] = 3; d_matrix1[1553] = 5; d_matrix1[1554] = 4; d_matrix1[1555] = 2; d_matrix1[1556] = 1; d_matrix1[1557] = 2; d_matrix1[1558] = 2; d_matrix1[1559] = 3; d_matrix1[1560] = 4; d_matrix1[1561] = 3; d_matrix1[1562] = 2; d_matrix1[1563] = 5; d_matrix1[1564] = 4; d_matrix1[1565] = 5; d_matrix1[1566] = 5; d_matrix1[1567] = 4; d_matrix1[1568] = 4; d_matrix1[1569] = 5; d_matrix1[1570] = 3; d_matrix1[1571] = 5; d_matrix1[1572] = 4; d_matrix1[1573] = 4; d_matrix1[1574] = 3; d_matrix1[1575] = 3; d_matrix1[1576] = 5; d_matrix1[1577] = 4; d_matrix1[1578] = 5; d_matrix1[1579] = 4; d_matrix1[1580] = 5; d_matrix1[1581] = 5; d_matrix1[1582] = 4; d_matrix1[1583] = 3; d_matrix1[1584] = 2; d_matrix1[1585] = 5; d_matrix1[1586] = 4; d_matrix1[1587] = 4; d_matrix1[1588] = 3; d_matrix1[1589] = 4; d_matrix1[1590] = 3; d_matrix1[1591] = 3; d_matrix1[1592] = 3; d_matrix1[1593] = 4; d_matrix1[1594] = 3; d_matrix1[1595] = 1; d_matrix1[1596] = 4; d_matrix1[1597] = 4; d_matrix1[1598] = 4; d_matrix1[1599] = 1;
d_matrix1[1600] = 0; d_matrix1[1601] = 0; d_matrix1[1602] = 5; d_matrix1[1603] = 3; d_matrix1[1604] = 4; d_matrix1[1605] = 3; d_matrix1[1606] = 3; d_matrix1[1607] = 5; d_matrix1[1608] = 4; d_matrix1[1609] = 1; d_matrix1[1610] = 5; d_matrix1[1611] = 3; d_matrix1[1612] = 2; d_matrix1[1613] = 5; d_matrix1[1614] = 5; d_matrix1[1615] = 5; d_matrix1[1616] = 5; d_matrix1[1617] = 5; d_matrix1[1618] = 3; d_matrix1[1619] = 4; d_matrix1[1620] = 5; d_matrix1[1621] = 4; d_matrix1[1622] = 1; d_matrix1[1623] = 4; d_matrix1[1624] = 4; d_matrix1[1625] = 3; d_matrix1[1626] = 4; d_matrix1[1627] = 3; d_matrix1[1628] = 2; d_matrix1[1629] = 4; d_matrix1[1630] = 1; d_matrix1[1631] = 3; d_matrix1[1632] = 3; d_matrix1[1633] = 5; d_matrix1[1634] = 4; d_matrix1[1635] = 2; d_matrix1[1636] = 1; d_matrix1[1637] = 2; d_matrix1[1638] = 2; d_matrix1[1639] = 3; d_matrix1[1640] = 4; d_matrix1[1641] = 3; d_matrix1[1642] = 2; d_matrix1[1643] = 5; d_matrix1[1644] = 4; d_matrix1[1645] = 5; d_matrix1[1646] = 5; d_matrix1[1647] = 4; d_matrix1[1648] = 4; d_matrix1[1649] = 5; d_matrix1[1650] = 3; d_matrix1[1651] = 5; d_matrix1[1652] = 4; d_matrix1[1653] = 4; d_matrix1[1654] = 3; d_matrix1[1655] = 3; d_matrix1[1656] = 5; d_matrix1[1657] = 4; d_matrix1[1658] = 5; d_matrix1[1659] = 4; d_matrix1[1660] = 5; d_matrix1[1661] = 5; d_matrix1[1662] = 4; d_matrix1[1663] = 3; d_matrix1[1664] = 2; d_matrix1[1665] = 5; d_matrix1[1666] = 4; d_matrix1[1667] = 4; d_matrix1[1668] = 3; d_matrix1[1669] = 4; d_matrix1[1670] = 3; d_matrix1[1671] = 3; d_matrix1[1672] = 3; d_matrix1[1673] = 4; d_matrix1[1674] = 3; d_matrix1[1675] = 1; d_matrix1[1676] = 4; d_matrix1[1677] = 4; d_matrix1[1678] = 4; d_matrix1[1679] = 1;
d_matrix1[1680] = 0; d_matrix1[1681] = 0; d_matrix1[1682] = 5; d_matrix1[1683] = 3; d_matrix1[1684] = 4; d_matrix1[1685] = 3; d_matrix1[1686] = 3; d_matrix1[1687] = 5; d_matrix1[1688] = 4; d_matrix1[1689] = 1; d_matrix1[1690] = 5; d_matrix1[1691] = 3; d_matrix1[1692] = 2; d_matrix1[1693] = 5; d_matrix1[1694] = 5; d_matrix1[1695] = 5; d_matrix1[1696] = 5; d_matrix1[1697] = 5; d_matrix1[1698] = 3; d_matrix1[1699] = 4; d_matrix1[1700] = 5; d_matrix1[1701] = 4; d_matrix1[1702] = 1; d_matrix1[1703] = 4; d_matrix1[1704] = 4; d_matrix1[1705] = 3; d_matrix1[1706] = 4; d_matrix1[1707] = 3; d_matrix1[1708] = 2; d_matrix1[1709] = 4; d_matrix1[1710] = 1; d_matrix1[1711] = 3; d_matrix1[1712] = 3; d_matrix1[1713] = 5; d_matrix1[1714] = 4; d_matrix1[1715] = 2; d_matrix1[1716] = 1; d_matrix1[1717] = 2; d_matrix1[1718] = 2; d_matrix1[1719] = 3; d_matrix1[1720] = 4; d_matrix1[1721] = 3; d_matrix1[1722] = 2; d_matrix1[1723] = 5; d_matrix1[1724] = 4; d_matrix1[1725] = 5; d_matrix1[1726] = 5; d_matrix1[1727] = 4; d_matrix1[1728] = 4; d_matrix1[1729] = 5; d_matrix1[1730] = 3; d_matrix1[1731] = 5; d_matrix1[1732] = 4; d_matrix1[1733] = 4; d_matrix1[1734] = 3; d_matrix1[1735] = 3; d_matrix1[1736] = 5; d_matrix1[1737] = 4; d_matrix1[1738] = 5; d_matrix1[1739] = 4; d_matrix1[1740] = 5; d_matrix1[1741] = 5; d_matrix1[1742] = 4; d_matrix1[1743] = 3; d_matrix1[1744] = 2; d_matrix1[1745] = 5; d_matrix1[1746] = 4; d_matrix1[1747] = 4; d_matrix1[1748] = 3; d_matrix1[1749] = 4; d_matrix1[1750] = 3; d_matrix1[1751] = 3; d_matrix1[1752] = 3; d_matrix1[1753] = 4; d_matrix1[1754] = 3; d_matrix1[1755] = 1; d_matrix1[1756] = 4; d_matrix1[1757] = 4; d_matrix1[1758] = 4; d_matrix1[1759] = 1;
d_matrix1[1760] = 0; d_matrix1[1761] = 0; d_matrix1[1762] = 5; d_matrix1[1763] = 3; d_matrix1[1764] = 4; d_matrix1[1765] = 3; d_matrix1[1766] = 3; d_matrix1[1767] = 5; d_matrix1[1768] = 4; d_matrix1[1769] = 1; d_matrix1[1770] = 5; d_matrix1[1771] = 3; d_matrix1[1772] = 2; d_matrix1[1773] = 5; d_matrix1[1774] = 5; d_matrix1[1775] = 5; d_matrix1[1776] = 5; d_matrix1[1777] = 5; d_matrix1[1778] = 3; d_matrix1[1779] = 4; d_matrix1[1780] = 5; d_matrix1[1781] = 4; d_matrix1[1782] = 1; d_matrix1[1783] = 4; d_matrix1[1784] = 4; d_matrix1[1785] = 3; d_matrix1[1786] = 4; d_matrix1[1787] = 3; d_matrix1[1788] = 2; d_matrix1[1789] = 4; d_matrix1[1790] = 1; d_matrix1[1791] = 3; d_matrix1[1792] = 3; d_matrix1[1793] = 5; d_matrix1[1794] = 4; d_matrix1[1795] = 2; d_matrix1[1796] = 1; d_matrix1[1797] = 2; d_matrix1[1798] = 2; d_matrix1[1799] = 3; d_matrix1[1800] = 4; d_matrix1[1801] = 3; d_matrix1[1802] = 2; d_matrix1[1803] = 5; d_matrix1[1804] = 4; d_matrix1[1805] = 5; d_matrix1[1806] = 5; d_matrix1[1807] = 4; d_matrix1[1808] = 4; d_matrix1[1809] = 5; d_matrix1[1810] = 3; d_matrix1[1811] = 5; d_matrix1[1812] = 4; d_matrix1[1813] = 4; d_matrix1[1814] = 3; d_matrix1[1815] = 3; d_matrix1[1816] = 5; d_matrix1[1817] = 4; d_matrix1[1818] = 5; d_matrix1[1819] = 4; d_matrix1[1820] = 5; d_matrix1[1821] = 5; d_matrix1[1822] = 4; d_matrix1[1823] = 3; d_matrix1[1824] = 2; d_matrix1[1825] = 5; d_matrix1[1826] = 4; d_matrix1[1827] = 4; d_matrix1[1828] = 3; d_matrix1[1829] = 4; d_matrix1[1830] = 3; d_matrix1[1831] = 3; d_matrix1[1832] = 3; d_matrix1[1833] = 4; d_matrix1[1834] = 3; d_matrix1[1835] = 1; d_matrix1[1836] = 4; d_matrix1[1837] = 4; d_matrix1[1838] = 4; d_matrix1[1839] = 1;
d_matrix1[1840] = 0; d_matrix1[1841] = 0; d_matrix1[1842] = 5; d_matrix1[1843] = 3; d_matrix1[1844] = 4; d_matrix1[1845] = 3; d_matrix1[1846] = 3; d_matrix1[1847] = 5; d_matrix1[1848] = 4; d_matrix1[1849] = 1; d_matrix1[1850] = 5; d_matrix1[1851] = 3; d_matrix1[1852] = 2; d_matrix1[1853] = 5; d_matrix1[1854] = 5; d_matrix1[1855] = 5; d_matrix1[1856] = 5; d_matrix1[1857] = 5; d_matrix1[1858] = 3; d_matrix1[1859] = 4; d_matrix1[1860] = 5; d_matrix1[1861] = 4; d_matrix1[1862] = 1; d_matrix1[1863] = 4; d_matrix1[1864] = 4; d_matrix1[1865] = 3; d_matrix1[1866] = 4; d_matrix1[1867] = 3; d_matrix1[1868] = 2; d_matrix1[1869] = 4; d_matrix1[1870] = 1; d_matrix1[1871] = 3; d_matrix1[1872] = 3; d_matrix1[1873] = 5; d_matrix1[1874] = 4; d_matrix1[1875] = 2; d_matrix1[1876] = 1; d_matrix1[1877] = 2; d_matrix1[1878] = 2; d_matrix1[1879] = 3; d_matrix1[1880] = 4; d_matrix1[1881] = 3; d_matrix1[1882] = 2; d_matrix1[1883] = 5; d_matrix1[1884] = 4; d_matrix1[1885] = 5; d_matrix1[1886] = 5; d_matrix1[1887] = 4; d_matrix1[1888] = 4; d_matrix1[1889] = 5; d_matrix1[1890] = 3; d_matrix1[1891] = 5; d_matrix1[1892] = 4; d_matrix1[1893] = 4; d_matrix1[1894] = 3; d_matrix1[1895] = 3; d_matrix1[1896] = 5; d_matrix1[1897] = 4; d_matrix1[1898] = 5; d_matrix1[1899] = 4; d_matrix1[1900] = 5; d_matrix1[1901] = 5; d_matrix1[1902] = 4; d_matrix1[1903] = 3; d_matrix1[1904] = 2; d_matrix1[1905] = 5; d_matrix1[1906] = 4; d_matrix1[1907] = 4; d_matrix1[1908] = 3; d_matrix1[1909] = 4; d_matrix1[1910] = 3; d_matrix1[1911] = 3; d_matrix1[1912] = 3; d_matrix1[1913] = 4; d_matrix1[1914] = 3; d_matrix1[1915] = 1; d_matrix1[1916] = 4; d_matrix1[1917] = 4; d_matrix1[1918] = 4; d_matrix1[1919] = 1;
d_matrix1[1920] = 0; d_matrix1[1921] = 0; d_matrix1[1922] = 5; d_matrix1[1923] = 3; d_matrix1[1924] = 4; d_matrix1[1925] = 3; d_matrix1[1926] = 3; d_matrix1[1927] = 5; d_matrix1[1928] = 4; d_matrix1[1929] = 1; d_matrix1[1930] = 5; d_matrix1[1931] = 3; d_matrix1[1932] = 2; d_matrix1[1933] = 5; d_matrix1[1934] = 5; d_matrix1[1935] = 5; d_matrix1[1936] = 5; d_matrix1[1937] = 5; d_matrix1[1938] = 3; d_matrix1[1939] = 4; d_matrix1[1940] = 5; d_matrix1[1941] = 4; d_matrix1[1942] = 1; d_matrix1[1943] = 4; d_matrix1[1944] = 4; d_matrix1[1945] = 3; d_matrix1[1946] = 4; d_matrix1[1947] = 3; d_matrix1[1948] = 2; d_matrix1[1949] = 4; d_matrix1[1950] = 1; d_matrix1[1951] = 3; d_matrix1[1952] = 3; d_matrix1[1953] = 5; d_matrix1[1954] = 4; d_matrix1[1955] = 2; d_matrix1[1956] = 1; d_matrix1[1957] = 2; d_matrix1[1958] = 2; d_matrix1[1959] = 3; d_matrix1[1960] = 4; d_matrix1[1961] = 3; d_matrix1[1962] = 2; d_matrix1[1963] = 5; d_matrix1[1964] = 4; d_matrix1[1965] = 5; d_matrix1[1966] = 5; d_matrix1[1967] = 4; d_matrix1[1968] = 4; d_matrix1[1969] = 5; d_matrix1[1970] = 3; d_matrix1[1971] = 5; d_matrix1[1972] = 4; d_matrix1[1973] = 4; d_matrix1[1974] = 3; d_matrix1[1975] = 3; d_matrix1[1976] = 5; d_matrix1[1977] = 4; d_matrix1[1978] = 5; d_matrix1[1979] = 4; d_matrix1[1980] = 5; d_matrix1[1981] = 5; d_matrix1[1982] = 4; d_matrix1[1983] = 3; d_matrix1[1984] = 2; d_matrix1[1985] = 5; d_matrix1[1986] = 4; d_matrix1[1987] = 4; d_matrix1[1988] = 3; d_matrix1[1989] = 4; d_matrix1[1990] = 3; d_matrix1[1991] = 3; d_matrix1[1992] = 3; d_matrix1[1993] = 4; d_matrix1[1994] = 3; d_matrix1[1995] = 1; d_matrix1[1996] = 4; d_matrix1[1997] = 4; d_matrix1[1998] = 4; d_matrix1[1999] = 1;
d_matrix1[2000] = 0; d_matrix1[2001] = 0; d_matrix1[2002] = 5; d_matrix1[2003] = 3; d_matrix1[2004] = 4; d_matrix1[2005] = 3; d_matrix1[2006] = 3; d_matrix1[2007] = 5; d_matrix1[2008] = 4; d_matrix1[2009] = 1; d_matrix1[2010] = 5; d_matrix1[2011] = 3; d_matrix1[2012] = 2; d_matrix1[2013] = 5; d_matrix1[2014] = 5; d_matrix1[2015] = 5; d_matrix1[2016] = 5; d_matrix1[2017] = 5; d_matrix1[2018] = 3; d_matrix1[2019] = 4; d_matrix1[2020] = 5; d_matrix1[2021] = 4; d_matrix1[2022] = 1; d_matrix1[2023] = 4; d_matrix1[2024] = 4; d_matrix1[2025] = 3; d_matrix1[2026] = 4; d_matrix1[2027] = 3; d_matrix1[2028] = 2; d_matrix1[2029] = 4; d_matrix1[2030] = 1; d_matrix1[2031] = 3; d_matrix1[2032] = 3; d_matrix1[2033] = 5; d_matrix1[2034] = 4; d_matrix1[2035] = 2; d_matrix1[2036] = 1; d_matrix1[2037] = 2; d_matrix1[2038] = 2; d_matrix1[2039] = 3; d_matrix1[2040] = 4; d_matrix1[2041] = 3; d_matrix1[2042] = 2; d_matrix1[2043] = 5; d_matrix1[2044] = 4; d_matrix1[2045] = 5; d_matrix1[2046] = 5; d_matrix1[2047] = 4; d_matrix1[2048] = 4; d_matrix1[2049] = 5; d_matrix1[2050] = 3; d_matrix1[2051] = 5; d_matrix1[2052] = 4; d_matrix1[2053] = 4; d_matrix1[2054] = 3; d_matrix1[2055] = 3; d_matrix1[2056] = 5; d_matrix1[2057] = 4; d_matrix1[2058] = 5; d_matrix1[2059] = 4; d_matrix1[2060] = 5; d_matrix1[2061] = 5; d_matrix1[2062] = 4; d_matrix1[2063] = 3; d_matrix1[2064] = 2; d_matrix1[2065] = 5; d_matrix1[2066] = 4; d_matrix1[2067] = 4; d_matrix1[2068] = 3; d_matrix1[2069] = 4; d_matrix1[2070] = 3; d_matrix1[2071] = 3; d_matrix1[2072] = 3; d_matrix1[2073] = 4; d_matrix1[2074] = 3; d_matrix1[2075] = 1; d_matrix1[2076] = 4; d_matrix1[2077] = 4; d_matrix1[2078] = 4; d_matrix1[2079] = 1;
d_matrix1[2080] = 0; d_matrix1[2081] = 0; d_matrix1[2082] = 5; d_matrix1[2083] = 3; d_matrix1[2084] = 4; d_matrix1[2085] = 3; d_matrix1[2086] = 3; d_matrix1[2087] = 5; d_matrix1[2088] = 4; d_matrix1[2089] = 1; d_matrix1[2090] = 5; d_matrix1[2091] = 3; d_matrix1[2092] = 2; d_matrix1[2093] = 5; d_matrix1[2094] = 5; d_matrix1[2095] = 5; d_matrix1[2096] = 5; d_matrix1[2097] = 5; d_matrix1[2098] = 3; d_matrix1[2099] = 4; d_matrix1[2100] = 5; d_matrix1[2101] = 4; d_matrix1[2102] = 1; d_matrix1[2103] = 4; d_matrix1[2104] = 4; d_matrix1[2105] = 3; d_matrix1[2106] = 4; d_matrix1[2107] = 3; d_matrix1[2108] = 2; d_matrix1[2109] = 4; d_matrix1[2110] = 1; d_matrix1[2111] = 3; d_matrix1[2112] = 3; d_matrix1[2113] = 5; d_matrix1[2114] = 4; d_matrix1[2115] = 2; d_matrix1[2116] = 1; d_matrix1[2117] = 2; d_matrix1[2118] = 2; d_matrix1[2119] = 3; d_matrix1[2120] = 4; d_matrix1[2121] = 3; d_matrix1[2122] = 2; d_matrix1[2123] = 5; d_matrix1[2124] = 4; d_matrix1[2125] = 5; d_matrix1[2126] = 5; d_matrix1[2127] = 4; d_matrix1[2128] = 4; d_matrix1[2129] = 5; d_matrix1[2130] = 3; d_matrix1[2131] = 5; d_matrix1[2132] = 4; d_matrix1[2133] = 4; d_matrix1[2134] = 3; d_matrix1[2135] = 3; d_matrix1[2136] = 5; d_matrix1[2137] = 4; d_matrix1[2138] = 5; d_matrix1[2139] = 4; d_matrix1[2140] = 5; d_matrix1[2141] = 5; d_matrix1[2142] = 4; d_matrix1[2143] = 3; d_matrix1[2144] = 2; d_matrix1[2145] = 5; d_matrix1[2146] = 4; d_matrix1[2147] = 4; d_matrix1[2148] = 3; d_matrix1[2149] = 4; d_matrix1[2150] = 3; d_matrix1[2151] = 3; d_matrix1[2152] = 3; d_matrix1[2153] = 4; d_matrix1[2154] = 3; d_matrix1[2155] = 1; d_matrix1[2156] = 4; d_matrix1[2157] = 4; d_matrix1[2158] = 4; d_matrix1[2159] = 1;
d_matrix1[2160] = 0; d_matrix1[2161] = 0; d_matrix1[2162] = 5; d_matrix1[2163] = 3; d_matrix1[2164] = 4; d_matrix1[2165] = 3; d_matrix1[2166] = 3; d_matrix1[2167] = 5; d_matrix1[2168] = 4; d_matrix1[2169] = 1; d_matrix1[2170] = 5; d_matrix1[2171] = 3; d_matrix1[2172] = 2; d_matrix1[2173] = 5; d_matrix1[2174] = 5; d_matrix1[2175] = 5; d_matrix1[2176] = 5; d_matrix1[2177] = 5; d_matrix1[2178] = 3; d_matrix1[2179] = 4; d_matrix1[2180] = 5; d_matrix1[2181] = 4; d_matrix1[2182] = 1; d_matrix1[2183] = 4; d_matrix1[2184] = 4; d_matrix1[2185] = 3; d_matrix1[2186] = 4; d_matrix1[2187] = 3; d_matrix1[2188] = 2; d_matrix1[2189] = 4; d_matrix1[2190] = 1; d_matrix1[2191] = 3; d_matrix1[2192] = 3; d_matrix1[2193] = 5; d_matrix1[2194] = 4; d_matrix1[2195] = 2; d_matrix1[2196] = 1; d_matrix1[2197] = 2; d_matrix1[2198] = 2; d_matrix1[2199] = 3; d_matrix1[2200] = 4; d_matrix1[2201] = 3; d_matrix1[2202] = 2; d_matrix1[2203] = 5; d_matrix1[2204] = 4; d_matrix1[2205] = 5; d_matrix1[2206] = 5; d_matrix1[2207] = 4; d_matrix1[2208] = 4; d_matrix1[2209] = 5; d_matrix1[2210] = 3; d_matrix1[2211] = 5; d_matrix1[2212] = 4; d_matrix1[2213] = 4; d_matrix1[2214] = 3; d_matrix1[2215] = 3; d_matrix1[2216] = 5; d_matrix1[2217] = 4; d_matrix1[2218] = 5; d_matrix1[2219] = 4; d_matrix1[2220] = 5; d_matrix1[2221] = 5; d_matrix1[2222] = 4; d_matrix1[2223] = 3; d_matrix1[2224] = 2; d_matrix1[2225] = 5; d_matrix1[2226] = 4; d_matrix1[2227] = 4; d_matrix1[2228] = 3; d_matrix1[2229] = 4; d_matrix1[2230] = 3; d_matrix1[2231] = 3; d_matrix1[2232] = 3; d_matrix1[2233] = 4; d_matrix1[2234] = 3; d_matrix1[2235] = 1; d_matrix1[2236] = 4; d_matrix1[2237] = 4; d_matrix1[2238] = 4; d_matrix1[2239] = 1;
d_matrix1[2240] = 0; d_matrix1[2241] = 0; d_matrix1[2242] = 5; d_matrix1[2243] = 3; d_matrix1[2244] = 4; d_matrix1[2245] = 3; d_matrix1[2246] = 3; d_matrix1[2247] = 5; d_matrix1[2248] = 4; d_matrix1[2249] = 1; d_matrix1[2250] = 5; d_matrix1[2251] = 3; d_matrix1[2252] = 2; d_matrix1[2253] = 5; d_matrix1[2254] = 5; d_matrix1[2255] = 5; d_matrix1[2256] = 5; d_matrix1[2257] = 5; d_matrix1[2258] = 3; d_matrix1[2259] = 4; d_matrix1[2260] = 5; d_matrix1[2261] = 4; d_matrix1[2262] = 1; d_matrix1[2263] = 4; d_matrix1[2264] = 4; d_matrix1[2265] = 3; d_matrix1[2266] = 4; d_matrix1[2267] = 3; d_matrix1[2268] = 2; d_matrix1[2269] = 4; d_matrix1[2270] = 1; d_matrix1[2271] = 3; d_matrix1[2272] = 3; d_matrix1[2273] = 5; d_matrix1[2274] = 4; d_matrix1[2275] = 2; d_matrix1[2276] = 1; d_matrix1[2277] = 2; d_matrix1[2278] = 2; d_matrix1[2279] = 3; d_matrix1[2280] = 4; d_matrix1[2281] = 3; d_matrix1[2282] = 2; d_matrix1[2283] = 5; d_matrix1[2284] = 4; d_matrix1[2285] = 5; d_matrix1[2286] = 5; d_matrix1[2287] = 4; d_matrix1[2288] = 4; d_matrix1[2289] = 5; d_matrix1[2290] = 3; d_matrix1[2291] = 5; d_matrix1[2292] = 4; d_matrix1[2293] = 4; d_matrix1[2294] = 3; d_matrix1[2295] = 3; d_matrix1[2296] = 5; d_matrix1[2297] = 4; d_matrix1[2298] = 5; d_matrix1[2299] = 4; d_matrix1[2300] = 5; d_matrix1[2301] = 5; d_matrix1[2302] = 4; d_matrix1[2303] = 3; d_matrix1[2304] = 2; d_matrix1[2305] = 5; d_matrix1[2306] = 4; d_matrix1[2307] = 4; d_matrix1[2308] = 3; d_matrix1[2309] = 4; d_matrix1[2310] = 3; d_matrix1[2311] = 3; d_matrix1[2312] = 3; d_matrix1[2313] = 4; d_matrix1[2314] = 3; d_matrix1[2315] = 1; d_matrix1[2316] = 4; d_matrix1[2317] = 4; d_matrix1[2318] = 4; d_matrix1[2319] = 1;
d_matrix1[2320] = 0; d_matrix1[2321] = 0; d_matrix1[2322] = 5; d_matrix1[2323] = 3; d_matrix1[2324] = 4; d_matrix1[2325] = 3; d_matrix1[2326] = 3; d_matrix1[2327] = 5; d_matrix1[2328] = 4; d_matrix1[2329] = 1; d_matrix1[2330] = 5; d_matrix1[2331] = 3; d_matrix1[2332] = 2; d_matrix1[2333] = 5; d_matrix1[2334] = 5; d_matrix1[2335] = 5; d_matrix1[2336] = 5; d_matrix1[2337] = 5; d_matrix1[2338] = 3; d_matrix1[2339] = 4; d_matrix1[2340] = 5; d_matrix1[2341] = 4; d_matrix1[2342] = 1; d_matrix1[2343] = 4; d_matrix1[2344] = 4; d_matrix1[2345] = 3; d_matrix1[2346] = 4; d_matrix1[2347] = 3; d_matrix1[2348] = 2; d_matrix1[2349] = 4; d_matrix1[2350] = 1; d_matrix1[2351] = 3; d_matrix1[2352] = 3; d_matrix1[2353] = 5; d_matrix1[2354] = 4; d_matrix1[2355] = 2; d_matrix1[2356] = 1; d_matrix1[2357] = 2; d_matrix1[2358] = 2; d_matrix1[2359] = 3; d_matrix1[2360] = 4; d_matrix1[2361] = 3; d_matrix1[2362] = 2; d_matrix1[2363] = 5; d_matrix1[2364] = 4; d_matrix1[2365] = 5; d_matrix1[2366] = 5; d_matrix1[2367] = 4; d_matrix1[2368] = 4; d_matrix1[2369] = 5; d_matrix1[2370] = 3; d_matrix1[2371] = 5; d_matrix1[2372] = 4; d_matrix1[2373] = 4; d_matrix1[2374] = 3; d_matrix1[2375] = 3; d_matrix1[2376] = 5; d_matrix1[2377] = 4; d_matrix1[2378] = 5; d_matrix1[2379] = 4; d_matrix1[2380] = 5; d_matrix1[2381] = 5; d_matrix1[2382] = 4; d_matrix1[2383] = 3; d_matrix1[2384] = 2; d_matrix1[2385] = 5; d_matrix1[2386] = 4; d_matrix1[2387] = 4; d_matrix1[2388] = 3; d_matrix1[2389] = 4; d_matrix1[2390] = 3; d_matrix1[2391] = 3; d_matrix1[2392] = 3; d_matrix1[2393] = 4; d_matrix1[2394] = 3; d_matrix1[2395] = 1; d_matrix1[2396] = 4; d_matrix1[2397] = 4; d_matrix1[2398] = 4; d_matrix1[2399] = 1;
d_matrix1[2400] = 0; d_matrix1[2401] = 0; d_matrix1[2402] = 5; d_matrix1[2403] = 3; d_matrix1[2404] = 4; d_matrix1[2405] = 3; d_matrix1[2406] = 3; d_matrix1[2407] = 5; d_matrix1[2408] = 4; d_matrix1[2409] = 1; d_matrix1[2410] = 5; d_matrix1[2411] = 3; d_matrix1[2412] = 2; d_matrix1[2413] = 5; d_matrix1[2414] = 5; d_matrix1[2415] = 5; d_matrix1[2416] = 5; d_matrix1[2417] = 5; d_matrix1[2418] = 3; d_matrix1[2419] = 4; d_matrix1[2420] = 5; d_matrix1[2421] = 4; d_matrix1[2422] = 1; d_matrix1[2423] = 4; d_matrix1[2424] = 4; d_matrix1[2425] = 3; d_matrix1[2426] = 4; d_matrix1[2427] = 3; d_matrix1[2428] = 2; d_matrix1[2429] = 4; d_matrix1[2430] = 1; d_matrix1[2431] = 3; d_matrix1[2432] = 3; d_matrix1[2433] = 5; d_matrix1[2434] = 4; d_matrix1[2435] = 2; d_matrix1[2436] = 1; d_matrix1[2437] = 2; d_matrix1[2438] = 2; d_matrix1[2439] = 3; d_matrix1[2440] = 4; d_matrix1[2441] = 3; d_matrix1[2442] = 2; d_matrix1[2443] = 5; d_matrix1[2444] = 4; d_matrix1[2445] = 5; d_matrix1[2446] = 5; d_matrix1[2447] = 4; d_matrix1[2448] = 4; d_matrix1[2449] = 5; d_matrix1[2450] = 3; d_matrix1[2451] = 5; d_matrix1[2452] = 4; d_matrix1[2453] = 4; d_matrix1[2454] = 3; d_matrix1[2455] = 3; d_matrix1[2456] = 5; d_matrix1[2457] = 4; d_matrix1[2458] = 5; d_matrix1[2459] = 4; d_matrix1[2460] = 5; d_matrix1[2461] = 5; d_matrix1[2462] = 4; d_matrix1[2463] = 3; d_matrix1[2464] = 2; d_matrix1[2465] = 5; d_matrix1[2466] = 4; d_matrix1[2467] = 4; d_matrix1[2468] = 3; d_matrix1[2469] = 4; d_matrix1[2470] = 3; d_matrix1[2471] = 3; d_matrix1[2472] = 3; d_matrix1[2473] = 4; d_matrix1[2474] = 3; d_matrix1[2475] = 1; d_matrix1[2476] = 4; d_matrix1[2477] = 4; d_matrix1[2478] = 4; d_matrix1[2479] = 1;
d_matrix1[2480] = 0; d_matrix1[2481] = 0; d_matrix1[2482] = 5; d_matrix1[2483] = 3; d_matrix1[2484] = 4; d_matrix1[2485] = 3; d_matrix1[2486] = 3; d_matrix1[2487] = 5; d_matrix1[2488] = 4; d_matrix1[2489] = 1; d_matrix1[2490] = 5; d_matrix1[2491] = 3; d_matrix1[2492] = 2; d_matrix1[2493] = 5; d_matrix1[2494] = 5; d_matrix1[2495] = 5; d_matrix1[2496] = 5; d_matrix1[2497] = 5; d_matrix1[2498] = 3; d_matrix1[2499] = 4; d_matrix1[2500] = 5; d_matrix1[2501] = 4; d_matrix1[2502] = 1; d_matrix1[2503] = 4; d_matrix1[2504] = 4; d_matrix1[2505] = 3; d_matrix1[2506] = 4; d_matrix1[2507] = 3; d_matrix1[2508] = 2; d_matrix1[2509] = 4; d_matrix1[2510] = 1; d_matrix1[2511] = 3; d_matrix1[2512] = 3; d_matrix1[2513] = 5; d_matrix1[2514] = 4; d_matrix1[2515] = 2; d_matrix1[2516] = 1; d_matrix1[2517] = 2; d_matrix1[2518] = 2; d_matrix1[2519] = 3; d_matrix1[2520] = 4; d_matrix1[2521] = 3; d_matrix1[2522] = 2; d_matrix1[2523] = 5; d_matrix1[2524] = 4; d_matrix1[2525] = 5; d_matrix1[2526] = 5; d_matrix1[2527] = 4; d_matrix1[2528] = 4; d_matrix1[2529] = 5; d_matrix1[2530] = 3; d_matrix1[2531] = 5; d_matrix1[2532] = 4; d_matrix1[2533] = 4; d_matrix1[2534] = 3; d_matrix1[2535] = 3; d_matrix1[2536] = 5; d_matrix1[2537] = 4; d_matrix1[2538] = 5; d_matrix1[2539] = 4; d_matrix1[2540] = 5; d_matrix1[2541] = 5; d_matrix1[2542] = 4; d_matrix1[2543] = 3; d_matrix1[2544] = 2; d_matrix1[2545] = 5; d_matrix1[2546] = 4; d_matrix1[2547] = 4; d_matrix1[2548] = 3; d_matrix1[2549] = 4; d_matrix1[2550] = 3; d_matrix1[2551] = 3; d_matrix1[2552] = 3; d_matrix1[2553] = 4; d_matrix1[2554] = 3; d_matrix1[2555] = 1; d_matrix1[2556] = 4; d_matrix1[2557] = 4; d_matrix1[2558] = 4; d_matrix1[2559] = 1;
d_matrix1[2560] = 0; d_matrix1[2561] = 0; d_matrix1[2562] = 5; d_matrix1[2563] = 3; d_matrix1[2564] = 4; d_matrix1[2565] = 3; d_matrix1[2566] = 3; d_matrix1[2567] = 5; d_matrix1[2568] = 4; d_matrix1[2569] = 1; d_matrix1[2570] = 5; d_matrix1[2571] = 3; d_matrix1[2572] = 2; d_matrix1[2573] = 5; d_matrix1[2574] = 5; d_matrix1[2575] = 5; d_matrix1[2576] = 5; d_matrix1[2577] = 5; d_matrix1[2578] = 3; d_matrix1[2579] = 4; d_matrix1[2580] = 5; d_matrix1[2581] = 4; d_matrix1[2582] = 1; d_matrix1[2583] = 4; d_matrix1[2584] = 4; d_matrix1[2585] = 3; d_matrix1[2586] = 4; d_matrix1[2587] = 3; d_matrix1[2588] = 2; d_matrix1[2589] = 4; d_matrix1[2590] = 1; d_matrix1[2591] = 3; d_matrix1[2592] = 3; d_matrix1[2593] = 5; d_matrix1[2594] = 4; d_matrix1[2595] = 2; d_matrix1[2596] = 1; d_matrix1[2597] = 2; d_matrix1[2598] = 2; d_matrix1[2599] = 3; d_matrix1[2600] = 4; d_matrix1[2601] = 3; d_matrix1[2602] = 2; d_matrix1[2603] = 5; d_matrix1[2604] = 4; d_matrix1[2605] = 5; d_matrix1[2606] = 5; d_matrix1[2607] = 4; d_matrix1[2608] = 4; d_matrix1[2609] = 5; d_matrix1[2610] = 3; d_matrix1[2611] = 5; d_matrix1[2612] = 4; d_matrix1[2613] = 4; d_matrix1[2614] = 3; d_matrix1[2615] = 3; d_matrix1[2616] = 5; d_matrix1[2617] = 4; d_matrix1[2618] = 5; d_matrix1[2619] = 4; d_matrix1[2620] = 5; d_matrix1[2621] = 5; d_matrix1[2622] = 4; d_matrix1[2623] = 3; d_matrix1[2624] = 2; d_matrix1[2625] = 5; d_matrix1[2626] = 4; d_matrix1[2627] = 4; d_matrix1[2628] = 3; d_matrix1[2629] = 4; d_matrix1[2630] = 3; d_matrix1[2631] = 3; d_matrix1[2632] = 3; d_matrix1[2633] = 4; d_matrix1[2634] = 3; d_matrix1[2635] = 1; d_matrix1[2636] = 4; d_matrix1[2637] = 4; d_matrix1[2638] = 4; d_matrix1[2639] = 1;
d_matrix1[2640] = 0; d_matrix1[2641] = 0; d_matrix1[2642] = 5; d_matrix1[2643] = 3; d_matrix1[2644] = 4; d_matrix1[2645] = 3; d_matrix1[2646] = 3; d_matrix1[2647] = 5; d_matrix1[2648] = 4; d_matrix1[2649] = 1; d_matrix1[2650] = 5; d_matrix1[2651] = 3; d_matrix1[2652] = 2; d_matrix1[2653] = 5; d_matrix1[2654] = 5; d_matrix1[2655] = 5; d_matrix1[2656] = 5; d_matrix1[2657] = 5; d_matrix1[2658] = 3; d_matrix1[2659] = 4; d_matrix1[2660] = 5; d_matrix1[2661] = 4; d_matrix1[2662] = 1; d_matrix1[2663] = 4; d_matrix1[2664] = 4; d_matrix1[2665] = 3; d_matrix1[2666] = 4; d_matrix1[2667] = 3; d_matrix1[2668] = 2; d_matrix1[2669] = 4; d_matrix1[2670] = 1; d_matrix1[2671] = 3; d_matrix1[2672] = 3; d_matrix1[2673] = 5; d_matrix1[2674] = 4; d_matrix1[2675] = 2; d_matrix1[2676] = 1; d_matrix1[2677] = 2; d_matrix1[2678] = 2; d_matrix1[2679] = 3; d_matrix1[2680] = 4; d_matrix1[2681] = 3; d_matrix1[2682] = 2; d_matrix1[2683] = 5; d_matrix1[2684] = 4; d_matrix1[2685] = 5; d_matrix1[2686] = 5; d_matrix1[2687] = 4; d_matrix1[2688] = 4; d_matrix1[2689] = 5; d_matrix1[2690] = 3; d_matrix1[2691] = 5; d_matrix1[2692] = 4; d_matrix1[2693] = 4; d_matrix1[2694] = 3; d_matrix1[2695] = 3; d_matrix1[2696] = 5; d_matrix1[2697] = 4; d_matrix1[2698] = 5; d_matrix1[2699] = 4; d_matrix1[2700] = 5; d_matrix1[2701] = 5; d_matrix1[2702] = 4; d_matrix1[2703] = 3; d_matrix1[2704] = 2; d_matrix1[2705] = 5; d_matrix1[2706] = 4; d_matrix1[2707] = 4; d_matrix1[2708] = 3; d_matrix1[2709] = 4; d_matrix1[2710] = 3; d_matrix1[2711] = 3; d_matrix1[2712] = 3; d_matrix1[2713] = 4; d_matrix1[2714] = 3; d_matrix1[2715] = 1; d_matrix1[2716] = 4; d_matrix1[2717] = 4; d_matrix1[2718] = 4; d_matrix1[2719] = 1;
d_matrix1[2720] = 0; d_matrix1[2721] = 0; d_matrix1[2722] = 5; d_matrix1[2723] = 3; d_matrix1[2724] = 4; d_matrix1[2725] = 3; d_matrix1[2726] = 3; d_matrix1[2727] = 5; d_matrix1[2728] = 4; d_matrix1[2729] = 1; d_matrix1[2730] = 5; d_matrix1[2731] = 3; d_matrix1[2732] = 2; d_matrix1[2733] = 5; d_matrix1[2734] = 5; d_matrix1[2735] = 5; d_matrix1[2736] = 5; d_matrix1[2737] = 5; d_matrix1[2738] = 3; d_matrix1[2739] = 4; d_matrix1[2740] = 5; d_matrix1[2741] = 4; d_matrix1[2742] = 1; d_matrix1[2743] = 4; d_matrix1[2744] = 4; d_matrix1[2745] = 3; d_matrix1[2746] = 4; d_matrix1[2747] = 3; d_matrix1[2748] = 2; d_matrix1[2749] = 4; d_matrix1[2750] = 1; d_matrix1[2751] = 3; d_matrix1[2752] = 3; d_matrix1[2753] = 5; d_matrix1[2754] = 4; d_matrix1[2755] = 2; d_matrix1[2756] = 1; d_matrix1[2757] = 2; d_matrix1[2758] = 2; d_matrix1[2759] = 3; d_matrix1[2760] = 4; d_matrix1[2761] = 3; d_matrix1[2762] = 2; d_matrix1[2763] = 5; d_matrix1[2764] = 4; d_matrix1[2765] = 5; d_matrix1[2766] = 5; d_matrix1[2767] = 4; d_matrix1[2768] = 4; d_matrix1[2769] = 5; d_matrix1[2770] = 3; d_matrix1[2771] = 5; d_matrix1[2772] = 4; d_matrix1[2773] = 4; d_matrix1[2774] = 3; d_matrix1[2775] = 3; d_matrix1[2776] = 5; d_matrix1[2777] = 4; d_matrix1[2778] = 5; d_matrix1[2779] = 4; d_matrix1[2780] = 5; d_matrix1[2781] = 5; d_matrix1[2782] = 4; d_matrix1[2783] = 3; d_matrix1[2784] = 2; d_matrix1[2785] = 5; d_matrix1[2786] = 4; d_matrix1[2787] = 4; d_matrix1[2788] = 3; d_matrix1[2789] = 4; d_matrix1[2790] = 3; d_matrix1[2791] = 3; d_matrix1[2792] = 3; d_matrix1[2793] = 4; d_matrix1[2794] = 3; d_matrix1[2795] = 1; d_matrix1[2796] = 4; d_matrix1[2797] = 4; d_matrix1[2798] = 4; d_matrix1[2799] = 1;
d_matrix1[2800] = 0; d_matrix1[2801] = 0; d_matrix1[2802] = 5; d_matrix1[2803] = 3; d_matrix1[2804] = 4; d_matrix1[2805] = 3; d_matrix1[2806] = 3; d_matrix1[2807] = 5; d_matrix1[2808] = 4; d_matrix1[2809] = 1; d_matrix1[2810] = 5; d_matrix1[2811] = 3; d_matrix1[2812] = 2; d_matrix1[2813] = 5; d_matrix1[2814] = 5; d_matrix1[2815] = 5; d_matrix1[2816] = 5; d_matrix1[2817] = 5; d_matrix1[2818] = 3; d_matrix1[2819] = 4; d_matrix1[2820] = 5; d_matrix1[2821] = 4; d_matrix1[2822] = 1; d_matrix1[2823] = 4; d_matrix1[2824] = 4; d_matrix1[2825] = 3; d_matrix1[2826] = 4; d_matrix1[2827] = 3; d_matrix1[2828] = 2; d_matrix1[2829] = 4; d_matrix1[2830] = 1; d_matrix1[2831] = 3; d_matrix1[2832] = 3; d_matrix1[2833] = 5; d_matrix1[2834] = 4; d_matrix1[2835] = 2; d_matrix1[2836] = 1; d_matrix1[2837] = 2; d_matrix1[2838] = 2; d_matrix1[2839] = 3; d_matrix1[2840] = 4; d_matrix1[2841] = 3; d_matrix1[2842] = 2; d_matrix1[2843] = 5; d_matrix1[2844] = 4; d_matrix1[2845] = 5; d_matrix1[2846] = 5; d_matrix1[2847] = 4; d_matrix1[2848] = 4; d_matrix1[2849] = 5; d_matrix1[2850] = 3; d_matrix1[2851] = 5; d_matrix1[2852] = 4; d_matrix1[2853] = 4; d_matrix1[2854] = 3; d_matrix1[2855] = 3; d_matrix1[2856] = 5; d_matrix1[2857] = 4; d_matrix1[2858] = 5; d_matrix1[2859] = 4; d_matrix1[2860] = 5; d_matrix1[2861] = 5; d_matrix1[2862] = 4; d_matrix1[2863] = 3; d_matrix1[2864] = 2; d_matrix1[2865] = 5; d_matrix1[2866] = 4; d_matrix1[2867] = 4; d_matrix1[2868] = 3; d_matrix1[2869] = 4; d_matrix1[2870] = 3; d_matrix1[2871] = 3; d_matrix1[2872] = 3; d_matrix1[2873] = 4; d_matrix1[2874] = 3; d_matrix1[2875] = 1; d_matrix1[2876] = 4; d_matrix1[2877] = 4; d_matrix1[2878] = 4; d_matrix1[2879] = 1;
d_matrix1[2880] = 0; d_matrix1[2881] = 0; d_matrix1[2882] = 5; d_matrix1[2883] = 3; d_matrix1[2884] = 4; d_matrix1[2885] = 3; d_matrix1[2886] = 3; d_matrix1[2887] = 5; d_matrix1[2888] = 4; d_matrix1[2889] = 1; d_matrix1[2890] = 5; d_matrix1[2891] = 3; d_matrix1[2892] = 2; d_matrix1[2893] = 5; d_matrix1[2894] = 5; d_matrix1[2895] = 5; d_matrix1[2896] = 5; d_matrix1[2897] = 5; d_matrix1[2898] = 3; d_matrix1[2899] = 4; d_matrix1[2900] = 5; d_matrix1[2901] = 4; d_matrix1[2902] = 1; d_matrix1[2903] = 4; d_matrix1[2904] = 4; d_matrix1[2905] = 3; d_matrix1[2906] = 4; d_matrix1[2907] = 3; d_matrix1[2908] = 2; d_matrix1[2909] = 4; d_matrix1[2910] = 1; d_matrix1[2911] = 3; d_matrix1[2912] = 3; d_matrix1[2913] = 5; d_matrix1[2914] = 4; d_matrix1[2915] = 2; d_matrix1[2916] = 1; d_matrix1[2917] = 2; d_matrix1[2918] = 2; d_matrix1[2919] = 3; d_matrix1[2920] = 4; d_matrix1[2921] = 3; d_matrix1[2922] = 2; d_matrix1[2923] = 5; d_matrix1[2924] = 4; d_matrix1[2925] = 5; d_matrix1[2926] = 5; d_matrix1[2927] = 4; d_matrix1[2928] = 4; d_matrix1[2929] = 5; d_matrix1[2930] = 3; d_matrix1[2931] = 5; d_matrix1[2932] = 4; d_matrix1[2933] = 4; d_matrix1[2934] = 3; d_matrix1[2935] = 3; d_matrix1[2936] = 5; d_matrix1[2937] = 4; d_matrix1[2938] = 5; d_matrix1[2939] = 4; d_matrix1[2940] = 5; d_matrix1[2941] = 5; d_matrix1[2942] = 4; d_matrix1[2943] = 3; d_matrix1[2944] = 2; d_matrix1[2945] = 5; d_matrix1[2946] = 4; d_matrix1[2947] = 4; d_matrix1[2948] = 3; d_matrix1[2949] = 4; d_matrix1[2950] = 3; d_matrix1[2951] = 3; d_matrix1[2952] = 3; d_matrix1[2953] = 4; d_matrix1[2954] = 3; d_matrix1[2955] = 1; d_matrix1[2956] = 4; d_matrix1[2957] = 4; d_matrix1[2958] = 4; d_matrix1[2959] = 1;
d_matrix1[2960] = 0; d_matrix1[2961] = 0; d_matrix1[2962] = 5; d_matrix1[2963] = 3; d_matrix1[2964] = 4; d_matrix1[2965] = 3; d_matrix1[2966] = 3; d_matrix1[2967] = 5; d_matrix1[2968] = 4; d_matrix1[2969] = 1; d_matrix1[2970] = 5; d_matrix1[2971] = 3; d_matrix1[2972] = 2; d_matrix1[2973] = 5; d_matrix1[2974] = 5; d_matrix1[2975] = 5; d_matrix1[2976] = 5; d_matrix1[2977] = 5; d_matrix1[2978] = 3; d_matrix1[2979] = 4; d_matrix1[2980] = 5; d_matrix1[2981] = 4; d_matrix1[2982] = 1; d_matrix1[2983] = 4; d_matrix1[2984] = 4; d_matrix1[2985] = 3; d_matrix1[2986] = 4; d_matrix1[2987] = 3; d_matrix1[2988] = 2; d_matrix1[2989] = 4; d_matrix1[2990] = 1; d_matrix1[2991] = 3; d_matrix1[2992] = 3; d_matrix1[2993] = 5; d_matrix1[2994] = 4; d_matrix1[2995] = 2; d_matrix1[2996] = 1; d_matrix1[2997] = 2; d_matrix1[2998] = 2; d_matrix1[2999] = 3; d_matrix1[3000] = 4; d_matrix1[3001] = 3; d_matrix1[3002] = 2; d_matrix1[3003] = 5; d_matrix1[3004] = 4; d_matrix1[3005] = 5; d_matrix1[3006] = 5; d_matrix1[3007] = 4; d_matrix1[3008] = 4; d_matrix1[3009] = 5; d_matrix1[3010] = 3; d_matrix1[3011] = 5; d_matrix1[3012] = 4; d_matrix1[3013] = 4; d_matrix1[3014] = 3; d_matrix1[3015] = 3; d_matrix1[3016] = 5; d_matrix1[3017] = 4; d_matrix1[3018] = 5; d_matrix1[3019] = 4; d_matrix1[3020] = 5; d_matrix1[3021] = 5; d_matrix1[3022] = 4; d_matrix1[3023] = 3; d_matrix1[3024] = 2; d_matrix1[3025] = 5; d_matrix1[3026] = 4; d_matrix1[3027] = 4; d_matrix1[3028] = 3; d_matrix1[3029] = 4; d_matrix1[3030] = 3; d_matrix1[3031] = 3; d_matrix1[3032] = 3; d_matrix1[3033] = 4; d_matrix1[3034] = 3; d_matrix1[3035] = 1; d_matrix1[3036] = 4; d_matrix1[3037] = 4; d_matrix1[3038] = 4; d_matrix1[3039] = 1;
d_matrix1[3040] = 0; d_matrix1[3041] = 0; d_matrix1[3042] = 5; d_matrix1[3043] = 3; d_matrix1[3044] = 4; d_matrix1[3045] = 3; d_matrix1[3046] = 3; d_matrix1[3047] = 5; d_matrix1[3048] = 4; d_matrix1[3049] = 1; d_matrix1[3050] = 5; d_matrix1[3051] = 3; d_matrix1[3052] = 2; d_matrix1[3053] = 5; d_matrix1[3054] = 5; d_matrix1[3055] = 5; d_matrix1[3056] = 5; d_matrix1[3057] = 5; d_matrix1[3058] = 3; d_matrix1[3059] = 4; d_matrix1[3060] = 5; d_matrix1[3061] = 4; d_matrix1[3062] = 1; d_matrix1[3063] = 4; d_matrix1[3064] = 4; d_matrix1[3065] = 3; d_matrix1[3066] = 4; d_matrix1[3067] = 3; d_matrix1[3068] = 2; d_matrix1[3069] = 4; d_matrix1[3070] = 1; d_matrix1[3071] = 3; d_matrix1[3072] = 3; d_matrix1[3073] = 5; d_matrix1[3074] = 4; d_matrix1[3075] = 2; d_matrix1[3076] = 1; d_matrix1[3077] = 2; d_matrix1[3078] = 2; d_matrix1[3079] = 3; d_matrix1[3080] = 4; d_matrix1[3081] = 3; d_matrix1[3082] = 2; d_matrix1[3083] = 5; d_matrix1[3084] = 4; d_matrix1[3085] = 5; d_matrix1[3086] = 5; d_matrix1[3087] = 4; d_matrix1[3088] = 4; d_matrix1[3089] = 5; d_matrix1[3090] = 3; d_matrix1[3091] = 5; d_matrix1[3092] = 4; d_matrix1[3093] = 4; d_matrix1[3094] = 3; d_matrix1[3095] = 3; d_matrix1[3096] = 5; d_matrix1[3097] = 4; d_matrix1[3098] = 5; d_matrix1[3099] = 4; d_matrix1[3100] = 5; d_matrix1[3101] = 5; d_matrix1[3102] = 4; d_matrix1[3103] = 3; d_matrix1[3104] = 2; d_matrix1[3105] = 5; d_matrix1[3106] = 4; d_matrix1[3107] = 4; d_matrix1[3108] = 3; d_matrix1[3109] = 4; d_matrix1[3110] = 3; d_matrix1[3111] = 3; d_matrix1[3112] = 3; d_matrix1[3113] = 4; d_matrix1[3114] = 3; d_matrix1[3115] = 1; d_matrix1[3116] = 4; d_matrix1[3117] = 4; d_matrix1[3118] = 4; d_matrix1[3119] = 1;
d_matrix1[3120] = 0; d_matrix1[3121] = 0; d_matrix1[3122] = 5; d_matrix1[3123] = 3; d_matrix1[3124] = 4; d_matrix1[3125] = 3; d_matrix1[3126] = 3; d_matrix1[3127] = 5; d_matrix1[3128] = 4; d_matrix1[3129] = 1; d_matrix1[3130] = 5; d_matrix1[3131] = 3; d_matrix1[3132] = 2; d_matrix1[3133] = 5; d_matrix1[3134] = 5; d_matrix1[3135] = 5; d_matrix1[3136] = 5; d_matrix1[3137] = 5; d_matrix1[3138] = 3; d_matrix1[3139] = 4; d_matrix1[3140] = 5; d_matrix1[3141] = 4; d_matrix1[3142] = 1; d_matrix1[3143] = 4; d_matrix1[3144] = 4; d_matrix1[3145] = 3; d_matrix1[3146] = 4; d_matrix1[3147] = 3; d_matrix1[3148] = 2; d_matrix1[3149] = 4; d_matrix1[3150] = 1; d_matrix1[3151] = 3; d_matrix1[3152] = 3; d_matrix1[3153] = 5; d_matrix1[3154] = 4; d_matrix1[3155] = 2; d_matrix1[3156] = 1; d_matrix1[3157] = 2; d_matrix1[3158] = 2; d_matrix1[3159] = 3; d_matrix1[3160] = 4; d_matrix1[3161] = 3; d_matrix1[3162] = 2; d_matrix1[3163] = 5; d_matrix1[3164] = 4; d_matrix1[3165] = 5; d_matrix1[3166] = 5; d_matrix1[3167] = 4; d_matrix1[3168] = 4; d_matrix1[3169] = 5; d_matrix1[3170] = 3; d_matrix1[3171] = 5; d_matrix1[3172] = 4; d_matrix1[3173] = 4; d_matrix1[3174] = 3; d_matrix1[3175] = 3; d_matrix1[3176] = 5; d_matrix1[3177] = 4; d_matrix1[3178] = 5; d_matrix1[3179] = 4; d_matrix1[3180] = 5; d_matrix1[3181] = 5; d_matrix1[3182] = 4; d_matrix1[3183] = 3; d_matrix1[3184] = 2; d_matrix1[3185] = 5; d_matrix1[3186] = 4; d_matrix1[3187] = 4; d_matrix1[3188] = 3; d_matrix1[3189] = 4; d_matrix1[3190] = 3; d_matrix1[3191] = 3; d_matrix1[3192] = 3; d_matrix1[3193] = 4; d_matrix1[3194] = 3; d_matrix1[3195] = 1; d_matrix1[3196] = 4; d_matrix1[3197] = 4; d_matrix1[3198] = 4; d_matrix1[3199] = 1;
d_matrix1[3200] = 0; d_matrix1[3201] = 0; d_matrix1[3202] = 5; d_matrix1[3203] = 3; d_matrix1[3204] = 4; d_matrix1[3205] = 3; d_matrix1[3206] = 3; d_matrix1[3207] = 5; d_matrix1[3208] = 4; d_matrix1[3209] = 1; d_matrix1[3210] = 5; d_matrix1[3211] = 3; d_matrix1[3212] = 2; d_matrix1[3213] = 5; d_matrix1[3214] = 5; d_matrix1[3215] = 5; d_matrix1[3216] = 5; d_matrix1[3217] = 5; d_matrix1[3218] = 3; d_matrix1[3219] = 4; d_matrix1[3220] = 5; d_matrix1[3221] = 4; d_matrix1[3222] = 1; d_matrix1[3223] = 4; d_matrix1[3224] = 4; d_matrix1[3225] = 3; d_matrix1[3226] = 4; d_matrix1[3227] = 3; d_matrix1[3228] = 2; d_matrix1[3229] = 4; d_matrix1[3230] = 1; d_matrix1[3231] = 3; d_matrix1[3232] = 3; d_matrix1[3233] = 5; d_matrix1[3234] = 4; d_matrix1[3235] = 2; d_matrix1[3236] = 1; d_matrix1[3237] = 2; d_matrix1[3238] = 2; d_matrix1[3239] = 3; d_matrix1[3240] = 4; d_matrix1[3241] = 3; d_matrix1[3242] = 2; d_matrix1[3243] = 5; d_matrix1[3244] = 4; d_matrix1[3245] = 5; d_matrix1[3246] = 5; d_matrix1[3247] = 4; d_matrix1[3248] = 4; d_matrix1[3249] = 5; d_matrix1[3250] = 3; d_matrix1[3251] = 5; d_matrix1[3252] = 4; d_matrix1[3253] = 4; d_matrix1[3254] = 3; d_matrix1[3255] = 3; d_matrix1[3256] = 5; d_matrix1[3257] = 4; d_matrix1[3258] = 5; d_matrix1[3259] = 4; d_matrix1[3260] = 5; d_matrix1[3261] = 5; d_matrix1[3262] = 4; d_matrix1[3263] = 3; d_matrix1[3264] = 2; d_matrix1[3265] = 5; d_matrix1[3266] = 4; d_matrix1[3267] = 4; d_matrix1[3268] = 3; d_matrix1[3269] = 4; d_matrix1[3270] = 3; d_matrix1[3271] = 3; d_matrix1[3272] = 3; d_matrix1[3273] = 4; d_matrix1[3274] = 3; d_matrix1[3275] = 1; d_matrix1[3276] = 4; d_matrix1[3277] = 4; d_matrix1[3278] = 4; d_matrix1[3279] = 1;
d_matrix1[3280] = 0; d_matrix1[3281] = 0; d_matrix1[3282] = 5; d_matrix1[3283] = 3; d_matrix1[3284] = 4; d_matrix1[3285] = 3; d_matrix1[3286] = 3; d_matrix1[3287] = 5; d_matrix1[3288] = 4; d_matrix1[3289] = 1; d_matrix1[3290] = 5; d_matrix1[3291] = 3; d_matrix1[3292] = 2; d_matrix1[3293] = 5; d_matrix1[3294] = 5; d_matrix1[3295] = 5; d_matrix1[3296] = 5; d_matrix1[3297] = 5; d_matrix1[3298] = 3; d_matrix1[3299] = 4; d_matrix1[3300] = 5; d_matrix1[3301] = 4; d_matrix1[3302] = 1; d_matrix1[3303] = 4; d_matrix1[3304] = 4; d_matrix1[3305] = 3; d_matrix1[3306] = 4; d_matrix1[3307] = 3; d_matrix1[3308] = 2; d_matrix1[3309] = 4; d_matrix1[3310] = 1; d_matrix1[3311] = 3; d_matrix1[3312] = 3; d_matrix1[3313] = 5; d_matrix1[3314] = 4; d_matrix1[3315] = 2; d_matrix1[3316] = 1; d_matrix1[3317] = 2; d_matrix1[3318] = 2; d_matrix1[3319] = 3; d_matrix1[3320] = 4; d_matrix1[3321] = 3; d_matrix1[3322] = 2; d_matrix1[3323] = 5; d_matrix1[3324] = 4; d_matrix1[3325] = 5; d_matrix1[3326] = 5; d_matrix1[3327] = 4; d_matrix1[3328] = 4; d_matrix1[3329] = 5; d_matrix1[3330] = 3; d_matrix1[3331] = 5; d_matrix1[3332] = 4; d_matrix1[3333] = 4; d_matrix1[3334] = 3; d_matrix1[3335] = 3; d_matrix1[3336] = 5; d_matrix1[3337] = 4; d_matrix1[3338] = 5; d_matrix1[3339] = 4; d_matrix1[3340] = 5; d_matrix1[3341] = 5; d_matrix1[3342] = 4; d_matrix1[3343] = 3; d_matrix1[3344] = 2; d_matrix1[3345] = 5; d_matrix1[3346] = 4; d_matrix1[3347] = 4; d_matrix1[3348] = 3; d_matrix1[3349] = 4; d_matrix1[3350] = 3; d_matrix1[3351] = 3; d_matrix1[3352] = 3; d_matrix1[3353] = 4; d_matrix1[3354] = 3; d_matrix1[3355] = 1; d_matrix1[3356] = 4; d_matrix1[3357] = 4; d_matrix1[3358] = 4; d_matrix1[3359] = 1;
d_matrix1[3360] = 0; d_matrix1[3361] = 0; d_matrix1[3362] = 5; d_matrix1[3363] = 3; d_matrix1[3364] = 4; d_matrix1[3365] = 3; d_matrix1[3366] = 3; d_matrix1[3367] = 5; d_matrix1[3368] = 4; d_matrix1[3369] = 1; d_matrix1[3370] = 5; d_matrix1[3371] = 3; d_matrix1[3372] = 2; d_matrix1[3373] = 5; d_matrix1[3374] = 5; d_matrix1[3375] = 5; d_matrix1[3376] = 5; d_matrix1[3377] = 5; d_matrix1[3378] = 3; d_matrix1[3379] = 4; d_matrix1[3380] = 5; d_matrix1[3381] = 4; d_matrix1[3382] = 1; d_matrix1[3383] = 4; d_matrix1[3384] = 4; d_matrix1[3385] = 3; d_matrix1[3386] = 4; d_matrix1[3387] = 3; d_matrix1[3388] = 2; d_matrix1[3389] = 4; d_matrix1[3390] = 1; d_matrix1[3391] = 3; d_matrix1[3392] = 3; d_matrix1[3393] = 5; d_matrix1[3394] = 4; d_matrix1[3395] = 2; d_matrix1[3396] = 1; d_matrix1[3397] = 2; d_matrix1[3398] = 2; d_matrix1[3399] = 3; d_matrix1[3400] = 4; d_matrix1[3401] = 3; d_matrix1[3402] = 2; d_matrix1[3403] = 5; d_matrix1[3404] = 4; d_matrix1[3405] = 5; d_matrix1[3406] = 5; d_matrix1[3407] = 4; d_matrix1[3408] = 4; d_matrix1[3409] = 5; d_matrix1[3410] = 3; d_matrix1[3411] = 5; d_matrix1[3412] = 4; d_matrix1[3413] = 4; d_matrix1[3414] = 3; d_matrix1[3415] = 3; d_matrix1[3416] = 5; d_matrix1[3417] = 4; d_matrix1[3418] = 5; d_matrix1[3419] = 4; d_matrix1[3420] = 5; d_matrix1[3421] = 5; d_matrix1[3422] = 4; d_matrix1[3423] = 3; d_matrix1[3424] = 2; d_matrix1[3425] = 5; d_matrix1[3426] = 4; d_matrix1[3427] = 4; d_matrix1[3428] = 3; d_matrix1[3429] = 4; d_matrix1[3430] = 3; d_matrix1[3431] = 3; d_matrix1[3432] = 3; d_matrix1[3433] = 4; d_matrix1[3434] = 3; d_matrix1[3435] = 1; d_matrix1[3436] = 4; d_matrix1[3437] = 4; d_matrix1[3438] = 4; d_matrix1[3439] = 1;
d_matrix1[3440] = 0; d_matrix1[3441] = 0; d_matrix1[3442] = 5; d_matrix1[3443] = 3; d_matrix1[3444] = 4; d_matrix1[3445] = 3; d_matrix1[3446] = 3; d_matrix1[3447] = 5; d_matrix1[3448] = 4; d_matrix1[3449] = 1; d_matrix1[3450] = 5; d_matrix1[3451] = 3; d_matrix1[3452] = 2; d_matrix1[3453] = 5; d_matrix1[3454] = 5; d_matrix1[3455] = 5; d_matrix1[3456] = 5; d_matrix1[3457] = 5; d_matrix1[3458] = 3; d_matrix1[3459] = 4; d_matrix1[3460] = 5; d_matrix1[3461] = 4; d_matrix1[3462] = 1; d_matrix1[3463] = 4; d_matrix1[3464] = 4; d_matrix1[3465] = 3; d_matrix1[3466] = 4; d_matrix1[3467] = 3; d_matrix1[3468] = 2; d_matrix1[3469] = 4; d_matrix1[3470] = 1; d_matrix1[3471] = 3; d_matrix1[3472] = 3; d_matrix1[3473] = 5; d_matrix1[3474] = 4; d_matrix1[3475] = 2; d_matrix1[3476] = 1; d_matrix1[3477] = 2; d_matrix1[3478] = 2; d_matrix1[3479] = 3; d_matrix1[3480] = 4; d_matrix1[3481] = 3; d_matrix1[3482] = 2; d_matrix1[3483] = 5; d_matrix1[3484] = 4; d_matrix1[3485] = 5; d_matrix1[3486] = 5; d_matrix1[3487] = 4; d_matrix1[3488] = 4; d_matrix1[3489] = 5; d_matrix1[3490] = 3; d_matrix1[3491] = 5; d_matrix1[3492] = 4; d_matrix1[3493] = 4; d_matrix1[3494] = 3; d_matrix1[3495] = 3; d_matrix1[3496] = 5; d_matrix1[3497] = 4; d_matrix1[3498] = 5; d_matrix1[3499] = 4; d_matrix1[3500] = 5; d_matrix1[3501] = 5; d_matrix1[3502] = 4; d_matrix1[3503] = 3; d_matrix1[3504] = 2; d_matrix1[3505] = 5; d_matrix1[3506] = 4; d_matrix1[3507] = 4; d_matrix1[3508] = 3; d_matrix1[3509] = 4; d_matrix1[3510] = 3; d_matrix1[3511] = 3; d_matrix1[3512] = 3; d_matrix1[3513] = 4; d_matrix1[3514] = 3; d_matrix1[3515] = 1; d_matrix1[3516] = 4; d_matrix1[3517] = 4; d_matrix1[3518] = 4; d_matrix1[3519] = 1;
d_matrix1[3520] = 0; d_matrix1[3521] = 0; d_matrix1[3522] = 5; d_matrix1[3523] = 3; d_matrix1[3524] = 4; d_matrix1[3525] = 3; d_matrix1[3526] = 3; d_matrix1[3527] = 5; d_matrix1[3528] = 4; d_matrix1[3529] = 1; d_matrix1[3530] = 5; d_matrix1[3531] = 3; d_matrix1[3532] = 2; d_matrix1[3533] = 5; d_matrix1[3534] = 5; d_matrix1[3535] = 5; d_matrix1[3536] = 5; d_matrix1[3537] = 5; d_matrix1[3538] = 3; d_matrix1[3539] = 4; d_matrix1[3540] = 5; d_matrix1[3541] = 4; d_matrix1[3542] = 1; d_matrix1[3543] = 4; d_matrix1[3544] = 4; d_matrix1[3545] = 3; d_matrix1[3546] = 4; d_matrix1[3547] = 3; d_matrix1[3548] = 2; d_matrix1[3549] = 4; d_matrix1[3550] = 1; d_matrix1[3551] = 3; d_matrix1[3552] = 3; d_matrix1[3553] = 5; d_matrix1[3554] = 4; d_matrix1[3555] = 2; d_matrix1[3556] = 1; d_matrix1[3557] = 2; d_matrix1[3558] = 2; d_matrix1[3559] = 3; d_matrix1[3560] = 4; d_matrix1[3561] = 3; d_matrix1[3562] = 2; d_matrix1[3563] = 5; d_matrix1[3564] = 4; d_matrix1[3565] = 5; d_matrix1[3566] = 5; d_matrix1[3567] = 4; d_matrix1[3568] = 4; d_matrix1[3569] = 5; d_matrix1[3570] = 3; d_matrix1[3571] = 5; d_matrix1[3572] = 4; d_matrix1[3573] = 4; d_matrix1[3574] = 3; d_matrix1[3575] = 3; d_matrix1[3576] = 5; d_matrix1[3577] = 4; d_matrix1[3578] = 5; d_matrix1[3579] = 4; d_matrix1[3580] = 5; d_matrix1[3581] = 5; d_matrix1[3582] = 4; d_matrix1[3583] = 3; d_matrix1[3584] = 2; d_matrix1[3585] = 5; d_matrix1[3586] = 4; d_matrix1[3587] = 4; d_matrix1[3588] = 3; d_matrix1[3589] = 4; d_matrix1[3590] = 3; d_matrix1[3591] = 3; d_matrix1[3592] = 3; d_matrix1[3593] = 4; d_matrix1[3594] = 3; d_matrix1[3595] = 1; d_matrix1[3596] = 4; d_matrix1[3597] = 4; d_matrix1[3598] = 4; d_matrix1[3599] = 1;
d_matrix1[3600] = 0; d_matrix1[3601] = 0; d_matrix1[3602] = 5; d_matrix1[3603] = 3; d_matrix1[3604] = 4; d_matrix1[3605] = 3; d_matrix1[3606] = 3; d_matrix1[3607] = 5; d_matrix1[3608] = 4; d_matrix1[3609] = 1; d_matrix1[3610] = 5; d_matrix1[3611] = 3; d_matrix1[3612] = 2; d_matrix1[3613] = 5; d_matrix1[3614] = 5; d_matrix1[3615] = 5; d_matrix1[3616] = 5; d_matrix1[3617] = 5; d_matrix1[3618] = 3; d_matrix1[3619] = 4; d_matrix1[3620] = 5; d_matrix1[3621] = 4; d_matrix1[3622] = 1; d_matrix1[3623] = 4; d_matrix1[3624] = 4; d_matrix1[3625] = 3; d_matrix1[3626] = 4; d_matrix1[3627] = 3; d_matrix1[3628] = 2; d_matrix1[3629] = 4; d_matrix1[3630] = 1; d_matrix1[3631] = 3; d_matrix1[3632] = 3; d_matrix1[3633] = 5; d_matrix1[3634] = 4; d_matrix1[3635] = 2; d_matrix1[3636] = 1; d_matrix1[3637] = 2; d_matrix1[3638] = 2; d_matrix1[3639] = 3; d_matrix1[3640] = 4; d_matrix1[3641] = 3; d_matrix1[3642] = 2; d_matrix1[3643] = 5; d_matrix1[3644] = 4; d_matrix1[3645] = 5; d_matrix1[3646] = 5; d_matrix1[3647] = 4; d_matrix1[3648] = 4; d_matrix1[3649] = 5; d_matrix1[3650] = 3; d_matrix1[3651] = 5; d_matrix1[3652] = 4; d_matrix1[3653] = 4; d_matrix1[3654] = 3; d_matrix1[3655] = 3; d_matrix1[3656] = 5; d_matrix1[3657] = 4; d_matrix1[3658] = 5; d_matrix1[3659] = 4; d_matrix1[3660] = 5; d_matrix1[3661] = 5; d_matrix1[3662] = 4; d_matrix1[3663] = 3; d_matrix1[3664] = 2; d_matrix1[3665] = 5; d_matrix1[3666] = 4; d_matrix1[3667] = 4; d_matrix1[3668] = 3; d_matrix1[3669] = 4; d_matrix1[3670] = 3; d_matrix1[3671] = 3; d_matrix1[3672] = 3; d_matrix1[3673] = 4; d_matrix1[3674] = 3; d_matrix1[3675] = 1; d_matrix1[3676] = 4; d_matrix1[3677] = 4; d_matrix1[3678] = 4; d_matrix1[3679] = 1;
d_matrix1[3680] = 0; d_matrix1[3681] = 0; d_matrix1[3682] = 5; d_matrix1[3683] = 3; d_matrix1[3684] = 4; d_matrix1[3685] = 3; d_matrix1[3686] = 3; d_matrix1[3687] = 5; d_matrix1[3688] = 4; d_matrix1[3689] = 1; d_matrix1[3690] = 5; d_matrix1[3691] = 3; d_matrix1[3692] = 2; d_matrix1[3693] = 5; d_matrix1[3694] = 5; d_matrix1[3695] = 5; d_matrix1[3696] = 5; d_matrix1[3697] = 5; d_matrix1[3698] = 3; d_matrix1[3699] = 4; d_matrix1[3700] = 5; d_matrix1[3701] = 4; d_matrix1[3702] = 1; d_matrix1[3703] = 4; d_matrix1[3704] = 4; d_matrix1[3705] = 3; d_matrix1[3706] = 4; d_matrix1[3707] = 3; d_matrix1[3708] = 2; d_matrix1[3709] = 4; d_matrix1[3710] = 1; d_matrix1[3711] = 3; d_matrix1[3712] = 3; d_matrix1[3713] = 5; d_matrix1[3714] = 4; d_matrix1[3715] = 2; d_matrix1[3716] = 1; d_matrix1[3717] = 2; d_matrix1[3718] = 2; d_matrix1[3719] = 3; d_matrix1[3720] = 4; d_matrix1[3721] = 3; d_matrix1[3722] = 2; d_matrix1[3723] = 5; d_matrix1[3724] = 4; d_matrix1[3725] = 5; d_matrix1[3726] = 5; d_matrix1[3727] = 4; d_matrix1[3728] = 4; d_matrix1[3729] = 5; d_matrix1[3730] = 3; d_matrix1[3731] = 5; d_matrix1[3732] = 4; d_matrix1[3733] = 4; d_matrix1[3734] = 3; d_matrix1[3735] = 3; d_matrix1[3736] = 5; d_matrix1[3737] = 4; d_matrix1[3738] = 5; d_matrix1[3739] = 4; d_matrix1[3740] = 5; d_matrix1[3741] = 5; d_matrix1[3742] = 4; d_matrix1[3743] = 3; d_matrix1[3744] = 2; d_matrix1[3745] = 5; d_matrix1[3746] = 4; d_matrix1[3747] = 4; d_matrix1[3748] = 3; d_matrix1[3749] = 4; d_matrix1[3750] = 3; d_matrix1[3751] = 3; d_matrix1[3752] = 3; d_matrix1[3753] = 4; d_matrix1[3754] = 3; d_matrix1[3755] = 1; d_matrix1[3756] = 4; d_matrix1[3757] = 4; d_matrix1[3758] = 4; d_matrix1[3759] = 1;
d_matrix1[3760] = 0; d_matrix1[3761] = 0; d_matrix1[3762] = 5; d_matrix1[3763] = 3; d_matrix1[3764] = 4; d_matrix1[3765] = 3; d_matrix1[3766] = 3; d_matrix1[3767] = 5; d_matrix1[3768] = 4; d_matrix1[3769] = 1; d_matrix1[3770] = 5; d_matrix1[3771] = 3; d_matrix1[3772] = 2; d_matrix1[3773] = 5; d_matrix1[3774] = 5; d_matrix1[3775] = 5; d_matrix1[3776] = 5; d_matrix1[3777] = 5; d_matrix1[3778] = 3; d_matrix1[3779] = 4; d_matrix1[3780] = 5; d_matrix1[3781] = 4; d_matrix1[3782] = 1; d_matrix1[3783] = 4; d_matrix1[3784] = 4; d_matrix1[3785] = 3; d_matrix1[3786] = 4; d_matrix1[3787] = 3; d_matrix1[3788] = 2; d_matrix1[3789] = 4; d_matrix1[3790] = 1; d_matrix1[3791] = 3; d_matrix1[3792] = 3; d_matrix1[3793] = 5; d_matrix1[3794] = 4; d_matrix1[3795] = 2; d_matrix1[3796] = 1; d_matrix1[3797] = 2; d_matrix1[3798] = 2; d_matrix1[3799] = 3; d_matrix1[3800] = 4; d_matrix1[3801] = 3; d_matrix1[3802] = 2; d_matrix1[3803] = 5; d_matrix1[3804] = 4; d_matrix1[3805] = 5; d_matrix1[3806] = 5; d_matrix1[3807] = 4; d_matrix1[3808] = 4; d_matrix1[3809] = 5; d_matrix1[3810] = 3; d_matrix1[3811] = 5; d_matrix1[3812] = 4; d_matrix1[3813] = 4; d_matrix1[3814] = 3; d_matrix1[3815] = 3; d_matrix1[3816] = 5; d_matrix1[3817] = 4; d_matrix1[3818] = 5; d_matrix1[3819] = 4; d_matrix1[3820] = 5; d_matrix1[3821] = 5; d_matrix1[3822] = 4; d_matrix1[3823] = 3; d_matrix1[3824] = 2; d_matrix1[3825] = 5; d_matrix1[3826] = 4; d_matrix1[3827] = 4; d_matrix1[3828] = 3; d_matrix1[3829] = 4; d_matrix1[3830] = 3; d_matrix1[3831] = 3; d_matrix1[3832] = 3; d_matrix1[3833] = 4; d_matrix1[3834] = 3; d_matrix1[3835] = 1; d_matrix1[3836] = 4; d_matrix1[3837] = 4; d_matrix1[3838] = 4; d_matrix1[3839] = 1;
d_matrix1[3840] = 0; d_matrix1[3841] = 0; d_matrix1[3842] = 5; d_matrix1[3843] = 3; d_matrix1[3844] = 4; d_matrix1[3845] = 3; d_matrix1[3846] = 3; d_matrix1[3847] = 5; d_matrix1[3848] = 4; d_matrix1[3849] = 1; d_matrix1[3850] = 5; d_matrix1[3851] = 3; d_matrix1[3852] = 2; d_matrix1[3853] = 5; d_matrix1[3854] = 5; d_matrix1[3855] = 5; d_matrix1[3856] = 5; d_matrix1[3857] = 5; d_matrix1[3858] = 3; d_matrix1[3859] = 4; d_matrix1[3860] = 5; d_matrix1[3861] = 4; d_matrix1[3862] = 1; d_matrix1[3863] = 4; d_matrix1[3864] = 4; d_matrix1[3865] = 3; d_matrix1[3866] = 4; d_matrix1[3867] = 3; d_matrix1[3868] = 2; d_matrix1[3869] = 4; d_matrix1[3870] = 1; d_matrix1[3871] = 3; d_matrix1[3872] = 3; d_matrix1[3873] = 5; d_matrix1[3874] = 4; d_matrix1[3875] = 2; d_matrix1[3876] = 1; d_matrix1[3877] = 2; d_matrix1[3878] = 2; d_matrix1[3879] = 3; d_matrix1[3880] = 4; d_matrix1[3881] = 3; d_matrix1[3882] = 2; d_matrix1[3883] = 5; d_matrix1[3884] = 4; d_matrix1[3885] = 5; d_matrix1[3886] = 5; d_matrix1[3887] = 4; d_matrix1[3888] = 4; d_matrix1[3889] = 5; d_matrix1[3890] = 3; d_matrix1[3891] = 5; d_matrix1[3892] = 4; d_matrix1[3893] = 4; d_matrix1[3894] = 3; d_matrix1[3895] = 3; d_matrix1[3896] = 5; d_matrix1[3897] = 4; d_matrix1[3898] = 5; d_matrix1[3899] = 4; d_matrix1[3900] = 5; d_matrix1[3901] = 5; d_matrix1[3902] = 4; d_matrix1[3903] = 3; d_matrix1[3904] = 2; d_matrix1[3905] = 5; d_matrix1[3906] = 4; d_matrix1[3907] = 4; d_matrix1[3908] = 3; d_matrix1[3909] = 4; d_matrix1[3910] = 3; d_matrix1[3911] = 3; d_matrix1[3912] = 3; d_matrix1[3913] = 4; d_matrix1[3914] = 3; d_matrix1[3915] = 1; d_matrix1[3916] = 4; d_matrix1[3917] = 4; d_matrix1[3918] = 4; d_matrix1[3919] = 1;
d_matrix1[3920] = 0; d_matrix1[3921] = 0; d_matrix1[3922] = 5; d_matrix1[3923] = 3; d_matrix1[3924] = 4; d_matrix1[3925] = 3; d_matrix1[3926] = 3; d_matrix1[3927] = 5; d_matrix1[3928] = 4; d_matrix1[3929] = 1; d_matrix1[3930] = 5; d_matrix1[3931] = 3; d_matrix1[3932] = 2; d_matrix1[3933] = 5; d_matrix1[3934] = 5; d_matrix1[3935] = 5; d_matrix1[3936] = 5; d_matrix1[3937] = 5; d_matrix1[3938] = 3; d_matrix1[3939] = 4; d_matrix1[3940] = 5; d_matrix1[3941] = 4; d_matrix1[3942] = 1; d_matrix1[3943] = 4; d_matrix1[3944] = 4; d_matrix1[3945] = 3; d_matrix1[3946] = 4; d_matrix1[3947] = 3; d_matrix1[3948] = 2; d_matrix1[3949] = 4; d_matrix1[3950] = 1; d_matrix1[3951] = 3; d_matrix1[3952] = 3; d_matrix1[3953] = 5; d_matrix1[3954] = 4; d_matrix1[3955] = 2; d_matrix1[3956] = 1; d_matrix1[3957] = 2; d_matrix1[3958] = 2; d_matrix1[3959] = 3; d_matrix1[3960] = 4; d_matrix1[3961] = 3; d_matrix1[3962] = 2; d_matrix1[3963] = 5; d_matrix1[3964] = 4; d_matrix1[3965] = 5; d_matrix1[3966] = 5; d_matrix1[3967] = 4; d_matrix1[3968] = 4; d_matrix1[3969] = 5; d_matrix1[3970] = 3; d_matrix1[3971] = 5; d_matrix1[3972] = 4; d_matrix1[3973] = 4; d_matrix1[3974] = 3; d_matrix1[3975] = 3; d_matrix1[3976] = 5; d_matrix1[3977] = 4; d_matrix1[3978] = 5; d_matrix1[3979] = 4; d_matrix1[3980] = 5; d_matrix1[3981] = 5; d_matrix1[3982] = 4; d_matrix1[3983] = 3; d_matrix1[3984] = 2; d_matrix1[3985] = 5; d_matrix1[3986] = 4; d_matrix1[3987] = 4; d_matrix1[3988] = 3; d_matrix1[3989] = 4; d_matrix1[3990] = 3; d_matrix1[3991] = 3; d_matrix1[3992] = 3; d_matrix1[3993] = 4; d_matrix1[3994] = 3; d_matrix1[3995] = 1; d_matrix1[3996] = 4; d_matrix1[3997] = 4; d_matrix1[3998] = 4; d_matrix1[3999] = 1;
d_matrix1[4000] = 0; d_matrix1[4001] = 0; d_matrix1[4002] = 5; d_matrix1[4003] = 3; d_matrix1[4004] = 4; d_matrix1[4005] = 3; d_matrix1[4006] = 3; d_matrix1[4007] = 5; d_matrix1[4008] = 4; d_matrix1[4009] = 1; d_matrix1[4010] = 5; d_matrix1[4011] = 3; d_matrix1[4012] = 2; d_matrix1[4013] = 5; d_matrix1[4014] = 5; d_matrix1[4015] = 5; d_matrix1[4016] = 5; d_matrix1[4017] = 5; d_matrix1[4018] = 3; d_matrix1[4019] = 4; d_matrix1[4020] = 5; d_matrix1[4021] = 4; d_matrix1[4022] = 1; d_matrix1[4023] = 4; d_matrix1[4024] = 4; d_matrix1[4025] = 3; d_matrix1[4026] = 4; d_matrix1[4027] = 3; d_matrix1[4028] = 2; d_matrix1[4029] = 4; d_matrix1[4030] = 1; d_matrix1[4031] = 3; d_matrix1[4032] = 3; d_matrix1[4033] = 5; d_matrix1[4034] = 4; d_matrix1[4035] = 2; d_matrix1[4036] = 1; d_matrix1[4037] = 2; d_matrix1[4038] = 2; d_matrix1[4039] = 3; d_matrix1[4040] = 4; d_matrix1[4041] = 3; d_matrix1[4042] = 2; d_matrix1[4043] = 5; d_matrix1[4044] = 4; d_matrix1[4045] = 5; d_matrix1[4046] = 5; d_matrix1[4047] = 4; d_matrix1[4048] = 4; d_matrix1[4049] = 5; d_matrix1[4050] = 3; d_matrix1[4051] = 5; d_matrix1[4052] = 4; d_matrix1[4053] = 4; d_matrix1[4054] = 3; d_matrix1[4055] = 3; d_matrix1[4056] = 5; d_matrix1[4057] = 4; d_matrix1[4058] = 5; d_matrix1[4059] = 4; d_matrix1[4060] = 5; d_matrix1[4061] = 5; d_matrix1[4062] = 4; d_matrix1[4063] = 3; d_matrix1[4064] = 2; d_matrix1[4065] = 5; d_matrix1[4066] = 4; d_matrix1[4067] = 4; d_matrix1[4068] = 3; d_matrix1[4069] = 4; d_matrix1[4070] = 3; d_matrix1[4071] = 3; d_matrix1[4072] = 3; d_matrix1[4073] = 4; d_matrix1[4074] = 3; d_matrix1[4075] = 1; d_matrix1[4076] = 4; d_matrix1[4077] = 4; d_matrix1[4078] = 4; d_matrix1[4079] = 1;
d_matrix1[4080] = 0; d_matrix1[4081] = 0; d_matrix1[4082] = 5; d_matrix1[4083] = 3; d_matrix1[4084] = 4; d_matrix1[4085] = 3; d_matrix1[4086] = 3; d_matrix1[4087] = 5; d_matrix1[4088] = 4; d_matrix1[4089] = 1; d_matrix1[4090] = 5; d_matrix1[4091] = 3; d_matrix1[4092] = 2; d_matrix1[4093] = 5; d_matrix1[4094] = 5; d_matrix1[4095] = 5; d_matrix1[4096] = 5; d_matrix1[4097] = 5; d_matrix1[4098] = 3; d_matrix1[4099] = 4; d_matrix1[4100] = 5; d_matrix1[4101] = 4; d_matrix1[4102] = 1; d_matrix1[4103] = 4; d_matrix1[4104] = 4; d_matrix1[4105] = 3; d_matrix1[4106] = 4; d_matrix1[4107] = 3; d_matrix1[4108] = 2; d_matrix1[4109] = 4; d_matrix1[4110] = 1; d_matrix1[4111] = 3; d_matrix1[4112] = 3; d_matrix1[4113] = 5; d_matrix1[4114] = 4; d_matrix1[4115] = 2; d_matrix1[4116] = 1; d_matrix1[4117] = 2; d_matrix1[4118] = 2; d_matrix1[4119] = 3; d_matrix1[4120] = 4; d_matrix1[4121] = 3; d_matrix1[4122] = 2; d_matrix1[4123] = 5; d_matrix1[4124] = 4; d_matrix1[4125] = 5; d_matrix1[4126] = 5; d_matrix1[4127] = 4; d_matrix1[4128] = 4; d_matrix1[4129] = 5; d_matrix1[4130] = 3; d_matrix1[4131] = 5; d_matrix1[4132] = 4; d_matrix1[4133] = 4; d_matrix1[4134] = 3; d_matrix1[4135] = 3; d_matrix1[4136] = 5; d_matrix1[4137] = 4; d_matrix1[4138] = 5; d_matrix1[4139] = 4; d_matrix1[4140] = 5; d_matrix1[4141] = 5; d_matrix1[4142] = 4; d_matrix1[4143] = 3; d_matrix1[4144] = 2; d_matrix1[4145] = 5; d_matrix1[4146] = 4; d_matrix1[4147] = 4; d_matrix1[4148] = 3; d_matrix1[4149] = 4; d_matrix1[4150] = 3; d_matrix1[4151] = 3; d_matrix1[4152] = 3; d_matrix1[4153] = 4; d_matrix1[4154] = 3; d_matrix1[4155] = 1; d_matrix1[4156] = 4; d_matrix1[4157] = 4; d_matrix1[4158] = 4; d_matrix1[4159] = 1;
d_matrix1[4160] = 0; d_matrix1[4161] = 0; d_matrix1[4162] = 5; d_matrix1[4163] = 3; d_matrix1[4164] = 4; d_matrix1[4165] = 3; d_matrix1[4166] = 3; d_matrix1[4167] = 5; d_matrix1[4168] = 4; d_matrix1[4169] = 1; d_matrix1[4170] = 5; d_matrix1[4171] = 3; d_matrix1[4172] = 2; d_matrix1[4173] = 5; d_matrix1[4174] = 5; d_matrix1[4175] = 5; d_matrix1[4176] = 5; d_matrix1[4177] = 5; d_matrix1[4178] = 3; d_matrix1[4179] = 4; d_matrix1[4180] = 5; d_matrix1[4181] = 4; d_matrix1[4182] = 1; d_matrix1[4183] = 4; d_matrix1[4184] = 4; d_matrix1[4185] = 3; d_matrix1[4186] = 4; d_matrix1[4187] = 3; d_matrix1[4188] = 2; d_matrix1[4189] = 4; d_matrix1[4190] = 1; d_matrix1[4191] = 3; d_matrix1[4192] = 3; d_matrix1[4193] = 5; d_matrix1[4194] = 4; d_matrix1[4195] = 2; d_matrix1[4196] = 1; d_matrix1[4197] = 2; d_matrix1[4198] = 2; d_matrix1[4199] = 3; d_matrix1[4200] = 4; d_matrix1[4201] = 3; d_matrix1[4202] = 2; d_matrix1[4203] = 5; d_matrix1[4204] = 4; d_matrix1[4205] = 5; d_matrix1[4206] = 5; d_matrix1[4207] = 4; d_matrix1[4208] = 4; d_matrix1[4209] = 5; d_matrix1[4210] = 3; d_matrix1[4211] = 5; d_matrix1[4212] = 4; d_matrix1[4213] = 4; d_matrix1[4214] = 3; d_matrix1[4215] = 3; d_matrix1[4216] = 5; d_matrix1[4217] = 4; d_matrix1[4218] = 5; d_matrix1[4219] = 4; d_matrix1[4220] = 5; d_matrix1[4221] = 5; d_matrix1[4222] = 4; d_matrix1[4223] = 3; d_matrix1[4224] = 2; d_matrix1[4225] = 5; d_matrix1[4226] = 4; d_matrix1[4227] = 4; d_matrix1[4228] = 3; d_matrix1[4229] = 4; d_matrix1[4230] = 3; d_matrix1[4231] = 3; d_matrix1[4232] = 3; d_matrix1[4233] = 4; d_matrix1[4234] = 3; d_matrix1[4235] = 1; d_matrix1[4236] = 4; d_matrix1[4237] = 4; d_matrix1[4238] = 4; d_matrix1[4239] = 1;
d_matrix1[4240] = 0; d_matrix1[4241] = 0; d_matrix1[4242] = 5; d_matrix1[4243] = 3; d_matrix1[4244] = 4; d_matrix1[4245] = 3; d_matrix1[4246] = 3; d_matrix1[4247] = 5; d_matrix1[4248] = 4; d_matrix1[4249] = 1; d_matrix1[4250] = 5; d_matrix1[4251] = 3; d_matrix1[4252] = 2; d_matrix1[4253] = 5; d_matrix1[4254] = 5; d_matrix1[4255] = 5; d_matrix1[4256] = 5; d_matrix1[4257] = 5; d_matrix1[4258] = 3; d_matrix1[4259] = 4; d_matrix1[4260] = 5; d_matrix1[4261] = 4; d_matrix1[4262] = 1; d_matrix1[4263] = 4; d_matrix1[4264] = 4; d_matrix1[4265] = 3; d_matrix1[4266] = 4; d_matrix1[4267] = 3; d_matrix1[4268] = 2; d_matrix1[4269] = 4; d_matrix1[4270] = 1; d_matrix1[4271] = 3; d_matrix1[4272] = 3; d_matrix1[4273] = 5; d_matrix1[4274] = 4; d_matrix1[4275] = 2; d_matrix1[4276] = 1; d_matrix1[4277] = 2; d_matrix1[4278] = 2; d_matrix1[4279] = 3; d_matrix1[4280] = 4; d_matrix1[4281] = 3; d_matrix1[4282] = 2; d_matrix1[4283] = 5; d_matrix1[4284] = 4; d_matrix1[4285] = 5; d_matrix1[4286] = 5; d_matrix1[4287] = 4; d_matrix1[4288] = 4; d_matrix1[4289] = 5; d_matrix1[4290] = 3; d_matrix1[4291] = 5; d_matrix1[4292] = 4; d_matrix1[4293] = 4; d_matrix1[4294] = 3; d_matrix1[4295] = 3; d_matrix1[4296] = 5; d_matrix1[4297] = 4; d_matrix1[4298] = 5; d_matrix1[4299] = 4; d_matrix1[4300] = 5; d_matrix1[4301] = 5; d_matrix1[4302] = 4; d_matrix1[4303] = 3; d_matrix1[4304] = 2; d_matrix1[4305] = 5; d_matrix1[4306] = 4; d_matrix1[4307] = 4; d_matrix1[4308] = 3; d_matrix1[4309] = 4; d_matrix1[4310] = 3; d_matrix1[4311] = 3; d_matrix1[4312] = 3; d_matrix1[4313] = 4; d_matrix1[4314] = 3; d_matrix1[4315] = 1; d_matrix1[4316] = 4; d_matrix1[4317] = 4; d_matrix1[4318] = 4; d_matrix1[4319] = 1;
d_matrix1[4320] = 0; d_matrix1[4321] = 0; d_matrix1[4322] = 5; d_matrix1[4323] = 3; d_matrix1[4324] = 4; d_matrix1[4325] = 3; d_matrix1[4326] = 3; d_matrix1[4327] = 5; d_matrix1[4328] = 4; d_matrix1[4329] = 1; d_matrix1[4330] = 5; d_matrix1[4331] = 3; d_matrix1[4332] = 2; d_matrix1[4333] = 5; d_matrix1[4334] = 5; d_matrix1[4335] = 5; d_matrix1[4336] = 5; d_matrix1[4337] = 5; d_matrix1[4338] = 3; d_matrix1[4339] = 4; d_matrix1[4340] = 5; d_matrix1[4341] = 4; d_matrix1[4342] = 1; d_matrix1[4343] = 4; d_matrix1[4344] = 4; d_matrix1[4345] = 3; d_matrix1[4346] = 4; d_matrix1[4347] = 3; d_matrix1[4348] = 2; d_matrix1[4349] = 4; d_matrix1[4350] = 1; d_matrix1[4351] = 3; d_matrix1[4352] = 3; d_matrix1[4353] = 5; d_matrix1[4354] = 4; d_matrix1[4355] = 2; d_matrix1[4356] = 1; d_matrix1[4357] = 2; d_matrix1[4358] = 2; d_matrix1[4359] = 3; d_matrix1[4360] = 4; d_matrix1[4361] = 3; d_matrix1[4362] = 2; d_matrix1[4363] = 5; d_matrix1[4364] = 4; d_matrix1[4365] = 5; d_matrix1[4366] = 5; d_matrix1[4367] = 4; d_matrix1[4368] = 4; d_matrix1[4369] = 5; d_matrix1[4370] = 3; d_matrix1[4371] = 5; d_matrix1[4372] = 4; d_matrix1[4373] = 4; d_matrix1[4374] = 3; d_matrix1[4375] = 3; d_matrix1[4376] = 5; d_matrix1[4377] = 4; d_matrix1[4378] = 5; d_matrix1[4379] = 4; d_matrix1[4380] = 5; d_matrix1[4381] = 5; d_matrix1[4382] = 4; d_matrix1[4383] = 3; d_matrix1[4384] = 2; d_matrix1[4385] = 5; d_matrix1[4386] = 4; d_matrix1[4387] = 4; d_matrix1[4388] = 3; d_matrix1[4389] = 4; d_matrix1[4390] = 3; d_matrix1[4391] = 3; d_matrix1[4392] = 3; d_matrix1[4393] = 4; d_matrix1[4394] = 3; d_matrix1[4395] = 1; d_matrix1[4396] = 4; d_matrix1[4397] = 4; d_matrix1[4398] = 4; d_matrix1[4399] = 1;
d_matrix1[4400] = 0; d_matrix1[4401] = 0; d_matrix1[4402] = 5; d_matrix1[4403] = 3; d_matrix1[4404] = 4; d_matrix1[4405] = 3; d_matrix1[4406] = 3; d_matrix1[4407] = 5; d_matrix1[4408] = 4; d_matrix1[4409] = 1; d_matrix1[4410] = 5; d_matrix1[4411] = 3; d_matrix1[4412] = 2; d_matrix1[4413] = 5; d_matrix1[4414] = 5; d_matrix1[4415] = 5; d_matrix1[4416] = 5; d_matrix1[4417] = 5; d_matrix1[4418] = 3; d_matrix1[4419] = 4; d_matrix1[4420] = 5; d_matrix1[4421] = 4; d_matrix1[4422] = 1; d_matrix1[4423] = 4; d_matrix1[4424] = 4; d_matrix1[4425] = 3; d_matrix1[4426] = 4; d_matrix1[4427] = 3; d_matrix1[4428] = 2; d_matrix1[4429] = 4; d_matrix1[4430] = 1; d_matrix1[4431] = 3; d_matrix1[4432] = 3; d_matrix1[4433] = 5; d_matrix1[4434] = 4; d_matrix1[4435] = 2; d_matrix1[4436] = 1; d_matrix1[4437] = 2; d_matrix1[4438] = 2; d_matrix1[4439] = 3; d_matrix1[4440] = 4; d_matrix1[4441] = 3; d_matrix1[4442] = 2; d_matrix1[4443] = 5; d_matrix1[4444] = 4; d_matrix1[4445] = 5; d_matrix1[4446] = 5; d_matrix1[4447] = 4; d_matrix1[4448] = 4; d_matrix1[4449] = 5; d_matrix1[4450] = 3; d_matrix1[4451] = 5; d_matrix1[4452] = 4; d_matrix1[4453] = 4; d_matrix1[4454] = 3; d_matrix1[4455] = 3; d_matrix1[4456] = 5; d_matrix1[4457] = 4; d_matrix1[4458] = 5; d_matrix1[4459] = 4; d_matrix1[4460] = 5; d_matrix1[4461] = 5; d_matrix1[4462] = 4; d_matrix1[4463] = 3; d_matrix1[4464] = 2; d_matrix1[4465] = 5; d_matrix1[4466] = 4; d_matrix1[4467] = 4; d_matrix1[4468] = 3; d_matrix1[4469] = 4; d_matrix1[4470] = 3; d_matrix1[4471] = 3; d_matrix1[4472] = 3; d_matrix1[4473] = 4; d_matrix1[4474] = 3; d_matrix1[4475] = 1; d_matrix1[4476] = 4; d_matrix1[4477] = 4; d_matrix1[4478] = 4; d_matrix1[4479] = 1;
d_matrix1[4480] = 0; d_matrix1[4481] = 0; d_matrix1[4482] = 5; d_matrix1[4483] = 3; d_matrix1[4484] = 4; d_matrix1[4485] = 3; d_matrix1[4486] = 3; d_matrix1[4487] = 5; d_matrix1[4488] = 4; d_matrix1[4489] = 1; d_matrix1[4490] = 5; d_matrix1[4491] = 3; d_matrix1[4492] = 2; d_matrix1[4493] = 5; d_matrix1[4494] = 5; d_matrix1[4495] = 5; d_matrix1[4496] = 5; d_matrix1[4497] = 5; d_matrix1[4498] = 3; d_matrix1[4499] = 4; d_matrix1[4500] = 5; d_matrix1[4501] = 4; d_matrix1[4502] = 1; d_matrix1[4503] = 4; d_matrix1[4504] = 4; d_matrix1[4505] = 3; d_matrix1[4506] = 4; d_matrix1[4507] = 3; d_matrix1[4508] = 2; d_matrix1[4509] = 4; d_matrix1[4510] = 1; d_matrix1[4511] = 3; d_matrix1[4512] = 3; d_matrix1[4513] = 5; d_matrix1[4514] = 4; d_matrix1[4515] = 2; d_matrix1[4516] = 1; d_matrix1[4517] = 2; d_matrix1[4518] = 2; d_matrix1[4519] = 3; d_matrix1[4520] = 4; d_matrix1[4521] = 3; d_matrix1[4522] = 2; d_matrix1[4523] = 5; d_matrix1[4524] = 4; d_matrix1[4525] = 5; d_matrix1[4526] = 5; d_matrix1[4527] = 4; d_matrix1[4528] = 4; d_matrix1[4529] = 5; d_matrix1[4530] = 3; d_matrix1[4531] = 5; d_matrix1[4532] = 4; d_matrix1[4533] = 4; d_matrix1[4534] = 3; d_matrix1[4535] = 3; d_matrix1[4536] = 5; d_matrix1[4537] = 4; d_matrix1[4538] = 5; d_matrix1[4539] = 4; d_matrix1[4540] = 5; d_matrix1[4541] = 5; d_matrix1[4542] = 4; d_matrix1[4543] = 3; d_matrix1[4544] = 2; d_matrix1[4545] = 5; d_matrix1[4546] = 4; d_matrix1[4547] = 4; d_matrix1[4548] = 3; d_matrix1[4549] = 4; d_matrix1[4550] = 3; d_matrix1[4551] = 3; d_matrix1[4552] = 3; d_matrix1[4553] = 4; d_matrix1[4554] = 3; d_matrix1[4555] = 1; d_matrix1[4556] = 4; d_matrix1[4557] = 4; d_matrix1[4558] = 4; d_matrix1[4559] = 1;
d_matrix1[4560] = 0; d_matrix1[4561] = 0; d_matrix1[4562] = 5; d_matrix1[4563] = 3; d_matrix1[4564] = 4; d_matrix1[4565] = 3; d_matrix1[4566] = 3; d_matrix1[4567] = 5; d_matrix1[4568] = 4; d_matrix1[4569] = 1; d_matrix1[4570] = 5; d_matrix1[4571] = 3; d_matrix1[4572] = 2; d_matrix1[4573] = 5; d_matrix1[4574] = 5; d_matrix1[4575] = 5; d_matrix1[4576] = 5; d_matrix1[4577] = 5; d_matrix1[4578] = 3; d_matrix1[4579] = 4; d_matrix1[4580] = 5; d_matrix1[4581] = 4; d_matrix1[4582] = 1; d_matrix1[4583] = 4; d_matrix1[4584] = 4; d_matrix1[4585] = 3; d_matrix1[4586] = 4; d_matrix1[4587] = 3; d_matrix1[4588] = 2; d_matrix1[4589] = 4; d_matrix1[4590] = 1; d_matrix1[4591] = 3; d_matrix1[4592] = 3; d_matrix1[4593] = 5; d_matrix1[4594] = 4; d_matrix1[4595] = 2; d_matrix1[4596] = 1; d_matrix1[4597] = 2; d_matrix1[4598] = 2; d_matrix1[4599] = 3; d_matrix1[4600] = 4; d_matrix1[4601] = 3; d_matrix1[4602] = 2; d_matrix1[4603] = 5; d_matrix1[4604] = 4; d_matrix1[4605] = 5; d_matrix1[4606] = 5; d_matrix1[4607] = 4; d_matrix1[4608] = 4; d_matrix1[4609] = 5; d_matrix1[4610] = 3; d_matrix1[4611] = 5; d_matrix1[4612] = 4; d_matrix1[4613] = 4; d_matrix1[4614] = 3; d_matrix1[4615] = 3; d_matrix1[4616] = 5; d_matrix1[4617] = 4; d_matrix1[4618] = 5; d_matrix1[4619] = 4; d_matrix1[4620] = 5; d_matrix1[4621] = 5; d_matrix1[4622] = 4; d_matrix1[4623] = 3; d_matrix1[4624] = 2; d_matrix1[4625] = 5; d_matrix1[4626] = 4; d_matrix1[4627] = 4; d_matrix1[4628] = 3; d_matrix1[4629] = 4; d_matrix1[4630] = 3; d_matrix1[4631] = 3; d_matrix1[4632] = 3; d_matrix1[4633] = 4; d_matrix1[4634] = 3; d_matrix1[4635] = 1; d_matrix1[4636] = 4; d_matrix1[4637] = 4; d_matrix1[4638] = 4; d_matrix1[4639] = 1;
d_matrix1[4640] = 0; d_matrix1[4641] = 0; d_matrix1[4642] = 5; d_matrix1[4643] = 3; d_matrix1[4644] = 4; d_matrix1[4645] = 3; d_matrix1[4646] = 3; d_matrix1[4647] = 5; d_matrix1[4648] = 4; d_matrix1[4649] = 1; d_matrix1[4650] = 5; d_matrix1[4651] = 3; d_matrix1[4652] = 2; d_matrix1[4653] = 5; d_matrix1[4654] = 5; d_matrix1[4655] = 5; d_matrix1[4656] = 5; d_matrix1[4657] = 5; d_matrix1[4658] = 3; d_matrix1[4659] = 4; d_matrix1[4660] = 5; d_matrix1[4661] = 4; d_matrix1[4662] = 1; d_matrix1[4663] = 4; d_matrix1[4664] = 4; d_matrix1[4665] = 3; d_matrix1[4666] = 4; d_matrix1[4667] = 3; d_matrix1[4668] = 2; d_matrix1[4669] = 4; d_matrix1[4670] = 1; d_matrix1[4671] = 3; d_matrix1[4672] = 3; d_matrix1[4673] = 5; d_matrix1[4674] = 4; d_matrix1[4675] = 2; d_matrix1[4676] = 1; d_matrix1[4677] = 2; d_matrix1[4678] = 2; d_matrix1[4679] = 3; d_matrix1[4680] = 4; d_matrix1[4681] = 3; d_matrix1[4682] = 2; d_matrix1[4683] = 5; d_matrix1[4684] = 4; d_matrix1[4685] = 5; d_matrix1[4686] = 5; d_matrix1[4687] = 4; d_matrix1[4688] = 4; d_matrix1[4689] = 5; d_matrix1[4690] = 3; d_matrix1[4691] = 5; d_matrix1[4692] = 4; d_matrix1[4693] = 4; d_matrix1[4694] = 3; d_matrix1[4695] = 3; d_matrix1[4696] = 5; d_matrix1[4697] = 4; d_matrix1[4698] = 5; d_matrix1[4699] = 4; d_matrix1[4700] = 5; d_matrix1[4701] = 5; d_matrix1[4702] = 4; d_matrix1[4703] = 3; d_matrix1[4704] = 2; d_matrix1[4705] = 5; d_matrix1[4706] = 4; d_matrix1[4707] = 4; d_matrix1[4708] = 3; d_matrix1[4709] = 4; d_matrix1[4710] = 3; d_matrix1[4711] = 3; d_matrix1[4712] = 3; d_matrix1[4713] = 4; d_matrix1[4714] = 3; d_matrix1[4715] = 1; d_matrix1[4716] = 4; d_matrix1[4717] = 4; d_matrix1[4718] = 4; d_matrix1[4719] = 1;
d_matrix1[4720] = 0; d_matrix1[4721] = 0; d_matrix1[4722] = 5; d_matrix1[4723] = 3; d_matrix1[4724] = 4; d_matrix1[4725] = 3; d_matrix1[4726] = 3; d_matrix1[4727] = 5; d_matrix1[4728] = 4; d_matrix1[4729] = 1; d_matrix1[4730] = 5; d_matrix1[4731] = 3; d_matrix1[4732] = 2; d_matrix1[4733] = 5; d_matrix1[4734] = 5; d_matrix1[4735] = 5; d_matrix1[4736] = 5; d_matrix1[4737] = 5; d_matrix1[4738] = 3; d_matrix1[4739] = 4; d_matrix1[4740] = 5; d_matrix1[4741] = 4; d_matrix1[4742] = 1; d_matrix1[4743] = 4; d_matrix1[4744] = 4; d_matrix1[4745] = 3; d_matrix1[4746] = 4; d_matrix1[4747] = 3; d_matrix1[4748] = 2; d_matrix1[4749] = 4; d_matrix1[4750] = 1; d_matrix1[4751] = 3; d_matrix1[4752] = 3; d_matrix1[4753] = 5; d_matrix1[4754] = 4; d_matrix1[4755] = 2; d_matrix1[4756] = 1; d_matrix1[4757] = 2; d_matrix1[4758] = 2; d_matrix1[4759] = 3; d_matrix1[4760] = 4; d_matrix1[4761] = 3; d_matrix1[4762] = 2; d_matrix1[4763] = 5; d_matrix1[4764] = 4; d_matrix1[4765] = 5; d_matrix1[4766] = 5; d_matrix1[4767] = 4; d_matrix1[4768] = 4; d_matrix1[4769] = 5; d_matrix1[4770] = 3; d_matrix1[4771] = 5; d_matrix1[4772] = 4; d_matrix1[4773] = 4; d_matrix1[4774] = 3; d_matrix1[4775] = 3; d_matrix1[4776] = 5; d_matrix1[4777] = 4; d_matrix1[4778] = 5; d_matrix1[4779] = 4; d_matrix1[4780] = 5; d_matrix1[4781] = 5; d_matrix1[4782] = 4; d_matrix1[4783] = 3; d_matrix1[4784] = 2; d_matrix1[4785] = 5; d_matrix1[4786] = 4; d_matrix1[4787] = 4; d_matrix1[4788] = 3; d_matrix1[4789] = 4; d_matrix1[4790] = 3; d_matrix1[4791] = 3; d_matrix1[4792] = 3; d_matrix1[4793] = 4; d_matrix1[4794] = 3; d_matrix1[4795] = 1; d_matrix1[4796] = 4; d_matrix1[4797] = 4; d_matrix1[4798] = 4; d_matrix1[4799] = 1;
d_matrix1[4800] = 0; d_matrix1[4801] = 0; d_matrix1[4802] = 5; d_matrix1[4803] = 3; d_matrix1[4804] = 4; d_matrix1[4805] = 3; d_matrix1[4806] = 3; d_matrix1[4807] = 5; d_matrix1[4808] = 4; d_matrix1[4809] = 1; d_matrix1[4810] = 5; d_matrix1[4811] = 3; d_matrix1[4812] = 2; d_matrix1[4813] = 5; d_matrix1[4814] = 5; d_matrix1[4815] = 5; d_matrix1[4816] = 5; d_matrix1[4817] = 5; d_matrix1[4818] = 3; d_matrix1[4819] = 4; d_matrix1[4820] = 5; d_matrix1[4821] = 4; d_matrix1[4822] = 1; d_matrix1[4823] = 4; d_matrix1[4824] = 4; d_matrix1[4825] = 3; d_matrix1[4826] = 4; d_matrix1[4827] = 3; d_matrix1[4828] = 2; d_matrix1[4829] = 4; d_matrix1[4830] = 1; d_matrix1[4831] = 3; d_matrix1[4832] = 3; d_matrix1[4833] = 5; d_matrix1[4834] = 4; d_matrix1[4835] = 2; d_matrix1[4836] = 1; d_matrix1[4837] = 2; d_matrix1[4838] = 2; d_matrix1[4839] = 3; d_matrix1[4840] = 4; d_matrix1[4841] = 3; d_matrix1[4842] = 2; d_matrix1[4843] = 5; d_matrix1[4844] = 4; d_matrix1[4845] = 5; d_matrix1[4846] = 5; d_matrix1[4847] = 4; d_matrix1[4848] = 4; d_matrix1[4849] = 5; d_matrix1[4850] = 3; d_matrix1[4851] = 5; d_matrix1[4852] = 4; d_matrix1[4853] = 4; d_matrix1[4854] = 3; d_matrix1[4855] = 3; d_matrix1[4856] = 5; d_matrix1[4857] = 4; d_matrix1[4858] = 5; d_matrix1[4859] = 4; d_matrix1[4860] = 5; d_matrix1[4861] = 5; d_matrix1[4862] = 4; d_matrix1[4863] = 3; d_matrix1[4864] = 2; d_matrix1[4865] = 5; d_matrix1[4866] = 4; d_matrix1[4867] = 4; d_matrix1[4868] = 3; d_matrix1[4869] = 4; d_matrix1[4870] = 3; d_matrix1[4871] = 3; d_matrix1[4872] = 3; d_matrix1[4873] = 4; d_matrix1[4874] = 3; d_matrix1[4875] = 1; d_matrix1[4876] = 4; d_matrix1[4877] = 4; d_matrix1[4878] = 4; d_matrix1[4879] = 1;
d_matrix1[4880] = 0; d_matrix1[4881] = 0; d_matrix1[4882] = 5; d_matrix1[4883] = 3; d_matrix1[4884] = 4; d_matrix1[4885] = 3; d_matrix1[4886] = 3; d_matrix1[4887] = 5; d_matrix1[4888] = 4; d_matrix1[4889] = 1; d_matrix1[4890] = 5; d_matrix1[4891] = 3; d_matrix1[4892] = 2; d_matrix1[4893] = 5; d_matrix1[4894] = 5; d_matrix1[4895] = 5; d_matrix1[4896] = 5; d_matrix1[4897] = 5; d_matrix1[4898] = 3; d_matrix1[4899] = 4; d_matrix1[4900] = 5; d_matrix1[4901] = 4; d_matrix1[4902] = 1; d_matrix1[4903] = 4; d_matrix1[4904] = 4; d_matrix1[4905] = 3; d_matrix1[4906] = 4; d_matrix1[4907] = 3; d_matrix1[4908] = 2; d_matrix1[4909] = 4; d_matrix1[4910] = 1; d_matrix1[4911] = 3; d_matrix1[4912] = 3; d_matrix1[4913] = 5; d_matrix1[4914] = 4; d_matrix1[4915] = 2; d_matrix1[4916] = 1; d_matrix1[4917] = 2; d_matrix1[4918] = 2; d_matrix1[4919] = 3; d_matrix1[4920] = 4; d_matrix1[4921] = 3; d_matrix1[4922] = 2; d_matrix1[4923] = 5; d_matrix1[4924] = 4; d_matrix1[4925] = 5; d_matrix1[4926] = 5; d_matrix1[4927] = 4; d_matrix1[4928] = 4; d_matrix1[4929] = 5; d_matrix1[4930] = 3; d_matrix1[4931] = 5; d_matrix1[4932] = 4; d_matrix1[4933] = 4; d_matrix1[4934] = 3; d_matrix1[4935] = 3; d_matrix1[4936] = 5; d_matrix1[4937] = 4; d_matrix1[4938] = 5; d_matrix1[4939] = 4; d_matrix1[4940] = 5; d_matrix1[4941] = 5; d_matrix1[4942] = 4; d_matrix1[4943] = 3; d_matrix1[4944] = 2; d_matrix1[4945] = 5; d_matrix1[4946] = 4; d_matrix1[4947] = 4; d_matrix1[4948] = 3; d_matrix1[4949] = 4; d_matrix1[4950] = 3; d_matrix1[4951] = 3; d_matrix1[4952] = 3; d_matrix1[4953] = 4; d_matrix1[4954] = 3; d_matrix1[4955] = 1; d_matrix1[4956] = 4; d_matrix1[4957] = 4; d_matrix1[4958] = 4; d_matrix1[4959] = 1;
d_matrix1[4960] = 0; d_matrix1[4961] = 0; d_matrix1[4962] = 5; d_matrix1[4963] = 3; d_matrix1[4964] = 4; d_matrix1[4965] = 3; d_matrix1[4966] = 3; d_matrix1[4967] = 5; d_matrix1[4968] = 4; d_matrix1[4969] = 1; d_matrix1[4970] = 5; d_matrix1[4971] = 3; d_matrix1[4972] = 2; d_matrix1[4973] = 5; d_matrix1[4974] = 5; d_matrix1[4975] = 5; d_matrix1[4976] = 5; d_matrix1[4977] = 5; d_matrix1[4978] = 3; d_matrix1[4979] = 4; d_matrix1[4980] = 5; d_matrix1[4981] = 4; d_matrix1[4982] = 1; d_matrix1[4983] = 4; d_matrix1[4984] = 4; d_matrix1[4985] = 3; d_matrix1[4986] = 4; d_matrix1[4987] = 3; d_matrix1[4988] = 2; d_matrix1[4989] = 4; d_matrix1[4990] = 1; d_matrix1[4991] = 3; d_matrix1[4992] = 3; d_matrix1[4993] = 5; d_matrix1[4994] = 4; d_matrix1[4995] = 2; d_matrix1[4996] = 1; d_matrix1[4997] = 2; d_matrix1[4998] = 2; d_matrix1[4999] = 3; d_matrix1[5000] = 4; d_matrix1[5001] = 3; d_matrix1[5002] = 2; d_matrix1[5003] = 5; d_matrix1[5004] = 4; d_matrix1[5005] = 5; d_matrix1[5006] = 5; d_matrix1[5007] = 4; d_matrix1[5008] = 4; d_matrix1[5009] = 5; d_matrix1[5010] = 3; d_matrix1[5011] = 5; d_matrix1[5012] = 4; d_matrix1[5013] = 4; d_matrix1[5014] = 3; d_matrix1[5015] = 3; d_matrix1[5016] = 5; d_matrix1[5017] = 4; d_matrix1[5018] = 5; d_matrix1[5019] = 4; d_matrix1[5020] = 5; d_matrix1[5021] = 5; d_matrix1[5022] = 4; d_matrix1[5023] = 3; d_matrix1[5024] = 2; d_matrix1[5025] = 5; d_matrix1[5026] = 4; d_matrix1[5027] = 4; d_matrix1[5028] = 3; d_matrix1[5029] = 4; d_matrix1[5030] = 3; d_matrix1[5031] = 3; d_matrix1[5032] = 3; d_matrix1[5033] = 4; d_matrix1[5034] = 3; d_matrix1[5035] = 1; d_matrix1[5036] = 4; d_matrix1[5037] = 4; d_matrix1[5038] = 4; d_matrix1[5039] = 1;
d_matrix1[5040] = 0; d_matrix1[5041] = 0; d_matrix1[5042] = 5; d_matrix1[5043] = 3; d_matrix1[5044] = 4; d_matrix1[5045] = 3; d_matrix1[5046] = 3; d_matrix1[5047] = 5; d_matrix1[5048] = 4; d_matrix1[5049] = 1; d_matrix1[5050] = 5; d_matrix1[5051] = 3; d_matrix1[5052] = 2; d_matrix1[5053] = 5; d_matrix1[5054] = 5; d_matrix1[5055] = 5; d_matrix1[5056] = 5; d_matrix1[5057] = 5; d_matrix1[5058] = 3; d_matrix1[5059] = 4; d_matrix1[5060] = 5; d_matrix1[5061] = 4; d_matrix1[5062] = 1; d_matrix1[5063] = 4; d_matrix1[5064] = 4; d_matrix1[5065] = 3; d_matrix1[5066] = 4; d_matrix1[5067] = 3; d_matrix1[5068] = 2; d_matrix1[5069] = 4; d_matrix1[5070] = 1; d_matrix1[5071] = 3; d_matrix1[5072] = 3; d_matrix1[5073] = 5; d_matrix1[5074] = 4; d_matrix1[5075] = 2; d_matrix1[5076] = 1; d_matrix1[5077] = 2; d_matrix1[5078] = 2; d_matrix1[5079] = 3; d_matrix1[5080] = 4; d_matrix1[5081] = 3; d_matrix1[5082] = 2; d_matrix1[5083] = 5; d_matrix1[5084] = 4; d_matrix1[5085] = 5; d_matrix1[5086] = 5; d_matrix1[5087] = 4; d_matrix1[5088] = 4; d_matrix1[5089] = 5; d_matrix1[5090] = 3; d_matrix1[5091] = 5; d_matrix1[5092] = 4; d_matrix1[5093] = 4; d_matrix1[5094] = 3; d_matrix1[5095] = 3; d_matrix1[5096] = 5; d_matrix1[5097] = 4; d_matrix1[5098] = 5; d_matrix1[5099] = 4; d_matrix1[5100] = 5; d_matrix1[5101] = 5; d_matrix1[5102] = 4; d_matrix1[5103] = 3; d_matrix1[5104] = 2; d_matrix1[5105] = 5; d_matrix1[5106] = 4; d_matrix1[5107] = 4; d_matrix1[5108] = 3; d_matrix1[5109] = 4; d_matrix1[5110] = 3; d_matrix1[5111] = 3; d_matrix1[5112] = 3; d_matrix1[5113] = 4; d_matrix1[5114] = 3; d_matrix1[5115] = 1; d_matrix1[5116] = 4; d_matrix1[5117] = 4; d_matrix1[5118] = 4; d_matrix1[5119] = 1;
d_matrix1[5120] = 0; d_matrix1[5121] = 0; d_matrix1[5122] = 5; d_matrix1[5123] = 3; d_matrix1[5124] = 4; d_matrix1[5125] = 3; d_matrix1[5126] = 3; d_matrix1[5127] = 5; d_matrix1[5128] = 4; d_matrix1[5129] = 1; d_matrix1[5130] = 5; d_matrix1[5131] = 3; d_matrix1[5132] = 2; d_matrix1[5133] = 5; d_matrix1[5134] = 5; d_matrix1[5135] = 5; d_matrix1[5136] = 5; d_matrix1[5137] = 5; d_matrix1[5138] = 3; d_matrix1[5139] = 4; d_matrix1[5140] = 5; d_matrix1[5141] = 4; d_matrix1[5142] = 1; d_matrix1[5143] = 4; d_matrix1[5144] = 4; d_matrix1[5145] = 3; d_matrix1[5146] = 4; d_matrix1[5147] = 3; d_matrix1[5148] = 2; d_matrix1[5149] = 4; d_matrix1[5150] = 1; d_matrix1[5151] = 3; d_matrix1[5152] = 3; d_matrix1[5153] = 5; d_matrix1[5154] = 4; d_matrix1[5155] = 2; d_matrix1[5156] = 1; d_matrix1[5157] = 2; d_matrix1[5158] = 2; d_matrix1[5159] = 3; d_matrix1[5160] = 4; d_matrix1[5161] = 3; d_matrix1[5162] = 2; d_matrix1[5163] = 5; d_matrix1[5164] = 4; d_matrix1[5165] = 5; d_matrix1[5166] = 5; d_matrix1[5167] = 4; d_matrix1[5168] = 4; d_matrix1[5169] = 5; d_matrix1[5170] = 3; d_matrix1[5171] = 5; d_matrix1[5172] = 4; d_matrix1[5173] = 4; d_matrix1[5174] = 3; d_matrix1[5175] = 3; d_matrix1[5176] = 5; d_matrix1[5177] = 4; d_matrix1[5178] = 5; d_matrix1[5179] = 4; d_matrix1[5180] = 5; d_matrix1[5181] = 5; d_matrix1[5182] = 4; d_matrix1[5183] = 3; d_matrix1[5184] = 2; d_matrix1[5185] = 5; d_matrix1[5186] = 4; d_matrix1[5187] = 4; d_matrix1[5188] = 3; d_matrix1[5189] = 4; d_matrix1[5190] = 3; d_matrix1[5191] = 3; d_matrix1[5192] = 3; d_matrix1[5193] = 4; d_matrix1[5194] = 3; d_matrix1[5195] = 1; d_matrix1[5196] = 4; d_matrix1[5197] = 4; d_matrix1[5198] = 4; d_matrix1[5199] = 1;
d_matrix1[5200] = 0; d_matrix1[5201] = 0; d_matrix1[5202] = 5; d_matrix1[5203] = 3; d_matrix1[5204] = 4; d_matrix1[5205] = 3; d_matrix1[5206] = 3; d_matrix1[5207] = 5; d_matrix1[5208] = 4; d_matrix1[5209] = 1; d_matrix1[5210] = 5; d_matrix1[5211] = 3; d_matrix1[5212] = 2; d_matrix1[5213] = 5; d_matrix1[5214] = 5; d_matrix1[5215] = 5; d_matrix1[5216] = 5; d_matrix1[5217] = 5; d_matrix1[5218] = 3; d_matrix1[5219] = 4; d_matrix1[5220] = 5; d_matrix1[5221] = 4; d_matrix1[5222] = 1; d_matrix1[5223] = 4; d_matrix1[5224] = 4; d_matrix1[5225] = 3; d_matrix1[5226] = 4; d_matrix1[5227] = 3; d_matrix1[5228] = 2; d_matrix1[5229] = 4; d_matrix1[5230] = 1; d_matrix1[5231] = 3; d_matrix1[5232] = 3; d_matrix1[5233] = 5; d_matrix1[5234] = 4; d_matrix1[5235] = 2; d_matrix1[5236] = 1; d_matrix1[5237] = 2; d_matrix1[5238] = 2; d_matrix1[5239] = 3; d_matrix1[5240] = 4; d_matrix1[5241] = 3; d_matrix1[5242] = 2; d_matrix1[5243] = 5; d_matrix1[5244] = 4; d_matrix1[5245] = 5; d_matrix1[5246] = 5; d_matrix1[5247] = 4; d_matrix1[5248] = 4; d_matrix1[5249] = 5; d_matrix1[5250] = 3; d_matrix1[5251] = 5; d_matrix1[5252] = 4; d_matrix1[5253] = 4; d_matrix1[5254] = 3; d_matrix1[5255] = 3; d_matrix1[5256] = 5; d_matrix1[5257] = 4; d_matrix1[5258] = 5; d_matrix1[5259] = 4; d_matrix1[5260] = 5; d_matrix1[5261] = 5; d_matrix1[5262] = 4; d_matrix1[5263] = 3; d_matrix1[5264] = 2; d_matrix1[5265] = 5; d_matrix1[5266] = 4; d_matrix1[5267] = 4; d_matrix1[5268] = 3; d_matrix1[5269] = 4; d_matrix1[5270] = 3; d_matrix1[5271] = 3; d_matrix1[5272] = 3; d_matrix1[5273] = 4; d_matrix1[5274] = 3; d_matrix1[5275] = 1; d_matrix1[5276] = 4; d_matrix1[5277] = 4; d_matrix1[5278] = 4; d_matrix1[5279] = 1;
d_matrix1[5280] = 0; d_matrix1[5281] = 0; d_matrix1[5282] = 5; d_matrix1[5283] = 3; d_matrix1[5284] = 4; d_matrix1[5285] = 3; d_matrix1[5286] = 3; d_matrix1[5287] = 5; d_matrix1[5288] = 4; d_matrix1[5289] = 1; d_matrix1[5290] = 5; d_matrix1[5291] = 3; d_matrix1[5292] = 2; d_matrix1[5293] = 5; d_matrix1[5294] = 5; d_matrix1[5295] = 5; d_matrix1[5296] = 5; d_matrix1[5297] = 5; d_matrix1[5298] = 3; d_matrix1[5299] = 4; d_matrix1[5300] = 5; d_matrix1[5301] = 4; d_matrix1[5302] = 1; d_matrix1[5303] = 4; d_matrix1[5304] = 4; d_matrix1[5305] = 3; d_matrix1[5306] = 4; d_matrix1[5307] = 3; d_matrix1[5308] = 2; d_matrix1[5309] = 4; d_matrix1[5310] = 1; d_matrix1[5311] = 3; d_matrix1[5312] = 3; d_matrix1[5313] = 5; d_matrix1[5314] = 4; d_matrix1[5315] = 2; d_matrix1[5316] = 1; d_matrix1[5317] = 2; d_matrix1[5318] = 2; d_matrix1[5319] = 3; d_matrix1[5320] = 4; d_matrix1[5321] = 3; d_matrix1[5322] = 2; d_matrix1[5323] = 5; d_matrix1[5324] = 4; d_matrix1[5325] = 5; d_matrix1[5326] = 5; d_matrix1[5327] = 4; d_matrix1[5328] = 4; d_matrix1[5329] = 5; d_matrix1[5330] = 3; d_matrix1[5331] = 5; d_matrix1[5332] = 4; d_matrix1[5333] = 4; d_matrix1[5334] = 3; d_matrix1[5335] = 3; d_matrix1[5336] = 5; d_matrix1[5337] = 4; d_matrix1[5338] = 5; d_matrix1[5339] = 4; d_matrix1[5340] = 5; d_matrix1[5341] = 5; d_matrix1[5342] = 4; d_matrix1[5343] = 3; d_matrix1[5344] = 2; d_matrix1[5345] = 5; d_matrix1[5346] = 4; d_matrix1[5347] = 4; d_matrix1[5348] = 3; d_matrix1[5349] = 4; d_matrix1[5350] = 3; d_matrix1[5351] = 3; d_matrix1[5352] = 3; d_matrix1[5353] = 4; d_matrix1[5354] = 3; d_matrix1[5355] = 1; d_matrix1[5356] = 4; d_matrix1[5357] = 4; d_matrix1[5358] = 4; d_matrix1[5359] = 1;
d_matrix1[5360] = 0; d_matrix1[5361] = 0; d_matrix1[5362] = 5; d_matrix1[5363] = 3; d_matrix1[5364] = 4; d_matrix1[5365] = 3; d_matrix1[5366] = 3; d_matrix1[5367] = 5; d_matrix1[5368] = 4; d_matrix1[5369] = 1; d_matrix1[5370] = 5; d_matrix1[5371] = 3; d_matrix1[5372] = 2; d_matrix1[5373] = 5; d_matrix1[5374] = 5; d_matrix1[5375] = 5; d_matrix1[5376] = 5; d_matrix1[5377] = 5; d_matrix1[5378] = 3; d_matrix1[5379] = 4; d_matrix1[5380] = 5; d_matrix1[5381] = 4; d_matrix1[5382] = 1; d_matrix1[5383] = 4; d_matrix1[5384] = 4; d_matrix1[5385] = 3; d_matrix1[5386] = 4; d_matrix1[5387] = 3; d_matrix1[5388] = 2; d_matrix1[5389] = 4; d_matrix1[5390] = 1; d_matrix1[5391] = 3; d_matrix1[5392] = 3; d_matrix1[5393] = 5; d_matrix1[5394] = 4; d_matrix1[5395] = 2; d_matrix1[5396] = 1; d_matrix1[5397] = 2; d_matrix1[5398] = 2; d_matrix1[5399] = 3; d_matrix1[5400] = 4; d_matrix1[5401] = 3; d_matrix1[5402] = 2; d_matrix1[5403] = 5; d_matrix1[5404] = 4; d_matrix1[5405] = 5; d_matrix1[5406] = 5; d_matrix1[5407] = 4; d_matrix1[5408] = 4; d_matrix1[5409] = 5; d_matrix1[5410] = 3; d_matrix1[5411] = 5; d_matrix1[5412] = 4; d_matrix1[5413] = 4; d_matrix1[5414] = 3; d_matrix1[5415] = 3; d_matrix1[5416] = 5; d_matrix1[5417] = 4; d_matrix1[5418] = 5; d_matrix1[5419] = 4; d_matrix1[5420] = 5; d_matrix1[5421] = 5; d_matrix1[5422] = 4; d_matrix1[5423] = 3; d_matrix1[5424] = 2; d_matrix1[5425] = 5; d_matrix1[5426] = 4; d_matrix1[5427] = 4; d_matrix1[5428] = 3; d_matrix1[5429] = 4; d_matrix1[5430] = 3; d_matrix1[5431] = 3; d_matrix1[5432] = 3; d_matrix1[5433] = 4; d_matrix1[5434] = 3; d_matrix1[5435] = 1; d_matrix1[5436] = 4; d_matrix1[5437] = 4; d_matrix1[5438] = 4; d_matrix1[5439] = 1;
d_matrix1[5440] = 0; d_matrix1[5441] = 0; d_matrix1[5442] = 5; d_matrix1[5443] = 3; d_matrix1[5444] = 4; d_matrix1[5445] = 3; d_matrix1[5446] = 3; d_matrix1[5447] = 5; d_matrix1[5448] = 4; d_matrix1[5449] = 1; d_matrix1[5450] = 5; d_matrix1[5451] = 3; d_matrix1[5452] = 2; d_matrix1[5453] = 5; d_matrix1[5454] = 5; d_matrix1[5455] = 5; d_matrix1[5456] = 5; d_matrix1[5457] = 5; d_matrix1[5458] = 3; d_matrix1[5459] = 4; d_matrix1[5460] = 5; d_matrix1[5461] = 4; d_matrix1[5462] = 1; d_matrix1[5463] = 4; d_matrix1[5464] = 4; d_matrix1[5465] = 3; d_matrix1[5466] = 4; d_matrix1[5467] = 3; d_matrix1[5468] = 2; d_matrix1[5469] = 4; d_matrix1[5470] = 1; d_matrix1[5471] = 3; d_matrix1[5472] = 3; d_matrix1[5473] = 5; d_matrix1[5474] = 4; d_matrix1[5475] = 2; d_matrix1[5476] = 1; d_matrix1[5477] = 2; d_matrix1[5478] = 2; d_matrix1[5479] = 3; d_matrix1[5480] = 4; d_matrix1[5481] = 3; d_matrix1[5482] = 2; d_matrix1[5483] = 5; d_matrix1[5484] = 4; d_matrix1[5485] = 5; d_matrix1[5486] = 5; d_matrix1[5487] = 4; d_matrix1[5488] = 4; d_matrix1[5489] = 5; d_matrix1[5490] = 3; d_matrix1[5491] = 5; d_matrix1[5492] = 4; d_matrix1[5493] = 4; d_matrix1[5494] = 3; d_matrix1[5495] = 3; d_matrix1[5496] = 5; d_matrix1[5497] = 4; d_matrix1[5498] = 5; d_matrix1[5499] = 4; d_matrix1[5500] = 5; d_matrix1[5501] = 5; d_matrix1[5502] = 4; d_matrix1[5503] = 3; d_matrix1[5504] = 2; d_matrix1[5505] = 5; d_matrix1[5506] = 4; d_matrix1[5507] = 4; d_matrix1[5508] = 3; d_matrix1[5509] = 4; d_matrix1[5510] = 3; d_matrix1[5511] = 3; d_matrix1[5512] = 3; d_matrix1[5513] = 4; d_matrix1[5514] = 3; d_matrix1[5515] = 1; d_matrix1[5516] = 4; d_matrix1[5517] = 4; d_matrix1[5518] = 4; d_matrix1[5519] = 1;
d_matrix1[5520] = 0; d_matrix1[5521] = 0; d_matrix1[5522] = 5; d_matrix1[5523] = 3; d_matrix1[5524] = 4; d_matrix1[5525] = 3; d_matrix1[5526] = 3; d_matrix1[5527] = 5; d_matrix1[5528] = 4; d_matrix1[5529] = 1; d_matrix1[5530] = 5; d_matrix1[5531] = 3; d_matrix1[5532] = 2; d_matrix1[5533] = 5; d_matrix1[5534] = 5; d_matrix1[5535] = 5; d_matrix1[5536] = 5; d_matrix1[5537] = 5; d_matrix1[5538] = 3; d_matrix1[5539] = 4; d_matrix1[5540] = 5; d_matrix1[5541] = 4; d_matrix1[5542] = 1; d_matrix1[5543] = 4; d_matrix1[5544] = 4; d_matrix1[5545] = 3; d_matrix1[5546] = 4; d_matrix1[5547] = 3; d_matrix1[5548] = 2; d_matrix1[5549] = 4; d_matrix1[5550] = 1; d_matrix1[5551] = 3; d_matrix1[5552] = 3; d_matrix1[5553] = 5; d_matrix1[5554] = 4; d_matrix1[5555] = 2; d_matrix1[5556] = 1; d_matrix1[5557] = 2; d_matrix1[5558] = 2; d_matrix1[5559] = 3; d_matrix1[5560] = 4; d_matrix1[5561] = 3; d_matrix1[5562] = 2; d_matrix1[5563] = 5; d_matrix1[5564] = 4; d_matrix1[5565] = 5; d_matrix1[5566] = 5; d_matrix1[5567] = 4; d_matrix1[5568] = 4; d_matrix1[5569] = 5; d_matrix1[5570] = 3; d_matrix1[5571] = 5; d_matrix1[5572] = 4; d_matrix1[5573] = 4; d_matrix1[5574] = 3; d_matrix1[5575] = 3; d_matrix1[5576] = 5; d_matrix1[5577] = 4; d_matrix1[5578] = 5; d_matrix1[5579] = 4; d_matrix1[5580] = 5; d_matrix1[5581] = 5; d_matrix1[5582] = 4; d_matrix1[5583] = 3; d_matrix1[5584] = 2; d_matrix1[5585] = 5; d_matrix1[5586] = 4; d_matrix1[5587] = 4; d_matrix1[5588] = 3; d_matrix1[5589] = 4; d_matrix1[5590] = 3; d_matrix1[5591] = 3; d_matrix1[5592] = 3; d_matrix1[5593] = 4; d_matrix1[5594] = 3; d_matrix1[5595] = 1; d_matrix1[5596] = 4; d_matrix1[5597] = 4; d_matrix1[5598] = 4; d_matrix1[5599] = 1;
d_matrix1[5600] = 0; d_matrix1[5601] = 0; d_matrix1[5602] = 5; d_matrix1[5603] = 3; d_matrix1[5604] = 4; d_matrix1[5605] = 3; d_matrix1[5606] = 3; d_matrix1[5607] = 5; d_matrix1[5608] = 4; d_matrix1[5609] = 1; d_matrix1[5610] = 5; d_matrix1[5611] = 3; d_matrix1[5612] = 2; d_matrix1[5613] = 5; d_matrix1[5614] = 5; d_matrix1[5615] = 5; d_matrix1[5616] = 5; d_matrix1[5617] = 5; d_matrix1[5618] = 3; d_matrix1[5619] = 4; d_matrix1[5620] = 5; d_matrix1[5621] = 4; d_matrix1[5622] = 1; d_matrix1[5623] = 4; d_matrix1[5624] = 4; d_matrix1[5625] = 3; d_matrix1[5626] = 4; d_matrix1[5627] = 3; d_matrix1[5628] = 2; d_matrix1[5629] = 4; d_matrix1[5630] = 1; d_matrix1[5631] = 3; d_matrix1[5632] = 3; d_matrix1[5633] = 5; d_matrix1[5634] = 4; d_matrix1[5635] = 2; d_matrix1[5636] = 1; d_matrix1[5637] = 2; d_matrix1[5638] = 2; d_matrix1[5639] = 3; d_matrix1[5640] = 4; d_matrix1[5641] = 3; d_matrix1[5642] = 2; d_matrix1[5643] = 5; d_matrix1[5644] = 4; d_matrix1[5645] = 5; d_matrix1[5646] = 5; d_matrix1[5647] = 4; d_matrix1[5648] = 4; d_matrix1[5649] = 5; d_matrix1[5650] = 3; d_matrix1[5651] = 5; d_matrix1[5652] = 4; d_matrix1[5653] = 4; d_matrix1[5654] = 3; d_matrix1[5655] = 3; d_matrix1[5656] = 5; d_matrix1[5657] = 4; d_matrix1[5658] = 5; d_matrix1[5659] = 4; d_matrix1[5660] = 5; d_matrix1[5661] = 5; d_matrix1[5662] = 4; d_matrix1[5663] = 3; d_matrix1[5664] = 2; d_matrix1[5665] = 5; d_matrix1[5666] = 4; d_matrix1[5667] = 4; d_matrix1[5668] = 3; d_matrix1[5669] = 4; d_matrix1[5670] = 3; d_matrix1[5671] = 3; d_matrix1[5672] = 3; d_matrix1[5673] = 4; d_matrix1[5674] = 3; d_matrix1[5675] = 1; d_matrix1[5676] = 4; d_matrix1[5677] = 4; d_matrix1[5678] = 4; d_matrix1[5679] = 1;
d_matrix1[5680] = 0; d_matrix1[5681] = 0; d_matrix1[5682] = 5; d_matrix1[5683] = 3; d_matrix1[5684] = 4; d_matrix1[5685] = 3; d_matrix1[5686] = 3; d_matrix1[5687] = 5; d_matrix1[5688] = 4; d_matrix1[5689] = 1; d_matrix1[5690] = 5; d_matrix1[5691] = 3; d_matrix1[5692] = 2; d_matrix1[5693] = 5; d_matrix1[5694] = 5; d_matrix1[5695] = 5; d_matrix1[5696] = 5; d_matrix1[5697] = 5; d_matrix1[5698] = 3; d_matrix1[5699] = 4; d_matrix1[5700] = 5; d_matrix1[5701] = 4; d_matrix1[5702] = 1; d_matrix1[5703] = 4; d_matrix1[5704] = 4; d_matrix1[5705] = 3; d_matrix1[5706] = 4; d_matrix1[5707] = 3; d_matrix1[5708] = 2; d_matrix1[5709] = 4; d_matrix1[5710] = 1; d_matrix1[5711] = 3; d_matrix1[5712] = 3; d_matrix1[5713] = 5; d_matrix1[5714] = 4; d_matrix1[5715] = 2; d_matrix1[5716] = 1; d_matrix1[5717] = 2; d_matrix1[5718] = 2; d_matrix1[5719] = 3; d_matrix1[5720] = 4; d_matrix1[5721] = 3; d_matrix1[5722] = 2; d_matrix1[5723] = 5; d_matrix1[5724] = 4; d_matrix1[5725] = 5; d_matrix1[5726] = 5; d_matrix1[5727] = 4; d_matrix1[5728] = 4; d_matrix1[5729] = 5; d_matrix1[5730] = 3; d_matrix1[5731] = 5; d_matrix1[5732] = 4; d_matrix1[5733] = 4; d_matrix1[5734] = 3; d_matrix1[5735] = 3; d_matrix1[5736] = 5; d_matrix1[5737] = 4; d_matrix1[5738] = 5; d_matrix1[5739] = 4; d_matrix1[5740] = 5; d_matrix1[5741] = 5; d_matrix1[5742] = 4; d_matrix1[5743] = 3; d_matrix1[5744] = 2; d_matrix1[5745] = 5; d_matrix1[5746] = 4; d_matrix1[5747] = 4; d_matrix1[5748] = 3; d_matrix1[5749] = 4; d_matrix1[5750] = 3; d_matrix1[5751] = 3; d_matrix1[5752] = 3; d_matrix1[5753] = 4; d_matrix1[5754] = 3; d_matrix1[5755] = 1; d_matrix1[5756] = 4; d_matrix1[5757] = 4; d_matrix1[5758] = 4; d_matrix1[5759] = 1;
d_matrix1[5760] = 0; d_matrix1[5761] = 0; d_matrix1[5762] = 5; d_matrix1[5763] = 3; d_matrix1[5764] = 4; d_matrix1[5765] = 3; d_matrix1[5766] = 3; d_matrix1[5767] = 5; d_matrix1[5768] = 4; d_matrix1[5769] = 1; d_matrix1[5770] = 5; d_matrix1[5771] = 3; d_matrix1[5772] = 2; d_matrix1[5773] = 5; d_matrix1[5774] = 5; d_matrix1[5775] = 5; d_matrix1[5776] = 5; d_matrix1[5777] = 5; d_matrix1[5778] = 3; d_matrix1[5779] = 4; d_matrix1[5780] = 5; d_matrix1[5781] = 4; d_matrix1[5782] = 1; d_matrix1[5783] = 4; d_matrix1[5784] = 4; d_matrix1[5785] = 3; d_matrix1[5786] = 4; d_matrix1[5787] = 3; d_matrix1[5788] = 2; d_matrix1[5789] = 4; d_matrix1[5790] = 1; d_matrix1[5791] = 3; d_matrix1[5792] = 3; d_matrix1[5793] = 5; d_matrix1[5794] = 4; d_matrix1[5795] = 2; d_matrix1[5796] = 1; d_matrix1[5797] = 2; d_matrix1[5798] = 2; d_matrix1[5799] = 3; d_matrix1[5800] = 4; d_matrix1[5801] = 3; d_matrix1[5802] = 2; d_matrix1[5803] = 5; d_matrix1[5804] = 4; d_matrix1[5805] = 5; d_matrix1[5806] = 5; d_matrix1[5807] = 4; d_matrix1[5808] = 4; d_matrix1[5809] = 5; d_matrix1[5810] = 3; d_matrix1[5811] = 5; d_matrix1[5812] = 4; d_matrix1[5813] = 4; d_matrix1[5814] = 3; d_matrix1[5815] = 3; d_matrix1[5816] = 5; d_matrix1[5817] = 4; d_matrix1[5818] = 5; d_matrix1[5819] = 4; d_matrix1[5820] = 5; d_matrix1[5821] = 5; d_matrix1[5822] = 4; d_matrix1[5823] = 3; d_matrix1[5824] = 2; d_matrix1[5825] = 5; d_matrix1[5826] = 4; d_matrix1[5827] = 4; d_matrix1[5828] = 3; d_matrix1[5829] = 4; d_matrix1[5830] = 3; d_matrix1[5831] = 3; d_matrix1[5832] = 3; d_matrix1[5833] = 4; d_matrix1[5834] = 3; d_matrix1[5835] = 1; d_matrix1[5836] = 4; d_matrix1[5837] = 4; d_matrix1[5838] = 4; d_matrix1[5839] = 1;
d_matrix1[5840] = 0; d_matrix1[5841] = 0; d_matrix1[5842] = 5; d_matrix1[5843] = 3; d_matrix1[5844] = 4; d_matrix1[5845] = 3; d_matrix1[5846] = 3; d_matrix1[5847] = 5; d_matrix1[5848] = 4; d_matrix1[5849] = 1; d_matrix1[5850] = 5; d_matrix1[5851] = 3; d_matrix1[5852] = 2; d_matrix1[5853] = 5; d_matrix1[5854] = 5; d_matrix1[5855] = 5; d_matrix1[5856] = 5; d_matrix1[5857] = 5; d_matrix1[5858] = 3; d_matrix1[5859] = 4; d_matrix1[5860] = 5; d_matrix1[5861] = 4; d_matrix1[5862] = 1; d_matrix1[5863] = 4; d_matrix1[5864] = 4; d_matrix1[5865] = 3; d_matrix1[5866] = 4; d_matrix1[5867] = 3; d_matrix1[5868] = 2; d_matrix1[5869] = 4; d_matrix1[5870] = 1; d_matrix1[5871] = 3; d_matrix1[5872] = 3; d_matrix1[5873] = 5; d_matrix1[5874] = 4; d_matrix1[5875] = 2; d_matrix1[5876] = 1; d_matrix1[5877] = 2; d_matrix1[5878] = 2; d_matrix1[5879] = 3; d_matrix1[5880] = 4; d_matrix1[5881] = 3; d_matrix1[5882] = 2; d_matrix1[5883] = 5; d_matrix1[5884] = 4; d_matrix1[5885] = 5; d_matrix1[5886] = 5; d_matrix1[5887] = 4; d_matrix1[5888] = 4; d_matrix1[5889] = 5; d_matrix1[5890] = 3; d_matrix1[5891] = 5; d_matrix1[5892] = 4; d_matrix1[5893] = 4; d_matrix1[5894] = 3; d_matrix1[5895] = 3; d_matrix1[5896] = 5; d_matrix1[5897] = 4; d_matrix1[5898] = 5; d_matrix1[5899] = 4; d_matrix1[5900] = 5; d_matrix1[5901] = 5; d_matrix1[5902] = 4; d_matrix1[5903] = 3; d_matrix1[5904] = 2; d_matrix1[5905] = 5; d_matrix1[5906] = 4; d_matrix1[5907] = 4; d_matrix1[5908] = 3; d_matrix1[5909] = 4; d_matrix1[5910] = 3; d_matrix1[5911] = 3; d_matrix1[5912] = 3; d_matrix1[5913] = 4; d_matrix1[5914] = 3; d_matrix1[5915] = 1; d_matrix1[5916] = 4; d_matrix1[5917] = 4; d_matrix1[5918] = 4; d_matrix1[5919] = 1;
d_matrix1[5920] = 0; d_matrix1[5921] = 0; d_matrix1[5922] = 5; d_matrix1[5923] = 3; d_matrix1[5924] = 4; d_matrix1[5925] = 3; d_matrix1[5926] = 3; d_matrix1[5927] = 5; d_matrix1[5928] = 4; d_matrix1[5929] = 1; d_matrix1[5930] = 5; d_matrix1[5931] = 3; d_matrix1[5932] = 2; d_matrix1[5933] = 5; d_matrix1[5934] = 5; d_matrix1[5935] = 5; d_matrix1[5936] = 5; d_matrix1[5937] = 5; d_matrix1[5938] = 3; d_matrix1[5939] = 4; d_matrix1[5940] = 5; d_matrix1[5941] = 4; d_matrix1[5942] = 1; d_matrix1[5943] = 4; d_matrix1[5944] = 4; d_matrix1[5945] = 3; d_matrix1[5946] = 4; d_matrix1[5947] = 3; d_matrix1[5948] = 2; d_matrix1[5949] = 4; d_matrix1[5950] = 1; d_matrix1[5951] = 3; d_matrix1[5952] = 3; d_matrix1[5953] = 5; d_matrix1[5954] = 4; d_matrix1[5955] = 2; d_matrix1[5956] = 1; d_matrix1[5957] = 2; d_matrix1[5958] = 2; d_matrix1[5959] = 3; d_matrix1[5960] = 4; d_matrix1[5961] = 3; d_matrix1[5962] = 2; d_matrix1[5963] = 5; d_matrix1[5964] = 4; d_matrix1[5965] = 5; d_matrix1[5966] = 5; d_matrix1[5967] = 4; d_matrix1[5968] = 4; d_matrix1[5969] = 5; d_matrix1[5970] = 3; d_matrix1[5971] = 5; d_matrix1[5972] = 4; d_matrix1[5973] = 4; d_matrix1[5974] = 3; d_matrix1[5975] = 3; d_matrix1[5976] = 5; d_matrix1[5977] = 4; d_matrix1[5978] = 5; d_matrix1[5979] = 4; d_matrix1[5980] = 5; d_matrix1[5981] = 5; d_matrix1[5982] = 4; d_matrix1[5983] = 3; d_matrix1[5984] = 2; d_matrix1[5985] = 5; d_matrix1[5986] = 4; d_matrix1[5987] = 4; d_matrix1[5988] = 3; d_matrix1[5989] = 4; d_matrix1[5990] = 3; d_matrix1[5991] = 3; d_matrix1[5992] = 3; d_matrix1[5993] = 4; d_matrix1[5994] = 3; d_matrix1[5995] = 1; d_matrix1[5996] = 4; d_matrix1[5997] = 4; d_matrix1[5998] = 4; d_matrix1[5999] = 1;
d_matrix1[6000] = 0; d_matrix1[6001] = 0; d_matrix1[6002] = 5; d_matrix1[6003] = 3; d_matrix1[6004] = 4; d_matrix1[6005] = 3; d_matrix1[6006] = 3; d_matrix1[6007] = 5; d_matrix1[6008] = 4; d_matrix1[6009] = 1; d_matrix1[6010] = 5; d_matrix1[6011] = 3; d_matrix1[6012] = 2; d_matrix1[6013] = 5; d_matrix1[6014] = 5; d_matrix1[6015] = 5; d_matrix1[6016] = 5; d_matrix1[6017] = 5; d_matrix1[6018] = 3; d_matrix1[6019] = 4; d_matrix1[6020] = 5; d_matrix1[6021] = 4; d_matrix1[6022] = 1; d_matrix1[6023] = 4; d_matrix1[6024] = 4; d_matrix1[6025] = 3; d_matrix1[6026] = 4; d_matrix1[6027] = 3; d_matrix1[6028] = 2; d_matrix1[6029] = 4; d_matrix1[6030] = 1; d_matrix1[6031] = 3; d_matrix1[6032] = 3; d_matrix1[6033] = 5; d_matrix1[6034] = 4; d_matrix1[6035] = 2; d_matrix1[6036] = 1; d_matrix1[6037] = 2; d_matrix1[6038] = 2; d_matrix1[6039] = 3; d_matrix1[6040] = 4; d_matrix1[6041] = 3; d_matrix1[6042] = 2; d_matrix1[6043] = 5; d_matrix1[6044] = 4; d_matrix1[6045] = 5; d_matrix1[6046] = 5; d_matrix1[6047] = 4; d_matrix1[6048] = 4; d_matrix1[6049] = 5; d_matrix1[6050] = 3; d_matrix1[6051] = 5; d_matrix1[6052] = 4; d_matrix1[6053] = 4; d_matrix1[6054] = 3; d_matrix1[6055] = 3; d_matrix1[6056] = 5; d_matrix1[6057] = 4; d_matrix1[6058] = 5; d_matrix1[6059] = 4; d_matrix1[6060] = 5; d_matrix1[6061] = 5; d_matrix1[6062] = 4; d_matrix1[6063] = 3; d_matrix1[6064] = 2; d_matrix1[6065] = 5; d_matrix1[6066] = 4; d_matrix1[6067] = 4; d_matrix1[6068] = 3; d_matrix1[6069] = 4; d_matrix1[6070] = 3; d_matrix1[6071] = 3; d_matrix1[6072] = 3; d_matrix1[6073] = 4; d_matrix1[6074] = 3; d_matrix1[6075] = 1; d_matrix1[6076] = 4; d_matrix1[6077] = 4; d_matrix1[6078] = 4; d_matrix1[6079] = 1;
d_matrix1[6080] = 0; d_matrix1[6081] = 0; d_matrix1[6082] = 5; d_matrix1[6083] = 3; d_matrix1[6084] = 4; d_matrix1[6085] = 3; d_matrix1[6086] = 3; d_matrix1[6087] = 5; d_matrix1[6088] = 4; d_matrix1[6089] = 1; d_matrix1[6090] = 5; d_matrix1[6091] = 3; d_matrix1[6092] = 2; d_matrix1[6093] = 5; d_matrix1[6094] = 5; d_matrix1[6095] = 5; d_matrix1[6096] = 5; d_matrix1[6097] = 5; d_matrix1[6098] = 3; d_matrix1[6099] = 4; d_matrix1[6100] = 5; d_matrix1[6101] = 4; d_matrix1[6102] = 1; d_matrix1[6103] = 4; d_matrix1[6104] = 4; d_matrix1[6105] = 3; d_matrix1[6106] = 4; d_matrix1[6107] = 3; d_matrix1[6108] = 2; d_matrix1[6109] = 4; d_matrix1[6110] = 1; d_matrix1[6111] = 3; d_matrix1[6112] = 3; d_matrix1[6113] = 5; d_matrix1[6114] = 4; d_matrix1[6115] = 2; d_matrix1[6116] = 1; d_matrix1[6117] = 2; d_matrix1[6118] = 2; d_matrix1[6119] = 3; d_matrix1[6120] = 4; d_matrix1[6121] = 3; d_matrix1[6122] = 2; d_matrix1[6123] = 5; d_matrix1[6124] = 4; d_matrix1[6125] = 5; d_matrix1[6126] = 5; d_matrix1[6127] = 4; d_matrix1[6128] = 4; d_matrix1[6129] = 5; d_matrix1[6130] = 3; d_matrix1[6131] = 5; d_matrix1[6132] = 4; d_matrix1[6133] = 4; d_matrix1[6134] = 3; d_matrix1[6135] = 3; d_matrix1[6136] = 5; d_matrix1[6137] = 4; d_matrix1[6138] = 5; d_matrix1[6139] = 4; d_matrix1[6140] = 5; d_matrix1[6141] = 5; d_matrix1[6142] = 4; d_matrix1[6143] = 3; d_matrix1[6144] = 2; d_matrix1[6145] = 5; d_matrix1[6146] = 4; d_matrix1[6147] = 4; d_matrix1[6148] = 3; d_matrix1[6149] = 4; d_matrix1[6150] = 3; d_matrix1[6151] = 3; d_matrix1[6152] = 3; d_matrix1[6153] = 4; d_matrix1[6154] = 3; d_matrix1[6155] = 1; d_matrix1[6156] = 4; d_matrix1[6157] = 4; d_matrix1[6158] = 4; d_matrix1[6159] = 1;
d_matrix1[6160] = 0; d_matrix1[6161] = 0; d_matrix1[6162] = 5; d_matrix1[6163] = 3; d_matrix1[6164] = 4; d_matrix1[6165] = 3; d_matrix1[6166] = 3; d_matrix1[6167] = 5; d_matrix1[6168] = 4; d_matrix1[6169] = 1; d_matrix1[6170] = 5; d_matrix1[6171] = 3; d_matrix1[6172] = 2; d_matrix1[6173] = 5; d_matrix1[6174] = 5; d_matrix1[6175] = 5; d_matrix1[6176] = 5; d_matrix1[6177] = 5; d_matrix1[6178] = 3; d_matrix1[6179] = 4; d_matrix1[6180] = 5; d_matrix1[6181] = 4; d_matrix1[6182] = 1; d_matrix1[6183] = 4; d_matrix1[6184] = 4; d_matrix1[6185] = 3; d_matrix1[6186] = 4; d_matrix1[6187] = 3; d_matrix1[6188] = 2; d_matrix1[6189] = 4; d_matrix1[6190] = 1; d_matrix1[6191] = 3; d_matrix1[6192] = 3; d_matrix1[6193] = 5; d_matrix1[6194] = 4; d_matrix1[6195] = 2; d_matrix1[6196] = 1; d_matrix1[6197] = 2; d_matrix1[6198] = 2; d_matrix1[6199] = 3; d_matrix1[6200] = 4; d_matrix1[6201] = 3; d_matrix1[6202] = 2; d_matrix1[6203] = 5; d_matrix1[6204] = 4; d_matrix1[6205] = 5; d_matrix1[6206] = 5; d_matrix1[6207] = 4; d_matrix1[6208] = 4; d_matrix1[6209] = 5; d_matrix1[6210] = 3; d_matrix1[6211] = 5; d_matrix1[6212] = 4; d_matrix1[6213] = 4; d_matrix1[6214] = 3; d_matrix1[6215] = 3; d_matrix1[6216] = 5; d_matrix1[6217] = 4; d_matrix1[6218] = 5; d_matrix1[6219] = 4; d_matrix1[6220] = 5; d_matrix1[6221] = 5; d_matrix1[6222] = 4; d_matrix1[6223] = 3; d_matrix1[6224] = 2; d_matrix1[6225] = 5; d_matrix1[6226] = 4; d_matrix1[6227] = 4; d_matrix1[6228] = 3; d_matrix1[6229] = 4; d_matrix1[6230] = 3; d_matrix1[6231] = 3; d_matrix1[6232] = 3; d_matrix1[6233] = 4; d_matrix1[6234] = 3; d_matrix1[6235] = 1; d_matrix1[6236] = 4; d_matrix1[6237] = 4; d_matrix1[6238] = 4; d_matrix1[6239] = 1;
d_matrix1[6240] = 0; d_matrix1[6241] = 0; d_matrix1[6242] = 5; d_matrix1[6243] = 3; d_matrix1[6244] = 4; d_matrix1[6245] = 3; d_matrix1[6246] = 3; d_matrix1[6247] = 5; d_matrix1[6248] = 4; d_matrix1[6249] = 1; d_matrix1[6250] = 5; d_matrix1[6251] = 3; d_matrix1[6252] = 2; d_matrix1[6253] = 5; d_matrix1[6254] = 5; d_matrix1[6255] = 5; d_matrix1[6256] = 5; d_matrix1[6257] = 5; d_matrix1[6258] = 3; d_matrix1[6259] = 4; d_matrix1[6260] = 5; d_matrix1[6261] = 4; d_matrix1[6262] = 1; d_matrix1[6263] = 4; d_matrix1[6264] = 4; d_matrix1[6265] = 3; d_matrix1[6266] = 4; d_matrix1[6267] = 3; d_matrix1[6268] = 2; d_matrix1[6269] = 4; d_matrix1[6270] = 1; d_matrix1[6271] = 3; d_matrix1[6272] = 3; d_matrix1[6273] = 5; d_matrix1[6274] = 4; d_matrix1[6275] = 2; d_matrix1[6276] = 1; d_matrix1[6277] = 2; d_matrix1[6278] = 2; d_matrix1[6279] = 3; d_matrix1[6280] = 4; d_matrix1[6281] = 3; d_matrix1[6282] = 2; d_matrix1[6283] = 5; d_matrix1[6284] = 4; d_matrix1[6285] = 5; d_matrix1[6286] = 5; d_matrix1[6287] = 4; d_matrix1[6288] = 4; d_matrix1[6289] = 5; d_matrix1[6290] = 3; d_matrix1[6291] = 5; d_matrix1[6292] = 4; d_matrix1[6293] = 4; d_matrix1[6294] = 3; d_matrix1[6295] = 3; d_matrix1[6296] = 5; d_matrix1[6297] = 4; d_matrix1[6298] = 5; d_matrix1[6299] = 4; d_matrix1[6300] = 5; d_matrix1[6301] = 5; d_matrix1[6302] = 4; d_matrix1[6303] = 3; d_matrix1[6304] = 2; d_matrix1[6305] = 5; d_matrix1[6306] = 4; d_matrix1[6307] = 4; d_matrix1[6308] = 3; d_matrix1[6309] = 4; d_matrix1[6310] = 3; d_matrix1[6311] = 3; d_matrix1[6312] = 3; d_matrix1[6313] = 4; d_matrix1[6314] = 3; d_matrix1[6315] = 1; d_matrix1[6316] = 4; d_matrix1[6317] = 4; d_matrix1[6318] = 4; d_matrix1[6319] = 1;
d_matrix1[6320] = 0; d_matrix1[6321] = 0; d_matrix1[6322] = 5; d_matrix1[6323] = 3; d_matrix1[6324] = 4; d_matrix1[6325] = 3; d_matrix1[6326] = 3; d_matrix1[6327] = 5; d_matrix1[6328] = 4; d_matrix1[6329] = 1; d_matrix1[6330] = 5; d_matrix1[6331] = 3; d_matrix1[6332] = 2; d_matrix1[6333] = 5; d_matrix1[6334] = 5; d_matrix1[6335] = 5; d_matrix1[6336] = 5; d_matrix1[6337] = 5; d_matrix1[6338] = 3; d_matrix1[6339] = 4; d_matrix1[6340] = 5; d_matrix1[6341] = 4; d_matrix1[6342] = 1; d_matrix1[6343] = 4; d_matrix1[6344] = 4; d_matrix1[6345] = 3; d_matrix1[6346] = 4; d_matrix1[6347] = 3; d_matrix1[6348] = 2; d_matrix1[6349] = 4; d_matrix1[6350] = 1; d_matrix1[6351] = 3; d_matrix1[6352] = 3; d_matrix1[6353] = 5; d_matrix1[6354] = 4; d_matrix1[6355] = 2; d_matrix1[6356] = 1; d_matrix1[6357] = 2; d_matrix1[6358] = 2; d_matrix1[6359] = 3; d_matrix1[6360] = 4; d_matrix1[6361] = 3; d_matrix1[6362] = 2; d_matrix1[6363] = 5; d_matrix1[6364] = 4; d_matrix1[6365] = 5; d_matrix1[6366] = 5; d_matrix1[6367] = 4; d_matrix1[6368] = 4; d_matrix1[6369] = 5; d_matrix1[6370] = 3; d_matrix1[6371] = 5; d_matrix1[6372] = 4; d_matrix1[6373] = 4; d_matrix1[6374] = 3; d_matrix1[6375] = 3; d_matrix1[6376] = 5; d_matrix1[6377] = 4; d_matrix1[6378] = 5; d_matrix1[6379] = 4; d_matrix1[6380] = 5; d_matrix1[6381] = 5; d_matrix1[6382] = 4; d_matrix1[6383] = 3; d_matrix1[6384] = 2; d_matrix1[6385] = 5; d_matrix1[6386] = 4; d_matrix1[6387] = 4; d_matrix1[6388] = 3; d_matrix1[6389] = 4; d_matrix1[6390] = 3; d_matrix1[6391] = 3; d_matrix1[6392] = 3; d_matrix1[6393] = 4; d_matrix1[6394] = 3; d_matrix1[6395] = 1; d_matrix1[6396] = 4; d_matrix1[6397] = 4; d_matrix1[6398] = 4; d_matrix1[6399] = 1;
d_matrix1[6400] = 0; d_matrix1[6401] = 0; d_matrix1[6402] = 5; d_matrix1[6403] = 3; d_matrix1[6404] = 4; d_matrix1[6405] = 3; d_matrix1[6406] = 3; d_matrix1[6407] = 5; d_matrix1[6408] = 4; d_matrix1[6409] = 1; d_matrix1[6410] = 5; d_matrix1[6411] = 3; d_matrix1[6412] = 2; d_matrix1[6413] = 5; d_matrix1[6414] = 5; d_matrix1[6415] = 5; d_matrix1[6416] = 5; d_matrix1[6417] = 5; d_matrix1[6418] = 3; d_matrix1[6419] = 4; d_matrix1[6420] = 5; d_matrix1[6421] = 4; d_matrix1[6422] = 1; d_matrix1[6423] = 4; d_matrix1[6424] = 4; d_matrix1[6425] = 3; d_matrix1[6426] = 4; d_matrix1[6427] = 3; d_matrix1[6428] = 2; d_matrix1[6429] = 4; d_matrix1[6430] = 1; d_matrix1[6431] = 3; d_matrix1[6432] = 3; d_matrix1[6433] = 5; d_matrix1[6434] = 4; d_matrix1[6435] = 2; d_matrix1[6436] = 1; d_matrix1[6437] = 2; d_matrix1[6438] = 2; d_matrix1[6439] = 3; d_matrix1[6440] = 4; d_matrix1[6441] = 3; d_matrix1[6442] = 2; d_matrix1[6443] = 5; d_matrix1[6444] = 4; d_matrix1[6445] = 5; d_matrix1[6446] = 5; d_matrix1[6447] = 4; d_matrix1[6448] = 4; d_matrix1[6449] = 5; d_matrix1[6450] = 3; d_matrix1[6451] = 5; d_matrix1[6452] = 4; d_matrix1[6453] = 4; d_matrix1[6454] = 3; d_matrix1[6455] = 3; d_matrix1[6456] = 5; d_matrix1[6457] = 4; d_matrix1[6458] = 5; d_matrix1[6459] = 4; d_matrix1[6460] = 5; d_matrix1[6461] = 5; d_matrix1[6462] = 4; d_matrix1[6463] = 3; d_matrix1[6464] = 2; d_matrix1[6465] = 5; d_matrix1[6466] = 4; d_matrix1[6467] = 4; d_matrix1[6468] = 3; d_matrix1[6469] = 4; d_matrix1[6470] = 3; d_matrix1[6471] = 3; d_matrix1[6472] = 3; d_matrix1[6473] = 4; d_matrix1[6474] = 3; d_matrix1[6475] = 1; d_matrix1[6476] = 4; d_matrix1[6477] = 4; d_matrix1[6478] = 4; d_matrix1[6479] = 1;
d_matrix1[6480] = 0; d_matrix1[6481] = 0; d_matrix1[6482] = 5; d_matrix1[6483] = 3; d_matrix1[6484] = 4; d_matrix1[6485] = 3; d_matrix1[6486] = 3; d_matrix1[6487] = 5; d_matrix1[6488] = 4; d_matrix1[6489] = 1; d_matrix1[6490] = 5; d_matrix1[6491] = 3; d_matrix1[6492] = 2; d_matrix1[6493] = 5; d_matrix1[6494] = 5; d_matrix1[6495] = 5; d_matrix1[6496] = 5; d_matrix1[6497] = 5; d_matrix1[6498] = 3; d_matrix1[6499] = 4; d_matrix1[6500] = 5; d_matrix1[6501] = 4; d_matrix1[6502] = 1; d_matrix1[6503] = 4; d_matrix1[6504] = 4; d_matrix1[6505] = 3; d_matrix1[6506] = 4; d_matrix1[6507] = 3; d_matrix1[6508] = 2; d_matrix1[6509] = 4; d_matrix1[6510] = 1; d_matrix1[6511] = 3; d_matrix1[6512] = 3; d_matrix1[6513] = 5; d_matrix1[6514] = 4; d_matrix1[6515] = 2; d_matrix1[6516] = 1; d_matrix1[6517] = 2; d_matrix1[6518] = 2; d_matrix1[6519] = 3; d_matrix1[6520] = 4; d_matrix1[6521] = 3; d_matrix1[6522] = 2; d_matrix1[6523] = 5; d_matrix1[6524] = 4; d_matrix1[6525] = 5; d_matrix1[6526] = 5; d_matrix1[6527] = 4; d_matrix1[6528] = 4; d_matrix1[6529] = 5; d_matrix1[6530] = 3; d_matrix1[6531] = 5; d_matrix1[6532] = 4; d_matrix1[6533] = 4; d_matrix1[6534] = 3; d_matrix1[6535] = 3; d_matrix1[6536] = 5; d_matrix1[6537] = 4; d_matrix1[6538] = 5; d_matrix1[6539] = 4; d_matrix1[6540] = 5; d_matrix1[6541] = 5; d_matrix1[6542] = 4; d_matrix1[6543] = 3; d_matrix1[6544] = 2; d_matrix1[6545] = 5; d_matrix1[6546] = 4; d_matrix1[6547] = 4; d_matrix1[6548] = 3; d_matrix1[6549] = 4; d_matrix1[6550] = 3; d_matrix1[6551] = 3; d_matrix1[6552] = 3; d_matrix1[6553] = 4; d_matrix1[6554] = 3; d_matrix1[6555] = 1; d_matrix1[6556] = 4; d_matrix1[6557] = 4; d_matrix1[6558] = 4; d_matrix1[6559] = 1;
d_matrix1[6560] = 0; d_matrix1[6561] = 0; d_matrix1[6562] = 5; d_matrix1[6563] = 3; d_matrix1[6564] = 4; d_matrix1[6565] = 3; d_matrix1[6566] = 3; d_matrix1[6567] = 5; d_matrix1[6568] = 4; d_matrix1[6569] = 1; d_matrix1[6570] = 5; d_matrix1[6571] = 3; d_matrix1[6572] = 2; d_matrix1[6573] = 5; d_matrix1[6574] = 5; d_matrix1[6575] = 5; d_matrix1[6576] = 5; d_matrix1[6577] = 5; d_matrix1[6578] = 3; d_matrix1[6579] = 4; d_matrix1[6580] = 5; d_matrix1[6581] = 4; d_matrix1[6582] = 1; d_matrix1[6583] = 4; d_matrix1[6584] = 4; d_matrix1[6585] = 3; d_matrix1[6586] = 4; d_matrix1[6587] = 3; d_matrix1[6588] = 2; d_matrix1[6589] = 4; d_matrix1[6590] = 1; d_matrix1[6591] = 3; d_matrix1[6592] = 3; d_matrix1[6593] = 5; d_matrix1[6594] = 4; d_matrix1[6595] = 2; d_matrix1[6596] = 1; d_matrix1[6597] = 2; d_matrix1[6598] = 2; d_matrix1[6599] = 3; d_matrix1[6600] = 4; d_matrix1[6601] = 3; d_matrix1[6602] = 2; d_matrix1[6603] = 5; d_matrix1[6604] = 4; d_matrix1[6605] = 5; d_matrix1[6606] = 5; d_matrix1[6607] = 4; d_matrix1[6608] = 4; d_matrix1[6609] = 5; d_matrix1[6610] = 3; d_matrix1[6611] = 5; d_matrix1[6612] = 4; d_matrix1[6613] = 4; d_matrix1[6614] = 3; d_matrix1[6615] = 3; d_matrix1[6616] = 5; d_matrix1[6617] = 4; d_matrix1[6618] = 5; d_matrix1[6619] = 4; d_matrix1[6620] = 5; d_matrix1[6621] = 5; d_matrix1[6622] = 4; d_matrix1[6623] = 3; d_matrix1[6624] = 2; d_matrix1[6625] = 5; d_matrix1[6626] = 4; d_matrix1[6627] = 4; d_matrix1[6628] = 3; d_matrix1[6629] = 4; d_matrix1[6630] = 3; d_matrix1[6631] = 3; d_matrix1[6632] = 3; d_matrix1[6633] = 4; d_matrix1[6634] = 3; d_matrix1[6635] = 1; d_matrix1[6636] = 4; d_matrix1[6637] = 4; d_matrix1[6638] = 4; d_matrix1[6639] = 1;
d_matrix1[6640] = 0; d_matrix1[6641] = 0; d_matrix1[6642] = 5; d_matrix1[6643] = 3; d_matrix1[6644] = 4; d_matrix1[6645] = 3; d_matrix1[6646] = 3; d_matrix1[6647] = 5; d_matrix1[6648] = 4; d_matrix1[6649] = 1; d_matrix1[6650] = 5; d_matrix1[6651] = 3; d_matrix1[6652] = 2; d_matrix1[6653] = 5; d_matrix1[6654] = 5; d_matrix1[6655] = 5; d_matrix1[6656] = 5; d_matrix1[6657] = 5; d_matrix1[6658] = 3; d_matrix1[6659] = 4; d_matrix1[6660] = 5; d_matrix1[6661] = 4; d_matrix1[6662] = 1; d_matrix1[6663] = 4; d_matrix1[6664] = 4; d_matrix1[6665] = 3; d_matrix1[6666] = 4; d_matrix1[6667] = 3; d_matrix1[6668] = 2; d_matrix1[6669] = 4; d_matrix1[6670] = 1; d_matrix1[6671] = 3; d_matrix1[6672] = 3; d_matrix1[6673] = 5; d_matrix1[6674] = 4; d_matrix1[6675] = 2; d_matrix1[6676] = 1; d_matrix1[6677] = 2; d_matrix1[6678] = 2; d_matrix1[6679] = 3; d_matrix1[6680] = 4; d_matrix1[6681] = 3; d_matrix1[6682] = 2; d_matrix1[6683] = 5; d_matrix1[6684] = 4; d_matrix1[6685] = 5; d_matrix1[6686] = 5; d_matrix1[6687] = 4; d_matrix1[6688] = 4; d_matrix1[6689] = 5; d_matrix1[6690] = 3; d_matrix1[6691] = 5; d_matrix1[6692] = 4; d_matrix1[6693] = 4; d_matrix1[6694] = 3; d_matrix1[6695] = 3; d_matrix1[6696] = 5; d_matrix1[6697] = 4; d_matrix1[6698] = 5; d_matrix1[6699] = 4; d_matrix1[6700] = 5; d_matrix1[6701] = 5; d_matrix1[6702] = 4; d_matrix1[6703] = 3; d_matrix1[6704] = 2; d_matrix1[6705] = 5; d_matrix1[6706] = 4; d_matrix1[6707] = 4; d_matrix1[6708] = 3; d_matrix1[6709] = 4; d_matrix1[6710] = 3; d_matrix1[6711] = 3; d_matrix1[6712] = 3; d_matrix1[6713] = 4; d_matrix1[6714] = 3; d_matrix1[6715] = 1; d_matrix1[6716] = 4; d_matrix1[6717] = 4; d_matrix1[6718] = 4; d_matrix1[6719] = 1;
d_matrix1[6720] = 0; d_matrix1[6721] = 0; d_matrix1[6722] = 5; d_matrix1[6723] = 3; d_matrix1[6724] = 4; d_matrix1[6725] = 3; d_matrix1[6726] = 3; d_matrix1[6727] = 5; d_matrix1[6728] = 4; d_matrix1[6729] = 1; d_matrix1[6730] = 5; d_matrix1[6731] = 3; d_matrix1[6732] = 2; d_matrix1[6733] = 5; d_matrix1[6734] = 5; d_matrix1[6735] = 5; d_matrix1[6736] = 5; d_matrix1[6737] = 5; d_matrix1[6738] = 3; d_matrix1[6739] = 4; d_matrix1[6740] = 5; d_matrix1[6741] = 4; d_matrix1[6742] = 1; d_matrix1[6743] = 4; d_matrix1[6744] = 4; d_matrix1[6745] = 3; d_matrix1[6746] = 4; d_matrix1[6747] = 3; d_matrix1[6748] = 2; d_matrix1[6749] = 4; d_matrix1[6750] = 1; d_matrix1[6751] = 3; d_matrix1[6752] = 3; d_matrix1[6753] = 5; d_matrix1[6754] = 4; d_matrix1[6755] = 2; d_matrix1[6756] = 1; d_matrix1[6757] = 2; d_matrix1[6758] = 2; d_matrix1[6759] = 3; d_matrix1[6760] = 4; d_matrix1[6761] = 3; d_matrix1[6762] = 2; d_matrix1[6763] = 5; d_matrix1[6764] = 4; d_matrix1[6765] = 5; d_matrix1[6766] = 5; d_matrix1[6767] = 4; d_matrix1[6768] = 4; d_matrix1[6769] = 5; d_matrix1[6770] = 3; d_matrix1[6771] = 5; d_matrix1[6772] = 4; d_matrix1[6773] = 4; d_matrix1[6774] = 3; d_matrix1[6775] = 3; d_matrix1[6776] = 5; d_matrix1[6777] = 4; d_matrix1[6778] = 5; d_matrix1[6779] = 4; d_matrix1[6780] = 5; d_matrix1[6781] = 5; d_matrix1[6782] = 4; d_matrix1[6783] = 3; d_matrix1[6784] = 2; d_matrix1[6785] = 5; d_matrix1[6786] = 4; d_matrix1[6787] = 4; d_matrix1[6788] = 3; d_matrix1[6789] = 4; d_matrix1[6790] = 3; d_matrix1[6791] = 3; d_matrix1[6792] = 3; d_matrix1[6793] = 4; d_matrix1[6794] = 3; d_matrix1[6795] = 1; d_matrix1[6796] = 4; d_matrix1[6797] = 4; d_matrix1[6798] = 4; d_matrix1[6799] = 1;
d_matrix1[6800] = 0; d_matrix1[6801] = 0; d_matrix1[6802] = 5; d_matrix1[6803] = 3; d_matrix1[6804] = 4; d_matrix1[6805] = 3; d_matrix1[6806] = 3; d_matrix1[6807] = 5; d_matrix1[6808] = 4; d_matrix1[6809] = 1; d_matrix1[6810] = 5; d_matrix1[6811] = 3; d_matrix1[6812] = 2; d_matrix1[6813] = 5; d_matrix1[6814] = 5; d_matrix1[6815] = 5; d_matrix1[6816] = 5; d_matrix1[6817] = 5; d_matrix1[6818] = 3; d_matrix1[6819] = 4; d_matrix1[6820] = 5; d_matrix1[6821] = 4; d_matrix1[6822] = 1; d_matrix1[6823] = 4; d_matrix1[6824] = 4; d_matrix1[6825] = 3; d_matrix1[6826] = 4; d_matrix1[6827] = 3; d_matrix1[6828] = 2; d_matrix1[6829] = 4; d_matrix1[6830] = 1; d_matrix1[6831] = 3; d_matrix1[6832] = 3; d_matrix1[6833] = 5; d_matrix1[6834] = 4; d_matrix1[6835] = 2; d_matrix1[6836] = 1; d_matrix1[6837] = 2; d_matrix1[6838] = 2; d_matrix1[6839] = 3; d_matrix1[6840] = 4; d_matrix1[6841] = 3; d_matrix1[6842] = 2; d_matrix1[6843] = 5; d_matrix1[6844] = 4; d_matrix1[6845] = 5; d_matrix1[6846] = 5; d_matrix1[6847] = 4; d_matrix1[6848] = 4; d_matrix1[6849] = 5; d_matrix1[6850] = 3; d_matrix1[6851] = 5; d_matrix1[6852] = 4; d_matrix1[6853] = 4; d_matrix1[6854] = 3; d_matrix1[6855] = 3; d_matrix1[6856] = 5; d_matrix1[6857] = 4; d_matrix1[6858] = 5; d_matrix1[6859] = 4; d_matrix1[6860] = 5; d_matrix1[6861] = 5; d_matrix1[6862] = 4; d_matrix1[6863] = 3; d_matrix1[6864] = 2; d_matrix1[6865] = 5; d_matrix1[6866] = 4; d_matrix1[6867] = 4; d_matrix1[6868] = 3; d_matrix1[6869] = 4; d_matrix1[6870] = 3; d_matrix1[6871] = 3; d_matrix1[6872] = 3; d_matrix1[6873] = 4; d_matrix1[6874] = 3; d_matrix1[6875] = 1; d_matrix1[6876] = 4; d_matrix1[6877] = 4; d_matrix1[6878] = 4; d_matrix1[6879] = 1;
d_matrix1[6880] = 0; d_matrix1[6881] = 0; d_matrix1[6882] = 5; d_matrix1[6883] = 3; d_matrix1[6884] = 4; d_matrix1[6885] = 3; d_matrix1[6886] = 3; d_matrix1[6887] = 5; d_matrix1[6888] = 4; d_matrix1[6889] = 1; d_matrix1[6890] = 5; d_matrix1[6891] = 3; d_matrix1[6892] = 2; d_matrix1[6893] = 5; d_matrix1[6894] = 5; d_matrix1[6895] = 5; d_matrix1[6896] = 5; d_matrix1[6897] = 5; d_matrix1[6898] = 3; d_matrix1[6899] = 4; d_matrix1[6900] = 5; d_matrix1[6901] = 4; d_matrix1[6902] = 1; d_matrix1[6903] = 4; d_matrix1[6904] = 4; d_matrix1[6905] = 3; d_matrix1[6906] = 4; d_matrix1[6907] = 3; d_matrix1[6908] = 2; d_matrix1[6909] = 4; d_matrix1[6910] = 1; d_matrix1[6911] = 3; d_matrix1[6912] = 3; d_matrix1[6913] = 5; d_matrix1[6914] = 4; d_matrix1[6915] = 2; d_matrix1[6916] = 1; d_matrix1[6917] = 2; d_matrix1[6918] = 2; d_matrix1[6919] = 3; d_matrix1[6920] = 4; d_matrix1[6921] = 3; d_matrix1[6922] = 2; d_matrix1[6923] = 5; d_matrix1[6924] = 4; d_matrix1[6925] = 5; d_matrix1[6926] = 5; d_matrix1[6927] = 4; d_matrix1[6928] = 4; d_matrix1[6929] = 5; d_matrix1[6930] = 3; d_matrix1[6931] = 5; d_matrix1[6932] = 4; d_matrix1[6933] = 4; d_matrix1[6934] = 3; d_matrix1[6935] = 3; d_matrix1[6936] = 5; d_matrix1[6937] = 4; d_matrix1[6938] = 5; d_matrix1[6939] = 4; d_matrix1[6940] = 5; d_matrix1[6941] = 5; d_matrix1[6942] = 4; d_matrix1[6943] = 3; d_matrix1[6944] = 2; d_matrix1[6945] = 5; d_matrix1[6946] = 4; d_matrix1[6947] = 4; d_matrix1[6948] = 3; d_matrix1[6949] = 4; d_matrix1[6950] = 3; d_matrix1[6951] = 3; d_matrix1[6952] = 3; d_matrix1[6953] = 4; d_matrix1[6954] = 3; d_matrix1[6955] = 1; d_matrix1[6956] = 4; d_matrix1[6957] = 4; d_matrix1[6958] = 4; d_matrix1[6959] = 1;
d_matrix1[6960] = 0; d_matrix1[6961] = 0; d_matrix1[6962] = 5; d_matrix1[6963] = 3; d_matrix1[6964] = 4; d_matrix1[6965] = 3; d_matrix1[6966] = 3; d_matrix1[6967] = 5; d_matrix1[6968] = 4; d_matrix1[6969] = 1; d_matrix1[6970] = 5; d_matrix1[6971] = 3; d_matrix1[6972] = 2; d_matrix1[6973] = 5; d_matrix1[6974] = 5; d_matrix1[6975] = 5; d_matrix1[6976] = 5; d_matrix1[6977] = 5; d_matrix1[6978] = 3; d_matrix1[6979] = 4; d_matrix1[6980] = 5; d_matrix1[6981] = 4; d_matrix1[6982] = 1; d_matrix1[6983] = 4; d_matrix1[6984] = 4; d_matrix1[6985] = 3; d_matrix1[6986] = 4; d_matrix1[6987] = 3; d_matrix1[6988] = 2; d_matrix1[6989] = 4; d_matrix1[6990] = 1; d_matrix1[6991] = 3; d_matrix1[6992] = 3; d_matrix1[6993] = 5; d_matrix1[6994] = 4; d_matrix1[6995] = 2; d_matrix1[6996] = 1; d_matrix1[6997] = 2; d_matrix1[6998] = 2; d_matrix1[6999] = 3; d_matrix1[7000] = 4; d_matrix1[7001] = 3; d_matrix1[7002] = 2; d_matrix1[7003] = 5; d_matrix1[7004] = 4; d_matrix1[7005] = 5; d_matrix1[7006] = 5; d_matrix1[7007] = 4; d_matrix1[7008] = 4; d_matrix1[7009] = 5; d_matrix1[7010] = 3; d_matrix1[7011] = 5; d_matrix1[7012] = 4; d_matrix1[7013] = 4; d_matrix1[7014] = 3; d_matrix1[7015] = 3; d_matrix1[7016] = 5; d_matrix1[7017] = 4; d_matrix1[7018] = 5; d_matrix1[7019] = 4; d_matrix1[7020] = 5; d_matrix1[7021] = 5; d_matrix1[7022] = 4; d_matrix1[7023] = 3; d_matrix1[7024] = 2; d_matrix1[7025] = 5; d_matrix1[7026] = 4; d_matrix1[7027] = 4; d_matrix1[7028] = 3; d_matrix1[7029] = 4; d_matrix1[7030] = 3; d_matrix1[7031] = 3; d_matrix1[7032] = 3; d_matrix1[7033] = 4; d_matrix1[7034] = 3; d_matrix1[7035] = 1; d_matrix1[7036] = 4; d_matrix1[7037] = 4; d_matrix1[7038] = 4; d_matrix1[7039] = 1;
d_matrix1[7040] = 0; d_matrix1[7041] = 0; d_matrix1[7042] = 5; d_matrix1[7043] = 3; d_matrix1[7044] = 4; d_matrix1[7045] = 3; d_matrix1[7046] = 3; d_matrix1[7047] = 5; d_matrix1[7048] = 4; d_matrix1[7049] = 1; d_matrix1[7050] = 5; d_matrix1[7051] = 3; d_matrix1[7052] = 2; d_matrix1[7053] = 5; d_matrix1[7054] = 5; d_matrix1[7055] = 5; d_matrix1[7056] = 5; d_matrix1[7057] = 5; d_matrix1[7058] = 3; d_matrix1[7059] = 4; d_matrix1[7060] = 5; d_matrix1[7061] = 4; d_matrix1[7062] = 1; d_matrix1[7063] = 4; d_matrix1[7064] = 4; d_matrix1[7065] = 3; d_matrix1[7066] = 4; d_matrix1[7067] = 3; d_matrix1[7068] = 2; d_matrix1[7069] = 4; d_matrix1[7070] = 1; d_matrix1[7071] = 3; d_matrix1[7072] = 3; d_matrix1[7073] = 5; d_matrix1[7074] = 4; d_matrix1[7075] = 2; d_matrix1[7076] = 1; d_matrix1[7077] = 2; d_matrix1[7078] = 2; d_matrix1[7079] = 3; d_matrix1[7080] = 4; d_matrix1[7081] = 3; d_matrix1[7082] = 2; d_matrix1[7083] = 5; d_matrix1[7084] = 4; d_matrix1[7085] = 5; d_matrix1[7086] = 5; d_matrix1[7087] = 4; d_matrix1[7088] = 4; d_matrix1[7089] = 5; d_matrix1[7090] = 3; d_matrix1[7091] = 5; d_matrix1[7092] = 4; d_matrix1[7093] = 4; d_matrix1[7094] = 3; d_matrix1[7095] = 3; d_matrix1[7096] = 5; d_matrix1[7097] = 4; d_matrix1[7098] = 5; d_matrix1[7099] = 4; d_matrix1[7100] = 5; d_matrix1[7101] = 5; d_matrix1[7102] = 4; d_matrix1[7103] = 3; d_matrix1[7104] = 2; d_matrix1[7105] = 5; d_matrix1[7106] = 4; d_matrix1[7107] = 4; d_matrix1[7108] = 3; d_matrix1[7109] = 4; d_matrix1[7110] = 3; d_matrix1[7111] = 3; d_matrix1[7112] = 3; d_matrix1[7113] = 4; d_matrix1[7114] = 3; d_matrix1[7115] = 1; d_matrix1[7116] = 4; d_matrix1[7117] = 4; d_matrix1[7118] = 4; d_matrix1[7119] = 1;
d_matrix1[7120] = 0; d_matrix1[7121] = 0; d_matrix1[7122] = 5; d_matrix1[7123] = 3; d_matrix1[7124] = 4; d_matrix1[7125] = 3; d_matrix1[7126] = 3; d_matrix1[7127] = 5; d_matrix1[7128] = 4; d_matrix1[7129] = 1; d_matrix1[7130] = 5; d_matrix1[7131] = 3; d_matrix1[7132] = 2; d_matrix1[7133] = 5; d_matrix1[7134] = 5; d_matrix1[7135] = 5; d_matrix1[7136] = 5; d_matrix1[7137] = 5; d_matrix1[7138] = 3; d_matrix1[7139] = 4; d_matrix1[7140] = 5; d_matrix1[7141] = 4; d_matrix1[7142] = 1; d_matrix1[7143] = 4; d_matrix1[7144] = 4; d_matrix1[7145] = 3; d_matrix1[7146] = 4; d_matrix1[7147] = 3; d_matrix1[7148] = 2; d_matrix1[7149] = 4; d_matrix1[7150] = 1; d_matrix1[7151] = 3; d_matrix1[7152] = 3; d_matrix1[7153] = 5; d_matrix1[7154] = 4; d_matrix1[7155] = 2; d_matrix1[7156] = 1; d_matrix1[7157] = 2; d_matrix1[7158] = 2; d_matrix1[7159] = 3; d_matrix1[7160] = 4; d_matrix1[7161] = 3; d_matrix1[7162] = 2; d_matrix1[7163] = 5; d_matrix1[7164] = 4; d_matrix1[7165] = 5; d_matrix1[7166] = 5; d_matrix1[7167] = 4; d_matrix1[7168] = 4; d_matrix1[7169] = 5; d_matrix1[7170] = 3; d_matrix1[7171] = 5; d_matrix1[7172] = 4; d_matrix1[7173] = 4; d_matrix1[7174] = 3; d_matrix1[7175] = 3; d_matrix1[7176] = 5; d_matrix1[7177] = 4; d_matrix1[7178] = 5; d_matrix1[7179] = 4; d_matrix1[7180] = 5; d_matrix1[7181] = 5; d_matrix1[7182] = 4; d_matrix1[7183] = 3; d_matrix1[7184] = 2; d_matrix1[7185] = 5; d_matrix1[7186] = 4; d_matrix1[7187] = 4; d_matrix1[7188] = 3; d_matrix1[7189] = 4; d_matrix1[7190] = 3; d_matrix1[7191] = 3; d_matrix1[7192] = 3; d_matrix1[7193] = 4; d_matrix1[7194] = 3; d_matrix1[7195] = 1; d_matrix1[7196] = 4; d_matrix1[7197] = 4; d_matrix1[7198] = 4; d_matrix1[7199] = 1;
d_matrix1[7200] = 0; d_matrix1[7201] = 0; d_matrix1[7202] = 5; d_matrix1[7203] = 3; d_matrix1[7204] = 4; d_matrix1[7205] = 3; d_matrix1[7206] = 3; d_matrix1[7207] = 5; d_matrix1[7208] = 4; d_matrix1[7209] = 1; d_matrix1[7210] = 5; d_matrix1[7211] = 3; d_matrix1[7212] = 2; d_matrix1[7213] = 5; d_matrix1[7214] = 5; d_matrix1[7215] = 5; d_matrix1[7216] = 5; d_matrix1[7217] = 5; d_matrix1[7218] = 3; d_matrix1[7219] = 4; d_matrix1[7220] = 5; d_matrix1[7221] = 4; d_matrix1[7222] = 1; d_matrix1[7223] = 4; d_matrix1[7224] = 4; d_matrix1[7225] = 3; d_matrix1[7226] = 4; d_matrix1[7227] = 3; d_matrix1[7228] = 2; d_matrix1[7229] = 4; d_matrix1[7230] = 1; d_matrix1[7231] = 3; d_matrix1[7232] = 3; d_matrix1[7233] = 5; d_matrix1[7234] = 4; d_matrix1[7235] = 2; d_matrix1[7236] = 1; d_matrix1[7237] = 2; d_matrix1[7238] = 2; d_matrix1[7239] = 3; d_matrix1[7240] = 4; d_matrix1[7241] = 3; d_matrix1[7242] = 2; d_matrix1[7243] = 5; d_matrix1[7244] = 4; d_matrix1[7245] = 5; d_matrix1[7246] = 5; d_matrix1[7247] = 4; d_matrix1[7248] = 4; d_matrix1[7249] = 5; d_matrix1[7250] = 3; d_matrix1[7251] = 5; d_matrix1[7252] = 4; d_matrix1[7253] = 4; d_matrix1[7254] = 3; d_matrix1[7255] = 3; d_matrix1[7256] = 5; d_matrix1[7257] = 4; d_matrix1[7258] = 5; d_matrix1[7259] = 4; d_matrix1[7260] = 5; d_matrix1[7261] = 5; d_matrix1[7262] = 4; d_matrix1[7263] = 3; d_matrix1[7264] = 2; d_matrix1[7265] = 5; d_matrix1[7266] = 4; d_matrix1[7267] = 4; d_matrix1[7268] = 3; d_matrix1[7269] = 4; d_matrix1[7270] = 3; d_matrix1[7271] = 3; d_matrix1[7272] = 3; d_matrix1[7273] = 4; d_matrix1[7274] = 3; d_matrix1[7275] = 1; d_matrix1[7276] = 4; d_matrix1[7277] = 4; d_matrix1[7278] = 4; d_matrix1[7279] = 1;
d_matrix1[7280] = 0; d_matrix1[7281] = 0; d_matrix1[7282] = 5; d_matrix1[7283] = 3; d_matrix1[7284] = 4; d_matrix1[7285] = 3; d_matrix1[7286] = 3; d_matrix1[7287] = 5; d_matrix1[7288] = 4; d_matrix1[7289] = 1; d_matrix1[7290] = 5; d_matrix1[7291] = 3; d_matrix1[7292] = 2; d_matrix1[7293] = 5; d_matrix1[7294] = 5; d_matrix1[7295] = 5; d_matrix1[7296] = 5; d_matrix1[7297] = 5; d_matrix1[7298] = 3; d_matrix1[7299] = 4; d_matrix1[7300] = 5; d_matrix1[7301] = 4; d_matrix1[7302] = 1; d_matrix1[7303] = 4; d_matrix1[7304] = 4; d_matrix1[7305] = 3; d_matrix1[7306] = 4; d_matrix1[7307] = 3; d_matrix1[7308] = 2; d_matrix1[7309] = 4; d_matrix1[7310] = 1; d_matrix1[7311] = 3; d_matrix1[7312] = 3; d_matrix1[7313] = 5; d_matrix1[7314] = 4; d_matrix1[7315] = 2; d_matrix1[7316] = 1; d_matrix1[7317] = 2; d_matrix1[7318] = 2; d_matrix1[7319] = 3; d_matrix1[7320] = 4; d_matrix1[7321] = 3; d_matrix1[7322] = 2; d_matrix1[7323] = 5; d_matrix1[7324] = 4; d_matrix1[7325] = 5; d_matrix1[7326] = 5; d_matrix1[7327] = 4; d_matrix1[7328] = 4; d_matrix1[7329] = 5; d_matrix1[7330] = 3; d_matrix1[7331] = 5; d_matrix1[7332] = 4; d_matrix1[7333] = 4; d_matrix1[7334] = 3; d_matrix1[7335] = 3; d_matrix1[7336] = 5; d_matrix1[7337] = 4; d_matrix1[7338] = 5; d_matrix1[7339] = 4; d_matrix1[7340] = 5; d_matrix1[7341] = 5; d_matrix1[7342] = 4; d_matrix1[7343] = 3; d_matrix1[7344] = 2; d_matrix1[7345] = 5; d_matrix1[7346] = 4; d_matrix1[7347] = 4; d_matrix1[7348] = 3; d_matrix1[7349] = 4; d_matrix1[7350] = 3; d_matrix1[7351] = 3; d_matrix1[7352] = 3; d_matrix1[7353] = 4; d_matrix1[7354] = 3; d_matrix1[7355] = 1; d_matrix1[7356] = 4; d_matrix1[7357] = 4; d_matrix1[7358] = 4; d_matrix1[7359] = 1;
d_matrix1[7360] = 0; d_matrix1[7361] = 0; d_matrix1[7362] = 5; d_matrix1[7363] = 3; d_matrix1[7364] = 4; d_matrix1[7365] = 3; d_matrix1[7366] = 3; d_matrix1[7367] = 5; d_matrix1[7368] = 4; d_matrix1[7369] = 1; d_matrix1[7370] = 5; d_matrix1[7371] = 3; d_matrix1[7372] = 2; d_matrix1[7373] = 5; d_matrix1[7374] = 5; d_matrix1[7375] = 5; d_matrix1[7376] = 5; d_matrix1[7377] = 5; d_matrix1[7378] = 3; d_matrix1[7379] = 4; d_matrix1[7380] = 5; d_matrix1[7381] = 4; d_matrix1[7382] = 1; d_matrix1[7383] = 4; d_matrix1[7384] = 4; d_matrix1[7385] = 3; d_matrix1[7386] = 4; d_matrix1[7387] = 3; d_matrix1[7388] = 2; d_matrix1[7389] = 4; d_matrix1[7390] = 1; d_matrix1[7391] = 3; d_matrix1[7392] = 3; d_matrix1[7393] = 5; d_matrix1[7394] = 4; d_matrix1[7395] = 2; d_matrix1[7396] = 1; d_matrix1[7397] = 2; d_matrix1[7398] = 2; d_matrix1[7399] = 3; d_matrix1[7400] = 4; d_matrix1[7401] = 3; d_matrix1[7402] = 2; d_matrix1[7403] = 5; d_matrix1[7404] = 4; d_matrix1[7405] = 5; d_matrix1[7406] = 5; d_matrix1[7407] = 4; d_matrix1[7408] = 4; d_matrix1[7409] = 5; d_matrix1[7410] = 3; d_matrix1[7411] = 5; d_matrix1[7412] = 4; d_matrix1[7413] = 4; d_matrix1[7414] = 3; d_matrix1[7415] = 3; d_matrix1[7416] = 5; d_matrix1[7417] = 4; d_matrix1[7418] = 5; d_matrix1[7419] = 4; d_matrix1[7420] = 5; d_matrix1[7421] = 5; d_matrix1[7422] = 4; d_matrix1[7423] = 3; d_matrix1[7424] = 2; d_matrix1[7425] = 5; d_matrix1[7426] = 4; d_matrix1[7427] = 4; d_matrix1[7428] = 3; d_matrix1[7429] = 4; d_matrix1[7430] = 3; d_matrix1[7431] = 3; d_matrix1[7432] = 3; d_matrix1[7433] = 4; d_matrix1[7434] = 3; d_matrix1[7435] = 1; d_matrix1[7436] = 4; d_matrix1[7437] = 4; d_matrix1[7438] = 4; d_matrix1[7439] = 1;
d_matrix1[7440] = 0; d_matrix1[7441] = 0; d_matrix1[7442] = 5; d_matrix1[7443] = 3; d_matrix1[7444] = 4; d_matrix1[7445] = 3; d_matrix1[7446] = 3; d_matrix1[7447] = 5; d_matrix1[7448] = 4; d_matrix1[7449] = 1; d_matrix1[7450] = 5; d_matrix1[7451] = 3; d_matrix1[7452] = 2; d_matrix1[7453] = 5; d_matrix1[7454] = 5; d_matrix1[7455] = 5; d_matrix1[7456] = 5; d_matrix1[7457] = 5; d_matrix1[7458] = 3; d_matrix1[7459] = 4; d_matrix1[7460] = 5; d_matrix1[7461] = 4; d_matrix1[7462] = 1; d_matrix1[7463] = 4; d_matrix1[7464] = 4; d_matrix1[7465] = 3; d_matrix1[7466] = 4; d_matrix1[7467] = 3; d_matrix1[7468] = 2; d_matrix1[7469] = 4; d_matrix1[7470] = 1; d_matrix1[7471] = 3; d_matrix1[7472] = 3; d_matrix1[7473] = 5; d_matrix1[7474] = 4; d_matrix1[7475] = 2; d_matrix1[7476] = 1; d_matrix1[7477] = 2; d_matrix1[7478] = 2; d_matrix1[7479] = 3; d_matrix1[7480] = 4; d_matrix1[7481] = 3; d_matrix1[7482] = 2; d_matrix1[7483] = 5; d_matrix1[7484] = 4; d_matrix1[7485] = 5; d_matrix1[7486] = 5; d_matrix1[7487] = 4; d_matrix1[7488] = 4; d_matrix1[7489] = 5; d_matrix1[7490] = 3; d_matrix1[7491] = 5; d_matrix1[7492] = 4; d_matrix1[7493] = 4; d_matrix1[7494] = 3; d_matrix1[7495] = 3; d_matrix1[7496] = 5; d_matrix1[7497] = 4; d_matrix1[7498] = 5; d_matrix1[7499] = 4; d_matrix1[7500] = 5; d_matrix1[7501] = 5; d_matrix1[7502] = 4; d_matrix1[7503] = 3; d_matrix1[7504] = 2; d_matrix1[7505] = 5; d_matrix1[7506] = 4; d_matrix1[7507] = 4; d_matrix1[7508] = 3; d_matrix1[7509] = 4; d_matrix1[7510] = 3; d_matrix1[7511] = 3; d_matrix1[7512] = 3; d_matrix1[7513] = 4; d_matrix1[7514] = 3; d_matrix1[7515] = 1; d_matrix1[7516] = 4; d_matrix1[7517] = 4; d_matrix1[7518] = 4; d_matrix1[7519] = 1;
d_matrix1[7520] = 0; d_matrix1[7521] = 0; d_matrix1[7522] = 5; d_matrix1[7523] = 3; d_matrix1[7524] = 4; d_matrix1[7525] = 3; d_matrix1[7526] = 3; d_matrix1[7527] = 5; d_matrix1[7528] = 4; d_matrix1[7529] = 1; d_matrix1[7530] = 5; d_matrix1[7531] = 3; d_matrix1[7532] = 2; d_matrix1[7533] = 5; d_matrix1[7534] = 5; d_matrix1[7535] = 5; d_matrix1[7536] = 5; d_matrix1[7537] = 5; d_matrix1[7538] = 3; d_matrix1[7539] = 4; d_matrix1[7540] = 5; d_matrix1[7541] = 4; d_matrix1[7542] = 1; d_matrix1[7543] = 4; d_matrix1[7544] = 4; d_matrix1[7545] = 3; d_matrix1[7546] = 4; d_matrix1[7547] = 3; d_matrix1[7548] = 2; d_matrix1[7549] = 4; d_matrix1[7550] = 1; d_matrix1[7551] = 3; d_matrix1[7552] = 3; d_matrix1[7553] = 5; d_matrix1[7554] = 4; d_matrix1[7555] = 2; d_matrix1[7556] = 1; d_matrix1[7557] = 2; d_matrix1[7558] = 2; d_matrix1[7559] = 3; d_matrix1[7560] = 4; d_matrix1[7561] = 3; d_matrix1[7562] = 2; d_matrix1[7563] = 5; d_matrix1[7564] = 4; d_matrix1[7565] = 5; d_matrix1[7566] = 5; d_matrix1[7567] = 4; d_matrix1[7568] = 4; d_matrix1[7569] = 5; d_matrix1[7570] = 3; d_matrix1[7571] = 5; d_matrix1[7572] = 4; d_matrix1[7573] = 4; d_matrix1[7574] = 3; d_matrix1[7575] = 3; d_matrix1[7576] = 5; d_matrix1[7577] = 4; d_matrix1[7578] = 5; d_matrix1[7579] = 4; d_matrix1[7580] = 5; d_matrix1[7581] = 5; d_matrix1[7582] = 4; d_matrix1[7583] = 3; d_matrix1[7584] = 2; d_matrix1[7585] = 5; d_matrix1[7586] = 4; d_matrix1[7587] = 4; d_matrix1[7588] = 3; d_matrix1[7589] = 4; d_matrix1[7590] = 3; d_matrix1[7591] = 3; d_matrix1[7592] = 3; d_matrix1[7593] = 4; d_matrix1[7594] = 3; d_matrix1[7595] = 1; d_matrix1[7596] = 4; d_matrix1[7597] = 4; d_matrix1[7598] = 4; d_matrix1[7599] = 1;
d_matrix1[7600] = 0; d_matrix1[7601] = 0; d_matrix1[7602] = 5; d_matrix1[7603] = 3; d_matrix1[7604] = 4; d_matrix1[7605] = 3; d_matrix1[7606] = 3; d_matrix1[7607] = 5; d_matrix1[7608] = 4; d_matrix1[7609] = 1; d_matrix1[7610] = 5; d_matrix1[7611] = 3; d_matrix1[7612] = 2; d_matrix1[7613] = 5; d_matrix1[7614] = 5; d_matrix1[7615] = 5; d_matrix1[7616] = 5; d_matrix1[7617] = 5; d_matrix1[7618] = 3; d_matrix1[7619] = 4; d_matrix1[7620] = 5; d_matrix1[7621] = 4; d_matrix1[7622] = 1; d_matrix1[7623] = 4; d_matrix1[7624] = 4; d_matrix1[7625] = 3; d_matrix1[7626] = 4; d_matrix1[7627] = 3; d_matrix1[7628] = 2; d_matrix1[7629] = 4; d_matrix1[7630] = 1; d_matrix1[7631] = 3; d_matrix1[7632] = 3; d_matrix1[7633] = 5; d_matrix1[7634] = 4; d_matrix1[7635] = 2; d_matrix1[7636] = 1; d_matrix1[7637] = 2; d_matrix1[7638] = 2; d_matrix1[7639] = 3; d_matrix1[7640] = 4; d_matrix1[7641] = 3; d_matrix1[7642] = 2; d_matrix1[7643] = 5; d_matrix1[7644] = 4; d_matrix1[7645] = 5; d_matrix1[7646] = 5; d_matrix1[7647] = 4; d_matrix1[7648] = 4; d_matrix1[7649] = 5; d_matrix1[7650] = 3; d_matrix1[7651] = 5; d_matrix1[7652] = 4; d_matrix1[7653] = 4; d_matrix1[7654] = 3; d_matrix1[7655] = 3; d_matrix1[7656] = 5; d_matrix1[7657] = 4; d_matrix1[7658] = 5; d_matrix1[7659] = 4; d_matrix1[7660] = 5; d_matrix1[7661] = 5; d_matrix1[7662] = 4; d_matrix1[7663] = 3; d_matrix1[7664] = 2; d_matrix1[7665] = 5; d_matrix1[7666] = 4; d_matrix1[7667] = 4; d_matrix1[7668] = 3; d_matrix1[7669] = 4; d_matrix1[7670] = 3; d_matrix1[7671] = 3; d_matrix1[7672] = 3; d_matrix1[7673] = 4; d_matrix1[7674] = 3; d_matrix1[7675] = 1; d_matrix1[7676] = 4; d_matrix1[7677] = 4; d_matrix1[7678] = 4; d_matrix1[7679] = 1;
d_matrix1[7680] = 0; d_matrix1[7681] = 0; d_matrix1[7682] = 5; d_matrix1[7683] = 3; d_matrix1[7684] = 4; d_matrix1[7685] = 3; d_matrix1[7686] = 3; d_matrix1[7687] = 5; d_matrix1[7688] = 4; d_matrix1[7689] = 1; d_matrix1[7690] = 5; d_matrix1[7691] = 3; d_matrix1[7692] = 2; d_matrix1[7693] = 5; d_matrix1[7694] = 5; d_matrix1[7695] = 5; d_matrix1[7696] = 5; d_matrix1[7697] = 5; d_matrix1[7698] = 3; d_matrix1[7699] = 4; d_matrix1[7700] = 5; d_matrix1[7701] = 4; d_matrix1[7702] = 1; d_matrix1[7703] = 4; d_matrix1[7704] = 4; d_matrix1[7705] = 3; d_matrix1[7706] = 4; d_matrix1[7707] = 3; d_matrix1[7708] = 2; d_matrix1[7709] = 4; d_matrix1[7710] = 1; d_matrix1[7711] = 3; d_matrix1[7712] = 3; d_matrix1[7713] = 5; d_matrix1[7714] = 4; d_matrix1[7715] = 2; d_matrix1[7716] = 1; d_matrix1[7717] = 2; d_matrix1[7718] = 2; d_matrix1[7719] = 3; d_matrix1[7720] = 4; d_matrix1[7721] = 3; d_matrix1[7722] = 2; d_matrix1[7723] = 5; d_matrix1[7724] = 4; d_matrix1[7725] = 5; d_matrix1[7726] = 5; d_matrix1[7727] = 4; d_matrix1[7728] = 4; d_matrix1[7729] = 5; d_matrix1[7730] = 3; d_matrix1[7731] = 5; d_matrix1[7732] = 4; d_matrix1[7733] = 4; d_matrix1[7734] = 3; d_matrix1[7735] = 3; d_matrix1[7736] = 5; d_matrix1[7737] = 4; d_matrix1[7738] = 5; d_matrix1[7739] = 4; d_matrix1[7740] = 5; d_matrix1[7741] = 5; d_matrix1[7742] = 4; d_matrix1[7743] = 3; d_matrix1[7744] = 2; d_matrix1[7745] = 5; d_matrix1[7746] = 4; d_matrix1[7747] = 4; d_matrix1[7748] = 3; d_matrix1[7749] = 4; d_matrix1[7750] = 3; d_matrix1[7751] = 3; d_matrix1[7752] = 3; d_matrix1[7753] = 4; d_matrix1[7754] = 3; d_matrix1[7755] = 1; d_matrix1[7756] = 4; d_matrix1[7757] = 4; d_matrix1[7758] = 4; d_matrix1[7759] = 1;
d_matrix1[7760] = 0; d_matrix1[7761] = 0; d_matrix1[7762] = 5; d_matrix1[7763] = 3; d_matrix1[7764] = 4; d_matrix1[7765] = 3; d_matrix1[7766] = 3; d_matrix1[7767] = 5; d_matrix1[7768] = 4; d_matrix1[7769] = 1; d_matrix1[7770] = 5; d_matrix1[7771] = 3; d_matrix1[7772] = 2; d_matrix1[7773] = 5; d_matrix1[7774] = 5; d_matrix1[7775] = 5; d_matrix1[7776] = 5; d_matrix1[7777] = 5; d_matrix1[7778] = 3; d_matrix1[7779] = 4; d_matrix1[7780] = 5; d_matrix1[7781] = 4; d_matrix1[7782] = 1; d_matrix1[7783] = 4; d_matrix1[7784] = 4; d_matrix1[7785] = 3; d_matrix1[7786] = 4; d_matrix1[7787] = 3; d_matrix1[7788] = 2; d_matrix1[7789] = 4; d_matrix1[7790] = 1; d_matrix1[7791] = 3; d_matrix1[7792] = 3; d_matrix1[7793] = 5; d_matrix1[7794] = 4; d_matrix1[7795] = 2; d_matrix1[7796] = 1; d_matrix1[7797] = 2; d_matrix1[7798] = 2; d_matrix1[7799] = 3; d_matrix1[7800] = 4; d_matrix1[7801] = 3; d_matrix1[7802] = 2; d_matrix1[7803] = 5; d_matrix1[7804] = 4; d_matrix1[7805] = 5; d_matrix1[7806] = 5; d_matrix1[7807] = 4; d_matrix1[7808] = 4; d_matrix1[7809] = 5; d_matrix1[7810] = 3; d_matrix1[7811] = 5; d_matrix1[7812] = 4; d_matrix1[7813] = 4; d_matrix1[7814] = 3; d_matrix1[7815] = 3; d_matrix1[7816] = 5; d_matrix1[7817] = 4; d_matrix1[7818] = 5; d_matrix1[7819] = 4; d_matrix1[7820] = 5; d_matrix1[7821] = 5; d_matrix1[7822] = 4; d_matrix1[7823] = 3; d_matrix1[7824] = 2; d_matrix1[7825] = 5; d_matrix1[7826] = 4; d_matrix1[7827] = 4; d_matrix1[7828] = 3; d_matrix1[7829] = 4; d_matrix1[7830] = 3; d_matrix1[7831] = 3; d_matrix1[7832] = 3; d_matrix1[7833] = 4; d_matrix1[7834] = 3; d_matrix1[7835] = 1; d_matrix1[7836] = 4; d_matrix1[7837] = 4; d_matrix1[7838] = 4; d_matrix1[7839] = 1;
d_matrix1[7840] = 0; d_matrix1[7841] = 0; d_matrix1[7842] = 5; d_matrix1[7843] = 3; d_matrix1[7844] = 4; d_matrix1[7845] = 3; d_matrix1[7846] = 3; d_matrix1[7847] = 5; d_matrix1[7848] = 4; d_matrix1[7849] = 1; d_matrix1[7850] = 5; d_matrix1[7851] = 3; d_matrix1[7852] = 2; d_matrix1[7853] = 5; d_matrix1[7854] = 5; d_matrix1[7855] = 5; d_matrix1[7856] = 5; d_matrix1[7857] = 5; d_matrix1[7858] = 3; d_matrix1[7859] = 4; d_matrix1[7860] = 5; d_matrix1[7861] = 4; d_matrix1[7862] = 1; d_matrix1[7863] = 4; d_matrix1[7864] = 4; d_matrix1[7865] = 3; d_matrix1[7866] = 4; d_matrix1[7867] = 3; d_matrix1[7868] = 2; d_matrix1[7869] = 4; d_matrix1[7870] = 1; d_matrix1[7871] = 3; d_matrix1[7872] = 3; d_matrix1[7873] = 5; d_matrix1[7874] = 4; d_matrix1[7875] = 2; d_matrix1[7876] = 1; d_matrix1[7877] = 2; d_matrix1[7878] = 2; d_matrix1[7879] = 3; d_matrix1[7880] = 4; d_matrix1[7881] = 3; d_matrix1[7882] = 2; d_matrix1[7883] = 5; d_matrix1[7884] = 4; d_matrix1[7885] = 5; d_matrix1[7886] = 5; d_matrix1[7887] = 4; d_matrix1[7888] = 4; d_matrix1[7889] = 5; d_matrix1[7890] = 3; d_matrix1[7891] = 5; d_matrix1[7892] = 4; d_matrix1[7893] = 4; d_matrix1[7894] = 3; d_matrix1[7895] = 3; d_matrix1[7896] = 5; d_matrix1[7897] = 4; d_matrix1[7898] = 5; d_matrix1[7899] = 4; d_matrix1[7900] = 5; d_matrix1[7901] = 5; d_matrix1[7902] = 4; d_matrix1[7903] = 3; d_matrix1[7904] = 2; d_matrix1[7905] = 5; d_matrix1[7906] = 4; d_matrix1[7907] = 4; d_matrix1[7908] = 3; d_matrix1[7909] = 4; d_matrix1[7910] = 3; d_matrix1[7911] = 3; d_matrix1[7912] = 3; d_matrix1[7913] = 4; d_matrix1[7914] = 3; d_matrix1[7915] = 1; d_matrix1[7916] = 4; d_matrix1[7917] = 4; d_matrix1[7918] = 4; d_matrix1[7919] = 1;
d_matrix1[7920] = 0; d_matrix1[7921] = 0; d_matrix1[7922] = 5; d_matrix1[7923] = 3; d_matrix1[7924] = 4; d_matrix1[7925] = 3; d_matrix1[7926] = 3; d_matrix1[7927] = 5; d_matrix1[7928] = 4; d_matrix1[7929] = 1; d_matrix1[7930] = 5; d_matrix1[7931] = 3; d_matrix1[7932] = 2; d_matrix1[7933] = 5; d_matrix1[7934] = 5; d_matrix1[7935] = 5; d_matrix1[7936] = 5; d_matrix1[7937] = 5; d_matrix1[7938] = 3; d_matrix1[7939] = 4; d_matrix1[7940] = 5; d_matrix1[7941] = 4; d_matrix1[7942] = 1; d_matrix1[7943] = 4; d_matrix1[7944] = 4; d_matrix1[7945] = 3; d_matrix1[7946] = 4; d_matrix1[7947] = 3; d_matrix1[7948] = 2; d_matrix1[7949] = 4; d_matrix1[7950] = 1; d_matrix1[7951] = 3; d_matrix1[7952] = 3; d_matrix1[7953] = 5; d_matrix1[7954] = 4; d_matrix1[7955] = 2; d_matrix1[7956] = 1; d_matrix1[7957] = 2; d_matrix1[7958] = 2; d_matrix1[7959] = 3; d_matrix1[7960] = 4; d_matrix1[7961] = 3; d_matrix1[7962] = 2; d_matrix1[7963] = 5; d_matrix1[7964] = 4; d_matrix1[7965] = 5; d_matrix1[7966] = 5; d_matrix1[7967] = 4; d_matrix1[7968] = 4; d_matrix1[7969] = 5; d_matrix1[7970] = 3; d_matrix1[7971] = 5; d_matrix1[7972] = 4; d_matrix1[7973] = 4; d_matrix1[7974] = 3; d_matrix1[7975] = 3; d_matrix1[7976] = 5; d_matrix1[7977] = 4; d_matrix1[7978] = 5; d_matrix1[7979] = 4; d_matrix1[7980] = 5; d_matrix1[7981] = 5; d_matrix1[7982] = 4; d_matrix1[7983] = 3; d_matrix1[7984] = 2; d_matrix1[7985] = 5; d_matrix1[7986] = 4; d_matrix1[7987] = 4; d_matrix1[7988] = 3; d_matrix1[7989] = 4; d_matrix1[7990] = 3; d_matrix1[7991] = 3; d_matrix1[7992] = 3; d_matrix1[7993] = 4; d_matrix1[7994] = 3; d_matrix1[7995] = 1; d_matrix1[7996] = 4; d_matrix1[7997] = 4; d_matrix1[7998] = 4; d_matrix1[7999] = 1;
printf("\n\nFirst matrix\n");
for(int i = 0; i < Nvec; i++) {
std::cout << " [ ";
for(int j = 0; j < N; j++)
std::cout << d_matrix1[i * N + j] << " ";
std::cout << "]\n";
}
printf("\n\nSecond matrix\n");
for(int i = 0; i < Nvec; i++) {
std::cout << " [ ";
for(int j = 0; j < N; j++)
std::cout << d_matrix2[i * N + j] << " ";
std::cout << "]\n";
}
/****************************************************************************/
/* CALCULATING THE EUCLIDEAN DISTANCES BETWEEN THE ROWS OF THE TWO MATRICES */
/****************************************************************************/
// --- Creating the indices for the reduction by key
thrust::device_vector<int> d_sequence(Nvec);
thrust::device_vector<int> d_indices(Nvec * N);
thrust::device_vector<int> d_counts(Nvec, N);
thrust::sequence(d_sequence.begin(), d_sequence.begin() + Nvec);
expand(d_counts.begin(), d_counts.end(), d_sequence.begin(), d_indices.begin());
printf("\n\nIndex matrix\n");
for(int i = 0; i < Nvec; i++) {
std::cout << " [ ";
for(int j = 0; j < N; j++)
std::cout << d_indices[i * N + j] << " ";
std::cout << "]\n";
}
thrust::device_vector<float> d_devnull(Nvec);
thrust::device_vector<float> d_squared_differences(Nvec * N);
thrust::transform(d_matrix1.begin(), d_matrix1.end(), d_matrix2.begin(), d_squared_differences.begin(), PowerDifference());
thrust::device_vector<float> d_norms(Nvec);
thrust::reduce_by_key(d_indices.begin(), d_indices.end(), d_squared_differences.begin(), d_devnull.begin(), d_norms.begin());
thrust::device_vector<float> d_cuenta(Nvec * N);
thrust::transform(d_matrix1.begin(), d_matrix1.end(), d_matrix2.begin(), d_cuenta.begin(), countIfNoZeros());
thrust::device_vector<float> d_dividendo(Nvec);
thrust::reduce_by_key(d_indices.begin(), d_indices.end(), d_cuenta.begin(), d_devnull.begin(), d_dividendo.begin());
thrust::device_vector<float> d_distancias_euclidianas(Nvec);
thrust::transform(d_norms.begin(), d_norms.end(), d_dividendo.begin(), d_distancias_euclidianas.begin(), thrust::divides<float>());
printf("\n\nDistancia Euclidiana \n");
for(int i = 0; i < Nvec; i++) {
// std::cout << (d_norms[i]/d_dividendo[i]) << " ";
std::cout << d_norms[i] << "/" << d_dividendo[i] << "=" << d_distancias_euclidianas[i] << " \n";
}
thrust::device_vector<int> user_index(Nvec);
thrust::sequence(user_index.begin(), user_index.end(), 0, 1);
thrust::sort_by_key(user_index.begin(), user_index.end(), d_distancias_euclidianas.begin());
std::cout << "La menor distancias es :" << d_distancias_euclidianas[1] << " del usuario " << user_index[1]<< " \n";
return 0;
}
|
8,550 | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <cuda.h>
#define SIZE(A) A*sizeof(int)
// for this method to work, (MULTIPLIER_SIZE <= NUM_MULTIPLIERS) must be true
#define MULTIPLIER_SIZE 32
#define NUM_MULTIPLIERS 32 // arbitrary size
typedef struct {
int ibits, obits; // bit precision of neurons
int stride; // filter stride length
int nx, ny, nz; // input dimensions
int f; // number of filters
int sx, sy; // filter dimensions
int ox, oy; // output dimensions
} conv_data;
__global__ void CLCTest(int *neuron, int *synapse, int *output, conv_data cd) {
volatile int tid = threadIdx.x;
int bid = blockIdx.x;
bool last_block = (cd.ox*cd.oy / NUM_MULTIPLIERS + ((cd.ox*cd.oy) % NUM_MULTIPLIERS != 0) - 1) == bid;
int window_size = cd.sx*cd.sy*cd.nz;
int num_windows = cd.ox*cd.oy;
for (int i = 0; i < window_size/NUM_MULTIPLIERS; i++) {
volatile int out_neuron;
volatile int j;
// send groups of 4 neurons to the operand collector
for (j = bid*MULTIPLIER_SIZE+3; (j < (bid+1)*MULTIPLIER_SIZE) && (j < num_windows); j += 4) {
int temp[4];
for (int k = 0; k < 4; k++) {
temp[k] = i*NUM_MULTIPLIERS+tid + ((j-3+k)/cd.oy)*cd.ny*cd.nz*cd.stride + ((j-3+k)%cd.oy)*cd.nz*cd.stride;
}
asm("/*");
asm("CPTX_BEGIN");
asm("clp.s32 %0, %1, %2, %3;" :: "r"(neuron[temp[0]]), "r"(neuron[temp[1]]), "r"(neuron[temp[2]]), "r"(neuron[temp[3]]));
asm("CPTX_END");
asm("*/");
}
// send the remaining neurons individually to the operand collector
if (last_block) { // this assumes MULTIPLIER_SIZE % 4 == 0
j -= 3; // revert the last iteration from previous for loop and add 1
for (; j < num_windows; j++) {
asm("/*");
asm("CPTX_BEGIN");
asm("clp.s32 %0;" :: "r"(neuron[i+tid + (j/cd.oy)*cd.ny*cd.nz*cd.stride + (j%cd.oy)*cd.nz*cd.stride]));
asm("CPTX_END");
asm("*/");
}
}
// compute the result
asm("/*");
asm("CPTX_BEGIN");
asm("clc.s32 %0, %1, %2, %3;" : "=r"(out_neuron) : "r"(synapse[i*NUM_MULTIPLIERS+tid]), "r"(cd.ibits), "r"(cd.obits));
asm("CPTX_END");
asm("*/");
// store the result, making sure the garbage return values are ignored
if ((!last_block && (tid < MULTIPLIER_SIZE)) || (last_block && (tid < num_windows % MULTIPLIER_SIZE))) {
output[bid*MULTIPLIER_SIZE + tid] += out_neuron;
}
}
}
int main(int argc, char** argv) {
conv_data cd;
cd.ibits = 4; cd.obits = 8; cd.stride = 2;
cd.nx = 8; cd.ny = 8; cd.nz = 3; cd.f = 2;
cd.sx = 4; cd.sy = 4; cd.ox = 3; cd.oy = 3;
// ox = (nx-sx)/stride + 1;
// oy = (ny-sy)/stride + 1;
int neuron[cd.nx*cd.ny*cd.nz];
int synapse[cd.f*cd.sx*cd.sy*cd.nz];
int output[cd.f*cd.ox*cd.oy];
memset(output, 0, SIZE(cd.ox*cd.oy*cd.f));
FILE *fp;
fp = fopen("input", "r");
// collect neuron data
for (int k = 0; k < cd.nz; k++) {
for (int j = 0; j < cd.ny; j++) {
for (int i = 0; i < cd.nx; i++) {
fscanf(fp, "%d", &neuron[i*cd.ny*cd.nz + j*cd.nz + k]);
}
}
}
// collect synapse data
for (int l = 0; l < cd.f; l++) {
for (int k = 0; k < cd.nz; k++) {
for (int j = 0; j < cd.sy; j++) {
for (int i = 0; i < cd.sx; i++) {
fscanf(fp, "%d", &synapse[l*cd.sx*cd.sy*cd.nz + i*cd.sy*cd.nz + j*cd.nz + k]);
}
}
}
}
fclose(fp);
int *d_neuron, *d_synapse, *d_output;
cudaMalloc(&d_neuron, SIZE(cd.nx*cd.ny*cd.nz));
cudaMalloc(&d_synapse, SIZE(cd.f*cd.sx*cd.sy*cd.nz));
cudaMalloc(&d_output, SIZE(cd.ox*cd.oy*cd.f));
cudaMemcpy(d_neuron, neuron, SIZE(cd.nx*cd.ny*cd.nz), cudaMemcpyHostToDevice);
cudaMemcpy(d_synapse, synapse, SIZE(cd.f*cd.sx*cd.sy*cd.nz), cudaMemcpyHostToDevice);
cudaMemcpy(d_output, output, SIZE(cd.ox*cd.oy*cd.f), cudaMemcpyHostToDevice);
// one thread block is composed of MULTIPLIER_SIZE windows and NUM_MULTIPLIERS threads
int blocks = cd.ox*cd.oy / NUM_MULTIPLIERS + ((cd.ox*cd.oy) % NUM_MULTIPLIERS != 0);
// apply one filter per kernel
for (int f = 0; f < cd.f; f++) {
CLCTest<<<blocks, NUM_MULTIPLIERS>>>(d_neuron, d_synapse + f*cd.sx*cd.sy*cd.nz, d_output + f*cd.ox*cd.oy, cd);
}
cudaMemcpy(output, d_output, SIZE(cd.ox*cd.oy*cd.f), cudaMemcpyDeviceToHost);
// print output
for (int k = 0; k < cd.f; k++) {
for (int j = 0; j < cd.oy; j++) {
for (int i = 0; i < cd.ox; i++) {
printf("%d ", output[k*cd.ox*cd.oy + i*cd.oy + j]);
}
printf("\n");
}
printf("\n");
}
cudaFree(d_neuron);
cudaFree(d_synapse);
cudaFree(d_output);
return 0;
}
|
8,551 | /// LSU EE 4702-1 (Fall 2018), GPU Programming
//
/// Simple CUDA Example, without LSU ECE helper classes.
/// References
//
// :ccpg8: CUDA C Programming Guide Version 8
// https://docs.nvidia.com/cuda/cuda-c-programming-guide
#if 0
/// Background
/// CUDA
//
// NVIDIA's system for programming NVIDIA GPUs.
//
// Intended for non-graphical computation, widely used for
// scientific computation.
//
/// CUDA Components.
//
// - CUDA C
// Language used for writing code that runs on the GPU.
//
// - CUDA Runtime API
// Library used for managing the execution of code on the GPU.
//
// - CUDA Compiler Toolchain
// The "compiler" nvcc, and related tools.
//
// - CUDA Compatible GPU
// Probably just NVIDIA GPUs.
/// CUDA C
//
// Language used for writing code that runs on the GPU.
//
// A file can contain both CUDA C and C for the host compiler ...
// ... that is the case for this file.
//
// In this file CUDA C is in routine: cuda_thread_start()
//
// Syntactically similar to C++.
//
// Major Differences
//
// Executes as a hierarchy of threads.
//
// Specialized address spaces.
/// CUDA C Runtime API
//
// Library calls used on CPU side to manage execution on GPU.
//
// Activities Performed with API
//
// o Send data from CPU to GPU.
// o Start execution of GPU code.
// o Send data from GPU to CPU.
/// CUDA Address Spaces
//
/// Global Address Space
//
// Works like "regular" memory on CPU, but it's usually separated.
// Uses the same hardware as OpenGL buffer objects.
/// Constant Address Space
//
// Limited amount of storage, read-only on GPU.
// Probably uses the same hardware as OpenGL uniforms.
/// The Whole Process
//
// - Install CUDA toolkit and NVIDIA drivers.
// - Write hello.cu.
// - Compile with nvcc
// - Run.
/// Typical Program Structure
//
// - Prepare input data on CPU.
// - Send data from CPU to GPU.
// - Launch kernel.
// - Send data from GPU to CPU.
/// Multithreaded Execution
//
// :Def: Thread
// A path of execution through a program.
// Most beginner programs have one thread.
//
// :Def: Multithreaded Execution
// Execution of a program using more than one thread.
// On CPUs, program starts with one thread (in main), additional
// threads are requested by programmer.
#endif
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <time.h>
#include <new>
#include <cuda_runtime.h>
/// CUDA API Error-Checking Wrapper
///
#define CE(call) \
{ \
const cudaError_t rv = call; \
if ( rv != cudaSuccess ) \
{ \
printf("CUDA error %d, %s\n",rv,cudaGetErrorString(rv)); \
exit(1); \
} \
}
double
time_fp()
{
struct timespec tp;
clock_gettime(CLOCK_REALTIME,&tp);
return ((double)tp.tv_sec)+((double)tp.tv_nsec) * 0.000000001;
}
struct App
{
int num_threads;
int array_size;
float *v_in;
float *m_out;
float *d_v_in;
float *d_m_out;
};
// In host address space.
App app;
// In device constant address space.
__constant__ App d_app;
__global__ void
cuda_thread_start()
{
// Compute a unique ID for this thread.
const int tid = threadIdx.x + blockIdx.x * blockDim.x;
if ( tid >= d_app.num_threads ) return;
// Warning: The order in which d_v_in is accessed is inefficient.
// See demo-cuda-02-basics for a better ordering.
//
const int elt_per_thread = d_app.array_size / d_app.num_threads;
const int start = elt_per_thread * tid;
const int stop = start + elt_per_thread;
# pragma unroll 1
for ( int h=start; h<stop; h++ )
d_app.d_m_out[h] = d_app.d_v_in[h] + 1;
}
int
main(int argc, char **argv)
{
const int nt_raw = argc < 2 ? 1 : atoi(argv[1]);
app.num_threads = abs(nt_raw);
app.array_size = argc < 3 ? 1 << 20 : int( atof(argv[2]) * (1<<20) );
const int array_size_bytes = app.array_size * sizeof(app.v_in[0]);
const int out_array_size_bytes = app.array_size * sizeof(app.m_out[0]);
// Allocate storage for CPU copy of data.
//
app.v_in = new float[app.array_size];
app.m_out = new float[app.array_size];
// Allocate storage for GPU copy of data.
//
CE( cudaMalloc( &app.d_v_in, array_size_bytes ) );
CE( cudaMalloc( &app.d_m_out, out_array_size_bytes ) );
printf("Preparing for %d threads %d elements.\n",
app.num_threads, app.array_size);
// Initialize input array.
//
for ( int i=0; i<app.array_size; i++ ) app.v_in[i] = drand48();
const double time_start = time_fp();
// Copy input array from CPU to GPU.
//
CE( cudaMemcpy
( app.d_v_in, app.v_in, array_size_bytes, cudaMemcpyHostToDevice ) );
// Copy App structure to GPU.
//
CE( cudaMemcpyToSymbol
( d_app, &app, sizeof(app), 0, cudaMemcpyHostToDevice ) );
const int threads_per_block = 256;
const int blocks_per_grid =
( app.num_threads + threads_per_block-1 ) / threads_per_block;
/// KERNEL LAUNCH
cuda_thread_start<<< blocks_per_grid, threads_per_block >>>();
// --- <-- CUDA C kernel launch syntax -> ---
// Copy output array from GPU to CPU.
//
CE( cudaMemcpy
( app.m_out, app.d_m_out, out_array_size_bytes, cudaMemcpyDeviceToHost) );
const double data_size =
app.array_size * ( sizeof(app.v_in[0]) + sizeof(app.m_out[0]) );
const double fp_op_count = app.array_size * 5;
const double elapsed_time = time_fp() - time_start;
printf("Elapsed time for %d threads and %d elements is %.3f µs\n",
app.num_threads, app.array_size, 1e6 * elapsed_time);
printf("Rate %.3f GFLOPS, %.3f GB/s\n",
1e-9 * fp_op_count / elapsed_time,
1e-9 * data_size / elapsed_time);
}
|
8,552 | #include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <cstdlib>
#include <chrono>
#include <iomanip>
__global__ void transp(double *matrix, int size){
printf("Hello?\n");
//Индекс текущего блока в гриде
int blockIndex = blockIdx.x + blockIdx.y*gridDim.x + blockIdx.z*gridDim.y*gridDim.x;
//Индекс треда внутри текущего блока
int ThreadIndex = threadIdx.x + threadIdx.y*blockDim.x + threadIdx.z*blockDim.y*blockDim.x;
//глобальный индекс нити
int idx = blockIndex*blockDim.x*blockDim.y*blockDim.z + ThreadIndex;
printf("In thread %d\n", idx);
if (idx / size > idx % size){
printf("%lf %lf\n", matrix[(idx / size) * size + (idx % size)], matrix[(idx % size) * size + (idx / size)]);
//std::cout << "[" << idx << ", " << idy << "] = " << matrix[idx][idy] << '\n';
double tmp = matrix[(idx / size) * size + (idx % size)];
matrix[(idx / size) * size + (idx % size)] = matrix[(idx % size) * size + (idx / size)];
matrix[(idx % size) * size + (idx / size)] = tmp;
}
}
int n;
bool transpose(double* matrix, double* res_gpu) //либо int matrix[][5], либо int (*matrix)[5]
{
int t;
auto start = std::chrono::steady_clock::now();
for(int i = 0; i < n * n; ++i)
{
if(i / n > i % n){
t = matrix[(i / n) * n + (i % n)];
matrix[(i / n) * n + (i % n)] = matrix[(i % n) * n + (i / n)];
matrix[(i % n) * n + (i / n)] = t;
}
}
auto end = std::chrono::steady_clock::now();
std::chrono::duration<double> elapsed_seconds = end-start;
std::cout << "Time for CPU: " << elapsed_seconds.count() << "s\n";
std::cout << "CPU" << '\n';
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
std::cout << std::setw(8) << matrix[i * n + j];
}
std::cout << '\n';
}
int num_of_err = 0;
bool is_correct = 1;
for (int i = 0; i < n; ++i){
for (int j = 0; j < n; ++j){
if (matrix[i * n + j] != res_gpu[i * n + j]){
num_of_err++;
//std::cout << "Error in " << i + 1 << ", " << j + 1 << " element;\nOn CPU " << matrix[i * n + j] << ", On GPU " << res_gpu[i * n + j] << ";\n";
is_correct = 0;
}
}
}
if (is_correct){
std::cout << "Everything is great, results are equal!" << '\n';
} else{
std::cout << "There are " << num_of_err << " errors. Hm... maybe we did something wrong..." << '\n';
}
return is_correct;
}
int main(int argc, char const *argv[]) {
sscanf(argv[1], "%d", &n);
int bytes = n * n * sizeof(double);
double* matrix;
matrix = (double*)malloc(bytes);
/*for(int i = 0; i < n; ++i){
matrix[i] = new(double[n]);
}*/
char decision;
std::cout << "Do you want to fill matrix by yourself? (Y/N)" << '\n';
std::cin >> decision;
switch(tolower(decision))
{
case 'y':
for(int j = 0; j < n; ++j){
std::cout << "Please, enter "<< j + 1 << " string: ";
for (int i = 0; i < n; ++i){
std::cin >> matrix[i * n + j];
}
}
break;
case 'n':
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
matrix[i * n + j] = /*(double(rand()) / rand()) + */int(rand() / 100000000);
}
}
break;
default:
std::cout << "You have wrote something wrong." << '\n';
}
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
std::cout << std::setw(8) << matrix[i * n + j];
}
std::cout << '\n';
}
int block_size = 1024;
int grid_size = (n - 1) / block_size + 1;
double *gpu_matrix;
dim3 dimBlock(block_size, block_size, 1);
dim3 dimGrid(grid_size, grid_size, 1);
cudaMalloc(&gpu_matrix, bytes);
cudaMemcpy(gpu_matrix, matrix, bytes, cudaMemcpyHostToDevice);
auto start = std::chrono::steady_clock::now();
transp<<<dimGrid, dimBlock>>>(gpu_matrix, n);
cudaDeviceSynchronize();
auto end = std::chrono::steady_clock::now();
std::chrono::duration<double> elapsed_seconds = end-start;
std::cout << "Time for GPU: " << elapsed_seconds.count() << "s\n";
/*for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
std::cout << std::setw(8) << gpu_matrix[i * n + j];
}
std::cout << '\n';
}*/
double* matrix_res;
matrix_res = (double*)malloc(bytes);
cudaMemcpy(matrix_res, gpu_matrix, bytes, cudaMemcpyDeviceToHost);
std::cout << "GPU: " << '\n';
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
std::cout << std::setw(8) << matrix_res[i * n + j];
}
std::cout << '\n';
}
transpose(matrix, matrix_res);
cudaFree(gpu_matrix);
free(matrix);
return 0;
}
|
8,553 | #include "includes.h"
__global__ void knapsackGPU2(int* dp, int* d_value, int* d_weight, int capacity,int n)
{
int in = threadIdx.x + (blockDim.x * blockIdx.x);
for (int row = 0;row <= n;row++)
{
if (row != 0)
{
int ind = in + (row * (capacity + 1));
if (in <= (capacity + 1) && in > 0)
{
if (in >= d_weight[row - 1])
{
dp[ind] = dp[ind - (capacity + 1)] > (d_value[row - 1] + dp[ind - (capacity + 1) - d_weight[row - 1]]) ? dp[ind - (capacity + 1)] : (d_value[row - 1] + dp[ind - (capacity + 1) - d_weight[row - 1]]);
}
else
dp[ind] = dp[ind - (capacity + 1)];
}
if (in == 0)
{
dp[ind] = 0;
}
}
else
{
dp[in] = 0;
}
}
} |
8,554 | #include<stdio.h>
#include<stdlib.h>
__global__ void arradd(int* md, int* nd, int* pd, int size)
{
int myid = threadIdx.y * size + threadIdx.x;
pd[myid] = md[myid] + nd[myid];
}
int main()
{
int size = 20 *20* sizeof(int);
int m[20][20], n[20][20], p[20][20],*md, *nd,*pd;
int i=0,j=0;
for(i=0; i<20; i++ )
{
for(j=0; j<20; j++ )
{
m[i][j] = i;
n[i][j] = i;
p[i][j] = 0;
}
}
cudaMalloc(&md, size);
cudaMemcpy(md, m, size, cudaMemcpyHostToDevice);
cudaMalloc(&nd, size);
cudaMemcpy(nd, n, size, cudaMemcpyHostToDevice);
cudaMalloc(&pd, size);
dim3 DimGrid(1, 1);
dim3 DimBlock(20, 20);
arradd<<< DimGrid,DimBlock >>>(md,nd,pd,20);
cudaMemcpy(p, pd, size, cudaMemcpyDeviceToHost);
cudaFree(md);
cudaFree(nd);
cudaFree (pd);
for(i=0; i<20; i++ )
{
for(j=0; j<20; j++ )
{
printf("\t%d",p[i][j]);
}
printf("\n");
}
}
|
8,555 | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <math.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#define m(data,y,x) data[y*n+x]
#define MAX_THREADS 1024
// ===========================> Functions Prototype <===============================
void fill(float* data, int size);
double calc_mse(float* data1, float* data2, int size);
void cpuKernel_yx(float* a, float* b, float* c, int n, int y, int x);
void cpuKernel_y(float* a, float* b, float* c, int n, int y);
void cpuKernel(float* a, float* b, float* c, int n);
__global__ void kernelFunc(float* ad, float* bd, float* cd, int n);
void gpuKernel(float* a, float* b, float* c, int n);
// =================================================================================
int main(int argc, char** argv) {
struct cudaDeviceProp p;
cudaGetDeviceProperties(&p, 0);
printf("Device Name: %s\n", p.name);
// get parameter from command line to build Matrix dimension
// check for 10<=m<=13, because m>=14 do not fit in the memory of our GPU, i.e., 1GB.
int m = 5;
int n = 1;
if(argc > 1)
m = atoi(argv[1]);
for (int i=0;i<m;i++)
n*=2; // n=2^m
// allocate memory in CPU for calculation
float* a;
float* b;
float* c_serial;
float* c;
a = (float*)malloc(n*n * sizeof(float));
b = (float*)malloc(n*n * sizeof(float));
c_serial = (float*)malloc(n*n * sizeof(float));
c = (float*)malloc(n*n * sizeof(float));
// fill a, b matrices with random values between -16.0f and 16.0f
srand(0);
fill(a, n*n);
fill(b, n*n);
// time measurement for CPU calculation
clock_t t0 = clock();
if (m<=10) {
cpuKernel (a, b, c_serial, n);
} else {
cpuKernel_y (a, b, c_serial, n, 0); // 1st row
}
clock_t t1 = clock();
// time measurement for GPU calculation
clock_t t2 = clock();
gpuKernel (a, b, c, n);
clock_t t3 = clock();
// check correctness of calculation
float mse;
if (m<=10) {
mse = calc_mse( c_serial, c, n*n );
} else {
mse = calc_mse( c_serial, c, n ); // 1st row
}
printf("n=%d\t CPU=%06ld ms GPU=%06ld ms mse=%f\n",n, (t1-t0)/1000, (t3-t2)/1000, mse);
// free allocated memory for later use
free(a);
free(b);
free(c_serial);
free(c);
return 0;
}
//-----------------------------------------------------------------------------
void fill(float* data, int size) {
for (int i=0; i<size; ++i)
data[i] = (float) (rand() % 33 - 16);
}
double calc_mse (float* data1, float* data2, int size) {
double mse = 0.0;
int i; for (i=0; i<size; i++) {
double e = data1[i]-data2[i];
e = e * e;
mse += e;
}
mse = mse / size;
return mse;
}
//-----------------------------------------------------------------------------
void cpuKernel_yx(float* a, float* b, float* c, int n, int y, int x) { // one element
m(c,y,x)=0;
for(int k=0; k<n; k++) {
m(c,y,x) += m(a,y,k) * m(b,k,x);
}
}
void cpuKernel_y(float* a, float* b, float* c, int n, int y) { // one row
for(int x=0; x<n; x++)
{
cpuKernel_yx(a,b,c,n,y,x);
}
}
void cpuKernel(float* a, float* b, float* c, int n) { // entire matrix
for(int y=0; y<n; y++)
for(int x=0; x<n; x++)
{
cpuKernel_yx(a,b,c,n,y,x);
}
}
//-----------------------------------------------------------------------------
/*__global__ void kernelFunc(float* ad, float* bd, float* cd, int n) {
// write your GPU kernel function here
// note that maximum # of threads per block is 1024
int bx=blockIdx.x;
int by=blockIdx.y;
int bz=blockIdx.z;
int tx=threadIdx.x;
long i,j;
float sum=0;
i= bx+(by*MAX_THREADS*MAX_THREADS+bz*MAX_THREADS+tx)/n;
j= (by*MAX_THREADS*MAX_THREADS+bz*MAX_THREADS+tx)%n;
for(long k=0; k<n; k++) {
sum += m(ad,i,k) * m(bd,k,j);
}
m(cd,i,j) = sum;
}*/
__global__ void kernelFunc(float* ad, float* bd, float* cd, int n) {
int tx = threadIdx.x;
int by = blockIdx.y;
int bx = blockIdx.x;
int row = bx;
float s = 0.0f;
int column;
column = (by)*(blockDim.x)+tx;
int k; for (k=0; k<n; k++)
s += m(ad,row,k) * m(bd,k,column);
m(cd,row,column) = s;
}
//-----------------------------------------------------------------------------
void gpuKernel(float* a, float* b, float* c, int n) {
// allocate memory on GPU
// copy data to GPU
// call kernelFunc
// copy the results back to CPU
// free GPU memory
float *ad, *bd, *cd;
cudaMalloc((void**)&ad, n*n*sizeof(float));
cudaMalloc((void**)&bd, n*n*sizeof(float));
cudaMalloc((void**)&cd, n*n*sizeof(float));
cudaMemcpy(ad, a, n*n*sizeof(float), cudaMemcpyHostToDevice);
cudaMemcpy(bd, b, n*n*sizeof(float), cudaMemcpyHostToDevice);
//kernelFunc <<<dim3(n/MAX_THREADS,n/MAX_THREADS,MAX_THREADS),MAX_THREADS>>> (ad,bd,cd,n);
kernelFunc<<< dim3(n,1,1), n >>>(ad, bd, cd, n);
cudaMemcpy(c, cd, n*n*sizeof(float), cudaMemcpyDeviceToHost);
cudaFree(ad);
cudaFree(bd);
cudaFree(cd);
} |
8,556 | #include "includes.h"
__global__ void gMaxPoolingForward(float* out, int outRows, int outCols, float* in, int inRows, int inCols, float* mask, int numKernels, int maskCols, int width, int lastWidth) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
if(tid >= outRows * outCols)
return;
int rowId = tid / outRows;
int colId = tid % outRows;
float* b = in + (rowId * inCols) + (colId * width);
float* localMask = mask + (rowId / numKernels) * maskCols + colId * width;
if(colId == outRows - 1) {
width = lastWidth;
}
float currentMax = b[0] * localMask[0];
for(int i = 1; i < width; ++i) {
if(b[i] * localMask[i] > currentMax) {
currentMax = b[i] * localMask[i];
}
}
out[rowId + (colId * outCols)] = currentMax;
} |
8,557 | #include <iostream>
#include <cuda_runtime.h>
#include <chrono>
#include <stdlib.h>
#include <stdio.h>
#define BLOCK 16
/*
0 0 X X 0 0 0 0
0 0 X X 0 0 0 0
0 0 0 0 X X 0 0
0 0 0 0 X X 0 0
*/
struct Matrix{
int width;
int height;
float* elements;
};
__global__ void blockedMatMulKernel(const Matrix A, const Matrix B, Matrix C){
int row = threadIdx.y;
int col = threadIdx.x;
if (blockDim.y * blockIdx.y + row >= A.height || blockDim.x * blockIdx.x + col >= B.width )
return;
float C_rc = 0;
for (int e = 0; e < A.width/blockDim.x; ++e){
__shared__ float A_block [BLOCK][BLOCK];
__shared__ float B_block [BLOCK][BLOCK];
A_block[row][col] = A.elements[A.width * (blockDim.y * blockIdx.y + row) + blockDim.x * e + col];
B_block[row][col] = B.elements[B.width * (e * blockDim.x + row) + blockIdx.x * blockDim.x + col];
__syncthreads();
for (int i = 0; i < BLOCK; ++i)
C_rc += A_block[row][i] * B_block[i][col];
__syncthreads(); // make sure that C is calculated before you go and overwrite A & B in next iter
}
C.elements[B.width * (blockDim.y * blockIdx.y + row) + col + blockDim.x * blockIdx.x] = C_rc;
__syncthreads();
}
void matMulBlocked(Matrix A, Matrix B, Matrix C){
Matrix d_A, d_B, d_C;
cudaMalloc(&(d_A.elements), sizeof(float) * A.width * A.height);
cudaMalloc(&(d_B.elements), sizeof(float) * B.width * B.height);
cudaMalloc(&(d_C.elements), sizeof(float) * C.width * C.height);
cudaMemcpy(d_A.elements, A.elements, sizeof(float) * A.width* A.height, cudaMemcpyHostToDevice);
cudaMemcpy(d_B.elements, B.elements, sizeof(float) * B.width* B.height, cudaMemcpyHostToDevice);
cudaMemcpy(d_C.elements, C.elements, sizeof(float) * C.width* C.height, cudaMemcpyHostToDevice);
d_A.width = A.width;
d_A.height = A.height;
d_B.width = B.width;
d_B.height = B.height;
d_C.width = C.width;
d_C.height = C.height;
dim3 block (BLOCK,BLOCK);
dim3 numBlocks ((A.height + BLOCK - 1)/BLOCK, (B.width + BLOCK - 1)/BLOCK);
blockedMatMulKernel<<<numBlocks, block>>>(d_A, d_B, d_C);
cudaDeviceSynchronize();
cudaMemcpy(C.elements, d_C.elements, sizeof(float) * C.width* C.height, cudaMemcpyDeviceToHost);
for (int i = 0; i < A.height; ++i){
for (int j = 0; j < B.width; ++j){
std::cout<<C.elements[i*B.width + j]<<" ";
}
std::cout<<std::endl;
}
cudaFree(d_A.elements);
cudaFree(d_B.elements);
cudaFree(d_C.elements);
}
void serialMatMul(int n, int p, int m, float* A, float* B, float* C){
for (int i = 0; i < m; ++i){
for (int j = 0; j < n; ++j){
float sum = 0;
for (int k = 0; k < p; ++k){
sum += A[i*p + k] * B[k*n + j];
}
C[i * n + j] = sum;
}
}
}
int main(int argc, char* argv[]){
if (argc < 4){
std::cout<<"please include 3 integers for matrix dimensions"<<std::endl;
exit(1);
}
int m = atoi(argv[1]);
int p = atoi(argv[2]);
int n = atoi(argv[3]);
Matrix A, B, C;
A.height = m;
C.height = m;
B.height = p;
B.width = n;
A.width = p;
C.width = n;
A.elements = new float[m*p];
B.elements = new float[p*n];
C.elements = new float[m*n];
for (int i = 0; i < m; ++i)
for (int j = 0; j < p; ++j)
A.elements[i*p + j] = (float)rand()/(float)(RAND_MAX);
for (int i = 0; i < p; ++i)
for (int j = 0; j < n; ++j)
B.elements[i*n + j] = (float)rand()/(float)(RAND_MAX);
auto s = std::chrono::high_resolution_clock::now();
serialMatMul(n, p, m, A.elements, B.elements, C.elements);
auto end = std::chrono::high_resolution_clock::now();
auto diff = std::chrono::duration_cast<std::chrono::microseconds>(end - s);
std::cout << "time: " << diff.count() << std::endl;
for (int i = 0; i < m; ++i){
for (int j = 0; j < n; ++j){
std::cout<<C.elements[i*n + j]<<" ";
}
std::cout<<std::endl;
}
std::cout<<std::endl;
cudaEvent_t start;
cudaEvent_t stop;
float time;
cudaEventCreate(&start);
cudaEventCreate(&stop);
cudaEventRecord(start);
matMulBlocked(A, B, C);
cudaEventRecord(stop);
cudaEventSynchronize(stop);
cudaEventElapsedTime(&time, start, stop);
std::cout<<"cuda time="<< time << std::endl;
free(A.elements);
free(B.elements);
free(C.elements);
return 0;
} |
8,558 | #include <string.h>
#include <stdio.h>
struct DataElement
{
char *name;
int value;
};
__global__
void Kernel(DataElement *elem) {
printf("On device: name=%s, value=%d\n", elem->name, elem->value);
elem->name[0] = 'd';
elem->value++;
}
void launch(DataElement *elem) {
DataElement *d_elem;
char *d_name;
int namelen = strlen(elem->name) + 1;
// Allocate storage for struct and text
cudaMalloc(&d_elem, sizeof(DataElement));
cudaMalloc(&d_name, namelen);
// Copy up each piece separately, including new “text” pointer value
cudaMemcpy(d_elem, elem, sizeof(DataElement), cudaMemcpyHostToDevice);
cudaMemcpy(d_name, elem->name, namelen, cudaMemcpyHostToDevice);
cudaMemcpy(&(d_elem->name), &d_name, sizeof(char*), cudaMemcpyHostToDevice);
// Finally we can launch our kernel, but CPU & GPU use different copies of “elem”
Kernel<<< 1, 1 >>>(d_elem);
cudaMemcpy(&(elem->value), &(d_elem->value), sizeof(int), cudaMemcpyDeviceToHost);
cudaMemcpy(elem->name, d_name, namelen, cudaMemcpyDeviceToHost);
cudaFree(d_name);
cudaFree(d_elem);
}
int main(void)
{
DataElement *e;
e = (DataElement*)malloc(sizeof(DataElement));
e->value = 10;
e->name = (char*)malloc(sizeof(char) * (strlen("hello") + 1));
strcpy(e->name, "hello");
launch(e);
printf("On host: name=%s, value=%d\n", e->name, e->value);
free(e->name);
free(e);
cudaDeviceReset();
} |
8,559 | #define N 1000
#include <stdio.h>
#include <time.h>
#include "cuda_runtime.h"
void initialize(float A[N][N], float B[N][N]) {
srand(0);
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
A[i][j] = rand() / (RAND_MAX * 1.0);
B[i][j] = rand() / (RAND_MAX * 1.0);
}
}
}
void display(float mat[N][N]) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
printf("%.2f\t", mat[i][j]);
}
printf("\n");
}
printf("\n");
}
__global__ void matMul(float *A, float *B, float *C) {
int block = blockIdx.x; // Used to index row of matrix
int thread = threadIdx.x; // Used to index column of matrix
int dim = blockDim.x;
float sum = 0;
for(int i = 0; i < N; i++){
sum += A[block*dim + i] * B[i*dim + thread];
}
C[block*dim + thread] = sum;
}
int main(int argc, char **argv) {
float A[N][N], B[N][N], C[N][N];
clock_t start, end;
double elapsed;
float *dev_A, *dev_B, *dev_C;
int size = N*N*sizeof(float);
cudaMalloc((void **)&dev_A, size);
cudaMalloc((void **)&dev_B, size);
cudaMalloc((void **)&dev_C, size);
initialize(A, B);
start = clock();
// Copy inputs from host to device
cudaMemcpy(dev_A, A, size, cudaMemcpyHostToDevice);
cudaMemcpy(dev_B, B, size, cudaMemcpyHostToDevice);
// Launch the Matrix multiplication kernel
matMul<<<N, N>>>(dev_A, dev_B, dev_C);
// Copy result from device to host
cudaMemcpy(C, dev_C, size, cudaMemcpyDeviceToHost);
end = clock();
elapsed = ((double) (end - start)) / CLOCKS_PER_SEC;
// display(A);
// display(B);
// display(C);
printf(" \n Time taken is %f \n",elapsed);
cudaFree(dev_A);
cudaFree(dev_B);
cudaFree(dev_C);
}
|
8,560 | const int n_signals = 384, n_samples = 65700, n_sections = 2;
//////////////////////////////////////////////////////////////////////////////////////////
__global__ void sosfilt(const float *sos, float *x, const float *zi){
int s, t;
float x_cur, x_new;
float zi_t[n_sections*2], sos_t[n_sections*6];
int tid = threadIdx.x;
int nt = n_samples;
int ns = n_sections;
// Index of signal to be filtered
int signal_id = blockIdx.x * blockDim.x + tid;
if (signal_id >= n_signals) return;
// Move arrays to local thread memory
for(s=0;s<ns*2;s++){
zi_t[s] = zi[signal_id*n_sections*2 + s];
}
for(s=0;s<ns*6;s++){
sos_t[s] = sos[s];
}
// Filtering
for(t=0;t<nt;t++){
x_cur = x[signal_id*nt+t];
for(s=0;s<ns;s++){
x_new = sos_t[s*6] * x_cur + zi_t[s*2];
zi_t[s*2] = sos_t[s*6+1] * x_cur - sos_t[s*6+4] * x_new + zi_t[s*2+1];
zi_t[s*2+1] = sos_t[s*6+2] * x_cur - sos_t[s*6+5] * x_new;
x_cur = x_new;
}
x[signal_id*nt+t] = x_cur;
}
}
|
8,561 | #include <stdio.h>
void check_cells(float *rx, float *ry, float *rz, int *head, int *list, int mx, int my, int mz, int natoms, int step, int pstep)
{
int i, icell, ix, iy, iz, icount;
icount = 0;
for(icell=0;icell<(mx+2)*(my+2)*(mz+2);icell++){
ix = icell%(mx+2);
iy = (icell/(mx+2))%(my+2);
iz = icell/((mx+2)*(my+2));
i = head[icell];
if(step==pstep) printf("\nCell number %d at (%d,%d,%d) contains particles:",icell,ix,iy,iz);
while(i>=0){
if(ix>0&&ix<(mx+1)&&iy>0&&iy<(my+1)&&iz>0&&iz<(mz+1)) icount++;
// if(step==pstep) {
// if(rx[i] < -0.5 || rx[i] > 0.5 || ry[i] < -0.5 || ry[i] > 0.5 || rz[i] < -0.5 || rz[i] > 0.5) printf("%d, r = (%f,%f,%f) ",i,rx[i],ry[i],rz[i]);
// }
printf(" (%f,%f,%f);",rx[i],ry[i],rz[i]);
i = list[i];
}
}
if (icount != natoms) printf("\nNumber of particles in cells = %d\n",icount);
}
|
8,562 | #include <cuda.h>
#include <cuda_runtime.h>
#include <iostream>
#include <device_launch_parameters.h>
__global__ void W4W(int *w, int *out)
{
int tid = blockIdx.x;
int weight[sizeof(w)/sizeof(int)];
char c1 = (w[tid]/100)+48;
char c2 = ((w[tid]%100)/10)+48;
char c3 = w[tid]%10+48;
weight[tid]=(w[tid]/100)+ ((w[tid] % 100) / 10) + w[tid] % 10;
printf("%d, %c, %c, %c, %d\n", w[tid], c1, c2, c3, weight[tid]);
if (tid != 0)
{
if (weight[tid - 1] > weight[tid])
{
int x,y;
x=w[tid -1];y=w[tid];//collapsed to reserve pixels
out[tid -1]=y;out[tid]=x;
x=0;y=0;
x=weight[tid -1];y=weight[tid];
weight[tid -1]=y;weight[tid]=x;
}
if (weight[tid - 1] = weight[tid])
{
}
}
}
int main()
{
//weight is the sum of the numbers
//like numbers differentiated by string
const int size = 9;
int weights[size] = {56, 65, 74, 100, 99, 68, 86, 180, 90};
int *out, *w, output[size];
cudaMalloc((void**)&w, size * sizeof(int));
cudaMalloc((void**)&out, size * sizeof(int));
cudaMemcpy(w, &weights, size * sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(out, &output, size * sizeof(int), cudaMemcpyHostToDevice);
W4W<<<size,1>>>(w, out);
cudaMemcpy(&output, out, size * sizeof(int), cudaMemcpyDeviceToHost);
for(int i=0;i<size;i++){printf("%d\n",output[i]); }
cudaFree(out);
cudaFree(w);
return 0;
} |
8,563 | // input: L (1), xyz1 (b,n,3), xyz2 (b,m,3)
// output: weight_space (b,m,27,3)
__global__ void query_and_interpolation_gpu(int b, int n, int m, int c, const float *xyz1, const float *xyz2, const float *lh, float *weight_space) {
int batch_index = blockIdx.x;
xyz1 += n*3*batch_index;
xyz2 += m*3*batch_index;
weight_space += m*27*3*batch_index;
int index = threadIdx.x;
int stride = blockDim.x;
float L=lh[0];
int pts;
int cnt;
float alpha=3*sqrtf(3)/2;
float dist[27];
float dist_sum[27];
float x2_,y2_,z2_;
for(int j=index;j<m;j+=stride){
for(int f=0;f<27;++f) dist_sum[f]=0;
pts=0;
for(int k=0;k<n;++k){
float x2=xyz2[j*3+0];
float y2=xyz2[j*3+1];
float z2=xyz2[j*3+2];
float x1=xyz1[k*3+0];
float y1=xyz1[k*3+1];
float z1=xyz1[k*3+2];
float d=max(sqrtf((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)),1e-20f);
if (d<alpha*L) {
pts += 1;
cnt = 0;
for (int o = -1; o < 2; ++o) {
for (int p = -1; p < 2; ++p) {
for (int q = -1; q < 2; ++q) {
x2_ = x2 + o * L;
y2_ = y2 + p * L;
z2_ = z2 + q * L;
dist[cnt] = sqrtf((x2_ - x1)*(x2_ - x1) + (y2_ - y1)*(y2_ - y1) + (z2_ - z1)*(z2_ - z1));
dist_sum[cnt] += dist[cnt];
weight_space[j * 27 * 3 + cnt * 3 + 0] += x1 / dist[cnt];
weight_space[j * 27 * 3 + cnt * 3 + 1] += y1 / dist[cnt];
weight_space[j * 27 * 3 + cnt * 3 + 2] += z1 / dist[cnt];
cnt += 1;
}
}
}
}
}
for (int s = 0; s < 27; ++s) {
weight_space[j * 27 * 3 + s * 3 + 0] *= (dist_sum[s] / pts);
weight_space[j * 27 * 3 + s * 3 + 1] *= (dist_sum[s] / pts);
weight_space[j * 27 * 3 + s * 3 + 2] *= (dist_sum[s] / pts);
}
}
}
__global__ void query_and_interpolation_grad_gpu(int b, int n, int m, int c, const float *xyz1, const float *xyz2, const float *lh, const float *grad_out, float *grad_points1, float *grad_points2) {
int batch_index = blockIdx.x;
xyz1 += n*3*batch_index;
xyz2 += m*3*batch_index;
grad_out += m*27*3*batch_index;
grad_points1 += n*3*batch_index;
grad_points2 += m*3*batch_index;
int index = threadIdx.x;
int stride = blockDim.x;
float L=lh[0];
int pts;
int cnt;
float alpha=3*sqrtf(3)/2;
float dist[27];
float dist_sum[27];
float x2_,y2_,z2_;
}
void queryAndInterpolationLauncher(int b, int n, int m, int c, const float *xyz1, const float *xyz2,const float *lh, float *weight_space) {
query_and_interpolation_gpu<<<b,256>>>(b,n,m,c,xyz1,xyz2,lh,weight_space);
//cudaDeviceSynchronize();
}
void queryAndInterpolationGradLauncher(int b, int n, int m, int c, const float *xyz1, const float *xyz2, const float *lh, const float *grad_out, float *grad_points1, float *grad_points2) {
query_and_interpolation_grad_gpu<<<b,256>>>(b,n,m,c,xyz1,xyz2,lh,grad_out,grad_points1,grad_points2);
//cudaDeviceSynchronize();
}
|
8,564 | /* compile with /usr/local/cuda-10.0/bin/nvcc -arch=compute_XX -o foo.out foo.cu
* run with ./foo.out N mode
* N is the size of matrix, mode is different way to multiply matrix
* 1 represents naive gpu, 2 means tiled gpu, 3 means transposed tiled gpu
*/
#include <stdio.h>
#include <stdlib.h>
#define MAX_MAT_VALUE 10
#define BLOCK_SIZE 16
void cpu_matrixMul(float *A, float *B, float *C, int N) {
int i, j, k;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
float partial = 0.0;
for (k = 0; k < N; k++) {
partial += A[i * N + k] * B[k * N + j];
}
C[i * N + j] = partial;
}
}
}
__global__ void naive_matrxiMul(float *dev_A, float *dev_B, float *dev_C, int N) {
float partial = 0.0;
int row = blockIdx.y * blockDim.y + threadIdx.y;
int col = blockIdx.x * blockDim.x + threadIdx.x;
int k;
if (row < N && col < N) {
for (k = 0; k < N; k++) {
partial += dev_A[row * N + k] * dev_B[k * N + col];
}
dev_C[row * N + col] = partial;
}
}
__global__ void tiled_matrxiMul(float *dev_A, float *dev_B, float *dev_C, int N) {
__shared__ float A_tile[BLOCK_SIZE][BLOCK_SIZE];
__shared__ float B_tile[BLOCK_SIZE][BLOCK_SIZE];
float partial = 0.0;
int row = blockIdx.y * blockDim.y + threadIdx.y;
int col = blockIdx.x * blockDim.x + threadIdx.x;
int tx = threadIdx.x, ty = threadIdx.y;
int m;
for (m = 0; m < N / blockDim.x; ++m) {
A_tile[ty][tx] = dev_A[row * N + m * blockDim.x + tx];
B_tile[ty][tx] = dev_B[N * (m * blockDim.y + ty) + col];
__syncthreads();
int k;
for (k = 0; k < blockDim.x; ++k) {
partial += A_tile[ty][k] * B_tile[k][tx];
}
__syncthreads();
}
if (row < N && col < N) {
dev_C[row * N + col] = partial;
}
}
__global__ void transposed_tiled_matrxiMul(float *dev_A, float *dev_B, float *dev_C, int N) {
__shared__ float A_tile[BLOCK_SIZE][BLOCK_SIZE];
__shared__ float B_tile[BLOCK_SIZE][BLOCK_SIZE];
float partial = 0.0;
int row = blockIdx.y * blockDim.y + threadIdx.y;
int col = blockIdx.x * blockDim.x + threadIdx.x;
int tx = threadIdx.x, ty = threadIdx.y;
int m;
for (m = 0; m < N / blockDim.x; ++m) {
A_tile[ty][tx] = dev_A[row * N + m * blockDim.x + tx];
B_tile[tx][ty] = dev_B[N * (m * blockDim.y + ty) + col];
__syncthreads();
int k;
for (k = 0; k < blockDim.x; ++k) {
partial += A_tile[ty][k] * B_tile[tx][k];
}
__syncthreads();
}
if (row < N && col < N) {
dev_C[row * N + col] = partial;
}
}
void print_matrix(float *A, int N) {
int i, j;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
printf("%.3f ", A[i * N + j]);
}
printf("\n");
}
}
int main(int argc, char *argv[]) {
if (argc != 3) {
puts("Please specify the size of matrix and mode (1, 2, 3, 4)");
return 0;
}
int N;
int mode;
N = atoi(argv[1]);
mode = atoi(argv[2]);
float *A, *B, *C, *CC, *dev_A, *dev_B, *dev_C;
// allocate memory in host
cudaMallocHost((void **) &A, N * N * sizeof(float));
cudaMallocHost((void **) &B, N * N * sizeof(float));
cudaMallocHost((void **) &C, N * N * sizeof(float));
cudaMallocHost((void **) &CC, N * N * sizeof(float));
int i, j;
// initialize matrix A and B
srand48(1);
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
A[i * N + j] = drand48() * MAX_MAT_VALUE;
B[i * N + j] = drand48() * MAX_MAT_VALUE;
}
}
float gpu_time, cpu_time;
cudaEvent_t start, stop;
cudaEventCreate(&start);
cudaEventCreate(&stop);
cudaEventRecord(start, 0);
// allocate memory on the device
cudaMalloc((void**) &dev_A, N * N * sizeof(float));
cudaMalloc((void**) &dev_B, N * N * sizeof(float));
cudaMalloc((void**) &dev_C, N * N * sizeof(float));
cudaMemcpy(dev_A, A, N * N * sizeof(float), cudaMemcpyHostToDevice);
cudaMemcpy(dev_B, B, N * N * sizeof(float), cudaMemcpyHostToDevice);
dim3 Block(BLOCK_SIZE, BLOCK_SIZE);
dim3 Grid(N / Block.x, N / Block.y);
if (mode == 1) {
naive_matrxiMul<<< Grid, Block>>>(dev_A, dev_B, dev_C, N);
} else if (mode == 2) {
tiled_matrxiMul<<< Grid, Block>>>(dev_A, dev_B, dev_C, N);
} else if (mode == 3) {
transposed_tiled_matrxiMul<<< Grid, Block>>>(dev_A, dev_B, dev_C, N);
} else {
return 0;
}
cudaMemcpy(C, dev_C, N * N * sizeof(float), cudaMemcpyDeviceToHost);
cudaDeviceSynchronize();
cudaEventRecord(stop, 0);
cudaEventSynchronize(stop);
cudaEventElapsedTime(&gpu_time, start, stop);
printf("total time used on gpu matrix multiply: %f ms.\n", gpu_time);
// start cpu matrix multiply
cudaEventRecord(start, 0);
cpu_matrixMul(A, B, CC, N);
cudaEventRecord(stop, 0);
cudaEventSynchronize(stop);
cudaEventElapsedTime(&cpu_time, start, stop);
printf("total time used on cpu matrix multiply: %f ms.\n", cpu_time);
// validate result
int all_right = 1;
for (i = 0; i < N; ++i) {
for (j = 0; j < N; ++j) {
if (abs(CC[i * N + j] - C[i * N + j]) > 2) {
printf("%3.f != %3.f\n", C[i * N + j], CC[i * N + j]);
all_right = 0;
break;
}
}
}
if (all_right) {
printf("all results are right, speed up by gpu = %f.2\n", cpu_time / gpu_time);
} else {
printf("wrong results\n");
}
cudaFree(dev_A);
cudaFree(dev_B);
cudaFree(dev_C);
cudaFreeHost(A);
cudaFreeHost(B);
cudaFreeHost(C);
cudaFreeHost(CC);
return 0;
} |
8,565 | #include "includes.h"
__global__ void threshold_and_support(float *vec, int *support, const int n, const float T)
{
unsigned int xIndex = blockDim.x * blockIdx.x + threadIdx.x;
if (xIndex < n) {
if (abs(vec[xIndex])<T) {
vec[xIndex] = 0.0f;
support[xIndex]=2;
}
}
} |
8,566 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include <omp.h>
#include <cuda.h>
const char ARQUIVO_DNA_1[] = {"src/DNA1.txt"};
const char ARQUIVO_DNA_2[] = {"src/DNA2.txt"};
char *DNA, *combinacoesDNA;
int *inicioProcesso, *countCombinacoesDNA;
char combinacoesDNAtxt[24][5] = {"ACGT", "ACTG", "AGCT" , "AGTC",
"ATCG", "ATGC", "CAGT", "CATG",
"CGAT", "CGTA", "CTAG", "CTGA",
"GACT", "GATC", "GCAT", "GCTA",
"GTAC", "GTCA", "TACG", "TAGC",
"TCAG", "TCGA", "TGAC", "TGCA"};
void lerArquivo(const char *nomeArquivo, const int tamanho);
int tamanhoArquivo(const char *nomeArquivo);
__device__ int my_strcmp(const char *str_a, const char *str_b, unsigned len = 5)
{
int match = 0;
unsigned i = 0;
unsigned done = 0;
while ((i < len) && (match == 0) && !done)
{
if ((str_a[i] == 0) || (str_b[i] == 0))
{
done = 1;
}
else if (str_a[i] != str_b[i])
{
match = i+1;
if (((int)str_a[i] - (int)str_b[i]) < 0)
{
match = 0 - (i + 1);
}
}
i++;
}
return match;
}
__global__ void pesquisar(char *dna, char *combinacoes, int *inicio, int *countCombinacoes, int tamanhoDNA, unsigned totalProcessos)
{
int idProcesso = blockIdx.x * blockDim.x + threadIdx.x;
if(idProcesso < totalProcessos)
{
int i;
char busca[5];
char combinacao[5];
int count;
for(count = inicio[idProcesso]; count < inicio[idProcesso + 1]; count++)
{
busca[0] = dna[count];
busca[1] = dna[count + 1];
busca[2] = dna[count + 2];
busca[3] = dna[count + 3];
for(i = 0; i < 96; i+=4)
{
combinacao[0] = combinacoes[i];
combinacao[1] = combinacoes[i + 1];
combinacao[2] = combinacoes[i + 2];
combinacao[3] = combinacoes[i + 3];
if(my_strcmp(busca, combinacao) == 0)
{
// Add no vetor
atomicAdd(&countCombinacoes[i/4],1);
break;
}
}
}
}
}
__global__ void compararEncontrados(char *dna, char *combinacoes, int *inicio, int *maisEncontrados, int *countmaisEncontrados, int tamanhoDNA, int totalProcessos)
{
int idProcesso = blockIdx.x * blockDim.x + threadIdx.x;
if(idProcesso < totalProcessos)
{
int i;
char busca[5];
char combinacao[5];
int count;
for(count = inicio[idProcesso]; count < inicio[idProcesso + 1]; count++)
{
busca[0] = dna[count];
busca[1] = dna[count + 1];
busca[2] = dna[count + 2];
busca[3] = dna[count + 3];
for(i = 0; i < 17; i+=4)
{
int tempIndex = maisEncontrados[i/4] * 4;
combinacao[0] = combinacoes[tempIndex];
combinacao[1] = combinacoes[tempIndex + 1];
combinacao[2] = combinacoes[tempIndex + 2];
combinacao[3] = combinacoes[tempIndex + 3];
if(my_strcmp(busca, combinacao) == 0)
{
// Add no vetor
atomicAdd(&countmaisEncontrados[i/4],1);
break;
}
}
}
}
}
int main(int argc, char *argv[0])
{
if((argv[1] == NULL) || (argv[2] == NULL))
{
printf("\n\nInsira o número de blocos e threads! \n\n");
return(1);
}
int *countMaisEncontrados;
int numBlocos = atoi(argv[1]);
int numThreads = atoi(argv[2]);
int totalProcessos = numBlocos * numThreads;
const int tamanhoDNA = tamanhoArquivo(ARQUIVO_DNA_1);
cudaMallocManaged(&DNA, tamanhoDNA * sizeof(char));
cudaMallocManaged(&combinacoesDNA, 96 * sizeof(char));
cudaMallocManaged(&inicioProcesso, (totalProcessos + 1) * sizeof(int));
cudaMallocManaged(&countCombinacoesDNA, 24 * sizeof(int));
cudaMallocManaged(&countMaisEncontrados, 5 * sizeof(int));
strcpy(combinacoesDNA,"ACGTACTGAGCTAGTCATCGATGCCAGTCATGCGATCGTACTAGCTGAGACTGATCGCATGCTAGTACGTCATACGTAGCTCAGTCGATGACTGCA");
lerArquivo(ARQUIVO_DNA_1, tamanhoDNA);
// Definindo a posição inicial de cada processo
int i;
inicioProcesso[0] = 0;
for(i = 0; i < totalProcessos; i++)
{
inicioProcesso[i + 1] = inicioProcesso[i] + tamanhoDNA / totalProcessos;
}
/*
<<<numDeBlocos, numDeThreadsPorBloco>>>
gtx 960 16 blocos 64 threads
gtx 1050 12 blocos 64 threads
*/
pesquisar <<<numBlocos, numThreads>>> (DNA, combinacoesDNA, inicioProcesso, countCombinacoesDNA, tamanhoDNA, totalProcessos);
cudaDeviceSynchronize();
int *maisEncontrados;
cudaMallocManaged(&maisEncontrados, 5 * sizeof(int));
maisEncontrados[0] = 0;
// Encontra as 5 combinações mais achadas pegando os seus indices
for (int count = 0; count < 5; count++)
{
if (count == 0)
{
for (i = 0; i < 24; i++)
{
if (countCombinacoesDNA[maisEncontrados[count]] < countCombinacoesDNA[i])
{
maisEncontrados[count] = i;
}
}
}
else
{
for (i = 0; i < 24; i++)
{
if (countCombinacoesDNA[maisEncontrados[count]] < countCombinacoesDNA[i] && countCombinacoesDNA[maisEncontrados[count - 1]] > countCombinacoesDNA[i])
{
maisEncontrados[count] = i;
}
}
}
}
lerArquivo(ARQUIVO_DNA_2, tamanhoDNA);
compararEncontrados<<<numBlocos, numThreads>>>(DNA, combinacoesDNA, inicioProcesso, maisEncontrados, countMaisEncontrados, tamanhoDNA, totalProcessos);
cudaDeviceSynchronize();
printf("\n Sequência | Encontrado no DNA1 |\n");
for(i = 0; i < 24; i++)
{
printf("\n %-9s | %-18d |", combinacoesDNAtxt[i], countCombinacoesDNA[i]);
}
printf("\n\n\nAs 5 sequências mais encontradas no DNA1 presentes no DNA2\n");
printf("\n Sequência | DNA1 | DNA2\n");
for (i = 0; i < 5; i++)
{
printf("\n %-9s | %-7d | %d", combinacoesDNAtxt[maisEncontrados[i]], countCombinacoesDNA[maisEncontrados[i]], countMaisEncontrados[i]);
}
printf("\n\n");
cudaFree(DNA);
cudaFree(countCombinacoesDNA);
cudaFree(combinacoesDNA);
cudaFree(inicioProcesso);
cudaFree(maisEncontrados);
cudaFree(countMaisEncontrados);
return 0;
}
void lerArquivo(const char *nomeArquivo, const int tamanho)
{
/*
omp_set_num_threads(12);
#pragma omp parallel
{
FILE *file;
file = fopen(nomeArquivo, "r");
int i;
char busca[2];
// Leitura do arquivo DNA1
#pragma omp for private (i)
fseek(file, i, SEEK_SET);
for (i = 0; i < tamanho; i++)
{
//fseek(file, i, SEEK_SET);
fgets(busca, 2, file);
DNA[i] = busca[0];
//fscanf(file, "%1c", &DNA[i]);
}
fclose(file);
}
*/
FILE *file;
file = fopen(nomeArquivo,"r");
int i;
// Leitura do arquivo DNA1
for(i = 0; i < tamanho; i++)
{
fscanf(file, "%1c", &DNA[i]);
}
fclose(file);
}
int tamanhoArquivo(const char *nomeArquivo)
{
FILE *file;
file = fopen(nomeArquivo, "r");
fseek(file, 0, SEEK_END);
int size;
size = ftell(file);
fclose(file);
return size;
}
|
8,567 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size, unsigned int *blocks, unsigned int *threadsPerBlock);
void printArray(const int a[], int size);
void fillArray(int a[], int size);
void cleanUpMatrixOperation(int *pA, int *pB, int *pResult);
void addMatricesWithCuda(const int a[3][3], const int b[3][3], int c[3][3]);
__global__
void addKernel(int *c, const int *a, const int *b)
{
int i = threadIdx.x + (blockIdx.x * blockDim.x);
c[i] = a[i] + b[i];
}
__global__
void addMarticesKernel(int *resultMatrix, const int *matrixA, const int *matrixB)
{
int x = threadIdx.x + (threadIdx.y * blockDim.x);
int y = threadIdx.y;
int **a = (int**)*matrixA;
int **b = (int**)*matrixA;
int **c = (int**)resultMatrix;
c[0][0] = a[0][0] + b[0][0];
}
void cudaAddingExample()
{
const int arraySize = 50;
int a[arraySize];
int b[arraySize];
unsigned int blocks = 1;
unsigned int threadsPerBlock = 10;
fillArray(a, arraySize);
fillArray(b, arraySize);
int c[arraySize] = { 0 };
// Add vectors in parallel.
cudaError_t cudaStatus = addWithCuda(c, a, b, arraySize, &blocks, &threadsPerBlock);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "addWithCuda failed!");
}
printArray(a, arraySize);
printf("\n+\n ");
printArray(b, arraySize);
printf(" \n= \n");
printArray(c, arraySize);
// cudaDeviceReset must be called before exiting in order for profiling and
// tracing tools such as Nsight and Visual Profiler to show complete traces.
cudaStatus = cudaDeviceReset();
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaDeviceReset failed!");
}
}
void cudaMatrixExample()
{
int width = 3;
int height = 3;
const int a[3][3] = {
{5, 5, 5},
{10, 10, 10},
{6, 6, 6}
};
const int b[3][3] = {
{6, 5, 10},
{6, 5, 10},
{6, 5, 10}
};
int result[3][3] = {};
addMatricesWithCuda(a, b, result);
}
void addMatricesWithCuda(const int a[][3], const int b[][3], int c[][3])
{
cudaError_t cudaStatus;
int *pA = 0;
int *pB = 0;
int *pC = 0;
//1. Setup device.
cudaStatus = cudaSetDevice(0);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaSetDevice failed! Do you have a CUDA-capable GPU installed?");
cleanUpMatrixOperation(pA, pB, pC);
}
//2. Allocate memory for 3 matrices
int sizeOfMatrices = (3 * sizeof(int)) * 3;
cudaStatus = cudaMalloc((void**)&pA, sizeOfMatrices);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "failed allocating mem for matrix");
cleanUpMatrixOperation(pA, pB, pC);
}
cudaStatus = cudaMalloc((void**)&pB, sizeOfMatrices);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "failed allocating mem for matrix");
cleanUpMatrixOperation(pA, pB, pC);
}
cudaStatus = cudaMalloc((void**)&pC, sizeOfMatrices);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "failed allocating mem for matrix");
cleanUpMatrixOperation(pA, pB, pC);
}
//3. Copy memory from host structures to device.
cudaStatus = cudaMemcpy(pA, a, sizeOfMatrices, cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "failed copying memory for matrix");
cleanUpMatrixOperation(pA, pB, pC);
}
cudaStatus = cudaMemcpy(pB, b, sizeOfMatrices, cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "failed copying memory for matrix");
cleanUpMatrixOperation(pA, pB, pC);
}
cudaStatus = cudaMemcpy(pC, c, sizeOfMatrices, cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "failed copying memory for matrix");
cleanUpMatrixOperation(pA, pB, pC);
}
addMarticesKernel<<<1, dim3(3, 3) >>>(pC, pA, pB);
// 4. Check for any errors launching the kernel
cudaStatus = cudaGetLastError();
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "add matrix launch failed: %s\n", cudaGetErrorString(cudaStatus));
cleanUpMatrixOperation(pA, pB, pC);
}
// 5. cudaDeviceSynchronize waits for the kernel to finish, and returns
// any errors encountered during the launch?
cudaStatus = cudaDeviceSynchronize();
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaDeviceSynchronize returned error code %d after launching addMatrix!\n", cudaStatus);
cleanUpMatrixOperation(pA, pB, pC);
}
cleanUpMatrixOperation(pA, pB, pC);
}
void cleanUpMatrixOperation(int *pA, int *pB, int *pResult)
{
cudaFree(pA);
cudaFree(pB);
cudaFree(pResult);
}
int main()
{
cudaMatrixExample();
return 0;
}
void printArray(const int a[], int size)
{
printf("{");
for (int i = 0; i < size; i++)
{
if (i % 50 == 0 && i != 0) {
printf("\n");
}
printf("%d", a[i]);
if (i != size -1)
{
printf(",");
}
}
printf("}");
}
void fillArray(int a[], int size)
{
for (int i = 0; i < size; i += 2)
{
a[i] = 1;
a[i + 1] = 2;
}
}
// Helper function for using CUDA to add vectors in parallel.
cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size, unsigned int *blocks, unsigned int *threadsPerBlock)
{
int *dev_a = 0;
int *dev_b = 0;
int *dev_c = 0;
cudaError_t cudaStatus;
// Choose which GPU to run on, change this on a multi-GPU system.
cudaStatus = cudaSetDevice(0);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaSetDevice failed! Do you have a CUDA-capable GPU installed?");
goto Error;
}
// Allocate GPU buffers for three vectors (two input, one output) .
cudaStatus = cudaMalloc((void**)&dev_c, size * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc failed!");
goto Error;
}
cudaStatus = cudaMalloc((void**)&dev_a, size * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc failed!");
goto Error;
}
cudaStatus = cudaMalloc((void**)&dev_b, size * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc failed!");
goto Error;
}
// Copy input vectors from host memory to GPU buffers.
cudaStatus = cudaMemcpy(dev_a, a, size * sizeof(int), cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMemcpy failed!");
goto Error;
}
cudaStatus = cudaMemcpy(dev_b, b, size * sizeof(int), cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMemcpy failed!");
goto Error;
}
// Launch a kernel on the GPU with one thread for each element.
addKernel<<<5, 10>>>(dev_c, dev_a, dev_b);
// Check for any errors launching the kernel
cudaStatus = cudaGetLastError();
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
goto Error;
}
// cudaDeviceSynchronize waits for the kernel to finish, and returns
// any errors encountered during the launch.
cudaStatus = cudaDeviceSynchronize();
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaDeviceSynchronize returned error code %d after launching addKernel!\n", cudaStatus);
goto Error;
}
// Copy output vector from GPU buffer to host memory.
cudaStatus = cudaMemcpy(c, dev_c, size * sizeof(int), cudaMemcpyDeviceToHost);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMemcpy failed!");
goto Error;
}
Error:
cudaFree(dev_c);
cudaFree(dev_a);
cudaFree(dev_b);
return cudaStatus;
}
|
8,568 |
/* This is a automatically generated test. Do not modify */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
__global__
void compute(float comp, float var_1,float var_2,float var_3,int var_4,float var_5,float var_6,float var_7,float var_8,float var_9,float var_10,float var_11,float var_12,float var_13,float var_14,float var_15,float var_16,float var_17,float var_18,float var_19,float var_20,float var_21,float var_22) {
if (comp > (+1.4693E36f - atan2f(floorf((+1.3008E-37f + var_1)), -1.9459E36f))) {
if (comp < var_2 * -1.8969E34f / var_3) {
comp += (+1.6139E12f + -1.6663E-43f - var_5);
comp = +1.9418E35f + ldexpf(-1.1265E-36f - (-1.2048E29f * (var_6 * var_7)), 2);
float tmp_1 = -0.0f;
comp += tmp_1 - var_8 - (var_9 - var_10 - atan2f((var_11 / (var_12 + (+1.0677E29f / (var_13 - floorf(+1.1488E-43f))))), var_14 * -0.0f));
for (int i=0; i < var_4; ++i) {
float tmp_2 = -1.9151E34f * tanhf((var_15 / -1.1452E6f));
comp += tmp_2 * var_16 / -1.1596E-36f / (+1.5494E35f / -1.4039E-36f + var_17 * var_18);
comp = -1.3565E-6f + +1.2987E35f + var_19 + (var_20 * (var_21 * var_22));
}
}
}
printf("%.17g\n", comp);
}
float* initPointer(float v) {
float *ret = (float*) malloc(sizeof(float)*10);
for(int i=0; i < 10; ++i)
ret[i] = v;
return ret;
}
int main(int argc, char** argv) {
/* Program variables */
float tmp_1 = atof(argv[1]);
float tmp_2 = atof(argv[2]);
float tmp_3 = atof(argv[3]);
float tmp_4 = atof(argv[4]);
int tmp_5 = atoi(argv[5]);
float tmp_6 = atof(argv[6]);
float tmp_7 = atof(argv[7]);
float tmp_8 = atof(argv[8]);
float tmp_9 = atof(argv[9]);
float tmp_10 = atof(argv[10]);
float tmp_11 = atof(argv[11]);
float tmp_12 = atof(argv[12]);
float tmp_13 = atof(argv[13]);
float tmp_14 = atof(argv[14]);
float tmp_15 = atof(argv[15]);
float tmp_16 = atof(argv[16]);
float tmp_17 = atof(argv[17]);
float tmp_18 = atof(argv[18]);
float tmp_19 = atof(argv[19]);
float tmp_20 = atof(argv[20]);
float tmp_21 = atof(argv[21]);
float tmp_22 = atof(argv[22]);
float tmp_23 = atof(argv[23]);
compute<<<1,1>>>(tmp_1,tmp_2,tmp_3,tmp_4,tmp_5,tmp_6,tmp_7,tmp_8,tmp_9,tmp_10,tmp_11,tmp_12,tmp_13,tmp_14,tmp_15,tmp_16,tmp_17,tmp_18,tmp_19,tmp_20,tmp_21,tmp_22,tmp_23);
cudaDeviceSynchronize();
return 0;
}
|
8,569 | /*
* AsmTest.cu
*
* Created on: May 18, 2014
* Author: reid
*/
__forceinline__ __device__ float2 add(float2 a, float2 b)
{
float2 c;
c.x = a.x + b.x;
c.y = a.y + b.y;
return c;
}
__device__ float2 sub(float2 a, float2 b)
{
float2 c;
c.x = a.x - b.x;
c.y = a.y - b.y;
return c;
}
|
8,570 | /*
HPC ASSIGNMENT 1 : QUESTION 2
Name : Arvind Sai K , Derik Clive
RollNo: 15CO207 , 15CO213
*/
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
#include<cuda.h>
#include<sys/time.h>
#define Arrsize 500000
#define HANDLE_ERROR( err ) ( HandleError( err, __FILE__, __LINE__ ) )
static void HandleError( cudaError_t err, const char *file, int line )
{
if (err != cudaSuccess)
{
printf( "%s in %s at line %d\n", cudaGetErrorString( err ),
file, line );
exit( EXIT_FAILURE );
}
}
//kernel to find the sum of an array
__global__ void find_sum(float *d_arr, float *d_sum)
{
__shared__ float sdata[1024];
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if(idx < Arrsize){
sdata[threadIdx.x] = d_arr[idx];
__syncthreads();
int i, index;
for(i=1; i<blockDim.x; i*=2)
{
index = 2*i*threadIdx.x;
if(index < blockDim.x && (blockIdx.x * blockDim.x + index + i) < Arrsize)
{
sdata[index] += sdata[index+i];
}
__syncthreads();
}
if(threadIdx.x==0)
atomicAdd(d_sum, sdata[0]);
}
}
int main()
{
//Defining the size of the array
const int ARRAY_SIZE = Arrsize;
const int ARRAY_BYTES = ARRAY_SIZE * sizeof(float);
//Creating a float array of size SIZE on the host
float h_arr[ARRAY_SIZE], h_sum[ARRAY_SIZE];
int i;
float s = 100.0;
srand((unsigned int)time(NULL));
for(i=0;i<ARRAY_SIZE;i++)
{
h_arr[i] = ((float)rand()/(float)(RAND_MAX))*s - s/2;
}
h_sum[0] = 0;
//Declaring variables on the GPU
float *d_arr;
float *d_sum;
float time;
cudaEvent_t start, stop;
cudaEventCreate(&start) ;
cudaEventCreate(&stop) ;
cudaEventRecord(start, 0) ;
//Allocating memory on the GPU
HANDLE_ERROR ( cudaMalloc((void **)&d_arr, ARRAY_BYTES));
HANDLE_ERROR ( cudaMalloc((void **)&d_sum, ARRAY_BYTES));
//Copy the h_arr from host to device
HANDLE_ERROR ( cudaMemcpy(d_arr, h_arr, ARRAY_BYTES, cudaMemcpyHostToDevice));
HANDLE_ERROR ( cudaMemcpy(d_sum, h_sum, ARRAY_BYTES, cudaMemcpyHostToDevice));
//Launch the kernel on the GPU
dim3 block_size = (1024);
dim3 grid_size = (ceil((float)ARRAY_SIZE/block_size.x));
find_sum<<<grid_size, block_size>>>(d_arr, d_sum);
//Copy back the result from device to host
HANDLE_ERROR ( cudaMemcpy(h_sum, d_sum, sizeof(float), cudaMemcpyDeviceToHost));
cudaEventRecord(stop, 0);
cudaEventSynchronize(stop);
cudaEventElapsedTime(&time, start, stop);
//Print the output
printf("\nResultant Sum: %f\n", h_sum[0]);
printf("Time on GPU: %f ms \n", time);
float expected = 0.0;
cudaEventCreate(&start) ;
cudaEventCreate(&stop) ;
cudaEventRecord(start, 0) ;
for(int i=0;i<ARRAY_SIZE;i++)
expected += h_arr[i];
cudaEventRecord(stop, 0);
cudaEventSynchronize(stop);
cudaEventElapsedTime(&time, start, stop);
printf("\nExpected Sum: %f\n", expected);
printf("Time on CPU: %f ms \n", time);
//Freeing memory on the GPU
cudaFree(d_arr);
cudaFree(d_sum);
return 0;
}
|
8,571 | #include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstdlib>
//#include <ctime>
#include <vector>
#include <thrust/extrema.h>
#include <thrust/device_vector.h>
//#include "../lib/cuPrintf.cu"
using namespace std;
typedef double TNum;
#define CSC(call) do { \
cudaError_t e = call; \
if (e != cudaSuccess) { \
fprintf(stderr, "CUDA Error in %s:%d: %s\n"\
, __FILE__, __LINE__, cudaGetErrorString(e)); \
exit(0); \
} \
} while(0)
//#define EPS .0000001;
struct Comparator {
__host__ __device__ bool operator()(TNum a, TNum b) {
return a < b;
}
};
__constant__ uint32_t SIZE_N[1];
__constant__ uint32_t SIZE_M[1];
__constant__ uint32_t SIZE_K[1];
struct Position {
int32_t Row;
int32_t Col;
};
__device__ __host__ Position SetPosition(int32_t i, int32_t j) {
Position pos;
pos.Row = i;
pos.Col = j;
return pos;
}
__device__ __host__ Position SetPosition(uint32_t i, uint32_t j) {
return SetPosition((int32_t) i, (int32_t) j);
}
__device__ __host__ bool IsCorrectPos(Position pos, uint32_t height, uint32_t width) {
return (pos.Row >= 0 && pos.Col >= 0 && pos.Row < (int32_t) height && pos.Col < (int32_t) width);
}
__device__ __host__ int32_t GetLinearPosition(Position pos, uint32_t height, uint32_t width) {
return (IsCorrectPos(pos, height, width)) ? (pos.Col * (int32_t) height + pos.Row) : -1;
}
__device__ __host__ bool IsCorrectPos(uint32_t i, uint32_t j, uint32_t height, uint32_t width) {
return (i < height && j < width);
}
__device__ __host__ int32_t GetLinearPosition(uint32_t i, uint32_t j, uint32_t height, uint32_t width) {
return (IsCorrectPos(i, j, height, width) ? ((int32_t) j * (int32_t) height + (int32_t) i) : -1);
}
/*__global__ void SwapVector(TNum *a, TNum *b, uint32_t length, uint32_t shift) {
uint32_t begin = blockDim.x * blockIdx.x + threadIdx.x + shift;
uint32_t offset = gridDim.x * blockDim.x;
TNum tmp;
for (uint32_t i = begin, i < length, i += offset) {
}
}*/
__global__ void SwapRows(TNum *a, TNum *b, uint32_t row1, uint32_t row2, uint32_t shift) {
//uint32_t begin = blockDim.x * blockIdx.x + threadIdx.x;
//uint32_t offset = gridDim.x * blockDim.x;
uint32_t col;
TNum tmp;
for (col = (blockDim.x * blockIdx.x + threadIdx.x) + shift; col < *SIZE_M; col += gridDim.x * blockDim.x) {
tmp = a[GetLinearPosition(row1, col, *SIZE_N, *SIZE_M)];
a[GetLinearPosition(row1, col, *SIZE_N, *SIZE_M)] = a[GetLinearPosition(row2, col, *SIZE_N, *SIZE_M)];
a[GetLinearPosition(row2, col, *SIZE_N, *SIZE_M)] = tmp;
}
for (col = blockDim.x * blockIdx.x + threadIdx.x; col < *SIZE_K; col += gridDim.x * blockDim.x) {
tmp = b[GetLinearPosition(row1, col, *SIZE_N, *SIZE_K)];
b[GetLinearPosition(row1, col, *SIZE_N, *SIZE_K)] = b[GetLinearPosition(row2, col, *SIZE_N, *SIZE_K)];
b[GetLinearPosition(row2, col, *SIZE_N, *SIZE_K)] = tmp;
}
}
__global__ void Normalize(TNum *a, TNum *b, uint32_t row, uint32_t shift) {
if (!(abs(a[GetLinearPosition(row, shift, *SIZE_N, *SIZE_M)]) > .0000001)) {
return;
}
//uint32_t begin = blockDim.x * blockIdx.x + threadIdx.x;
//uint32_t offset = gridDim.x * blockDim.x;
uint32_t col;
for (col = (blockDim.x * blockIdx.x + threadIdx.x) + shift + 1; col < *SIZE_M; col += gridDim.x * blockDim.x) {
a[GetLinearPosition(row, col, *SIZE_N, *SIZE_M)] /=
a[GetLinearPosition(row, shift, *SIZE_N, *SIZE_M)];
}
for (col = blockDim.x * blockIdx.x + threadIdx.x; col < *SIZE_K; col += gridDim.x * blockDim.x) {
b[GetLinearPosition(row, col, *SIZE_N, *SIZE_K)] /=
a[GetLinearPosition(row, shift, *SIZE_N, *SIZE_M)];
}
}
__global__ void GaussFirst(TNum *a, TNum *b, uint32_t row, uint32_t shift) {
if (!(abs(a[GetLinearPosition(row, shift, *SIZE_N, *SIZE_M)]) > .0000001)) {
return;
}
/*Position begin = SetPosition(blockDim.x * blockIdx.x + threadIdx.x,
blockDim.y * blockIdx.y + threadIdx.y);
Position offset = SetPosition(blockDim.x * gridDim.x, blockDim.y * gridDim.y);*/
//Position curr = begin;
/*int32_t beginRow = blockDim.x * blockIdx.x + threadIdx.x;
int32_t beginCol = blockDim.y * blockIdx.y + threadIdx.y;
int32_t offsetRow = blockDim.x * gridDim.x;
int32_t offsetCol = blockDim.y * gridDim.y;*/
Position curr;
//TNum head;
for (curr.Row = (blockDim.x * blockIdx.x + threadIdx.x) + row + 1; curr.Row < *SIZE_N; curr.Row += blockDim.x * gridDim.x) {
//head = a[GetLinearPosition(curr.Row, shift, *SIZE_N, *SIZE_M)];
if (!(abs(a[GetLinearPosition(curr.Row, shift, *SIZE_N, *SIZE_M)]) > .0000001)) {
continue;
}
for (curr.Col = (blockDim.y * blockIdx.y + threadIdx.y) + shift + 1; curr.Col < *SIZE_M; curr.Col += blockDim.y * gridDim.y) {
a[GetLinearPosition(curr.Row, curr.Col, *SIZE_N, *SIZE_M)] -=
a[GetLinearPosition(row, curr.Col, *SIZE_N, *SIZE_M)] *
a[GetLinearPosition(curr.Row, shift, *SIZE_N, *SIZE_M)];
}
for (curr.Col = blockDim.y * blockIdx.y + threadIdx.y; curr.Col < *SIZE_K; curr.Col += blockDim.y * gridDim.y) {
b[GetLinearPosition(curr.Row, curr.Col, *SIZE_N, *SIZE_K)] -=
b[GetLinearPosition(row, curr.Col, *SIZE_N, *SIZE_K)] *
a[GetLinearPosition(curr.Row, shift, *SIZE_N, *SIZE_M)];
}
}
}
__global__ void GaussSecond(TNum *a, TNum *b, uint32_t row, uint32_t shift) {
/*Position begin = SetPosition(blockDim.x * blockIdx.x + threadIdx.x,
blockDim.y * blockIdx.y + threadIdx.y);
Position offset = SetPosition(blockDim.x * gridDim.x, blockDim.y * gridDim.y);*/
/*int32_t beginRow = blockDim.x * blockIdx.x + threadIdx.x;
int32_t beginCol = blockDim.y * blockIdx.y + threadIdx.y;
int32_t offsetRow = blockDim.x * gridDim.x;
int32_t offsetCol = blockDim.y * gridDim.y;*/
Position curr;
for (curr.Row = row - 1 - (blockDim.x * blockIdx.x + threadIdx.x); curr.Row >= 0; curr.Row -= blockDim.x * gridDim.x) {
/*for (curr.Col = begin.Col + shift; curr.Col < *SIZE_M; curr.Col += offset.Col) {
a[GetLinearPosition(curr.Row, curr.Col, *SIZE_N, *SIZE_M)] -=
a[GetLinearPosition(row, curr.Col, *SIZE_N, *SIZE_M)] *
a[GetLinearPosition(curr.Row, shift, *SIZE_N, *SIZE_M)];
}*/
for (curr.Col = blockDim.y * blockIdx.y + threadIdx.y; curr.Col < *SIZE_K; curr.Col += blockDim.y * gridDim.y) {
b[GetLinearPosition(curr.Row, curr.Col, *SIZE_N, *SIZE_K)] -=
b[GetLinearPosition(row, curr.Col, *SIZE_N, *SIZE_K)] *
a[GetLinearPosition(curr.Row, shift, *SIZE_N, *SIZE_M)];
}
}
}
/*__host__ void GaussSecondCPU(TNum *a, TNum *b, uint32_t row, uint32_t shift) {
Position curr;
for (curr.Row = row - 1; curr.Row >= 0; curr.Row--) {
for (curr.Col = shift; curr.Col >= 0; curr.Col -= offset.Col) {
a[GetLinearPosition(curr.Row, curr.Col, *SIZE_N, *SIZE_M)] -=
a[GetLinearPosition(row, curr.Col, *SIZE_N, *SIZE_M)] *
a[GetLinearPosition(curr.Row, shift, *SIZE_N, *SIZE_M)];
}
for (curr.Col = begin.Col; curr.Col >= 0; curr.Col -= offset.Col) {
b[GetLinearPosition(curr.Row, curr.Col, *SIZE_N, *SIZE_K)] -=
b[GetLinearPosition(row, curr.Col, *SIZE_N, *SIZE_K)] *
a[GetLinearPosition(curr.Row, shift, *SIZE_N, *SIZE_M)];
}
}
}*/
/*__global__ void GetResult(TNum *b, TNum *x, uint32_t *shifts, uint32_t rows) {
Position begin = SetPosition(blockDim.x * blockIdx.x + threadIdx.x,
blockDim.y * blockIdx.y + threadIdx.y);
Position offset = SetPosition(blockDim.x * gridDim.x, blockDim.y * gridDim.y);
Position curr;
for (curr.Row = begin.Row; curr.Row < rows; curr.Rows++) {
for (curr.Col = begin.Col; curr.Col < *SIZE_K; curr.Col++) {
}
}
}*/
__host__ void InputMatrix(TNum *matrix, uint32_t height, uint32_t width) {
for (uint32_t i = 0; i < height; i++) {
for (uint32_t j = 0; j < width; j++) {
cin >> matrix[GetLinearPosition(i, j, height, width)];
}
}
}
__host__ void PrintMatrix(TNum *matrix, uint32_t height, uint32_t width) {
for (uint32_t i = 0; i < height; i++) {
for (uint32_t j = 0; j < width; j++) {
if (j > 0) {
cout << " ";
}
cout << scientific << matrix[GetLinearPosition(SetPosition(i, j), height, width)];
}
cout << endl;
}
}
__host__ int main(void) {
Comparator cmp;
uint32_t n, m, k;
cin >> n >> m >> k;
CSC(cudaMemcpyToSymbol(SIZE_N, &n, sizeof(uint32_t)));
CSC(cudaMemcpyToSymbol(SIZE_M, &m, sizeof(uint32_t)));
CSC(cudaMemcpyToSymbol(SIZE_K, &k, sizeof(uint32_t)));
TNum *a = new TNum[n * m];
TNum *b = new TNum[n * k];
InputMatrix(a, n, m);
InputMatrix(b, n, k);
TNum *cuda_a;
TNum *cuda_b;
CSC(cudaMalloc((void**) &cuda_a, sizeof(TNum) * n * m));
CSC(cudaMalloc((void**) &cuda_b, sizeof(TNum) * n * k));
CSC(cudaMemcpy(cuda_a, a, sizeof(TNum) * n * m, cudaMemcpyHostToDevice));
CSC(cudaMemcpy(cuda_b, b, sizeof(TNum) * n * k, cudaMemcpyHostToDevice));
uint32_t row = 0;
uint32_t *shifts = new uint32_t[n];
memset(shifts, 0, n * sizeof(uint32_t));
for (uint32_t col = 0; col < m && row < n; col++) {
/*CSC(cudaMemcpy(a, cuda_a, sizeof(TNum) * n * m, cudaMemcpyDeviceToHost));
CSC(cudaMemcpy(b, cuda_b, sizeof(TNum) * n * k, cudaMemcpyDeviceToHost));
PrintMatrix(a, n, m);
cout << "---" << endl;
PrintMatrix(b, n, k);
cout << "___" << endl;*/
if (row < n - 1) {
thrust::device_ptr <TNum> cuda_a_begin = thrust::device_pointer_cast(cuda_a);
thrust::device_ptr <TNum> cuda_a_max = thrust::max_element(
cuda_a_begin + GetLinearPosition(row, col, n, m),
cuda_a_begin + (col + 1) * n, cmp);
uint32_t row_max_pos = cuda_a_max - cuda_a_begin - GetLinearPosition(0, col, n, m);
TNum row_value, max_value;
//cout << sizeof(TNum) << endl;
//cout << cuda_a << " : " << cuda_a + n * m * sizeof(TNum) << endl;
//cout << cuda_a + sizeof(TNum) * GetLinearPosition(row, col, n, m) << " : " <<
//cuda_a + sizeof(TNum) * GetLinearPosition(row_max_pos, col, n, m) << endl;
CSC(cudaMemcpy(&row_value, cuda_a + GetLinearPosition(row, col, n, m),
sizeof(TNum), cudaMemcpyDeviceToHost));
CSC(cudaMemcpy(&max_value, cuda_a + GetLinearPosition(row_max_pos, col, n, m),
sizeof(TNum), cudaMemcpyDeviceToHost));
TNum curr = row_value;
//cout << curr << " : " << max_value << endl;
if (row_max_pos != row && row_value < max_value) {
SwapRows<<<dim3(1024), dim3(1024)>>>(cuda_a, cuda_b, row, row_max_pos, col);
curr = max_value;
}
if (!(abs(curr) > .0000001)) {
//cout << "CURR = " << curr << endl;
//cout << "OUT1" << endl;
continue;
}
} else {
TNum curr;
//cout << GetLinearPosition(row, col, n, m) << endl;
//cout << row << ":" << col << endl;
CSC(cudaMemcpy(&curr, cuda_a + GetLinearPosition(row, col, n, m),
sizeof(TNum), cudaMemcpyDeviceToHost));
if (!(abs(curr) > .0000001)) {
//cout << "OUT2" << endl;
continue;
}
}
/*CSC(cudaMemcpy(a, cuda_a, sizeof(TNum) * n * m, cudaMemcpyDeviceToHost));
CSC(cudaMemcpy(b, cuda_b, sizeof(TNum) * n * k, cudaMemcpyDeviceToHost));
cout << "Col: " << col << endl;
PrintMatrix(a, n, m);
cout << "---" << endl;
PrintMatrix(b, n, k);
cout << "~~~" << endl;*/
//cudaPrintfInit();
Normalize<<<dim3(1024), dim3(1024)>>>(cuda_a, cuda_b, row, col);
//cudaPrintfDisplay(stdout, true);
//cudaPrintfEnd();
/*CSC(cudaMemcpy(a, cuda_a, sizeof(TNum) * n * m, cudaMemcpyDeviceToHost));
CSC(cudaMemcpy(b, cuda_b, sizeof(TNum) * n * k, cudaMemcpyDeviceToHost));
PrintMatrix(a, n, m);
cout << "---" << endl;
PrintMatrix(b, n, k);
cout << "+++" << endl;*/
if (row < n - 1) {
GaussFirst<<<dim3(32, 32), dim3(32, 32)>>>(cuda_a, cuda_b, row, col);
}
//cout << shifts[row] << " -> " << col << endl;
shifts[row] = col;
row++;
/*CSC(cudaMemcpy(a, cuda_a, sizeof(TNum) * n * m, cudaMemcpyDeviceToHost));
CSC(cudaMemcpy(b, cuda_b, sizeof(TNum) * n * k, cudaMemcpyDeviceToHost));
PrintMatrix(a, n, m);
cout << "---" << endl;
PrintMatrix(b, n, k);
cout << "===" << endl << endl;*/
}
/*cout << "NEXT!!" << endl;
CSC(cudaMemcpy(a, cuda_a, sizeof(TNum) * n * m, cudaMemcpyDeviceToHost));
CSC(cudaMemcpy(b, cuda_b, sizeof(TNum) * n * k, cudaMemcpyDeviceToHost));
PrintMatrix(a, n, m);
cout << "---" << endl;
PrintMatrix(b, n, k);
cout << "===" << endl << endl;*/
for (uint32_t i = row; i > 0; i--) {
uint32_t row_curr = i - 1;
if (row_curr > 0) {
GaussSecond<<<dim3(32, 32), dim3(32, 32)>>>(cuda_a, cuda_b, row_curr, shifts[row_curr]);
}
/*CSC(cudaMemcpy(a, cuda_a, sizeof(TNum) * n * m, cudaMemcpyDeviceToHost));
CSC(cudaMemcpy(b, cuda_b, sizeof(TNum) * n * k, cudaMemcpyDeviceToHost));
PrintMatrix(a, n, m);
cout << "---" << endl;
PrintMatrix(b, n, k);
cout << "===" << endl << endl;*/
}
//uint32_t *cuda_shifts;
//cudaMalloc((void**) &cuda_shifts, sizeof(uint32_t) * row);
//cudaMemcpy(cuda_shifts, shifts, sizeof(uint32_t) * row, cudaMemcpyHostToDevice);
//GetResult<<<dim3(32, 32), dim3(32, 32)>>>(cuda_b, cuda_x, cuda_shifts, row, );
cudaEvent_t syncEvent;
cudaEventCreate(&syncEvent);
cudaEventRecord(syncEvent, 0);
cudaEventSynchronize(syncEvent);
cudaEventDestroy(syncEvent);
//Calculating end
CSC(cudaMemcpy(b, cuda_b, sizeof(TNum) * n * k, cudaMemcpyDeviceToHost));
CSC(cudaFree(cuda_a));
CSC(cudaFree(cuda_b));
//cudaFree(cuda_x);
//PrintMatrix(cuda_b, shifts, m, k);
TNum zero = 0.;
uint32_t untill = 0;
if (row > 0) {
untill = shifts[0];
}
uint32_t rows_cnt = 0;
for (uint32_t i = 0; i < untill; i++) {
for (uint32_t j = 0; j < k; j++) {
//cout << "1: " << shifts[0] << "::" << i << ":" << j << endl;
if (j > 0) {
cout << " ";
}
cout << scientific << zero;
}
rows_cnt++;
cout << endl;
}
//cout << row << endl;
for (uint32_t i = 0; i < row; i++) {
if (i > 0) {
for (uint32_t ii = 0; ii < shifts[i] - shifts[i - 1] - 1; ii++) {
for (uint32_t j = 0; j < k; j++) {
if (j > 0) {
cout << " ";
}
//cout << "2: " << i << ":" << j << endl;
cout << scientific << zero;
}
rows_cnt++;
cout << endl;
}
}
for (uint32_t j = 0; j < k; j++) {
if (j > 0) {
cout << " ";
}
//cout << "3: " << i << ":" << j << endl;
cout << scientific << b[GetLinearPosition(i, j, n, k)];
}
rows_cnt++;
cout << endl;
}
//cout << "TEST0" << endl;
//cout << shifts[0] << endl;
//untill = m - shifts[max(0, (int32_t) row - 1)];
for (uint32_t i = 0; i < m - rows_cnt; i++) {
for (uint32_t j = 0; j < k; j++) {
if (j > 0) {
cout << " ";
}
//cout << "4: " << i << ":" << j << endl;
cout << scientific << zero;
}
cout << endl;
}
//cout << "TEST1" << endl;
/*cout << "SHIFTS:\n";
for (uint32_t i = 0; i < row; i++) {
cout << shifts[i] << endl;
}*/
delete [] shifts;
delete [] a;
delete [] b;
//delete [] cuda_x;
return 0;
} |
8,572 |
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <math.h>
/**
* @file pctdemo_processMandelbrotElement.cu
*
* CUDA code to calculate the Mandelbrot Set on a GPU.
*
* Copyright 2011 The MathWorks, Inc.
*/
/** Work out which piece of the global array this thread should operate on */
__device__ size_t calculateGlobalIndex() {
// Which block are we?
size_t const globalBlockIndex = blockIdx.x + blockIdx.y * gridDim.x;
// Which thread are we within the block?
size_t const localThreadIdx = threadIdx.x + blockDim.x * threadIdx.y;
// How big is each block?
size_t const threadsPerBlock = blockDim.x*blockDim.y;
// Which thread are we overall?
return localThreadIdx + globalBlockIndex * threadsPerBlock;
}
/** The actual Mandelbrot algorithm for a single location */
__device__ unsigned int doIterations(double const realPart0,
double const imagPart0,
unsigned int const maxIters) {
// Initialise: z = z0
double realPart = realPart0;
double imagPart = imagPart0;
unsigned int count = 0;
// Loop until escape
while ((count <= maxIters)
&& ((realPart*realPart + imagPart * imagPart) <= 4.0)) {
++count;
// Update: z = z*z + z0;
double const oldRealPart = realPart;
realPart = realPart * realPart - imagPart * imagPart + realPart0;
imagPart = 2.0*oldRealPart*imagPart + imagPart0;
}
return count;
}
/** Main entry point.
* Works out where the current thread should read/write to global memory
* and calls doIterations to do the actual work.
*/
__global__ void processMandelbrotElement(
double * out,
const double * x,
const double * y,
const unsigned int maxIters,
const unsigned int numel) {
// Work out which thread we are
size_t const globalThreadIdx = calculateGlobalIndex();
// If we're off the end, return now
if (globalThreadIdx >= numel) {
return;
}
// Get our X and Y coords
double const realPart0 = x[globalThreadIdx];
double const imagPart0 = y[globalThreadIdx];
// Run the itearations on this location
unsigned int const count = doIterations(realPart0, imagPart0, maxIters);
out[globalThreadIdx] = log(double(count + 1));
}
int main()
{
return 0;
}
|
8,573 | // Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#ifndef CUDAWITHINSTACK_H_
#define CUDAWITHINSTACK_H_
#ifndef VS_OPENCL
#include <cuda_runtime.h>
#include <math_constants.h>
#endif
#include <cmath>
#ifndef __CUDACC__
#include <algorithm>
#include <math.h>
#endif
namespace VideoStitch {
namespace Core {
/**
* Input must be within both texture and crop rect
*/
inline __device__ bool isWithinRect(const float2 uv, float width, float height) {
return 0.0f <= uv.x && uv.x < width && 0.0f <= uv.y && uv.y < height;
}
inline __device__ bool isWithinCropRect(const float2 uv, float width, float height, float cLeft, float cRight,
float cTop, float cBottom) {
return 0.0f <= uv.x && uv.x < width && 0.0f <= uv.y && uv.y < height && cLeft <= uv.x && uv.x <= cRight &&
cTop <= uv.y && uv.y <= cBottom;
}
inline __device__ bool isWithinCropCircle(const float2 uv, float width, float height, float cLeft, float cRight,
float cTop, float cBottom) {
const float centerX = (cRight + cLeft) / 2.0f;
const float centerY = (cBottom + cTop) / 2.0f;
const float radius = fminf(cRight - cLeft, cBottom - cTop) / 2.0f;
return 0.0f <= uv.x && uv.x < width && 0.0f <= uv.y && uv.y < height &&
(uv.x - centerX) * (uv.x - centerX) + (uv.y - centerY) * (uv.y - centerY) < radius * radius;
}
namespace TransformStack {
inline __host__ bool isWithinCropRect(const float2 uv, float width, float height, float cLeft, float cRight, float cTop,
float cBottom) {
return 0.0f <= uv.x && uv.x < width && 0.0f <= uv.y && uv.y < height && cLeft <= uv.x && uv.x < cRight &&
cTop <= uv.y && uv.y < cBottom;
}
inline __host__ bool isWithinCropCircle(const float2 uv, float width, float height, float cLeft, float cRight,
float cTop, float cBottom) {
const float centerX = (cRight + cLeft) / 2.0f;
const float centerY = (cBottom + cTop) / 2.0f;
const float radius = fminf(cRight - cLeft, cBottom - cTop) / 2.0f;
return 0.0f <= uv.x && uv.x < width && 0.0f <= uv.y && uv.y < height &&
(uv.x - centerX) * (uv.x - centerX) + (uv.y - centerY) * (uv.y - centerY) < radius * radius;
}
} // namespace TransformStack
#ifdef __CUDACC__
/**
* Output cropper with a rectangular shape.
*/
struct OutputRectCropper {
public:
static inline __device__ bool isPanoPointVisible(int x, int y, int panoWidth, int panoHeight) { return true; }
};
/**
* Output cropper with a circular shape.
*/
struct OutputCircleCropper {
public:
static inline __device__ bool isPanoPointVisible(int x, int y, int panoWidth, int panoHeight) {
// We want to be in a frame where values are at the pixel centers instead of pixels top-left.
// That would mean using (x + 0.5, y + 0.5) instead of (x, y). Since we want integers, we multiply everything by 2
// to yield (2 * x + 1, 2 * y + 1).
x = 2 * x + 1;
y = 2 * y + 1;
// The radius is simply the smallest of the semi-axis. For an odd size, we always ignore the last pixel.
const int centerX = panoWidth & (~1);
const int centerY = panoHeight & (~1);
int radiusSquared = min(centerX, centerY);
radiusSquared *= radiusSquared;
return (x - centerX) * (x - centerX) + (y - centerY) * (y - centerY) <= radiusSquared;
}
};
#endif
} // namespace Core
} // namespace VideoStitch
#endif
|
8,574 | #ifndef __CUDA_RUNTIME_H__
#include "cuda_runtime.h"
#endif // !"cuda_runtime.h"
#ifndef __DEVICE_LAUNCH_PARAMETERS_H__
#include "device_launch_parameters.h"
#endif // !__DEVICE_LAUNCH_PARAMETERS_H__
// Constants
const int MAX_N = (2147483648 / 8); // N = maxInt32 / 8 = (2147483648 / 8) = 268,435,456 queens
// GPU-local variables
__device__ int board[MAX_N] = { 0 }; // list of queen positions, where board[x] = y
__device__ short occ_col[MAX_N]; // column occupancy (unique x)
__device__ short occ_row[MAX_N]; // row occupancy (unique y)
__device__ short occ_adiag[2 * MAX_N]; // ascending diagonal occupancy (unique x+y)
__device__ short occ_ddiag[2 * MAX_N]; // decending diagonal occupancy (unique x-y)
__device__ short collision_flag[1] = { 0 }; // Flag raised if any 2 Queens can attack each other
using namespace std;
// Adds queen to occupancy arrays and checks for collisions
__device__ void register_q(int x, int y, int num_queens)
{
if (occ_col[x] != 0 || occ_row[y] != 0 || occ_adiag[(x + y)] != 0 || occ_ddiag[num_queens + (x - y)] != 0) {
collision_flag[0] = 1;
}
occ_col[x] = 1;
occ_row[y] = 1;
occ_adiag[x + y] = 1;
occ_ddiag[num_queens + (x - y)] = 1;
return;
}
// Equation 1
__device__ void case1(int i, int N) {
int x, y, x1, y1;
x = i;
y = 2 * i;
x1 = N / 2 + i;
y1 = 2 * i - 1;
register_q(x - 1, y - 1, N);
register_q(x1 - 1, y1 - 1, N);
board[x - 1] = y - 1;
board[x1 - 1] = y1 - 1;
return;
}
// Equation 2
__device__ void case2(int i, int N) {
int x, y, x1, y1;
x = i;
y = 1 + ((2 * (i - 1) + N / 2 - 1) % N);
x1 = N + 1 - i;
y1 = N - ((2 * (i - 1) + N / 2 - 1) % N);
register_q(x - 1, y - 1, N);
register_q(x1 - 1, y1 - 1, N);
board[x - 1] = y - 1;
board[x1 - 1] = y1 - 1;
return;
}
// Main GPU kernel
__global__ void N_Queens_Kernel(int num_queens)
{
// Each thread places 2 queens
int i = (blockDim.x * blockIdx.x + threadIdx.x) + 1;
if (i > (num_queens - num_queens % 2) / 2) {
return;
}
// Case 1, N is even and (N-2) mod 6 is not 0
if (num_queens % 2 == 0 && (num_queens - 2) % 6 != 0) {
case1(i, num_queens);
}
// Case 2, N is even and N mod 6 is not 0
else if (num_queens % 2 == 0 && num_queens % 6 != 0) {
case2(i, num_queens);
}
// Case 3, N is odd, and (N-3) mod 6 is not 0
else if ((num_queens - 1) % 2 == 0 && (num_queens - 3) % 6 != 0) {
case1(i, num_queens - 1);
if (blockIdx.x == 0 && threadIdx.x == 0) {
board[num_queens - 1] = num_queens - 1;
}
}
// Case 4, N is odd and (N-1) mod 6 is not 0
else if ((num_queens - 1) % 2 == 0 && (num_queens - 1) % 6 != 0) {
case2(i, num_queens - 1);
if (blockIdx.x == 0 && threadIdx.x == 0) {
board[num_queens - 1] = num_queens - 1;
}
}
return;
}
// Resets board and occupancy grid
__global__ void clearBuffers(int num_queens) {
int i = (blockDim.x * blockIdx.x + threadIdx.x);
board[2 * i] = 0;
board[2 * i + 1] = 0;
occ_col[2 * i] = 0;
occ_col[2 * i + 1] = 0;
occ_row[2 * i] = 0;
occ_row[2 * i + 1] = 0;
occ_adiag[2 * i] = 0;
occ_adiag[2 * i + 1] = 0;
occ_adiag[2 * i + num_queens] = 0;
occ_adiag[2 * i + 1 + num_queens] = 0;
occ_ddiag[2 * i] = 0;
occ_ddiag[2 * i + 1] = 0;
occ_ddiag[2 * i + num_queens] = 0;
occ_ddiag[2 * i + 1 + num_queens] = 0;
if (blockIdx.x == 0 && threadIdx.x == 0) {
collision_flag[0] = 0;
}
}
// Returns symbol addresses for interface variables
int* getBoardAddr() {
int* board_ptr = 0;
cudaGetSymbolAddress((void**)&board_ptr, board);
return board_ptr;
}
int* getFlagAddr() {
int* cflag_ptr = 0;
cudaGetSymbolAddress((void**)&cflag_ptr, collision_flag);
return cflag_ptr;
}
int getMaxN() {
int N = MAX_N;
return N;
}
// Frees all memory prior to shutdown
void memPurge() {
cudaFree(board);
cudaFree(collision_flag);
cudaFree(occ_col);
cudaFree(occ_row);
cudaFree(occ_adiag);
cudaFree(occ_ddiag);
} |
8,575 | #include "includes.h"
__global__ void kernelUpdateParticle(double *positions, double *velocities, double *pBests, double *gBest, int particlesCount, int dimensionsCount, double r1, double r2)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
if(i >= particlesCount * dimensionsCount)
return;
velocities[i] = d_OMEGA * velocities[i] + r1 * (pBests[i] - positions[i])
+ r2 * (gBest[i % dimensionsCount] - positions[i]);
// Update posisi particle
positions[i] += velocities[i];
} |
8,576 | #include <cuda.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#include <curand_kernel.h>
#include <cuda_runtime.h>
#include <ctime>
#define OUTPUT_FILE "/tmp/absorbed.dat"
char info[] = "\
Usage:\n\
neutron-seq H Nb C_c C_s\n\
\n\
H : épaisseur de la plaque\n\
Nb : nombre d'échantillons\n\
C_c: composante absorbante\n\
C_s: componente diffusante\n\
\n\
Exemple d'execution : \n\
neutron-seq 1.0 500000000 0.5 0.5\n\
";
/* setup_kernel <<<NbBlocks,NbThreadsParBloc>>> (devStates,unsigned(time(NULL))); //initialisation de l'état curandState pour chaque thread
* notre gettimeofday()
*/
double my_gettimeofday(){
struct timeval tmp_time;
gettimeofday(&tmp_time, NULL);
return tmp_time.tv_sec + (tmp_time.tv_usec * 1.0e-6L);
}
__global__ void setup_kernel(curandState *state)
{
int id = threadIdx.x + blockIdx.x * blockDim.x;
/* Each thread gets same seed, a different sequence
number, no offset */
curand_init(0,id, 0, &state[id]);
}
//int id = threadIdx.x + blockIdx.x * blockDim.x;
__global__ void generate_kernel(curandState *state,
int step, unsigned int nbThread, dim3 TailleGrille, unsigned int N, float c, float c_c,float h, int* R, int* B,int* T,float* absorbed, int* j)
{
int id = threadIdx.x + blockIdx.x *TailleGrille.x;
/* Copy state to local memory for efficiency */
curandState localState = state[id];
/* Generate pseudo-random unsigned ints */
float u;
int r=0;
int b=0;
int t=0;
__shared__ int Rtab[1024];
__shared__ int Btab[1024];
__shared__ int Ttab[1024];
float d, x, L;
int debut_for = id*step ;
int fin_for = (id+1)*step;
if(id == nbThread) fin_for = N;
for (int i = debut_for; i < fin_for; i++) {
d = 0.0;
x = 0.0;
while (1) {
u = curand_uniform(&localState);
L = -(1 / c) * log(u);
x = x + L * cos(d); //initialisation de l'état curandState pour chaque thread
if (x < 0) {
r++;
break;
} else if (x >= h) {
t++;
break;
} else if ((u = curand_uniform(&localState)) < c_c / c) {
b++;
atomicAdd(j,1);
absorbed[(*j)] = x;
break;
} else {
u = curand_uniform(&localState);
d = u * M_PI;
}
}
}
Rtab[threadIdx.x]=r;
Btab[threadIdx.x]=b;
Ttab[threadIdx.x]=t;
//reduction :
__syncthreads();
int k=blockDim.x/2;
while (k>0){
if(threadIdx.x<k){
Rtab[threadIdx.x]+=Rtab[threadIdx.x +k];
Btab[threadIdx.x]+=Btab[threadIdx.x +k];
Ttab[threadIdx.x]+=Ttab[threadIdx.x +k];
}
k/=2;
__syncthreads();
}
if(threadIdx.x==0){
atomicAdd(R,Rtab[0]);
atomicAdd(B,Btab[0]);
atomicAdd(T,Ttab[0]);
}
state[id] = localState;
}
int main(int argc, char *argv[]) {
// La distance moyenne entre les interactions neutron/atome est 1/c.
// c_c et c_s sont les composantes absorbantes et diffusantes de c.
float c, c_c, c_s;
// épaisseur de la plaque
float h;
// nombre d'échantillons
int n;
// nombre de neutrons refléchis, absorbés et transmis
int r, b, t;
// chronometrage
double start, finish;
int j = 0; // compteurs
if( argc == 1)
fprintf( stderr, "%s\n", info);
// valeurs par defaut
h = 1.0;
n = 500000000;
c_c = 0.5;
c_s = 0.5;
// recuperation des parametres
if (argc > 1)
h = atof(argv[1]);
if (argc > 2)
n = atoi(argv[2]);
if (argc > 3)
c_c = atof(argv[3]);
if (argc > 4)
c_s = atof(argv[4]);
r = b = t = 0;
c = c_c + c_s;
// affichage des parametres pour verificatrion
printf("Épaisseur de la plaque : %4.g\n", h);
printf("Nombre d'échantillons : %d\n", n);
printf("C_c : %g\n", c_c);
printf("C_s : %g\n", c_s);
float *absorbed;
absorbed = (float *) calloc(n, sizeof(float));
/* allocation de memoire GPU*/
float *d_absorbed;
int size = n*sizeof(float);
cudaMalloc((void**)&d_absorbed, size);
int *d_r, *d_b, *d_t, *d_j;
cudaMalloc((void**)&d_r, sizeof(int));
cudaMalloc((void**)&d_b, sizeof(int));
cudaMalloc((void**)&d_t, sizeof(int));
cudaMalloc((void**)&d_j, sizeof(int));
// Transfert CPU -> GPU
cudaMemcpy(d_absorbed, absorbed, size, cudaMemcpyHostToDevice);
cudaMemcpy(d_r, &r, sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(d_b, &b, sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(d_t, &t, sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(d_j, &j, sizeof(int), cudaMemcpyHostToDevice);
// Definition nombre de threads
dim3 TailleGrille, ThreadparBlock;
ThreadparBlock.x = 256; //32*32
ThreadparBlock.y = 1;
ThreadparBlock.z = 1;
TailleGrille.x = 256;
TailleGrille.y = 1;
TailleGrille.z = 1;
int nbThread = TailleGrille.x*ThreadparBlock.x;
int step = n/nbThread; //nb de neutrons gérés par chaque thread
curandState *d_States;
/* Allocation un vecteur d'etat par thread */
cudaMalloc((void **)&d_States, nbThread*sizeof(curandState));
// debut du chronometrage
start = my_gettimeofday();
//appel kernel1 : initialisation states
setup_kernel<<<TailleGrille,ThreadparBlock>>>(d_States);
//appel kernel2 : calcul
generate_kernel<<<TailleGrille,ThreadparBlock>>>(d_States,step,nbThread,TailleGrille,n,c,c_c,h,d_r,d_b,d_t,d_absorbed, d_j);
// Transfert GPU-> CPU
cudaMemcpy(absorbed, d_absorbed, size, cudaMemcpyDeviceToHost);
cudaMemcpy(&r, d_r, sizeof(int), cudaMemcpyDeviceToHost);
cudaMemcpy(&b, d_b, sizeof(int), cudaMemcpyDeviceToHost);
cudaMemcpy(&t, d_t, sizeof(int), cudaMemcpyDeviceToHost);
// fin du chronometrage
finish = my_gettimeofday();
printf("\nPourcentage des neutrons refléchis : %4.2g\n", (float) r / (float) n);
printf("Pourcentage des neutrons absorbés : %4.2g\n", (float) b / (float) n);
printf("Pourcentage des neutrons transmis : %4.2g\n", (float) t / (float) n);
printf("\nTemps total de calcul: %.8g sec\n", finish - start);
printf("Millions de neutrons /s: %.2g\n", (double) n / ((finish - start)*1e6));
// ouverture du fichier pour ecrire les positions des neutrons absorbés
FILE *f_handle = fopen(OUTPUT_FILE, "w");
if (!f_handle) {
fprintf(stderr, "Cannot open " OUTPUT_FILE "\n");
exit(EXIT_FAILURE);
}
for (j = 0; j < b; j++){
fprintf(f_handle, "%f\n", absorbed[j]);
}
// fermeture du fichier
fclose(f_handle);
printf("Result written in " OUTPUT_FILE "\n");
free(absorbed);
cudaFree(d_absorbed);
cudaFree(d_States);
cudaFree(d_r);
cudaFree(d_b);
cudaFree(d_t);
}
|
8,577 | #ifndef GPU_VECTOR4D_H
#define GPU_VECTOR4D_H
#include "gpuVector3D.cu"
/**
* Defines 4D standard vectors.
*/
class gpuVector4D {
public:
// components
float x, y, z, w;
/**
* Constructor.
* Initializes tp vector (0,0,0, 0).
*/
__device__ __host__
gpuVector4D() : x( 0.0 ), y( 0.0 ), z( 0.0 ), w( 0.0 ) { }
/**
* Constructor.
* Initializes to vector (x,y,z,w).
*/
__device__ __host__
gpuVector4D( float x, float y, float z, float w) : x( x ), y( y ), z( z ), w( w ) { }
/**
* Constructor.
* Initializes to vector (x,y,z,0).
*/
__device__ __host__
gpuVector4D( float x, float y, float z) : x( x ), y( y ), z( z ), w( 0.0 ) { }
/**
* Constructor.
* Initializes to vector (c,c,c,c)
*/
__device__ __host__
gpuVector4D( float c ) : x( c ), y( c ), z( c ), w ( c ) { }
/**
* Constructor.
* Initializes from existing vector4D.
*/
__device__ __host__
gpuVector4D( const gpuVector4D& v ) : x( v.x ), y( v.y ), z( v.z ), w( v.w ) { }
/**
* Constructor.
* Initializes from existing vector3D.
*/
__device__ __host__
gpuVector4D( const gpuVector3D& v ) : x( v.x ), y( v.y ), z( v.z ), w( 0.0 ) { }
/**
* Constructor.
* Initializes from existing vector3D and w value.
*/
__device__ __host__
gpuVector4D( const gpuVector3D& v, float w ) : x( v.x ), y( v.y ), z( v.z ), w( w ) { }
// returns reference to the specified component (0-based indexing: x, y, z)
__device__
inline float& operator[] ( const int& index ) {
return ( &x )[ index ];
}
// returns const reference to the specified component (0-based indexing: x, y, z)
__device__
inline const float& operator[] ( const int& index ) const {
return ( &x )[ index ];
}
// negation
__device__
inline gpuVector4D operator-( void ) const {
return gpuVector4D( -x, -y, -z, -w);
}
// addition
__device__
inline gpuVector4D operator+( const gpuVector4D& v ) const {
return gpuVector4D( x + v.x, y + v.y, z + v.z, w + v.w);
}
// subtraction
__device__
inline gpuVector4D operator-( const gpuVector4D& v ) const {
return gpuVector4D( x - v.x, y - v.y, z - v.z, w - v.w );
}
// right scalar multiplication
__device__
inline gpuVector4D operator*( const float& c ) const {
return gpuVector4D( x * c, y * c, z * c, w * c );
}
// scalar division
__device__
inline gpuVector4D operator/( const float& c ) const {
const float rc = 1.0/c;
return gpuVector4D( rc * x, rc * y, rc * z, rc * w );
}
// addition / assignment
__device__
inline void operator+=( const gpuVector4D& v ) {
x += v.x; y += v.y; z += v.z; z += v.w;
}
// subtraction / assignment
__device__
inline void operator-=( const gpuVector4D& v ) {
x -= v.x; y -= v.y; z -= v.z; w -= v.w;
}
// scalar multiplication / assignment
__device__
inline void operator*=( const float& c ) {
x *= c; y *= c; z *= c; w *= c;
}
// scalar division / assignment
__device__
inline void operator/=( const float& c ) {
(*this) *= ( 1./c );
}
/**
* Returns Euclidean distance metric extended to 4 dimensions.
*/
__device__
inline float norm( void ) const {
return sqrt( x*x + y*y + z*z + w*w );
}
/**
* Returns Euclidean length squared.
*/
__device__
inline float norm2( void ) const {
return x*x + y*y + z*z + w*w;
}
/**
* Returns unit vector. (returns the normalized copy of this vector.)
*/
__device__
inline gpuVector4D unit( void ) const {
float rNorm = 1. / sqrt( x*x + y*y + z*z + w*w);
return gpuVector4D( rNorm*x, rNorm*y, rNorm*z );
}
/**
* Divides by Euclidean length.
* This vector will be of unit length i.e. "normalized" afterwards.
*/
__device__
inline void normalize( void ) {
(*this) /= norm();
}
/**
* Converts this vector to a 3D vector ignoring the w component.
*/
__device__
inline gpuVector3D to3D( void ) { return gpuVector3D(x, y, z); }
/**
* Converts this vector to a 3D vector by dividing x, y, and z by w.
*/
__device__
inline gpuVector3D projectTo3D( void ) {
float invW = 1.0 / w;
return gpuVector3D(x * invW, y * invW, z * invW);
}
}; // class gpuVector4D
// left scalar multiplication
__device__
inline gpuVector4D operator* ( const float& c, const gpuVector4D& v ) {
return gpuVector4D( c * v.x, c * v.y, c * v.z, c*v.w );
}
// dot product (a.k.a. inner or scalar product)
__device__
inline float dot( const gpuVector4D& u, const gpuVector4D& v ) {
return u.x*v.x + u.y*v.y + u.z*v.z + u.w*v.w;;
}
#endif // CMU462_VECTOR4D_H
|
8,578 | #include "includes.h"
__global__ void sparse_mat_compact(int * input, int * output, int * output_index_array, int array_size)
{
int gid = blockDim.x*blockIdx.x + threadIdx.x;
//TO DO handle when gid ==0
//this is very unefficient in memory management
if (gid > 0 && gid < array_size)
{
if (output_index_array[gid] != output_index_array[gid - 1])
{
//printf("gid : %d , index :%d , value : %d, prev_value : %d \n",gid, output_index_array[gid], input[gid], input[gid-1]);
output[output_index_array[gid]] = input[gid - 1];
}
}
} |
8,579 | // no template
|
8,580 | /*
autor fredy m
uaem
desonses@gmail.com para mas comentarios
*/
#ifdef __CUDACC__
#define cuda_SYNCTHREADS() __syncthreads()
#else
#define cuda_SYNCTHREADS()
#endif
#include <device_functions.h>
#include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <vector_types.h>
#include <device_launch_parameters.h>
#include <cuda_runtime_api.h>
#include <cuda.h>
#define N 16
/*
suma de los elementos de un vector en el orden de log2(n)
*/
//kernel
__global__ void reduccion(float *vector, float *suma)
{
//reserva de memoria en la zona de memoria compartida
__shared__ float temporal[N];
//indice local de cada hilo -> kernel con un solo bloque
int Id = threadIdx.x;
//copiamos en 'temporal' el vector y sincronizamos los hilos
temporal[Id] = vector[Id];
cuda_SYNCTHREADS();
//reduccion paralela
int salto = N / 2;
//realizamos log2(N) iteraciones
while (salto)
{
//solo trabajan la mitad de los hilos
if (Id < salto)
{
temporal[Id] = temporal[Id] + temporal[Id + salto];
}
//cuda_SYNCTHREADS();
cuda_SYNCTHREADS();
salto = salto / 2;
}
//el hilo 0 escribe el resultado final en la memoria global
if (Id == 0)
{
*suma = temporal[Id];
}
}
int main(int argc, char** argv)
{
float *vector1, *resultado;
float *dev_vector1, *dev_resultado;
int size = N * sizeof(float);
//reserva de memoria en el host
vector1 = (float*)malloc(size);
resultado = (float*)malloc(size);
//reserva de memoria en el device
cudaMalloc((void**)&dev_vector1, size);
cudaMalloc((void**)&dev_resultado, size);
// inicializacion de los vectores
for (int i = 0; i < N; i++) {
vector1[i] = (float)rand() / RAND_MAX;
}
//enviar los datos hacia el Device
cudaMemcpy(dev_vector1, vector1, size, cudaMemcpyHostToDevice);
//lanzamiento del kernel
reduccion <<<1, N >>> (dev_vector1, dev_resultado);
//recogida de los datos
cudaMemcpy(resultado, dev_resultado, size, cudaMemcpyDeviceToHost);
//impresion de los datos
printf(">vector1: \n");
for (int i = 0; i < N; i++) {
printf("%.3f, ", vector1[i]);
}
printf("\n");
printf(">suma: \n");
for (int i = 0; i < N; i++) {
printf("%.3f, ", resultado[i]);
}
printf("\n");
//liberacion de memoria del device y host
cudaFree(dev_vector1);
cudaFree(dev_resultado);
free(vector1);
free(resultado);
printf("\n...");
fflush(stdin);
char tecla = getchar();
return 0;
}
|
8,581 | #include <stdio.h>
#include <iostream>
__global__
void saxpy(int n, float a, float *x, float *y,float *sum)
{
int i = blockIdx.x*blockDim.x + threadIdx.x;
if (i < n) sum[i] = a*x[i] + y[i];
//blockIdx variabile di tipo dim3, contiene l'indice del blocco
//threadIdx variabile di tipo dim3, contiene l'indice del thread
}
int main(void){
float *hy,*hx,*dx,*dy,*hdsum,*sum;
int N=100;
hx=(float*)malloc(N*sizeof(float));
hy=(float*)malloc(N*sizeof(float));
hdsum=(float*)malloc(N*sizeof(float));
cudaMalloc(&dx,N*sizeof(float));
cudaMalloc(&dy,N*sizeof(float));
cudaMalloc(&sum,N*sizeof(float));
for(int k=0;k<N;k++){
hx[k]=1.0f;
hy[k]=2.0f;
}
cudaMemcpy(dx,hx, N*sizeof(float), cudaMemcpyHostToDevice);
cudaMemcpy(dy,hy, N*sizeof(float), cudaMemcpyHostToDevice);
saxpy<<<1, N>>>(N, 1.0f,dx,dy,sum);
cudaMemcpy(hdsum,sum, N*sizeof(float), cudaMemcpyDeviceToHost);
for(int k=0;k<N;k++)std::cout<<hdsum[k]<<" "<<hy[k]<<std::endl;
}
|
8,582 | extern "C" __global__ void dgemv(
const double alpha,
const double* A,
const double* x,
const double beta,
const double* y,
double* z,
size_t rows, size_t cols)
{
int stride = blockDim.x * gridDim.x;
double buf;
for (int row = blockDim.x * blockIdx.x + threadIdx.x; row < rows; row += stride)
{
buf = 0.0;
for (int col = 0; col < cols; col++)
{
buf += alpha * A[row * cols + col] * x[col];
}
z[row] = buf + beta * y[row];
}
} |
8,583 | #include <stdio.h>
#include <time.h>
#define ROUND 32768*32768 // 32k ^ 2 = 1073741824
__global__ void outputFromGPU(int *cg)
{
for(int i = 0; i < ROUND; i++){ *cg += 1; } // GPU
}
int main(void)
{
printf(":: Ex2 ::\n");
int cg, c;
int *d_cg;
clock_t begin, end;
float timeGPU, timeCPU;
cg = 0;
begin = clock();
cudaMalloc((void**)&d_cg, sizeof(int));
cudaMemcpy(d_cg, &cg, sizeof(int), cudaMemcpyHostToDevice);
outputFromGPU<<<1,1>>>(d_cg);
cudaDeviceSynchronize();
cudaMemcpy(&cg, d_cg, sizeof(int), cudaMemcpyDeviceToHost);
end = clock();
timeGPU = (float)(end-begin)/CLOCKS_PER_SEC;
cudaFree(d_cg);
c = 0;
begin = clock();
for(int i = 0; i < ROUND; i++){ c++; } // CPU
end = clock();
timeCPU = (float)(end-begin)/CLOCKS_PER_SEC;
printf("(GPU) : time %f sec. : Value = %d\n", timeGPU, cg);
printf("(CPU) : time %f sec. : Value = %d\n", timeCPU, c);
return 0;
}
|
8,584 | #include "includes.h"
__global__ void scan_kernel(unsigned int* d_bins, int size) {
int mid = threadIdx.x + blockDim.x * blockIdx.x;
if (mid >= size) return;
for (int s = 1; s <= size; s *= 2) {
int spot = mid - s;
unsigned int val = 0;
if (spot >= 0) val = d_bins[spot];
__syncthreads();
if (spot >= 0) d_bins[mid] += val;
__syncthreads();
}
} |
8,585 | /**
* @file projector_kernels.cu
*/
extern "C" __device__ unsigned char ray_cube_intersection_cuda(float orig0,
float orig1,
float orig2,
float bounds0_min,
float bounds1_min,
float bounds2_min,
float bounds0_max,
float bounds1_max,
float bounds2_max,
float rdir0,
float rdir1,
float rdir2,
float* t1,
float* t2){
// the inverse of the directional vector
// using the inverse of the directional vector and IEEE floating point arith standard 754
// makes sure that 0's in the directional vector are handled correctly
float invdir0 = 1.f/rdir0;
float invdir1 = 1.f/rdir1;
float invdir2 = 1.f/rdir2;
unsigned char intersec = 1;
float t11, t12, t21, t22;
if (invdir0 >= 0){
*t1 = (bounds0_min - orig0) * invdir0;
*t2 = (bounds0_max - orig0) * invdir0;
}
else{
*t1 = (bounds0_max - orig0) * invdir0;
*t2 = (bounds0_min - orig0) * invdir0;
}
if (invdir1 >= 0){
t11 = (bounds1_min - orig1) * invdir1;
t12 = (bounds1_max - orig1) * invdir1;
}
else{
t11 = (bounds1_max - orig1) * invdir1;
t12 = (bounds1_min - orig1) * invdir1;
}
if ((*t1 > t12) || (t11 > *t2)){intersec = 0;}
if (t11 > *t1){*t1 = t11;}
if (t12 < *t2){*t2 = t12;}
if (invdir2 >= 0){
t21 = (bounds2_min - orig2) * invdir2;
t22 = (bounds2_max - orig2) * invdir2;
}
else{
t21 = (bounds2_max - orig2) * invdir2;
t22 = (bounds2_min - orig2) * invdir2;
}
if ((*t1 > t22) || (t21 > *t2)){intersec = 0;}
if (t21 > *t1){*t1 = t21;}
if (t22 < *t2){*t2 = t22;}
return(intersec);
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
extern "C" __device__ void relevant_tof_bins_cuda(float x_m0,
float x_m1,
float x_m2,
float x_v0,
float x_v1,
float x_v2,
float u0,
float u1,
float u2,
float tofbin_width,
float tofcenter_offset,
float sigma_tof,
float n_sigmas,
int n_half,
int *it1,
int *it2)
{
float b1, b2;
// calculate which TOF bins it1 and it2 are within +- n_sigmas
// the tof bin numbers run from -n_tofbins//2 ... 0 ... n_tofbins//2
b1 = (((x_v0 - x_m0)*u0 + (x_v1 - x_m1)*u1 + (x_v2 - x_m2)*u2) -
tofcenter_offset + n_sigmas*sigma_tof) / tofbin_width;
b2 = (((x_v0 - x_m0)*u0 + (x_v1 - x_m1)*u1 + (x_v2 - x_m2)*u2) -
tofcenter_offset - n_sigmas*sigma_tof) / tofbin_width;
if(b1 <= b2){
*it1 = (int)floor(b1);
*it2 = (int)ceil(b2);
}
else{
*it1 = (int)floor(b2);
*it2 = (int)ceil(b1);
}
if(*it1 < -n_half){*it1 = -n_half;}
if(*it2 < -n_half){*it2 = -n_half;}
if(*it1 > n_half){*it1 = n_half;}
if(*it2 > n_half){*it2 = n_half;}
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
extern "C" __global__ void joseph3d_back_cuda_kernel(float *xstart,
float *xend,
float *img,
float *img_origin,
float *voxsize,
float *p,
long long nlors,
int *img_dim)
{
long long i = blockDim.x * blockIdx.x + threadIdx.x;
if(i < nlors)
{
if(p[i] != 0)
{
int n0 = img_dim[0];
int n1 = img_dim[1];
int n2 = img_dim[2];
float d0, d1, d2, d0_sq, d1_sq, d2_sq;
float cs0, cs1, cs2, corfac;
float lsq, cos0_sq, cos1_sq, cos2_sq;
unsigned short direction;
int i0, i1, i2;
int i0_floor, i1_floor, i2_floor;
int i0_ceil, i1_ceil, i2_ceil;
float x_pr0, x_pr1, x_pr2;
float tmp_0, tmp_1, tmp_2;
float xstart0 = xstart[i*3 + 0];
float xstart1 = xstart[i*3 + 1];
float xstart2 = xstart[i*3 + 2];
float xend0 = xend[i*3 + 0];
float xend1 = xend[i*3 + 1];
float xend2 = xend[i*3 + 2];
float voxsize0 = voxsize[0];
float voxsize1 = voxsize[1];
float voxsize2 = voxsize[2];
float img_origin0 = img_origin[0];
float img_origin1 = img_origin[1];
float img_origin2 = img_origin[2];
unsigned char intersec;
float t1, t2;
float istart_f, iend_f, tmp;
int istart, iend;
// test whether the ray between the two detectors is most parallel
// with the 0, 1, or 2 axis
d0 = xend0 - xstart0;
d1 = xend1 - xstart1;
d2 = xend2 - xstart2;
//-----------
//--- test whether ray and cube intersect
intersec = ray_cube_intersection_cuda(xstart0, xstart1, xstart2,
img_origin0 - 1*voxsize0, img_origin1 - 1*voxsize1, img_origin2 - 1*voxsize2,
img_origin0 + n0*voxsize0, img_origin1 + n1*voxsize1, img_origin2 + n2*voxsize2,
d0, d1, d2, &t1, &t2);
if (intersec == 1)
{
d0_sq = d0*d0;
d1_sq = d1*d1;
d2_sq = d2*d2;
lsq = d0_sq + d1_sq + d2_sq;
cos0_sq = d0_sq / lsq;
cos1_sq = d1_sq / lsq;
cos2_sq = d2_sq / lsq;
cs0 = sqrtf(cos0_sq);
cs1 = sqrtf(cos1_sq);
cs2 = sqrtf(cos2_sq);
direction = 0;
if ((cos1_sq >= cos0_sq) && (cos1_sq >= cos2_sq))
{
direction = 1;
}
if ((cos2_sq >= cos0_sq) && (cos2_sq >= cos1_sq))
{
direction = 2;
}
if(direction == 0)
{
// case where ray is most parallel to the 0 axis
// we step through the volume along the 0 direction
// factor for correctiong voxel size and |cos(theta)|
corfac = voxsize0/cs0;
//--- check where ray enters / leaves cube
istart_f = (xstart0 + t1*d0 - img_origin0) / voxsize0;
iend_f = (xstart0 + t2*d0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n0){iend = n0;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart0 - img_origin0) / voxsize0;
iend_f = (xend0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i0 = istart; i0 < iend; i0++)
{
// get the indices where the ray intersects the image plane
x_pr1 = xstart1 + (img_origin0 + i0*voxsize0 - xstart0)*d1 / d0;
x_pr2 = xstart2 + (img_origin0 + i0*voxsize0 - xstart0)*d2 / d0;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_floor + i2_floor,
p[i] * (1 - tmp_1) * (1 - tmp_2) * corfac);
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_ceil + i2_floor,
p[i] * tmp_1 * (1 - tmp_2) * corfac);
}
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_floor + i2_ceil,
p[i] * (1 - tmp_1) * tmp_2*corfac);
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_ceil + i2_ceil, p[i] * tmp_1 * tmp_2 * corfac);
}
}
}
// ---------------------------------------------------------------------------------
if(direction == 1)
{
// case where ray is most parallel to the 1 axis
// we step through the volume along the 1 direction
// factor for correctiong voxel size and |cos(theta)|
corfac = voxsize1/cs1;
//--- check where ray enters / leaves cube
istart_f = (xstart1 + t1*d1 - img_origin1) / voxsize1;
iend_f = (xstart1 + t2*d1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n1){iend = n1;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart1 - img_origin1) / voxsize1;
iend_f = (xend1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i1 = istart; i1 < iend; i1++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin1 + i1*voxsize1 - xstart1)*d0 / d1;
x_pr2 = xstart2 + (img_origin1 + i1*voxsize1 - xstart1)*d2 / d1;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1 + i2_floor,
p[i] * (1 - tmp_0) * (1 - tmp_2) * corfac);
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1 + i2_floor,
p[i] * tmp_0 * (1 - tmp_2) * corfac);
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1 + i2_ceil,
p[i] * (1 - tmp_0) * tmp_2 * corfac);
}
if((i0_ceil >= 0) && (i0_ceil < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1 + i2_ceil,
p[i] * tmp_0 * tmp_2 * corfac);
}
}
}
//---------------------------------------------------------------------------------
if (direction == 2)
{
// case where ray is most parallel to the 2 axis
// we step through the volume along the 2 direction
// factor for correctiong voxel size and |cos(theta)|
corfac = voxsize2/cs2;
//--- check where ray enters / leaves cube
istart_f = (xstart2 + t1*d2 - img_origin2) / voxsize2;
iend_f = (xstart2 + t2*d2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n2){iend = n2;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart2 - img_origin2) / voxsize2;
iend_f = (xend2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i2 = istart; i2 < iend; i2++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin2 + i2*voxsize2 - xstart2)*d0 / d2;
x_pr1 = xstart1 + (img_origin2 + i2*voxsize2 - xstart2)*d1 / d2;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1_floor + i2,
p[i] * (1 - tmp_0) * (1 - tmp_1) * corfac);
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1_floor + i2,
p[i] * tmp_0 * (1 - tmp_1) * corfac);
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_ceil >= 0) && (i1_ceil < n1))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1_ceil + i2,
p[i] * (1 - tmp_0) * tmp_1 * corfac);
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_ceil >= 0) && (i1_ceil < n1))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1_ceil + i2,
p[i] * tmp_0 * tmp_1 * corfac);
}
}
}
}
}
}
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
extern "C" __global__ void joseph3d_fwd_cuda_kernel(float *xstart,
float *xend,
float *img,
float *img_origin,
float *voxsize,
float *p,
long long nlors,
int *img_dim)
{
long long i = blockDim.x * blockIdx.x + threadIdx.x;
if(i < nlors)
{
int n0 = img_dim[0];
int n1 = img_dim[1];
int n2 = img_dim[2];
float d0, d1, d2, d0_sq, d1_sq, d2_sq;
float lsq, cos0_sq, cos1_sq, cos2_sq;
unsigned short direction;
int i0, i1, i2;
int i0_floor, i1_floor, i2_floor;
int i0_ceil, i1_ceil, i2_ceil;
float x_pr0, x_pr1, x_pr2;
float tmp_0, tmp_1, tmp_2;
float toAdd, cf;
float xstart0 = xstart[i*3 + 0];
float xstart1 = xstart[i*3 + 1];
float xstart2 = xstart[i*3 + 2];
float xend0 = xend[i*3 + 0];
float xend1 = xend[i*3 + 1];
float xend2 = xend[i*3 + 2];
float voxsize0 = voxsize[0];
float voxsize1 = voxsize[1];
float voxsize2 = voxsize[2];
float img_origin0 = img_origin[0];
float img_origin1 = img_origin[1];
float img_origin2 = img_origin[2];
unsigned char intersec;
float t1, t2;
float istart_f, iend_f, tmp;
int istart, iend;
// test whether the ray between the two detectors is most parallel
// with the 0, 1, or 2 axis
d0 = xend0 - xstart0;
d1 = xend1 - xstart1;
d2 = xend2 - xstart2;
//-----------
//--- test whether ray and cube intersect
intersec = ray_cube_intersection_cuda(xstart0, xstart1, xstart2,
img_origin0 - 1*voxsize0, img_origin1 - 1*voxsize1, img_origin2 - 1*voxsize2,
img_origin0 + n0*voxsize0, img_origin1 + n1*voxsize1, img_origin2 + n2*voxsize2,
d0, d1, d2, &t1, &t2);
if (intersec == 1)
{
d0_sq = d0*d0;
d1_sq = d1*d1;
d2_sq = d2*d2;
lsq = d0_sq + d1_sq + d2_sq;
cos0_sq = d0_sq / lsq;
cos1_sq = d1_sq / lsq;
cos2_sq = d2_sq / lsq;
direction = 0;
if ((cos1_sq >= cos0_sq) && (cos1_sq >= cos2_sq))
{
direction = 1;
}
else
{
if ((cos2_sq >= cos0_sq) && (cos2_sq >= cos1_sq))
{
direction = 2;
}
}
if (direction == 0)
{
cf = voxsize0 / sqrtf(cos0_sq);
// case where ray is most parallel to the 0 axis
// we step through the volume along the 0 direction
//--- check where ray enters / leaves cube
istart_f = (xstart0 + t1*d0 - img_origin0) / voxsize0;
iend_f = (xstart0 + t2*d0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n0){iend = n0;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart0 - img_origin0) / voxsize0;
iend_f = (xend0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i0 = istart; i0 < iend; i0++)
{
// get the indices where the ray intersects the image plane
x_pr1 = xstart1 + (img_origin0 + i0*voxsize0 - xstart0)*d1 / d0;
x_pr2 = xstart2 + (img_origin0 + i0*voxsize0 - xstart0)*d2 / d0;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
toAdd = 0;
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_floor + i2_floor] * (1 - tmp_1) * (1 - tmp_2);
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_ceil + i2_floor] * tmp_1 * (1 - tmp_2);
}
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_floor + i2_ceil] * (1 - tmp_1) * tmp_2;
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_ceil + i2_ceil] * tmp_1 * tmp_2;
}
if(toAdd != 0){p[i] += (cf * toAdd);}
}
}
//---------------------------------------------------------------------------------
if (direction == 1)
{
cf = voxsize1 / sqrtf(cos1_sq);
// case where ray is most parallel to the 1 axis
// we step through the volume along the 1 direction
//--- check where ray enters / leaves cube
istart_f = (xstart1 + t1*d1 - img_origin1) / voxsize1;
iend_f = (xstart1 + t2*d1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n1){iend = n1;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart1 - img_origin1) / voxsize1;
iend_f = (xend1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for (i1 = istart; i1 < iend; i1++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin1 + i1*voxsize1 - xstart1)*d0 / d1;
x_pr2 = xstart2 + (img_origin1 + i1*voxsize1 - xstart1)*d2 / d1;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
toAdd = 0;
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0_floor + n2*i1 + i2_floor] * (1 - tmp_0) * (1 - tmp_2);
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0_ceil + n2*i1 + i2_floor] * tmp_0 * (1 - tmp_2);
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0_floor + n2*i1 + i2_ceil] * (1 - tmp_0) * tmp_2;
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0_ceil + n2*i1 + i2_ceil] * tmp_0 * tmp_2;
}
if(toAdd != 0){p[i] += (cf * toAdd);}
}
}
//---------------------------------------------------------------------------------
if (direction == 2)
{
cf = voxsize2 / sqrtf(cos2_sq);
// case where ray is most parallel to the 2 axis
// we step through the volume along the 2 direction
//--- check where ray enters / leaves cube
istart_f = (xstart2 + t1*d2 - img_origin2) / voxsize2;
iend_f = (xstart2 + t2*d2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n2){iend = n2;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart2 - img_origin2) / voxsize2;
iend_f = (xend2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i2 = istart; i2 < iend; i2++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin2 + i2*voxsize2 - xstart2)*d0 / d2;
x_pr1 = xstart1 + (img_origin2 + i2*voxsize2 - xstart2)*d1 / d2;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
toAdd = 0;
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
toAdd += img[n1*n2*i0_floor + n2*i1_floor + i2] * (1 - tmp_0) * (1 - tmp_1);
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
toAdd += img[n1*n2*i0_ceil + n2*i1_floor + i2] * tmp_0 * (1 - tmp_1);
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_ceil >= 0) & (i1_ceil < n1))
{
toAdd += img[n1*n2*i0_floor + n2*i1_ceil + i2] * (1 - tmp_0) * tmp_1;
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_ceil >= 0) && (i1_ceil < n1))
{
toAdd += img[n1*n2*i0_ceil + n2*i1_ceil + i2] * tmp_0 * tmp_1;
}
if(toAdd != 0){p[i] += (cf * toAdd);}
}
}
}
}
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
extern "C" __global__ void joseph3d_back_tof_sino_cuda_kernel(float *xstart,
float *xend,
float *img,
float *img_origin,
float *voxsize,
float *p,
long long nlors,
int *img_dim,
short n_tofbins,
float tofbin_width,
float *sigma_tof,
float *tofcenter_offset,
float n_sigmas,
unsigned char lor_dependent_sigma_tof,
unsigned char lor_dependent_tofcenter_offset)
{
long long i = blockDim.x * blockIdx.x + threadIdx.x;
//long long i = blockIdx.x + threadIdx.x * gridDim.x;
int n0 = img_dim[0];
int n1 = img_dim[1];
int n2 = img_dim[2];
int n_half = n_tofbins/2;
if(i < nlors)
{
float d0, d1, d2, d0_sq, d1_sq, d2_sq;
float cs0, cs1, cs2, cf;
float lsq, cos0_sq, cos1_sq, cos2_sq;
unsigned short direction;
int i0, i1, i2;
int i0_floor, i1_floor, i2_floor;
int i0_ceil, i1_ceil, i2_ceil;
float x_pr0, x_pr1, x_pr2;
float tmp_0, tmp_1, tmp_2;
float u0, u1, u2, d_norm;
float x_m0, x_m1, x_m2;
float x_v0, x_v1, x_v2;
int it, it1, it2;
float dtof, tw;
float sig_tof = (lor_dependent_sigma_tof == 1) ? sigma_tof[i] : sigma_tof[0];
float tc_offset = (lor_dependent_tofcenter_offset == 1) ? tofcenter_offset[i] : tofcenter_offset[0];
float xstart0 = xstart[i*3 + 0];
float xstart1 = xstart[i*3 + 1];
float xstart2 = xstart[i*3 + 2];
float xend0 = xend[i*3 + 0];
float xend1 = xend[i*3 + 1];
float xend2 = xend[i*3 + 2];
float voxsize0 = voxsize[0];
float voxsize1 = voxsize[1];
float voxsize2 = voxsize[2];
float img_origin0 = img_origin[0];
float img_origin1 = img_origin[1];
float img_origin2 = img_origin[2];
unsigned char intersec;
float t1, t2;
float istart_f, iend_f, tmp;
int istart, iend;
float istart_tof_f, iend_tof_f;
int istart_tof, iend_tof;
// test whether the ray between the two detectors is most parallel
// with the 0, 1, or 2 axis
d0 = xend0 - xstart0;
d1 = xend1 - xstart1;
d2 = xend2 - xstart2;
//-----------
//--- test whether ray and cube intersect
intersec = ray_cube_intersection_cuda(xstart0, xstart1, xstart2,
img_origin0 - 1*voxsize0, img_origin1 - 1*voxsize1, img_origin2 - 1*voxsize2,
img_origin0 + n0*voxsize0, img_origin1 + n1*voxsize1, img_origin2 + n2*voxsize2,
d0, d1, d2, &t1, &t2);
if (intersec == 1)
{
d0_sq = d0*d0;
d1_sq = d1*d1;
d2_sq = d2*d2;
lsq = d0_sq + d1_sq + d2_sq;
cos0_sq = d0_sq / lsq;
cos1_sq = d1_sq / lsq;
cos2_sq = d2_sq / lsq;
cs0 = sqrtf(cos0_sq);
cs1 = sqrtf(cos1_sq);
cs2 = sqrtf(cos2_sq);
direction = 0;
if ((cos1_sq >= cos0_sq) && (cos1_sq >= cos2_sq))
{
direction = 1;
}
if ((cos2_sq >= cos0_sq) && (cos2_sq >= cos1_sq))
{
direction = 2;
}
//---------------------------------------------------------
//--- calculate TOF related quantities
// unit vector (u0,u1,u2) that points from xstart to end
d_norm = sqrtf(lsq);
u0 = d0 / d_norm;
u1 = d1 / d_norm;
u2 = d2 / d_norm;
// calculate mid point of LOR
x_m0 = 0.5f*(xstart0 + xend0);
x_m1 = 0.5f*(xstart1 + xend1);
x_m2 = 0.5f*(xstart2 + xend2);
//---------------------------------------------------------
if(direction == 0)
{
// case where ray is most parallel to the 0 axis
// we step through the volume along the 0 direction
// factor for correctiong voxel size and |cos(theta)|
cf = voxsize0/cs0;
//--- check where ray enters / leaves cube
istart_f = (xstart0 + t1*d0 - img_origin0) / voxsize0;
iend_f = (xstart0 + t2*d0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n0){iend = n0;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart0 - img_origin0) / voxsize0;
iend_f = (xend0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i0 = istart; i0 < iend; i0++)
{
// get the indices where the ray intersects the image plane
x_pr1 = xstart1 + (img_origin0 + i0*voxsize0 - xstart0)*d1 / d0;
x_pr2 = xstart2 + (img_origin0 + i0*voxsize0 - xstart0)*d2 / d0;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = img_origin0 + i0*voxsize0;
x_v1 = x_pr1;
x_v2 = x_pr2;
it1 = -n_half;
it2 = n_half;
// get the relevant tof bins (the TOF bins where the TOF weight is not close to 0)
relevant_tof_bins_cuda(x_m0, x_m1, x_m2, x_v0, x_v1, x_v2, u0, u1, u2,
tofbin_width, tc_offset, sig_tof, n_sigmas, n_half,
&it1, &it2);
for(it = it1; it <= it2; it++){
//--- add extra check to be compatible with behavior of LM projector
istart_tof_f = (x_m0 + (it*tofbin_width - n_sigmas*sig_tof)*u0 - img_origin0) / voxsize0;
iend_tof_f = (x_m0 + (it*tofbin_width + n_sigmas*sig_tof)*u0 - img_origin0) / voxsize0;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
//---
if ((i0 >= istart_tof) && (i0 < iend_tof)){
if(p[i*n_tofbins + it + n_half] != 0){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_floor + i2_floor,
(tw * p[i*n_tofbins + it + n_half] * (1 - tmp_1) * (1 - tmp_2) * cf));
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_ceil + i2_floor,
(tw * p[i*n_tofbins + it + n_half] * tmp_1 * (1 - tmp_2) * cf));
}
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_floor + i2_ceil,
(tw * p[i*n_tofbins + it + n_half] * (1 - tmp_1) * tmp_2*cf));
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_ceil + i2_ceil,
(tw * p[i*n_tofbins + it + n_half] * tmp_1 * tmp_2 * cf));
}
}
}
}
}
}
// ---------------------------------------------------------------------------------
if(direction == 1)
{
// case where ray is most parallel to the 1 axis
// we step through the volume along the 1 direction
// factor for correctiong voxel size and |cos(theta)|
cf = voxsize1/cs1;
//--- check where ray enters / leaves cube
istart_f = (xstart1 + t1*d1 - img_origin1) / voxsize1;
iend_f = (xstart1 + t2*d1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n1){iend = n1;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart1 - img_origin1) / voxsize1;
iend_f = (xend1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i1 = istart; i1 < iend; i1++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin1 + i1*voxsize1 - xstart1)*d0 / d1;
x_pr2 = xstart2 + (img_origin1 + i1*voxsize1 - xstart1)*d2 / d1;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = x_pr0;
x_v1 = img_origin1 + i1*voxsize1;
x_v2 = x_pr2;
it1 = -n_half;
it2 = n_half;
// get the relevant tof bins (the TOF bins where the TOF weight is not close to 0)
relevant_tof_bins_cuda(x_m0, x_m1, x_m2, x_v0, x_v1, x_v2, u0, u1, u2,
tofbin_width, tc_offset, sig_tof, n_sigmas, n_half,
&it1, &it2);
for(it = it1; it <= it2; it++){
//--- add extra check to be compatible with behavior of LM projector
istart_tof_f = (x_m1 + (it*tofbin_width - n_sigmas*sig_tof)*u1 - img_origin1) / voxsize1;
iend_tof_f = (x_m1 + (it*tofbin_width + n_sigmas*sig_tof)*u1 - img_origin1) / voxsize1;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
//---
if ((i1 >= istart_tof) && (i1 < iend_tof)){
if(p[i*n_tofbins + it + n_half] != 0){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1 + i2_floor,
(tw * p[i*n_tofbins + it + n_half] * (1 - tmp_0) * (1 - tmp_2) * cf));
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1 + i2_floor,
(tw * p[i*n_tofbins + it + n_half] * tmp_0 * (1 - tmp_2) * cf));
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1 + i2_ceil,
(tw * p[i*n_tofbins + it + n_half] * (1 - tmp_0) * tmp_2 * cf));
}
if((i0_ceil >= 0) && (i0_ceil < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1 + i2_ceil,
(tw * p[i*n_tofbins + it + n_half] * tmp_0 * tmp_2 * cf));
}
}
}
}
}
}
//---------------------------------------------------------------------------------
if (direction == 2)
{
// case where ray is most parallel to the 2 axis
// we step through the volume along the 2 direction
// factor for correctiong voxel size and |cos(theta)|
cf = voxsize2/cs2;
//--- check where ray enters / leaves cube
istart_f = (xstart2 + t1*d2 - img_origin2) / voxsize2;
iend_f = (xstart2 + t2*d2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n2){iend = n2;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart2 - img_origin2) / voxsize2;
iend_f = (xend2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i2 = istart; i2 < iend; i2++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin2 + i2*voxsize2 - xstart2)*d0 / d2;
x_pr1 = xstart1 + (img_origin2 + i2*voxsize2 - xstart2)*d1 / d2;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = x_pr0;
x_v1 = x_pr1;
x_v2 = img_origin2 + i2*voxsize2;
it1 = -n_half;
it2 = n_half;
// get the relevant tof bins (the TOF bins where the TOF weight is not close to 0)
relevant_tof_bins_cuda(x_m0, x_m1, x_m2, x_v0, x_v1, x_v2, u0, u1, u2,
tofbin_width, tc_offset, sig_tof, n_sigmas, n_half,
&it1, &it2);
for(it = it1; it <= it2; it++){
//--- add extra check to be compatible with behavior of LM projector
istart_tof_f = (x_m2 + (it*tofbin_width - n_sigmas*sig_tof)*u2 - img_origin2) / voxsize2;
iend_tof_f = (x_m2 + (it*tofbin_width + n_sigmas*sig_tof)*u2 - img_origin2) / voxsize2;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
//---
if ((i2 >= istart_tof) && (i2 < iend_tof)){
if(p[i*n_tofbins + it + n_half] != 0){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1_floor + i2,
(tw * p[i*n_tofbins + it + n_half] * (1 - tmp_0) * (1 - tmp_1) * cf));
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1_floor + i2,
(tw * p[i*n_tofbins + it + n_half] * tmp_0 * (1 - tmp_1) * cf));
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_ceil >= 0) && (i1_ceil < n1))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1_ceil + i2,
(tw * p[i*n_tofbins + it + n_half] * (1 - tmp_0) * tmp_1 * cf));
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_ceil >= 0) && (i1_ceil < n1))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1_ceil + i2,
(tw * p[i*n_tofbins + it + n_half] * tmp_0 * tmp_1 * cf));
}
}
}
}
}
}
}
}
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
extern "C" __global__ void joseph3d_fwd_tof_sino_cuda_kernel(float *xstart,
float *xend,
float *img,
float *img_origin,
float *voxsize,
float *p,
long long nlors,
int *img_dim,
short n_tofbins,
float tofbin_width,
float *sigma_tof,
float *tofcenter_offset,
float n_sigmas,
unsigned char lor_dependent_sigma_tof,
unsigned char lor_dependent_tofcenter_offset)
{
long long i = blockDim.x * blockIdx.x + threadIdx.x;
int n0 = img_dim[0];
int n1 = img_dim[1];
int n2 = img_dim[2];
int n_half = n_tofbins/2;
if(i < nlors)
{
float d0, d1, d2, d0_sq, d1_sq, d2_sq;
float lsq, cos0_sq, cos1_sq, cos2_sq;
unsigned short direction;
int i0, i1, i2;
int i0_floor, i1_floor, i2_floor;
int i0_ceil, i1_ceil, i2_ceil;
float x_pr0, x_pr1, x_pr2;
float tmp_0, tmp_1, tmp_2;
float u0, u1, u2, d_norm;
float x_m0, x_m1, x_m2;
float x_v0, x_v1, x_v2;
int it, it1, it2;
float dtof, tw;
// correction factor for cos(theta) and voxsize
float cf;
float toAdd;
float sig_tof = (lor_dependent_sigma_tof == 1) ? sigma_tof[i] : sigma_tof[0];
float tc_offset = (lor_dependent_tofcenter_offset == 1) ? tofcenter_offset[i] : tofcenter_offset[0];
float xstart0 = xstart[i*3 + 0];
float xstart1 = xstart[i*3 + 1];
float xstart2 = xstart[i*3 + 2];
float xend0 = xend[i*3 + 0];
float xend1 = xend[i*3 + 1];
float xend2 = xend[i*3 + 2];
float voxsize0 = voxsize[0];
float voxsize1 = voxsize[1];
float voxsize2 = voxsize[2];
float img_origin0 = img_origin[0];
float img_origin1 = img_origin[1];
float img_origin2 = img_origin[2];
unsigned char intersec;
float t1, t2;
float istart_f, iend_f, tmp;
int istart, iend;
float istart_tof_f, iend_tof_f;
int istart_tof, iend_tof;
// test whether the ray between the two detectors is most parallel
// with the 0, 1, or 2 axis
d0 = xend0 - xstart0;
d1 = xend1 - xstart1;
d2 = xend2 - xstart2;
//-----------
//--- test whether ray and cube intersect
intersec = ray_cube_intersection_cuda(xstart0, xstart1, xstart2,
img_origin0 - 1*voxsize0, img_origin1 - 1*voxsize1, img_origin2 - 1*voxsize2,
img_origin0 + n0*voxsize0, img_origin1 + n1*voxsize1, img_origin2 + n2*voxsize2,
d0, d1, d2, &t1, &t2);
if (intersec == 1)
{
d0_sq = d0*d0;
d1_sq = d1*d1;
d2_sq = d2*d2;
lsq = d0_sq + d1_sq + d2_sq;
cos0_sq = d0_sq / lsq;
cos1_sq = d1_sq / lsq;
cos2_sq = d2_sq / lsq;
direction = 0;
if ((cos1_sq >= cos0_sq) && (cos1_sq >= cos2_sq))
{
direction = 1;
}
else
{
if ((cos2_sq >= cos0_sq) && (cos2_sq >= cos1_sq))
{
direction = 2;
}
}
//---------------------------------------------------------
//--- calculate TOF related quantities
// unit vector (u0,u1,u2) that points from xstart to end
d_norm = sqrtf(lsq);
u0 = d0 / d_norm;
u1 = d1 / d_norm;
u2 = d2 / d_norm;
// calculate mid point of LOR
x_m0 = 0.5f*(xstart0 + xend0);
x_m1 = 0.5f*(xstart1 + xend1);
x_m2 = 0.5f*(xstart2 + xend2);
//---------------------------------------------------------
if (direction == 0)
{
cf = voxsize0 / sqrtf(cos0_sq);
// case where ray is most parallel to the 0 axis
// we step through the volume along the 0 direction
//--- check where ray enters / leaves cube
istart_f = (xstart0 + t1*d0 - img_origin0) / voxsize0;
iend_f = (xstart0 + t2*d0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n0){iend = n0;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart0 - img_origin0) / voxsize0;
iend_f = (xend0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i0 = istart; i0 < iend; i0++)
{
// get the indices where the ray intersects the image plane
x_pr1 = xstart1 + (img_origin0 + i0*voxsize0 - xstart0)*d1 / d0;
x_pr2 = xstart2 + (img_origin0 + i0*voxsize0 - xstart0)*d2 / d0;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
toAdd = 0;
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_floor + i2_floor] * (1 - tmp_1) * (1 - tmp_2);
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_ceil + i2_floor] * tmp_1 * (1 - tmp_2);
}
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_floor + i2_ceil] * (1 - tmp_1) * tmp_2;
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_ceil + i2_ceil] * tmp_1 * tmp_2;
}
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = img_origin0 + i0*voxsize0;
x_v1 = x_pr1;
x_v2 = x_pr2;
it1 = -n_half;
it2 = n_half;
// get the relevant tof bins (the TOF bins where the TOF weight is not close to 0)
relevant_tof_bins_cuda(x_m0, x_m1, x_m2, x_v0, x_v1, x_v2, u0, u1, u2,
tofbin_width, tc_offset, sig_tof, n_sigmas, n_half,
&it1, &it2);
if(toAdd != 0){
for(it = it1; it <= it2; it++){
//--- add extra check to be compatible with behavior of LM projector
istart_tof_f = (x_m0 + (it*tofbin_width - n_sigmas*sig_tof)*u0 - img_origin0) / voxsize0;
iend_tof_f = (x_m0 + (it*tofbin_width + n_sigmas*sig_tof)*u0 - img_origin0) / voxsize0;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
//---
if ((i0 >= istart_tof) && (i0 < iend_tof)){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
p[i*n_tofbins + it + n_half] += (tw * cf * toAdd);
}
}
}
}
}
//---------------------------------------------------------------------------------
if (direction == 1)
{
cf = voxsize1 / sqrtf(cos1_sq);
// case where ray is most parallel to the 1 axis
// we step through the volume along the 1 direction
//--- check where ray enters / leaves cube
istart_f = (xstart1 + t1*d1 - img_origin1) / voxsize1;
iend_f = (xstart1 + t2*d1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n1){iend = n1;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart1 - img_origin1) / voxsize1;
iend_f = (xend1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for (i1 = istart; i1 < iend; i1++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin1 + i1*voxsize1 - xstart1)*d0 / d1;
x_pr2 = xstart2 + (img_origin1 + i1*voxsize1 - xstart1)*d2 / d1;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
toAdd = 0;
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0_floor + n2*i1 + i2_floor] * (1 - tmp_0) * (1 - tmp_2);
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0_ceil + n2*i1 + i2_floor] * tmp_0 * (1 - tmp_2);
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0_floor + n2*i1 + i2_ceil] * (1 - tmp_0) * tmp_2;
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0_ceil + n2*i1 + i2_ceil] * tmp_0 * tmp_2;
}
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = x_pr0;
x_v1 = img_origin1 + i1*voxsize1;
x_v2 = x_pr2;
it1 = -n_half;
it2 = n_half;
// get the relevant tof bins (the TOF bins where the TOF weight is not close to 0)
relevant_tof_bins_cuda(x_m0, x_m1, x_m2, x_v0, x_v1, x_v2, u0, u1, u2,
tofbin_width, tc_offset, sig_tof, n_sigmas, n_half,
&it1, &it2);
if(toAdd != 0){
for(it = it1; it <= it2; it++){
//--- add extra check to be compatible with behavior of LM projector
istart_tof_f = (x_m1 + (it*tofbin_width - n_sigmas*sig_tof)*u1 - img_origin1) / voxsize1;
iend_tof_f = (x_m1 + (it*tofbin_width + n_sigmas*sig_tof)*u1 - img_origin1) / voxsize1;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
//---
if ((i1 >= istart_tof) && (i1 < iend_tof)){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
p[i*n_tofbins + it + n_half] += (tw * cf * toAdd);
}
}
}
}
}
//---------------------------------------------------------------------------------
if (direction == 2)
{
cf = voxsize2 / sqrtf(cos2_sq);
// case where ray is most parallel to the 2 axis
// we step through the volume along the 2 direction
//--- check where ray enters / leaves cube
istart_f = (xstart2 + t1*d2 - img_origin2) / voxsize2;
iend_f = (xstart2 + t2*d2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
if (istart < 0){istart = 0;}
if (iend >= n2){iend = n2;}
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart2 - img_origin2) / voxsize2;
iend_f = (xend2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//---
for(i2 = istart; i2 < iend; i2++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin2 + i2*voxsize2 - xstart2)*d0 / d2;
x_pr1 = xstart1 + (img_origin2 + i2*voxsize2 - xstart2)*d1 / d2;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
toAdd = 0;
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
toAdd += img[n1*n2*i0_floor + n2*i1_floor + i2] * (1 - tmp_0) * (1 - tmp_1);
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
toAdd += img[n1*n2*i0_ceil + n2*i1_floor + i2] * tmp_0 * (1 - tmp_1);
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_ceil >= 0) & (i1_ceil < n1))
{
toAdd += img[n1*n2*i0_floor + n2*i1_ceil + i2] * (1 - tmp_0) * tmp_1;
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_ceil >= 0) && (i1_ceil < n1))
{
toAdd += img[n1*n2*i0_ceil + n2*i1_ceil + i2] * tmp_0 * tmp_1;
}
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = x_pr0;
x_v1 = x_pr1;
x_v2 = img_origin2 + i2*voxsize2;
it1 = -n_half;
it2 = n_half;
// get the relevant tof bins (the TOF bins where the TOF weight is not close to 0)
relevant_tof_bins_cuda(x_m0, x_m1, x_m2, x_v0, x_v1, x_v2, u0, u1, u2,
tofbin_width, tc_offset, sig_tof, n_sigmas, n_half,
&it1, &it2);
if(toAdd != 0){
for(it = it1; it <= it2; it++){
//--- add extra check to be compatible with behavior of LM projector
istart_tof_f = (x_m2 + (it*tofbin_width - n_sigmas*sig_tof)*u2 - img_origin2) / voxsize2;
iend_tof_f = (x_m2 + (it*tofbin_width + n_sigmas*sig_tof)*u2 - img_origin2) / voxsize2;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
//---
if ((i2 >= istart_tof) && (i2 < iend_tof)){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
p[i*n_tofbins + it + n_half] += (tw * cf * toAdd);
}
}
}
}
}
}
}
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
extern "C" __global__ void joseph3d_back_tof_lm_cuda_kernel(float *xstart,
float *xend,
float *img,
float *img_origin,
float *voxsize,
float *p,
long long nlors,
int *img_dim,
float tofbin_width,
float *sigma_tof,
float *tofcenter_offset,
float n_sigmas,
short *tof_bin,
unsigned char lor_dependent_sigma_tof,
unsigned char lor_dependent_tofcenter_offset)
{
long long i = blockDim.x * blockIdx.x + threadIdx.x;
int n0 = img_dim[0];
int n1 = img_dim[1];
int n2 = img_dim[2];
if(i < nlors)
{
float d0, d1, d2, d0_sq, d1_sq, d2_sq;
float cs0, cs1, cs2, cf;
float lsq, cos0_sq, cos1_sq, cos2_sq;
unsigned short direction;
int i0, i1, i2;
int i0_floor, i1_floor, i2_floor;
int i0_ceil, i1_ceil, i2_ceil;
float x_pr0, x_pr1, x_pr2;
float tmp_0, tmp_1, tmp_2;
float u0, u1, u2, d_norm;
float x_m0, x_m1, x_m2;
float x_v0, x_v1, x_v2;
int it = tof_bin[i];
float dtof, tw;
float sig_tof = (lor_dependent_sigma_tof == 1) ? sigma_tof[i] : sigma_tof[0];
float tc_offset = (lor_dependent_tofcenter_offset == 1) ? tofcenter_offset[i] : tofcenter_offset[0];
float xstart0 = xstart[i*3 + 0];
float xstart1 = xstart[i*3 + 1];
float xstart2 = xstart[i*3 + 2];
float xend0 = xend[i*3 + 0];
float xend1 = xend[i*3 + 1];
float xend2 = xend[i*3 + 2];
float voxsize0 = voxsize[0];
float voxsize1 = voxsize[1];
float voxsize2 = voxsize[2];
float img_origin0 = img_origin[0];
float img_origin1 = img_origin[1];
float img_origin2 = img_origin[2];
unsigned char intersec;
float t1, t2;
float istart_f, iend_f, tmp;
int istart, iend;
float istart_tof_f, iend_tof_f;
int istart_tof, iend_tof;
// test whether the ray between the two detectors is most parallel
// with the 0, 1, or 2 axis
d0 = xend0 - xstart0;
d1 = xend1 - xstart1;
d2 = xend2 - xstart2;
//-----------
//--- test whether ray and cube intersect
intersec = ray_cube_intersection_cuda(xstart0, xstart1, xstart2,
img_origin0 - 1*voxsize0, img_origin1 - 1*voxsize1, img_origin2 - 1*voxsize2,
img_origin0 + n0*voxsize0, img_origin1 + n1*voxsize1, img_origin2 + n2*voxsize2,
d0, d1, d2, &t1, &t2);
if (intersec == 1)
{
d0_sq = d0*d0;
d1_sq = d1*d1;
d2_sq = d2*d2;
lsq = d0_sq + d1_sq + d2_sq;
cos0_sq = d0_sq / lsq;
cos1_sq = d1_sq / lsq;
cos2_sq = d2_sq / lsq;
cs0 = sqrtf(cos0_sq);
cs1 = sqrtf(cos1_sq);
cs2 = sqrtf(cos2_sq);
direction = 0;
if ((cos1_sq >= cos0_sq) && (cos1_sq >= cos2_sq))
{
direction = 1;
}
if ((cos2_sq >= cos0_sq) && (cos2_sq >= cos1_sq))
{
direction = 2;
}
//---------------------------------------------------------
//--- calculate TOF related quantities
// unit vector (u0,u1,u2) that points from xstart to end
d_norm = sqrtf(lsq);
u0 = d0 / d_norm;
u1 = d1 / d_norm;
u2 = d2 / d_norm;
// calculate mid point of LOR
x_m0 = 0.5f*(xstart0 + xend0);
x_m1 = 0.5f*(xstart1 + xend1);
x_m2 = 0.5f*(xstart2 + xend2);
//---------------------------------------------------------
if(direction == 0)
{
// case where ray is most parallel to the 0 axis
// we step through the volume along the 0 direction
// factor for correctiong voxel size and |cos(theta)|
cf = voxsize0/cs0;
//--- check where ray enters / leaves cube
istart_f = (xstart0 + t1*d0 - img_origin0) / voxsize0;
iend_f = (xstart0 + t2*d0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart0 - img_origin0) / voxsize0;
iend_f = (xend0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//-- check where we should start and stop according to the TOF kernel
//-- the tof weights outside +- 3 sigma will be close to 0 so we can
//-- ignore them
istart_tof_f = (x_m0 + (it*tofbin_width - n_sigmas*sig_tof)*u0 - img_origin0) / voxsize0;
iend_tof_f = (x_m0 + (it*tofbin_width + n_sigmas*sig_tof)*u0 - img_origin0) / voxsize0;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
if(istart_tof > istart){istart = istart_tof;}
if(iend_tof < iend){iend = iend_tof;}
//-----------
if (istart < 0){istart = 0;}
if (iend >= n0){iend = n0;}
//---
for(i0 = istart; i0 < iend; i0++)
{
// get the indices where the ray intersects the image plane
x_pr1 = xstart1 + (img_origin0 + i0*voxsize0 - xstart0)*d1 / d0;
x_pr2 = xstart2 + (img_origin0 + i0*voxsize0 - xstart0)*d2 / d0;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = img_origin0 + i0*voxsize0;
x_v1 = x_pr1;
x_v2 = x_pr2;
if(p[i] != 0){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_floor + i2_floor,
(tw * p[i] * (1 - tmp_1) * (1 - tmp_2) * cf));
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_ceil + i2_floor,
(tw * p[i] * tmp_1 * (1 - tmp_2) * cf));
}
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_floor + i2_ceil,
(tw * p[i] * (1 - tmp_1) * tmp_2*cf));
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0 + n2*i1_ceil + i2_ceil,
(tw * p[i] * tmp_1 * tmp_2 * cf));
}
}
}
}
// ---------------------------------------------------------------------------------
if(direction == 1)
{
// case where ray is most parallel to the 1 axis
// we step through the volume along the 1 direction
// factor for correctiong voxel size and |cos(theta)|
cf = voxsize1/cs1;
//--- check where ray enters / leaves cube
istart_f = (xstart1 + t1*d1 - img_origin1) / voxsize1;
iend_f = (xstart1 + t2*d1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart1 - img_origin1) / voxsize1;
iend_f = (xend1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//-- check where we should start and stop according to the TOF kernel
//-- the tof weights outside +- 3 sigma will be close to 0 so we can
//-- ignore them
istart_tof_f = (x_m1 + (it*tofbin_width - n_sigmas*sig_tof)*u1 - img_origin1) / voxsize1;
iend_tof_f = (x_m1 + (it*tofbin_width + n_sigmas*sig_tof)*u1 - img_origin1) / voxsize1;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
if(istart_tof > istart){istart = istart_tof;}
if(iend_tof < iend){iend = iend_tof;}
//-----------
if (istart < 0){istart = 0;}
if (iend >= n1){iend = n1;}
//---
for(i1 = istart; i1 < iend; i1++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin1 + i1*voxsize1 - xstart1)*d0 / d1;
x_pr2 = xstart2 + (img_origin1 + i1*voxsize1 - xstart1)*d2 / d1;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = x_pr0;
x_v1 = img_origin1 + i1*voxsize1;
x_v2 = x_pr2;
if(p[i] != 0){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1 + i2_floor,
(tw * p[i] * (1 - tmp_0) * (1 - tmp_2) * cf));
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1 + i2_floor,
(tw * p[i] * tmp_0 * (1 - tmp_2) * cf));
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1 + i2_ceil,
(tw * p[i] * (1 - tmp_0) * tmp_2 * cf));
}
if((i0_ceil >= 0) && (i0_ceil < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1 + i2_ceil,
(tw * p[i] * tmp_0 * tmp_2 * cf));
}
}
}
}
//---------------------------------------------------------------------------------
if (direction == 2)
{
// case where ray is most parallel to the 2 axis
// we step through the volume along the 2 direction
// factor for correctiong voxel size and |cos(theta)|
cf = voxsize2/cs2;
//--- check where ray enters / leaves cube
istart_f = (xstart2 + t1*d2 - img_origin2) / voxsize2;
iend_f = (xstart2 + t2*d2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart2 - img_origin2) / voxsize2;
iend_f = (xend2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//-- check where we should start and stop according to the TOF kernel
//-- the tof weights outside +- 3 sigma will be close to 0 so we can
//-- ignore them
istart_tof_f = (x_m2 + (it*tofbin_width - n_sigmas*sig_tof)*u2 - img_origin2) / voxsize2;
iend_tof_f = (x_m2 + (it*tofbin_width + n_sigmas*sig_tof)*u2 - img_origin2) / voxsize2;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
if(istart_tof > istart){istart = istart_tof;}
if(iend_tof < iend){iend = iend_tof;}
//-----------
if (istart < 0){istart = 0;}
if (iend >= n2){iend = n2;}
//---
for(i2 = istart; i2 < iend; i2++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin2 + i2*voxsize2 - xstart2)*d0 / d2;
x_pr1 = xstart1 + (img_origin2 + i2*voxsize2 - xstart2)*d1 / d2;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = x_pr0;
x_v1 = x_pr1;
x_v2 = img_origin2 + i2*voxsize2;
if(p[i] != 0){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1_floor + i2,
(tw * p[i] * (1 - tmp_0) * (1 - tmp_1) * cf));
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1_floor + i2,
(tw * p[i] * tmp_0 * (1 - tmp_1) * cf));
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_ceil >= 0) && (i1_ceil < n1))
{
atomicAdd(img + n1*n2*i0_floor + n2*i1_ceil + i2,
(tw * p[i] * (1 - tmp_0) * tmp_1 * cf));
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_ceil >= 0) && (i1_ceil < n1))
{
atomicAdd(img + n1*n2*i0_ceil + n2*i1_ceil + i2,
(tw * p[i] * tmp_0 * tmp_1 * cf));
}
}
}
}
}
}
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
extern "C" __global__ void joseph3d_fwd_tof_lm_cuda_kernel(float *xstart,
float *xend,
float *img,
float *img_origin,
float *voxsize,
float *p,
long long nlors,
int *img_dim,
float tofbin_width,
float *sigma_tof,
float *tofcenter_offset,
float n_sigmas,
short *tof_bin,
unsigned char lor_dependent_sigma_tof,
unsigned char lor_dependent_tofcenter_offset)
{
long long i = blockDim.x * blockIdx.x + threadIdx.x;
int n0 = img_dim[0];
int n1 = img_dim[1];
int n2 = img_dim[2];
if(i < nlors)
{
float d0, d1, d2, d0_sq, d1_sq, d2_sq;
float lsq, cos0_sq, cos1_sq, cos2_sq;
unsigned short direction;
int i0, i1, i2;
int i0_floor, i1_floor, i2_floor;
int i0_ceil, i1_ceil, i2_ceil;
float x_pr0, x_pr1, x_pr2;
float tmp_0, tmp_1, tmp_2;
float u0, u1, u2, d_norm;
float x_m0, x_m1, x_m2;
float x_v0, x_v1, x_v2;
int it = tof_bin[i];
float dtof, tw;
// correction factor for cos(theta) and voxsize
float cf;
float toAdd;
float sig_tof = (lor_dependent_sigma_tof == 1) ? sigma_tof[i] : sigma_tof[0];
float tc_offset = (lor_dependent_tofcenter_offset == 1) ? tofcenter_offset[i] : tofcenter_offset[0];
float xstart0 = xstart[i*3 + 0];
float xstart1 = xstart[i*3 + 1];
float xstart2 = xstart[i*3 + 2];
float xend0 = xend[i*3 + 0];
float xend1 = xend[i*3 + 1];
float xend2 = xend[i*3 + 2];
float voxsize0 = voxsize[0];
float voxsize1 = voxsize[1];
float voxsize2 = voxsize[2];
float img_origin0 = img_origin[0];
float img_origin1 = img_origin[1];
float img_origin2 = img_origin[2];
unsigned char intersec;
float t1, t2;
float istart_f, iend_f, tmp;
int istart, iend;
float istart_tof_f, iend_tof_f;
int istart_tof, iend_tof;
// test whether the ray between the two detectors is most parallel
// with the 0, 1, or 2 axis
d0 = xend0 - xstart0;
d1 = xend1 - xstart1;
d2 = xend2 - xstart2;
//-----------
//--- test whether ray and cube intersect
intersec = ray_cube_intersection_cuda(xstart0, xstart1, xstart2,
img_origin0 - 1*voxsize0, img_origin1 - 1*voxsize1, img_origin2 - 1*voxsize2,
img_origin0 + n0*voxsize0, img_origin1 + n1*voxsize1, img_origin2 + n2*voxsize2,
d0, d1, d2, &t1, &t2);
if (intersec == 1)
{
d0_sq = d0*d0;
d1_sq = d1*d1;
d2_sq = d2*d2;
lsq = d0_sq + d1_sq + d2_sq;
cos0_sq = d0_sq / lsq;
cos1_sq = d1_sq / lsq;
cos2_sq = d2_sq / lsq;
direction = 0;
if ((cos1_sq >= cos0_sq) && (cos1_sq >= cos2_sq))
{
direction = 1;
}
else
{
if ((cos2_sq >= cos0_sq) && (cos2_sq >= cos1_sq))
{
direction = 2;
}
}
//---------------------------------------------------------
//--- calculate TOF related quantities
// unit vector (u0,u1,u2) that points from xstart to end
d_norm = sqrtf(lsq);
u0 = d0 / d_norm;
u1 = d1 / d_norm;
u2 = d2 / d_norm;
// calculate mid point of LOR
x_m0 = 0.5f*(xstart0 + xend0);
x_m1 = 0.5f*(xstart1 + xend1);
x_m2 = 0.5f*(xstart2 + xend2);
//---------------------------------------------------------
if (direction == 0)
{
cf = voxsize0 / sqrtf(cos0_sq);
// case where ray is most parallel to the 0 axis
// we step through the volume along the 0 direction
//--- check where ray enters / leaves cube
istart_f = (xstart0 + t1*d0 - img_origin0) / voxsize0;
iend_f = (xstart0 + t2*d0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart0 - img_origin0) / voxsize0;
iend_f = (xend0 - img_origin0) / voxsize0;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//-- check where we should start and stop according to the TOF kernel
//-- the tof weights outside +- 3 sigma will be close to 0 so we can
//-- ignore them
istart_tof_f = (x_m0 + (it*tofbin_width - n_sigmas*sig_tof)*u0 - img_origin0) / voxsize0;
iend_tof_f = (x_m0 + (it*tofbin_width + n_sigmas*sig_tof)*u0 - img_origin0) / voxsize0;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
if(istart_tof > istart){istart = istart_tof;}
if(iend_tof < iend){iend = iend_tof;}
//-----------
if (istart < 0){istart = 0;}
if (iend >= n0){iend = n0;}
for(i0 = istart; i0 < iend; i0++)
{
// get the indices where the ray intersects the image plane
x_pr1 = xstart1 + (img_origin0 + i0*voxsize0 - xstart0)*d1 / d0;
x_pr2 = xstart2 + (img_origin0 + i0*voxsize0 - xstart0)*d2 / d0;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
toAdd = 0;
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_floor + i2_floor] * (1 - tmp_1) * (1 - tmp_2);
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_ceil + i2_floor] * tmp_1 * (1 - tmp_2);
}
if ((i1_floor >= 0) && (i1_floor < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_floor + i2_ceil] * (1 - tmp_1) * tmp_2;
}
if ((i1_ceil >= 0) && (i1_ceil < n1) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0 + n2*i1_ceil + i2_ceil] * tmp_1 * tmp_2;
}
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = img_origin0 + i0*voxsize0;
x_v1 = x_pr1;
x_v2 = x_pr2;
if(toAdd != 0){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
p[i] += (tw * cf * toAdd);
}
}
}
//---------------------------------------------------------------------------------
if (direction == 1)
{
cf = voxsize1 / sqrtf(cos1_sq);
// case where ray is most parallel to the 1 axis
// we step through the volume along the 1 direction
//--- check where ray enters / leaves cube
istart_f = (xstart1 + t1*d1 - img_origin1) / voxsize1;
iend_f = (xstart1 + t2*d1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart1 - img_origin1) / voxsize1;
iend_f = (xend1 - img_origin1) / voxsize1;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//-- check where we should start and stop according to the TOF kernel
//-- the tof weights outside +- 3 sigma will be close to 0 so we can
//-- ignore them
istart_tof_f = (x_m1 + (it*tofbin_width - n_sigmas*sig_tof)*u1 - img_origin1) / voxsize1;
iend_tof_f = (x_m1 + (it*tofbin_width + n_sigmas*sig_tof)*u1 - img_origin1) / voxsize1;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
if(istart_tof > istart){istart = istart_tof;}
if(iend_tof < iend){iend = iend_tof;}
//-----------
if (istart < 0){istart = 0;}
if (iend >= n1){iend = n1;}
//---
for (i1 = istart; i1 < iend; i1++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin1 + i1*voxsize1 - xstart1)*d0 / d1;
x_pr2 = xstart2 + (img_origin1 + i1*voxsize1 - xstart1)*d2 / d1;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i2_floor = (int)floor((x_pr2 - img_origin2)/voxsize2);
i2_ceil = i2_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_2 = (x_pr2 - (i2_floor*voxsize2 + img_origin2)) / voxsize2;
toAdd = 0;
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0_floor + n2*i1 + i2_floor] * (1 - tmp_0) * (1 - tmp_2);
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i2_floor >= 0) && (i2_floor < n2))
{
toAdd += img[n1*n2*i0_ceil + n2*i1 + i2_floor] * tmp_0 * (1 - tmp_2);
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0_floor + n2*i1 + i2_ceil] * (1 - tmp_0) * tmp_2;
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i2_ceil >= 0) && (i2_ceil < n2))
{
toAdd += img[n1*n2*i0_ceil + n2*i1 + i2_ceil] * tmp_0 * tmp_2;
}
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = x_pr0;
x_v1 = img_origin1 + i1*voxsize1;
x_v2 = x_pr2;
if(toAdd != 0){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
p[i] += (tw * cf * toAdd);
}
}
}
//---------------------------------------------------------------------------------
if (direction == 2)
{
cf = voxsize2 / sqrtf(cos2_sq);
// case where ray is most parallel to the 2 axis
// we step through the volume along the 2 direction
//--- check where ray enters / leaves cube
istart_f = (xstart2 + t1*d2 - img_origin2) / voxsize2;
iend_f = (xstart2 + t2*d2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
istart = (int)floor(istart_f);
iend = (int)ceil(iend_f);
// check in which "plane" the start and end points are
// we have to do this to avoid that we include voxels
// that are "outside" the line segment bewteen xstart and xend
// !! for these calculations we overwrite the istart_f and iend_f variables !!
istart_f = (xstart2 - img_origin2) / voxsize2;
iend_f = (xend2 - img_origin2) / voxsize2;
if (istart_f > iend_f){
tmp = iend_f;
iend_f = istart_f;
istart_f = tmp;
}
if (istart < (int)floor(istart_f)){istart = (int)floor(istart_f);}
if (iend >= (int)ceil(iend_f)){iend = (int)ceil(iend_f);}
//-- check where we should start and stop according to the TOF kernel
//-- the tof weights outside +- 3 sigma will be close to 0 so we can
//-- ignore them
istart_tof_f = (x_m2 + (it*tofbin_width - n_sigmas*sig_tof)*u2 - img_origin2) / voxsize2;
iend_tof_f = (x_m2 + (it*tofbin_width + n_sigmas*sig_tof)*u2 - img_origin2) / voxsize2;
if (istart_tof_f > iend_tof_f){
tmp = iend_tof_f;
iend_tof_f = istart_tof_f;
istart_tof_f = tmp;
}
istart_tof = (int)floor(istart_tof_f);
iend_tof = (int)ceil(iend_tof_f);
if(istart_tof > istart){istart = istart_tof;}
if(iend_tof < iend){iend = iend_tof;}
//-----------
if (istart < 0){istart = 0;}
if (iend >= n2){iend = n2;}
//---
for(i2 = istart; i2 < iend; i2++)
{
// get the indices where the ray intersects the image plane
x_pr0 = xstart0 + (img_origin2 + i2*voxsize2 - xstart2)*d0 / d2;
x_pr1 = xstart1 + (img_origin2 + i2*voxsize2 - xstart2)*d1 / d2;
i0_floor = (int)floor((x_pr0 - img_origin0)/voxsize0);
i0_ceil = i0_floor + 1;
i1_floor = (int)floor((x_pr1 - img_origin1)/voxsize1);
i1_ceil = i1_floor + 1;
// calculate the distances to the floor normalized to [0,1]
// for the bilinear interpolation
tmp_0 = (x_pr0 - (i0_floor*voxsize0 + img_origin0)) / voxsize0;
tmp_1 = (x_pr1 - (i1_floor*voxsize1 + img_origin1)) / voxsize1;
toAdd = 0;
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
toAdd += img[n1*n2*i0_floor + n2*i1_floor + i2] * (1 - tmp_0) * (1 - tmp_1);
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_floor >= 0) && (i1_floor < n1))
{
toAdd += img[n1*n2*i0_ceil + n2*i1_floor + i2] * tmp_0 * (1 - tmp_1);
}
if ((i0_floor >= 0) && (i0_floor < n0) && (i1_ceil >= 0) & (i1_ceil < n1))
{
toAdd += img[n1*n2*i0_floor + n2*i1_ceil + i2] * (1 - tmp_0) * tmp_1;
}
if ((i0_ceil >= 0) && (i0_ceil < n0) && (i1_ceil >= 0) && (i1_ceil < n1))
{
toAdd += img[n1*n2*i0_ceil + n2*i1_ceil + i2] * tmp_0 * tmp_1;
}
//--------- TOF related quantities
// calculate the voxel center needed for TOF weights
x_v0 = x_pr0;
x_v1 = x_pr1;
x_v2 = img_origin2 + i2*voxsize2;
if(toAdd != 0){
// calculate distance of voxel to tof bin center
dtof = sqrtf(powf((x_m0 + (it*tofbin_width + tc_offset)*u0 - x_v0), 2) +
powf((x_m1 + (it*tofbin_width + tc_offset)*u1 - x_v1), 2) +
powf((x_m2 + (it*tofbin_width + tc_offset)*u2 - x_v2), 2));
//calculate the TOF weight
tw = 0.5f*(erff((dtof + 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)) -
erff((dtof - 0.5f*tofbin_width)/(sqrtf(2)*sig_tof)));
p[i] += (tw * cf * toAdd);
}
}
}
}
}
}
|
8,586 | #include <stdio.h>
__device__ __managed__ int ret[1000];
__global__ void AplusB(int a, int b) {
ret[threadIdx.x] = a + b + threadIdx.x;
}
int main() {
AplusB<<< 1, 1000 >>>(10, 100);
cudaDeviceSynchronize();
for(int i=0; i<1000; i++)
printf("%d: A+B = %d\n", i, ret[i]);
return 0;
}
|
8,587 | #include "includes.h"
__global__ void boundaryCondition_k(float* payoff, size_t spotSize, float strike) {
size_t state_idx = threadIdx.x;
payoff[spotSize - 1 + state_idx * spotSize] = 2 * strike;
payoff[0 + state_idx * spotSize] = 0.0;
} |
8,588 | #include <iostream>
#include <cuda_runtime.h>
using namespace std;
__global__ void reverse_kernel(int *a, int size){
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= size / 2){
return;
}
extern __shared__ int a_copy[];
a_copy[idx] = a[idx];
a_copy[size - 1 - idx] = a[size - 1 - idx];
__syncthreads();
int t = a_copy[idx];
a_copy[idx] = a_copy[size - 1 - idx];
a_copy[size - 1 - idx] = t;
__syncthreads();
a[idx] = a_copy[idx];
a[size - 1 - idx] = a_copy[size - 1 - idx];
}
int main(int argc, char **argv){
int n = atoi(argv[1]);
int *h_a;
size_t bytes = n * sizeof(int);
h_a = (int *) malloc(bytes);
for (int i = 0; i < n; i++){
h_a[i] = i;
}
int *d_a;
cudaEvent_t start, stop;
cudaEventCreate(&start);
cudaEventCreate(&stop);
cudaEventRecord(start);
cudaMalloc(&d_a, bytes);
cudaMemcpy(d_a, h_a, bytes, cudaMemcpyHostToDevice);
int blockSize = 1024;
int gridSize = 1;
reverse_kernel<<<gridSize, blockSize>>>(d_a, n);
cudaDeviceSynchronize();
cudaMemcpy(h_a, d_a, bytes, cudaMemcpyDeviceToHost);
cudaEventRecord(stop);
cudaEventSynchronize(stop);
float milliseconds = 0;
cudaEventElapsedTime(&milliseconds, start, stop);
cout << milliseconds << endl;
cudaFree(d_a);
return 0;
}
|
8,589 | /*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// Basic cuda functions callable from C/C++ code
#include <cuda.h>
#include <stdio.h>
extern "C" int ScaLBL_SetDevice(int rank){
int n_devices;
//int local_rank = atoi(getenv("OMPI_COMM_WORLD_LOCAL_RANK"));
cudaGetDeviceCount(&n_devices);
//int device = local_rank % n_devices;
int device = rank % n_devices;
cudaSetDevice(device);
printf("MPI rank=%i will use GPU ID %i / %i \n",rank,device,n_devices);
return device;
}
extern "C" void ScaLBL_AllocateDeviceMemory(void** address, size_t size){
cudaMalloc(address,size);
cudaError_t err = cudaGetLastError();
if (cudaSuccess != err){
printf("Error in cudaMalloc: %s \n",cudaGetErrorString(err));
}
}
extern "C" void ScaLBL_FreeDeviceMemory(void* pointer){
cudaFree(pointer);
}
extern "C" void ScaLBL_CopyToDevice(void* dest, const void* source, size_t size){
cudaMemcpy(dest,source,size,cudaMemcpyHostToDevice);
cudaError_t err = cudaGetLastError();
if (cudaSuccess != err){
printf("Error in cudaMemcpy (host->device): %s \n",cudaGetErrorString(err));
}
}
extern "C" void ScaLBL_AllocateZeroCopy(void** address, size_t size){
//cudaMallocHost(address,size);
cudaMalloc(address,size);
cudaError_t err = cudaGetLastError();
if (cudaSuccess != err){
printf("Error in cudaMallocHost: %s \n",cudaGetErrorString(err));
}
}
extern "C" void ScaLBL_CopyToZeroCopy(void* dest, const void* source, size_t size){
cudaMemcpy(dest,source,size,cudaMemcpyHostToDevice);
cudaError_t err = cudaGetLastError();
//memcpy(dest, source, size);
}
extern "C" void ScaLBL_CopyToHost(void* dest, const void* source, size_t size){
cudaMemcpy(dest,source,size,cudaMemcpyDeviceToHost);
cudaError_t err = cudaGetLastError();
if (cudaSuccess != err){
printf("Error in cudaMemcpy (device->host): %s \n",cudaGetErrorString(err));
}
}
extern "C" void ScaLBL_DeviceBarrier(){
cudaDeviceSynchronize();
}
|
8,590 | #include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#define WIDTH 512
#define BLOCK_WIDTH 16
#define TILE_WIDTH 16
__global__
void matMulTiledKernel(float *d_M, float *d_N, float *d_P, int Width)
{
__shared__ float Mds[TILE_WIDTH][TILE_WIDTH];
__shared__ float Nds[TILE_WIDTH][TILE_WIDTH];
int bx = blockIdx.x; int by = blockIdx.y;
int tx = threadIdx.x; int ty = threadIdx.y;
int Row = by*TILE_WIDTH + ty;
int Col = bx*TILE_WIDTH + tx;
int k, m;
float Pvalue = 0.0;
for(m=0;m<Width/TILE_WIDTH;++m){
Mds[ty][tx] = d_M[Row*Width+m*TILE_WIDTH+tx];
Nds[ty][tx] = d_N[(m*TILE_WIDTH+ty)*Width+Col];
__syncthreads();
for(k=0;k<TILE_WIDTH;k++) Pvalue += Mds[ty][k]*Nds[k][tx];
__syncthreads();
}
d_P[Row*Width+Col] = Pvalue;
}
void matMulDevice(float *h_M, float *h_N, float *h_P, int Width)
{
int size = Width * Width * sizeof(float);
float *d_M, *d_N, *d_P;
// Step 1: Allocate and Load M, N to device memory
cudaMalloc((void **)&d_M, size);
cudaMemcpy(d_M, h_M, size, cudaMemcpyHostToDevice);
cudaMalloc((void **)&d_N, size);
cudaMemcpy(d_N, h_N, size, cudaMemcpyHostToDevice);
// Step 2: Allocate P on the device
cudaMalloc((void **)&d_P, size);
// Step 3a: Set up execution configuration
int numBlocks = ceil(Width/(float)BLOCK_WIDTH);
dim3 dimGrid(numBlocks,numBlocks);
dim3 dimBlock(BLOCK_WIDTH, BLOCK_WIDTH);
// Step 3b: Launch the device computation threads!
matMulTiledKernel<<<dimGrid, dimBlock>>>(d_M, d_N, d_P, Width);
// Step 4: Copy back result, and free memory on device
cudaMemcpy(h_P, d_P, size, cudaMemcpyDeviceToHost);
cudaFree(d_M); cudaFree(d_N); cudaFree(d_P);
}
int main()
{
float *h_M, *h_N, *h_P;
int i, n = WIDTH, size=sizeof(float)*n*n;
h_P = (float *)malloc(size);
h_M = (float *)malloc(size);
h_N = (float *)malloc(size);
for(i=0;i<n*n;i++){*(h_M+i)=(float)i;
*(h_N+i)=(float)i;}
matMulDevice(h_M,h_N,h_P,n);
}
|
8,591 | #include <stdio.h>
#include <iostream>
#define NUMTHREADS 32
__global__ void kernel(){
int tx = blockDim.x*blockIdx.x+threadIdx.x;
printf("%d\n",tx);
}
extern "C" {
int cppfunc(int a){
int numthreads= NUMTHREADS;
int numblocks = 2;
printf("cppfunc:%d blocks %d\n", a, numblocks);
std::cout<<"Hello"<<std::endl;
std::cout << "kernel:" << a << std::endl;
cudaDeviceSynchronize();
kernel <<< numblocks , numthreads >>> ();
cudaDeviceSynchronize();
return 927;
}
}
|
8,592 | #include <thrust/device_vector.h>
#include <thrust/sort.h>
#include <thrust/random.h>
#include <iostream>
#include <iomanip>
// Helper routines
void initialize(thrust::device_vector<int>& v)
{
thrust::default_random_engine rng(123456);
thrust::uniform_int_distribution<int> dist(10, 99);
for(size_t i = 0; i < v.size(); i++)
v[i] = dist(rng);
}
void print(const thrust::device_vector<int>& v)
{
for(size_t i = 0; i < v.size(); i++)
std::cout << " " << v[i];
std::cout << "\n";
}
int main(void)
{
size_t N = 16;
std::cout << "sorting integers\n";
{
thrust::device_vector<int> keys(N);
initialize(keys);
print(keys);
thrust::sort(keys.begin(), keys.end());
print(keys);
}
std::cout << "\nsorting integers (descending)\n";
{
thrust::device_vector<int> keys(N);
initialize(keys);
print(keys);
thrust::sort(keys.begin(), keys.end(), thrust::greater<int>());
print(keys);
}
return 0;
}
|
8,593 | #include <iostream>
#include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
static void HandleError(cudaError_t err, const char *file, int line)
{
if (err != cudaSuccess)
{
printf("%s in %s at line %d\n", cudaGetErrorString(err), file, line);
exit(EXIT_FAILURE);
}
}
#define HANDLE_ERROR(err)(HandleError(err, __FILE__, __LINE__))
//star character is a pointer
__global__ void add(int a, int b, int *c)
{
*c = a + b;
}
int main(void)
{
/*int c;
int *dev_c; //pointer declaration
HANDLE_ERROR(cudaMalloc((void**)&dev_c, sizeof(int)));
add<<<1, 1 >>>(2, 7, dev_c);
HANDLE_ERROR(cudaMemcpy(&c, dev_c, sizeof(int), cudaMemcpyDeviceToHost));*/
int count;
cudaDeviceProp prop;
HANDLE_ERROR(cudaGetDeviceCount(&count));
for (int x = 0; x < count; x++)
{
HANDLE_ERROR(cudaGetDeviceProperties(&prop, x));
printf("Device %d \n", x);
printf("Name: %s\n", prop.name);
printf("Compute Capability: %d.%d\n", prop.major, prop.minor);
printf("Clock rate: %d\n", prop.clockRate);
if (prop.deviceOverlap) { printf("Overlap Enabled\n"); };
if (prop.kernelExecTimeoutEnabled) { printf("Kernal Timeout Enabled\n"); };
printf("Memory Info\n");
printf("Total global mem: %ld\n", prop.totalGlobalMem);
printf("Total constant mem: %ld\n", prop.totalConstMem);
printf("Max mem pitch: %ld\n", prop.memPitch);
printf("Texture Alignment: %ld\n", prop.textureAlignment);
printf("Multiprocessor info\n");
printf("Multiprocessor count: %d\n", prop.multiProcessorCount);
printf("Shared mem per mp %d\n", prop.sharedMemPerBlock);
printf("Registers per mp %d\n", prop.regsPerBlock);
printf("Threads in warp: %d\n", prop.warpSize);
printf("Memory per block: %d\n", prop.sharedMemPerBlock);
printf("Max threads per block: %d\n", prop.maxThreadsPerBlock);
printf("Max thread dimensions (%d, %d, %d)\n", prop.maxThreadsDim[0], prop.maxThreadsDim[1], prop.maxThreadsDim[2]);
printf("Max grid dimensions: (%d, %d, %d)\n", prop.maxGridSize[0], prop.maxGridSize[1], prop.maxGridSize[2]);
}
//page 34 - 55 in pdf
//printf("%d",count);
//printf("2 + 7 = %d\n", c);
//cudaFree(dev_c);
getchar();
return 0;
} |
8,594 | /*
* Kobe Davis
* Prof. Karavan
* CS 405
* 19 April 2019
*
* Assignment 1: Vector Addition
*/
#include <device_launch_parameters.h>
#include <cuda_runtime.h>
#include <iostream>
using namespace std;
__host__ void errCatch(cudaError_t err);
__global__ void vecAddKernel(int* A, int* B, int* C, int size);
int main()
{
int len = 1024;
int* d_A, * d_B, * d_C;
int* h_A = new int[len];
int* h_B = new int[len];
int* h_C = new int[len];
for (int i = 0; i < len; ++i) {
h_A[i] = h_B[i] = 1;
h_C[i] = 0;
}
int size = len * sizeof(int);
errCatch(cudaMalloc((void**)& d_A, size));
errCatch(cudaMemcpy(d_A, h_A, size, cudaMemcpyHostToDevice));
errCatch(cudaMalloc((void**)& d_B, size));
errCatch(cudaMemcpy(d_B, h_B, size, cudaMemcpyHostToDevice));
errCatch(cudaMalloc((void**)& d_C, size));
vecAddKernel<<< len / 256, 256 >>>(d_A, d_B, d_C, len);
errCatch(cudaMemcpy(h_C, d_C, size, cudaMemcpyDeviceToHost));
int sum = 0;
cout << "Sum of Resultant Vector: ";
for (int i = 0; i < len; ++i)
sum += h_C[i];
cout << sum << endl;
errCatch(cudaFree(d_A));
errCatch(cudaFree(d_B));
errCatch(cudaFree(d_C));
delete[] h_A;
delete[] h_B;
delete[] h_C;
return 0;
}
__global__
void vecAddKernel(int* A, int* B, int* C, int size) {
int idx = (blockDim.x * blockIdx.x) + threadIdx.x;
if (idx < size)
C[idx] = A[idx] + B[idx];
}
__host__
void errCatch(cudaError_t err) {
if (err != cudaSuccess) {
cout << cudaGetErrorString(err) << " in " << __FILE__ << " at line " << __LINE__ << endl;
exit(EXIT_FAILURE);
}
} |
8,595 | #include <stdint.h>
#include <stdio.h>
#define N 48
#define THREADS_PER_BLOCK 32
__global__ void saxpy(float a, float* x, float* y) {
// Which index of the array should this thread use?
size_t index = THREADS_PER_BLOCK * blockIdx.x + threadIdx.x;
if(index < blockDim.x * THREADS_PER_BLOCK) {
y[index] = a * x[index] + y[index];
}
}
int main() {
// Allocate arrays for X and Y on the CPU
float* cpu_x = (float*)malloc(sizeof(float) * N);
float* cpu_y = (float*)malloc(sizeof(float) * N);
// Initialize X and Y
int i;
for(i=0; i<N; i++) {
cpu_x[i] = (float)i;
cpu_y[i] = 0.0;
}
// Allocate space for X and Y on the GPU
float* gpu_x;
float* gpu_y;
if(cudaMalloc(&gpu_x, sizeof(float) * N) != cudaSuccess) {
fprintf(stderr, "Failed to allocate X array on GPU\n");
exit(2);
}
if(cudaMalloc(&gpu_y, sizeof(float) * N) != cudaSuccess) {
fprintf(stderr, "Failed to allocate Y array on GPU\n");
exit(2);
}
// Copy the host X and Y arrays to the device X and Y arrays
if(cudaMemcpy(gpu_x, cpu_x, sizeof(float) * N, cudaMemcpyHostToDevice) != cudaSuccess) {
fprintf(stderr, "Failed to copy X to the GPU\n");
}
if(cudaMemcpy(gpu_y, cpu_y, sizeof(float) * N, cudaMemcpyHostToDevice) != cudaSuccess) {
fprintf(stderr, "Failed to copy Y to the GPU\n");
}
// How many blocks should be run, rounding up to include all threads?
size_t blocks = (N + THREADS_PER_BLOCK - 1) / THREADS_PER_BLOCK;
// Run the saxpy kernel
saxpy<<<blocks, THREADS_PER_BLOCK>>>(0.5, gpu_x, gpu_y);
// Wait for the kernel to finish
cudaDeviceSynchronize();
// Copy values from the GPU back to the CPU
if(cudaMemcpy(cpu_y, gpu_y, sizeof(float) * N, cudaMemcpyDeviceToHost) != cudaSuccess) {
fprintf(stderr, "Failed to copy Y from the GPU\n");
}
for(i=0; i<N; i++) {
printf("%d: %f\n", i, cpu_y[i]);
}
cudaFree(gpu_x);
cudaFree(gpu_y);
free(cpu_x);
free(cpu_y);
return 0;
}
|
8,596 | /******************************************************************
File : lcsInitialCellLocationKernel.cu
Author : Mingcheng Chen
Last Update : January 29th, 2013
*******************************************************************/
#include <stdio.h>
#define BLOCK_SIZE 512
__device__ inline int Sign(double a, double epsilon) {
return a < -epsilon ? -1 : a > epsilon;
}
__device__ inline double DeterminantThree(double *a) {
// a[0] a[1] a[2]
// a[3] a[4] a[5]
// a[6] a[7] a[8]
return a[0] * a[4] * a[8] + a[1] * a[5] * a[6] + a[2] * a[3] * a[7] -
a[0] * a[5] * a[7] - a[1] * a[3] * a[8] - a[2] * a[4] * a[6];
}
__device__ inline bool Inside(double X, double Y, double Z, double *tetX, double *tetY, double *tetZ, double epsilon) {
X -= tetX[0];
Y -= tetY[0];
Z -= tetZ[0];
double det[9] = {tetX[1] - tetX[0], tetY[1] - tetY[0], tetZ[1] - tetZ[0],
tetX[2] - tetX[0], tetY[2] - tetY[0], tetZ[2] - tetZ[0],
tetX[3] - tetX[0], tetY[3] - tetY[0], tetZ[3] - tetZ[0]};
double V = 1 / DeterminantThree(det);
double z41 = tetZ[3] - tetZ[0];
double y34 = tetY[2] - tetY[3];
double z34 = tetZ[2] - tetZ[3];
double y41 = tetY[3] - tetY[0];
double a11 = (z41 * y34 - z34 * y41) * V;
double x41 = tetX[3] - tetX[0];
double x34 = tetX[2] - tetX[3];
double a12 = (x41 * z34 - x34 * z41) * V;
double a13 = (y41 * x34 - y34 * x41) * V;
double coordinate1 = a11 * X + a12 * Y + a13 * Z;
if (Sign(coordinate1, epsilon) < 0) return false;
double y12 = tetY[0] - tetY[1];
double z12 = tetZ[0] - tetZ[1];
double a21 = (z41 * y12 - z12 * y41) * V;
double x12 = tetX[0] - tetX[1];
double a22 = (x41 * z12 - x12 * z41) * V;
double a23 = (y41 * x12 - y12 * x41) * V;
double coordinate2 = a21 * X + a22 * Y + a23 * Z;
if (Sign(coordinate2, epsilon) < 0) return false;
double z23 = tetZ[1] - tetZ[2];
double y23 = tetY[1] - tetY[2];
double a31 = (z23 * y12 - z12 * y23) * V;
double x23 = tetX[1] - tetX[2];
double a32 = (x23 * z12 - x12 * z23) * V;
double a33 = (y23 * x12 - y12 * x23) * V;
double coordinate3 = a31 * X + a32 * Y + a33 * Z;
if (Sign(coordinate3, epsilon) < 0) return false;
double coordinate0 = 1 - coordinate1 - coordinate2 - coordinate3;
if (Sign(coordinate0, epsilon) < 0) return false;
return true;
}
__global__ void InitialCellLocationKernel(double *vertexPositions,
int *tetrahedralConnectivities,
int *cellLocations,
int xRes, int yRes, int zRes,
double minX, double minY, double minZ,
double dx, double dy, double dz,
double epsilon,
int numOfCells
) {
// Get global ID
int globalID = blockDim.x * blockIdx.x + threadIdx.x;
// Only use first "numOfCells" threads
if (globalID < numOfCells) {
int point1 = tetrahedralConnectivities[globalID << 2];
int point2 = tetrahedralConnectivities[(globalID << 2) + 1];
int point3 = tetrahedralConnectivities[(globalID << 2) + 2];
int point4 = tetrahedralConnectivities[(globalID << 2) + 3];
double tetX[4], tetY[4], tetZ[4];
tetX[0] = vertexPositions[point1 * 3];
tetY[0] = vertexPositions[point1 * 3 + 1];
tetZ[0] = vertexPositions[point1 * 3 + 2];
tetX[1] = vertexPositions[point2 * 3];
tetY[1] = vertexPositions[point2 * 3 + 1];
tetZ[1] = vertexPositions[point2 * 3 + 2];
tetX[2] = vertexPositions[point3 * 3];
tetY[2] = vertexPositions[point3 * 3 + 1];
tetZ[2] = vertexPositions[point3 * 3 + 2];
tetX[3] = vertexPositions[point4 * 3];
tetY[3] = vertexPositions[point4 * 3 + 1];
tetZ[3] = vertexPositions[point4 * 3 + 2];
double tetMinX = min(min(tetX[0], tetX[1]), min(tetX[2], tetX[3]));
double tetMaxX = max(max(tetX[0], tetX[1]), max(tetX[2], tetX[3]));
double tetMinY = min(min(tetY[0], tetY[1]), min(tetY[2], tetY[3]));
double tetMaxY = max(max(tetY[0], tetY[1]), max(tetY[2], tetY[3]));
double tetMinZ = min(min(tetZ[0], tetZ[1]), min(tetZ[2], tetZ[3]));
double tetMaxZ = max(max(tetZ[0], tetZ[1]), max(tetZ[2], tetZ[3]));
if (Sign(tetMaxX - minX, epsilon) < 0) return;
if (Sign(tetMaxY - minY, epsilon) < 0) return;
if (Sign(tetMaxZ - minZ, epsilon) < 0) return;
double maxX = minX + dx * xRes;
double maxY = minY + dy * yRes;
double maxZ = minZ + dz * zRes;
if (Sign(tetMinX - maxX, epsilon) > 0) return;
if (Sign(tetMinY - maxY, epsilon) > 0) return;
if (Sign(tetMinZ - maxZ, epsilon) > 0) return;
int xStart = 0, yStart = 0, zStart = 0;
if (tetMinX > minX) xStart = (int)((tetMinX - minX) / dx);
if (tetMinY > minY) yStart = (int)((tetMinY - minY) / dy);
if (tetMinZ > minZ) zStart = (int)((tetMinZ - minZ) / dz);
int xFinish = xRes, yFinish = yRes, zFinish = zRes;
if (tetMaxX < maxX) xFinish = min((int)((tetMaxX - minX) / dx) + 1, xRes);
if (tetMaxY < maxY) yFinish = min((int)((tetMaxY - minY) / dy) + 1, yRes);
if (tetMaxZ < maxZ) zFinish = min((int)((tetMaxZ - minZ) / dz) + 1, zRes);
int numOfCandidates = (xFinish - xStart + 1) * (yFinish - yStart + 1) * (zFinish - zStart + 1);
for (int i = 0; i < numOfCandidates; i++) {
int zIdx = i % (zFinish - zStart + 1) + zStart;
int temp = i / (zFinish - zStart + 1);
int yIdx = temp % (yFinish - yStart + 1) + yStart;
int xIdx = temp / (yFinish - yStart + 1) + xStart;
double X = minX + dx * xIdx;
double Y = minY + dy * yIdx;
double Z = minZ + dz * zIdx;
if (Inside(X, Y, Z, tetX, tetY, tetZ, epsilon)) {
int index = (xIdx * (yRes + 1) + yIdx) * (zRes + 1) + zIdx;
int oldValue = atomicAdd(cellLocations + index, globalID + 1);
if (oldValue != -1) atomicAdd(cellLocations + index, -globalID - 1);
}
}
}
}
extern "C"
void InitialCellLocation(double *vertexPositions,
int *tetrahedralConnectivities,
int *cellLocations,
int xRes, int yRes, int zRes,
double minX, double minY, double minZ,
double dx, double dy, double dz,
double epsilon,
int numOfCells) {
dim3 dimBlock(BLOCK_SIZE, 1, 1);
dim3 dimGrid((numOfCells - 1) / dimBlock.x + 1, 1, 1);
InitialCellLocationKernel<<<dimGrid, dimBlock>>>(vertexPositions, tetrahedralConnectivities, cellLocations,
xRes, yRes, zRes, minX, minY, minZ, dx, dy, dz,
epsilon, numOfCells);
cudaError_t err = cudaDeviceSynchronize();
if (err) {
cudaGetErrorString(err);
exit(0);
}
}
|
8,597 | #include "includes.h"
__global__ void fix_nan_and_inf_kernel(float *input, size_t size)
{
const int index = blockIdx.x*blockDim.x + threadIdx.x;
if (index < size) {
float val = input[index];
if (isnan(val) || isinf(val))
input[index] = index; // pseudo random value
}
} |
8,598 | #include "includes.h"
__global__ void Mask_Union_Kernel( int* A, int* B, int* devOut)
{
const int idx = blockDim.x*blockIdx.x + threadIdx.x;
if( A[idx] + B[idx] > 0)
devOut[idx] = 1;
else
devOut[idx] = 0;
} |
8,599 | /*
@modifier : Nilanka Manoj
@compile : nvcc vecadd.cu -o build/vecadd
@run : ./build/vecadd <<n>>
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <cuda.h>
double *a, *b;
double *c, *c2;
__global__ void vecAdd(double *A, double *B, double *C, int N)
{
int i = blockIdx.x * blockDim.x + threadIdx.x;
C[i] = A[i] + B[i];
}
void vecAdd_h(double *A1, double *B1, double *C1, double N)
{
for (int i = 0; i < N; i++)
C1[i] = A1[i] + B1[i];
}
int main(int argc, char **argv)
{
if (argc == 2)
{
printf("=====================round strating==========================\n");
int n = atoi(argv[1]);
int nBytes = n * sizeof(double);
int block_size, block_no;
a = (double *)malloc(nBytes);
b = (double *)malloc(nBytes);
c = (double *)malloc(nBytes);
c2 = (double *)malloc(nBytes);
double *a_d, *b_d, *c_d;
block_size = 768;
block_no = (int)ceil(n / block_size) + 1;
for (int i = 0; i < n; i++)
{
a[i] = sin(i) * sin(i);
b[i] = cos(i) * cos(i);
c[i] = 0;
c2[i] = 0;
}
printf("Allocating device memory on host..\n");
cudaMalloc((void **)&a_d, n * sizeof(double));
cudaMalloc((void **)&b_d, n * sizeof(double));
cudaMalloc((void **)&c_d, n * sizeof(double));
printf("Copying to device..\n");
cudaMemcpy(a_d, a, n * sizeof(double), cudaMemcpyHostToDevice);
cudaMemcpy(b_d, b, n * sizeof(double), cudaMemcpyHostToDevice);
cudaMemcpy(c_d, c, n * sizeof(double), cudaMemcpyHostToDevice);
printf("Doing GPU Vector add\n");
clock_t start_d = clock();
vecAdd<<<block_no, block_size>>>(a_d, b_d, c_d, n);
cudaThreadSynchronize();
clock_t end_d = clock();
printf("Doing CPU Vector add\n");
clock_t start_h = clock();
vecAdd_h(a, b, c2, n);
clock_t end_h = clock();
double time_d = (double)(end_d - start_d) / CLOCKS_PER_SEC;
double time_h = (double)(end_h - start_h) / CLOCKS_PER_SEC;
cudaMemcpy(c, c_d, n * sizeof(double), cudaMemcpyDeviceToHost);
printf("Number of elements: %d GPU Time: %f CPU Time: %f\n", n, time_d, time_h);
cudaFree(a_d);
cudaFree(b_d);
cudaFree(c_d);
int e = memcmp(c, c2, n);
printf("compaired error : %d\n", e);
}
else
{
printf("invalid arguments\n");
}
return 0;
} |
8,600 | /*
Compile and profile
nvcc checkTransferMatMul.cu -o checkTransferMatMul
If you have problems with gcc version try
sudo ln -s /usr/bin/gcc-4.9 /usr/local/cuda-7.5/bin/gcc
Profile console
nvprof ./checkTransferMatMul
*/
#include <stdio.h>
int main(int argc, char *argv[])
{
unsigned int BytesToSend=60;
unsigned int BytesToReceive=24;
if (argc > 2) {
BytesToSend = atoi(argv[1]);
BytesToReceive = atoi(argv[2]);
}
printf("Checking GPU transfer...\n");
printf("Sending %d bytes\n",BytesToSend);
printf("Sending %d bytes\n",BytesToReceive);
// Alocate memory on CPU
char *hostArray= (char*)malloc(BytesToSend);
char *deviceArray;
// Allocate memory on GPU
cudaMalloc((char**)&deviceArray,BytesToSend);
memset(hostArray,0,BytesToSend);
// Transfer hostArray from CPU to GPU
cudaMemcpy(deviceArray,hostArray,BytesToSend,cudaMemcpyHostToDevice);
// Get hostArray from GPU to CPU
cudaMemcpy(hostArray,deviceArray,BytesToReceive,cudaMemcpyDeviceToHost);
// Release memory from GPU
cudaFree(deviceArray);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.