EVSL
1.1.0
EigenValues Slicing Library
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
EXTERNAL
CXSparse
Source
cs_load.c
Go to the documentation of this file.
1
#include "
cs.h
"
2
/* load a triplet matrix from a file */
3
cs
*
cs_load
(FILE *f)
4
{
5
double
i, j ;
/* use double for integers to avoid csi conflicts */
6
double
x ;
7
#ifdef CS_COMPLEX
8
double
xi ;
9
#endif
10
cs
*T ;
11
if
(!f)
return
(NULL) ;
/* check inputs */
12
T =
cs_spalloc
(0, 0, 1, 1, 1) ;
/* allocate result */
13
#ifdef CS_COMPLEX
14
while
(fscanf (f,
"%lg %lg %lg %lg\n"
, &i, &j, &x, &xi) == 4)
15
#else
16
while
(fscanf (f,
"%lg %lg %lg\n"
, &i, &j, &x) == 3)
17
#endif
18
{
19
#ifdef CS_COMPLEX
20
if
(!
cs_entry
(T, (
CS_INT
) i, (
CS_INT
) j, x + xi*I))
return
(
cs_spfree
(T)) ;
21
#else
22
if
(!
cs_entry
(T, (
CS_INT
) i, (
CS_INT
) j, x))
return
(
cs_spfree
(T)) ;
23
#endif
24
}
25
return
(T) ;
26
}
cs
#define cs
Definition:
cs.h:637
cs_spfree
cs * cs_spfree(cs *A)
Definition:
cs_util.c:33
cs_spalloc
cs * cs_spalloc(CS_INT m, CS_INT n, CS_INT nzmax, CS_INT values, CS_INT triplet)
Definition:
cs_util.c:3
cs.h
CS_INT
#define CS_INT
Definition:
cs.h:627
cs_load
cs * cs_load(FILE *f)
Definition:
cs_load.c:3
cs_entry
CS_INT cs_entry(cs *T, CS_INT i, CS_INT j, CS_ENTRY x)
Definition:
cs_entry.c:3
Generated by
1.8.6