add numerical recipes library

This commit is contained in:
2025-09-12 18:55:25 +09:00
parent d4dff245bd
commit 2c75620ec9
1344 changed files with 63869 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
#include <math.h>
void sprsin(float **a, int n, float thresh, unsigned long nmax, float sa[],
unsigned long ija[])
{
void nrerror(char error_text[]);
int i,j;
unsigned long k;
for (j=1;j<=n;j++) sa[j]=a[j][j];
ija[1]=n+2;
k=n+1;
for (i=1;i<=n;i++) {
for (j=1;j<=n;j++) {
if (fabs(a[i][j]) >= thresh && i != j) {
if (++k > nmax) nrerror("sprsin: nmax too small");
sa[k]=a[i][j];
ija[k]=j;
}
}
ija[i+1]=k+1;
}
}