public static void  sprsin(double [][]  a,  double  thresh, double [] sa, double []ija) throws NRException
{
    int i, j, k;

    int n = a.length;
    int nmax = sa.length;
    for (j=0; j<n; j++)  sa[j] = a[j][j];
    ija[0]=n+1;
    k=n;
    for (i=0;i<n;i++) {
        for (j=0;j<n;j++) {
            if (Math.abs(a[i][j]) >= thresh && i != j) {
	if (++k > nmax)  throw new NRException("sprsin: sa and ija too small");
	sa[k]=a[i][j];
	ija[k]=j;
	}
        }
    ija[i+1] = k+1;
	}
 }