add numerical recipes library
This commit is contained in:
22
lib/nr/ansi/recipes/mprove.c
Normal file
22
lib/nr/ansi/recipes/mprove.c
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
#define NRANSI
|
||||
#include "nrutil.h"
|
||||
|
||||
void mprove(float **a, float **alud, int n, int indx[], float b[], float x[])
|
||||
{
|
||||
void lubksb(float **a, int n, int *indx, float b[]);
|
||||
int j,i;
|
||||
double sdp;
|
||||
float *r;
|
||||
|
||||
r=vector(1,n);
|
||||
for (i=1;i<=n;i++) {
|
||||
sdp = -b[i];
|
||||
for (j=1;j<=n;j++) sdp += a[i][j]*x[j];
|
||||
r[i]=sdp;
|
||||
}
|
||||
lubksb(alud,n,indx,r);
|
||||
for (i=1;i<=n;i++) x[i] -= r[i];
|
||||
free_vector(r,1,n);
|
||||
}
|
||||
#undef NRANSI
|
||||
Reference in New Issue
Block a user