/* $Id: shoot_optimN.c 6097 2014-07-10 18:51:05Z guillaume $ */ /* (c) John Ashburner (2007) */ #include #include extern double log(double x); #define MAXD3 128 #include "shoot_boundary.h" #include "shoot_multiscale.h" static void choldc(int n, double a[], double p[]) { int i, j, k; double sm, sm0; sm0 = 1e-16; for(i=0; i=0; k--) sm -= a[i*n+k] * a[j*n+k]; if(i==j) { if(sm <= sm0) sm = sm0; p[i] = sqrt(sm); } else a[j*n+i] = sm / p[i]; } } } static void cholls(int n, double a[], double p[], double b[], double x[]) { int i, k; double sm; for(i=0; i=0; k--) sm -= a[i*n+k]*x[k]; x[i] = sm/p[i]; } for(i=n-1; i>=0; i--) { sm = x[i]; for(k=i+1; k=0; j--) { int jc; prolong(n0[3],n[j+1],u[j+1],n[j],u[j],rbuf); if(j>0) copy(n0[3]*m[j],bo[j],b[j]); for(jc=0; jc=j; jj--) { prolong(n0[3],n[jj+1],u[jj+1],n[jj],res,rbuf); addto(n0[3]*m[jj], u[jj], res); relax(n[jj], a[jj], b[jj], param[jj], scal, nit, u[jj]); } } } /* printf("end=%g\n", sumsq(n0, a0, b0, param[0], scal, u0)); */ }