/[escript]/trunk/paso/src/mmio.h
ViewVC logotype

Annotation of /trunk/paso/src/mmio.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 757 - (hide annotations)
Mon Jun 26 13:12:56 2006 UTC (13 years, 4 months ago) by woo409
File MIME type: text/plain
File size: 5043 byte(s)
+ Merge of intelc_win32 branch (revision 741:755) with trunk. Tested on iVEC altix (run_tests and py_tests all pass)

1 jgs 82 /* $Id$ */
2    
3     /*
4 dhawcroft 631 ********************************************************************************
5 dhawcroft 633 * Copyright 2006 by ACcESS MNRF *
6 dhawcroft 631 * *
7     * http://www.access.edu.au *
8     * Primary Business: Queensland, Australia *
9     * Licensed under the Open Software License version 3.0 *
10     * http://www.opensource.org/licenses/osl-3.0.php *
11     ********************************************************************************
12     */
13    
14     /*
15 jgs 82 * Matrix Market I/O library for ANSI C
16     *
17     * See http://math.nist.gov/MatrixMarket for details.
18     *
19     */
20    
21     #ifndef MM_IO_H
22     #define MM_IO_H
23    
24 woo409 757 #include <stdio.h>
25 jgs 82
26     #define MM_MAX_LINE_LENGTH 1025
27     #define MatrixMarketBanner "%%MatrixMarket"
28     #define MM_MAX_TOKEN_LENGTH 64
29    
30     typedef char MM_typecode[4];
31    
32     char *mm_typecode_to_str(MM_typecode matcode);
33    
34     int mm_read_banner(FILE *f, MM_typecode *matcode);
35     int mm_read_mtx_crd_size(FILE *f, int *M, int *N, int *nz);
36     int mm_read_mtx_array_size(FILE *f, int *M, int *N);
37    
38     int mm_write_banner(FILE *f, MM_typecode matcode);
39     int mm_write_mtx_crd_size(FILE *f, int M, int N, int nz);
40     int mm_write_mtx_array_size(FILE *f, int M, int N);
41    
42    
43     /********************* MM_typecode query fucntions ***************************/
44    
45     #define mm_is_matrix(typecode) ((typecode)[0]=='M')
46    
47     #define mm_is_sparse(typecode) ((typecode)[1]=='C')
48     #define mm_is_coordinate(typecode)((typecode)[1]=='C')
49     #define mm_is_dense(typecode) ((typecode)[1]=='A')
50     #define mm_is_array(typecode) ((typecode)[1]=='A')
51    
52     #define mm_is_complex(typecode) ((typecode)[2]=='C')
53     #define mm_is_real(typecode) ((typecode)[2]=='R')
54     #define mm_is_pattern(typecode) ((typecode)[2]=='P')
55     #define mm_is_integer(typecode) ((typecode)[2]=='I')
56    
57     #define mm_is_symmetric(typecode)((typecode)[3]=='S')
58     #define mm_is_general(typecode) ((typecode)[3]=='G')
59     #define mm_is_skew(typecode) ((typecode)[3]=='K')
60     #define mm_is_hermitian(typecode)((typecode)[3]=='H')
61    
62     int mm_is_valid(MM_typecode matcode); /* too complex for a macro */
63    
64    
65     /********************* MM_typecode modify fucntions ***************************/
66    
67     #define mm_set_matrix(typecode) ((*typecode)[0]='M')
68     #define mm_set_coordinate(typecode) ((*typecode)[1]='C')
69     #define mm_set_array(typecode) ((*typecode)[1]='A')
70     #define mm_set_dense(typecode) mm_set_array(typecode)
71     #define mm_set_sparse(typecode) mm_set_coordinate(typecode)
72    
73     #define mm_set_complex(typecode)((*typecode)[2]='C')
74     #define mm_set_real(typecode) ((*typecode)[2]='R')
75     #define mm_set_pattern(typecode)((*typecode)[2]='P')
76     #define mm_set_integer(typecode)((*typecode)[2]='I')
77    
78    
79     #define mm_set_symmetric(typecode)((*typecode)[3]='S')
80     #define mm_set_general(typecode)((*typecode)[3]='G')
81     #define mm_set_skew(typecode) ((*typecode)[3]='K')
82     #define mm_set_hermitian(typecode)((*typecode)[3]='H')
83    
84     #define mm_clear_typecode(typecode) ((*typecode)[0]=(*typecode)[1]= \
85     (*typecode)[2]=' ',(*typecode)[3]='G')
86    
87     #define mm_initialize_typecode(typecode) mm_clear_typecode(typecode)
88    
89    
90     /********************* Matrix Market error codes ***************************/
91    
92    
93     #define MM_COULD_NOT_READ_FILE 11
94     #define MM_PREMATURE_EOF 12
95     #define MM_NOT_MTX 13
96     #define MM_NO_HEADER 14
97     #define MM_UNSUPPORTED_TYPE 15
98     #define MM_LINE_TOO_LONG 16
99     #define MM_COULD_NOT_WRITE_FILE 17
100    
101    
102     /******************** Matrix Market internal definitions ********************
103    
104     MM_matrix_typecode: 4-character sequence
105    
106     ojbect sparse/ data storage
107     dense type scheme
108    
109     string position: [0] [1] [2] [3]
110    
111     Matrix typecode: M(atrix) C(oord) R(eal) G(eneral)
112     A(array) C(omplex) H(ermitian)
113     P(attern) S(ymmetric)
114     I(nteger) K(kew)
115    
116     ***********************************************************************/
117    
118     #define MM_MTX_STR "matrix"
119     #define MM_ARRAY_STR "array"
120     #define MM_DENSE_STR "array"
121     #define MM_COORDINATE_STR "coordinate"
122     #define MM_SPARSE_STR "coordinate"
123     #define MM_COMPLEX_STR "complex"
124     #define MM_REAL_STR "real"
125     #define MM_INT_STR "integer"
126     #define MM_GENERAL_STR "general"
127     #define MM_SYMM_STR "symmetric"
128     #define MM_HERM_STR "hermitian"
129     #define MM_SKEW_STR "skew-symmetric"
130     #define MM_PATTERN_STR "pattern"
131    
132    
133     /* high level routines */
134    
135 woo409 757 int mm_write_mtx_crd(char fname[], int M, int N, int nz, int i[], int j[],
136 jgs 82 double val[], MM_typecode matcode);
137 woo409 757 int mm_read_mtx_crd_data(FILE *f, int M, int N, int nz, int i[], int j[],
138 jgs 82 double val[], MM_typecode matcode);
139 woo409 757 int mm_read_mtx_crd_entry(FILE *f, int *i, int *j, double *real, double *img,
140 jgs 82 MM_typecode matcode);
141    
142     int mm_read_unsymmetric_sparse(const char *fname, int *M_, int *N_, int *nz_,
143     double **val_, int **I_, int **J_);
144    
145     #endif
146    
147     /*
148     * $Log$
149     * Revision 1.1 2004/10/26 06:53:59 jgs
150     * Initial revision
151     *
152     * Revision 1.1 2004/07/02 00:48:35 gross
153     * matrix market io function added
154     *
155     *
156     */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26