Skip to content

Commit 9e41836

Browse files
committed
Added SRC/_readMM.c - read Matrix Market format
1 parent 9e23fe7 commit 9e41836

File tree

12 files changed

+42
-31
lines changed

12 files changed

+42
-31
lines changed

EXAMPLE/pclinsol.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ at the top-level directory.
1616
* September 10, 2007
1717
*
1818
*/
19+
#include <unistd.h>
1920
#include "slu_mt_cdefs.h"
2021

21-
#include <unistd.h>
22-
23-
int
24-
main(int argc, char *argv[])
22+
int main(int argc, char *argv[])
2523
{
2624
SuperMatrix A;
2725
NCformat *Astore;
@@ -41,8 +39,7 @@ main(int argc, char *argv[])
4139
trans_t trans;
4240
complex *xact, *rhs;
4341
superlu_memusage_t superlu_memusage;
44-
void parse_command_line(int argc, char *argv[], int_t *procs,
45-
int_t *n, int_t *b, int_t *w, int_t *r, int_t *maxsup);
42+
void parse_command_line();
4643

4744
nrhs = 1;
4845
trans = NOTRANS;
@@ -61,7 +58,8 @@ main(int argc, char *argv[])
6158
printf("int_t %d bytes\n", sizeof(int_t));
6259
#endif
6360

64-
#define HB
61+
#undef HB
62+
6563
#if defined( DEN )
6664
m = n;
6765
nnz = n * n;
@@ -78,8 +76,8 @@ main(int argc, char *argv[])
7876
cblockdiag(nb, bs, nnz, &a, &asub, &xa);
7977
#elif defined( HB )
8078
creadhb(&m, &n, &nnz, &a, &asub, &xa);
81-
#else
82-
creadmt(&m, &n, &nnz, &a, &asub, &xa);
79+
#else
80+
creadMM(&m, &n, &nnz, &a, &asub, &xa);
8381
#endif
8482

8583
cCreate_CompCol_Matrix(&A, m, n, nnz, a, asub, xa, SLU_NC, SLU_C, SLU_GE);

EXAMPLE/pdlinsol.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ at the top-level directory.
1616
* September 10, 2007
1717
*
1818
*/
19+
#include <unistd.h>
1920
#include "slu_mt_ddefs.h"
2021

21-
#include <unistd.h>
22-
23-
int
24-
main(int argc, char *argv[])
22+
int main(int argc, char *argv[])
2523
{
2624
SuperMatrix A;
2725
NCformat *Astore;
@@ -41,8 +39,7 @@ main(int argc, char *argv[])
4139
trans_t trans;
4240
double *xact, *rhs;
4341
superlu_memusage_t superlu_memusage;
44-
void parse_command_line(int argc, char *argv[], int_t *procs, int_t *n,
45-
int_t *b, int_t *w, int_t *r, int_t *maxsup);
42+
void parse_command_line();
4643

4744
nrhs = 1;
4845
trans = NOTRANS;
@@ -61,7 +58,8 @@ main(int argc, char *argv[])
6158
printf("int_t %d bytes\n", sizeof(int_t));
6259
#endif
6360

64-
#define HB
61+
#undef HB
62+
6563
#if defined( DEN )
6664
m = n;
6765
nnz = n * n;
@@ -78,8 +76,8 @@ main(int argc, char *argv[])
7876
dblockdiag(nb, bs, nnz, &a, &asub, &xa);
7977
#elif defined( HB )
8078
dreadhb(&m, &n, &nnz, &a, &asub, &xa);
81-
#else
82-
dreadmt(&m, &n, &nnz, &a, &asub, &xa);
79+
#else
80+
dreadMM(&m, &n, &nnz, &a, &asub, &xa);
8381
#endif
8482

8583
dCreate_CompCol_Matrix(&A, m, n, nnz, a, asub, xa, SLU_NC, SLU_D, SLU_GE);

EXAMPLE/pslinsol.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ at the top-level directory.
1616
* September 10, 2007
1717
*
1818
*/
19+
#include <unistd.h>
1920
#include "slu_mt_sdefs.h"
2021

21-
#include <unistd.h>
22-
23-
int
24-
main(int argc, char *argv[])
22+
int main(int argc, char *argv[])
2523
{
2624
SuperMatrix A;
2725
NCformat *Astore;
@@ -41,8 +39,7 @@ main(int argc, char *argv[])
4139
trans_t trans;
4240
float *xact, *rhs;
4341
superlu_memusage_t superlu_memusage;
44-
void parse_command_line(int argc, char *argv[], int_t *procs, int_t *n,
45-
int_t *b, int_t *w, int_t *r, int_t *maxsup);
42+
void parse_command_line();
4643

4744
nrhs = 1;
4845
trans = NOTRANS;
@@ -61,7 +58,8 @@ main(int argc, char *argv[])
6158
printf("int_t %d bytes\n", sizeof(int_t));
6259
#endif
6360

64-
#define HB
61+
#undef HB
62+
6563
#if defined( DEN )
6664
m = n;
6765
nnz = n * n;
@@ -78,8 +76,8 @@ main(int argc, char *argv[])
7876
sblockdiag(nb, bs, nnz, &a, &asub, &xa);
7977
#elif defined( HB )
8078
sreadhb(&m, &n, &nnz, &a, &asub, &xa);
81-
#else
82-
sreadmt(&m, &n, &nnz, &a, &asub, &xa);
79+
#else
80+
sreadMM(&m, &n, &nnz, &a, &asub, &xa);
8381
#endif
8482

8583
sCreate_CompCol_Matrix(&A, m, n, nnz, a, asub, xa, SLU_NC, SLU_S, SLU_GE);

SRC/pcmemory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ cPresetMap(
869869
int_t *map_in_sup; /* memory mapping function; values irrelevant on entry. */
870870
int_t *colcnt; /* column count of Lc or H */
871871
int_t *super_bnd; /* supernodes partition in H */
872-
char *snode_env, *getenv();
872+
char *snode_env;
873873

874874
snode_env = getenv("SuperLU_DYNAMIC_SNODE_STORE");
875875
if ( snode_env != NULL ) {

SRC/pdmemory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ dPresetMap(
869869
int_t *map_in_sup; /* memory mapping function; values irrelevant on entry. */
870870
int_t *colcnt; /* column count of Lc or H */
871871
int_t *super_bnd; /* supernodes partition in H */
872-
char *snode_env, *getenv();
872+
char *snode_env;
873873

874874
snode_env = getenv("SuperLU_DYNAMIC_SNODE_STORE");
875875
if ( snode_env != NULL ) {

SRC/pmemory.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ user_bcopy(char *src, char *dest, int_t bytes)
6666
}
6767

6868

69+
int *int32Malloc(int n)
70+
{
71+
int *buf;
72+
buf = (int *) SUPERLU_MALLOC((size_t) n * sizeof(int));
73+
if ( !buf ) {
74+
SUPERLU_ABORT("SUPERLU_MALLOC fails for buf in int32Malloc()");
75+
}
76+
return (buf);
77+
}
6978

7079
int_t *intMalloc(int_t n)
7180
{

SRC/psmemory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ sPresetMap(
869869
int_t *map_in_sup; /* memory mapping function; values irrelevant on entry. */
870870
int_t *colcnt; /* column count of Lc or H */
871871
int_t *super_bnd; /* supernodes partition in H */
872-
char *snode_env, *getenv();
872+
char *snode_env;
873873

874874
snode_env = getenv("SuperLU_DYNAMIC_SNODE_STORE");
875875
if ( snode_env != NULL ) {

SRC/pzmemory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ zPresetMap(
869869
int_t *map_in_sup; /* memory mapping function; values irrelevant on entry. */
870870
int_t *colcnt; /* column count of Lc or H */
871871
int_t *super_bnd; /* supernodes partition in H */
872-
char *snode_env, *getenv();
872+
char *snode_env;
873873

874874
snode_env = getenv("SuperLU_DYNAMIC_SNODE_STORE");
875875
if ( snode_env != NULL ) {

SRC/slu_mt_cdefs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ extern void compressSUP (const int_t, GlobalLU_t *);
417417
extern int_t *TreePostorder (int_t, int_t *);
418418
extern void creadmt (int_t *, int_t *, int_t *, complex **, int_t **, int_t **);
419419
extern void creadhb (int_t *, int_t *, int_t *, complex **, int_t **, int_t **);
420+
extern void creadMM (int *m, int *n, int_t *nonz, complex **nzval, int_t **rowind, int_t **colptr);
420421
extern void cGenXtrue (int_t, int_t, complex *, int_t);
421422
extern void cFillRHS (trans_t, int_t, complex *, int_t,
422423
SuperMatrix *, SuperMatrix *);
@@ -453,6 +454,7 @@ extern void pcgstrf_SetRWork (int_t, int_t, complex *, complex **, complex **);
453454
extern void pcgstrf_WorkFree (int_t *, complex *, GlobalLU_t *);
454455
extern int_t pcgstrf_MemXpand (int_t, int_t, MemType, int_t *, GlobalLU_t *);
455456

457+
extern int *int32Malloc(int);
456458
extern int_t *intMalloc (int_t);
457459
extern int_t *intCalloc (int_t);
458460
extern complex *complexMalloc(int_t);

SRC/slu_mt_ddefs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ extern void compressSUP (const int_t, GlobalLU_t *);
416416
extern int_t *TreePostorder (int_t, int_t *);
417417
extern void dreadmt (int_t *, int_t *, int_t *, double **, int_t **, int_t **);
418418
extern void dreadhb (int_t *, int_t *, int_t *, double **, int_t **, int_t **);
419+
extern void dreadMM (int *m, int *n, int_t *nonz, double **nzval, int_t **rowind, int_t **colptr);
419420
extern void dGenXtrue (int_t, int_t, double *, int_t);
420421
extern void dFillRHS (trans_t, int_t, double *, int_t,
421422
SuperMatrix *, SuperMatrix *);
@@ -452,6 +453,7 @@ extern void pdgstrf_SetRWork (int_t, int_t, double *, double **, double **);
452453
extern void pdgstrf_WorkFree (int_t *, double *, GlobalLU_t *);
453454
extern int_t pdgstrf_MemXpand (int_t, int_t, MemType, int_t *, GlobalLU_t *);
454455

456+
extern int *int32Malloc(int);
455457
extern int_t *intMalloc (int_t);
456458
extern int_t *intCalloc (int_t);
457459
extern double *doubleMalloc(int_t);

0 commit comments

Comments
 (0)