add numerical recipes library
This commit is contained in:
17
lib/nr/k_and_r/recipes/sprstx.c
Normal file
17
lib/nr/k_and_r/recipes/sprstx.c
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
void sprstx(sa,ija,x,b,n)
|
||||
float b[],sa[],x[];
|
||||
unsigned long ija[],n;
|
||||
{
|
||||
void nrerror();
|
||||
unsigned long i,j,k;
|
||||
|
||||
if (ija[1] != n+2) nrerror("mismatched vector and matrix in sprstx");
|
||||
for (i=1;i<=n;i++) b[i]=sa[i]*x[i];
|
||||
for (i=1;i<=n;i++) {
|
||||
for (k=ija[i];k<=ija[i+1]-1;k++) {
|
||||
j=ija[k];
|
||||
b[j] += sa[k]*x[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user