/usr/share/doc/libsuperlu-dev/tests/sp_zconvert.c is in libsuperlu3-dev 3.0+20070106-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | /*
* -- SuperLU routine (version 2.0) --
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
* and Lawrence Berkeley National Lab.
* November 15, 1997
*
*/
#include "slu_zdefs.h"
/*
* Convert a full matrix into a sparse matrix format.
*/
int
sp_zconvert(int m, int n, doublecomplex *A, int lda, int kl, int ku,
doublecomplex *a, int *asub, int *xa, int *nnz)
{
int lasta = 0;
int i, j, ilow, ihigh;
int *row;
doublecomplex *val;
for (j = 0; j < n; ++j) {
xa[j] = lasta;
val = &a[xa[j]];
row = &asub[xa[j]];
ilow = SUPERLU_MAX(0, j - ku);
ihigh = SUPERLU_MIN(n-1, j + kl);
for (i = ilow; i <= ihigh; ++i) {
val[i-ilow] = A[i + j*lda];
row[i-ilow] = i;
}
lasta += ihigh - ilow + 1;
}
xa[n] = *nnz = lasta;
return 0;
}
|