]> AND Private Git Repository - book_gpu.git/blobdiff - BookGPU/Chapters/chapter11/code1.cu
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
add ch16
[book_gpu.git] / BookGPU / Chapters / chapter11 / code1.cu
index 4f2316e9b1a91fa29b93bc248f6953bb645e5513..5598fcc42e1e2d571e72e09ca31fda5e54133e47 100644 (file)
@@ -24,12 +24,13 @@ __global__ void CalculateCoefficientsKnots( Tx *u, Ty *v, double *b, double *c,
       else
         h[s+1]=0.5*(u[tid+1] + u[tid]);
       //calculate coefficients
       else
         h[s+1]=0.5*(u[tid+1] + u[tid]);
       //calculate coefficients
-      double dtemp = (2*b[tid] - c[tid+1])+((c[tid+1] - c[tid])*(h[s+1] - u[tid]))/fmax(1e-10,(u[tid+1] - u[tid]));
+      double dtemp = (2*b[tid] - c[tid+1])+((c[tid+1] - c[tid])*
+              (h[s+1] - u[tid]))/ fmax(1e-10,(u[tid+1] - u[tid]));
       alpha[s]=v[tid];   beta[s]=c[tid];
       gamma[s]=(dtemp - c[tid])/(2*fmax(1e-10,(h[s+1] - u[tid])));
       alpha[s+1]=v[tid] + c[tid]*(h[s+1] - u[tid]) +
                 (dtemp - c[tid])*(h[s+1] - u[tid])/2;
       alpha[s]=v[tid];   beta[s]=c[tid];
       gamma[s]=(dtemp - c[tid])/(2*fmax(1e-10,(h[s+1] - u[tid])));
       alpha[s+1]=v[tid] + c[tid]*(h[s+1] - u[tid]) +
                 (dtemp - c[tid])*(h[s+1] - u[tid])/2;
-      gamma[s+1]=(c[tid+1] - dtemp)/(2*fmax(1e-10,(u[tid+1] - h[s+1])));
+      gamma[s+1]=(c[tid+1]-dtemp)/(2*fmax(1e-10,(u[tid+1]-h[s+1])));
       beta[s+1]=dtemp;
     }
     tid += blockDim.x * gridDim.x;   s = tid*2;
       beta[s+1]=dtemp;
     }
     tid += blockDim.x * gridDim.x;   s = tid*2;