add numerical recipes library
This commit is contained in:
18
lib/nr/cpp/recipes/mprove.cpp
Normal file
18
lib/nr/cpp/recipes/mprove.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "nr.h"
|
||||
|
||||
void NR::mprove(Mat_I_DP &a, Mat_I_DP &alud, Vec_I_INT &indx, Vec_I_DP &b,
|
||||
Vec_IO_DP &x)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
int n=x.size();
|
||||
Vec_DP r(n);
|
||||
for (i=0;i<n;i++) {
|
||||
long double sdp = -b[i];
|
||||
for (j=0;j<n;j++)
|
||||
sdp += (long double) a[i][j]*(long double) x[j];
|
||||
r[i]=sdp;
|
||||
}
|
||||
lubksb(alud,indx,r);
|
||||
for (i=0;i<n;i++) x[i] -= r[i];
|
||||
}
|
||||
Reference in New Issue
Block a user