add numerical recipes library
This commit is contained in:
24
lib/nr/k_and_r/recipes/fred2.c
Normal file
24
lib/nr/k_and_r/recipes/fred2.c
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#include "nrutil.h"
|
||||
|
||||
void fred2(n,a,b,t,f,w,g,ak)
|
||||
float (*ak)(),(*g)(),a,b,f[],t[],w[];
|
||||
int n;
|
||||
{
|
||||
void gauleg(),lubksb(),ludcmp();
|
||||
int i,j,*indx;
|
||||
float d,**omk;
|
||||
|
||||
indx=ivector(1,n);
|
||||
omk=matrix(1,n,1,n);
|
||||
gauleg(a,b,t,w,n);
|
||||
for (i=1;i<=n;i++) {
|
||||
for (j=1;j<=n;j++)
|
||||
omk[i][j]=(float)(i == j)-(*ak)(t[i],t[j])*w[j];
|
||||
f[i]=(*g)(t[i]);
|
||||
}
|
||||
ludcmp(omk,n,indx,&d);
|
||||
lubksb(omk,n,indx,f);
|
||||
free_matrix(omk,1,n,1,n);
|
||||
free_ivector(indx,1,n);
|
||||
}
|
||||
Reference in New Issue
Block a user