add numerical recipes library
This commit is contained in:
22
lib/nr/k_and_r/recipes/rstrct.c
Normal file
22
lib/nr/k_and_r/recipes/rstrct.c
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
void rstrct(uc,uf,nc)
|
||||
double **uc,**uf;
|
||||
int nc;
|
||||
{
|
||||
int ic,iif,jc,jf,ncc=2*nc-1;
|
||||
|
||||
for (jf=3,jc=2;jc<nc;jc++,jf+=2) {
|
||||
for (iif=3,ic=2;ic<nc;ic++,iif+=2) {
|
||||
uc[ic][jc]=0.5*uf[iif][jf]+0.125*(uf[iif+1][jf]+uf[iif-1][jf]
|
||||
+uf[iif][jf+1]+uf[iif][jf-1]);
|
||||
}
|
||||
}
|
||||
for (jc=1,ic=1;ic<=nc;ic++,jc+=2) {
|
||||
uc[ic][1]=uf[jc][1];
|
||||
uc[ic][nc]=uf[jc][ncc];
|
||||
}
|
||||
for (jc=1,ic=1;ic<=nc;ic++,jc+=2) {
|
||||
uc[1][ic]=uf[1][jc];
|
||||
uc[nc][ic]=uf[ncc][jc];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user