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