add numerical recipes library
This commit is contained in:
17
lib/nr/k_and_r/recipes/lop.c
Normal file
17
lib/nr/k_and_r/recipes/lop.c
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
void lop(out,u,n)
|
||||
double **out,**u;
|
||||
int n;
|
||||
{
|
||||
int i,j;
|
||||
double h,h2i;
|
||||
|
||||
h=1.0/(n-1);
|
||||
h2i=1.0/(h*h);
|
||||
for (j=2;j<n;j++)
|
||||
for (i=2;i<n;i++)
|
||||
out[i][j]=h2i*(u[i+1][j]+u[i-1][j]+u[i][j+1]+u[i][j-1]-
|
||||
4.0*u[i][j])+u[i][j]*u[i][j];
|
||||
for (i=1;i<=n;i++)
|
||||
out[i][1]=out[i][n]=out[1][i]=out[n][i]=0.0;
|
||||
}
|
||||
Reference in New Issue
Block a user