Newer
Older
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
40
41
42
43
44
45
46
47
48
49
#include "SparseMatrix.h"
int main(int argc, char **argv) {
long m, n, nz, t, i, j ;
struct sparsematrix A ;
printf("Test MMSparseMatrixFreeMemory: ");
MMSparseMatrixInit(&A) ;
m = 2400 ;
n = 1700 ;
nz = 1000 ;
A.m = m ;
A.n = n ;
A.NrNzElts = nz ;
A.NrRowWeights = m ;
A.NrColWeights = n ;
A.MMTypeCode[2] = 'C' ; /* complex matrix */
A.MMTypeCode[0] = 'W' ; /* weighted matrix, we do not test
a distributed matrix */
MMSparseMatrixAllocateMemory(&A) ;
if ( A.i == NULL || A.j == NULL ||
A.ReValue == NULL || A.ImValue == NULL ||
A.RowWeights == NULL || A.ColWeights == NULL){
printf("Error\n") ;
exit(1);
}
for (t=0; t<nz; t++){
A.i[t] = t ;
A.j[t] = t ;
A.ReValue[t] = t ;
A.ImValue[t] = t ;
}
for (i=0 ; i<m ; i++)
A.RowWeights[i] = 1;
for (j=0 ; j<n ; j++)
A.ColWeights[j] = 1;
MMSparseMatrixFreeMemory(&A) ;
printf("OK\n") ;
exit(0);
} /* end main */