Ifpack Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mat_dh_private.h
Go to the documentation of this file.
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack: Object-Oriented Algebraic Preconditioner Package
5 // Copyright (2002) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 */
42 
43 #ifndef MAT_DH_PRIVATE
44 #define MAT_DH_PRIVATE
45 
46 /* Functions called by Mat_dh, Factor_dh, and possibly others.
47  Also, a few handy functions for dealing with permutations,
48  etc.
49 
50  */
51 
52 #include "euclid_common.h"
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57 
58  extern int mat_find_owner (int *beg_rows, int *end_rows, int index);
59 
60  extern void mat_dh_transpose_private (int m, int *rpIN, int **rpOUT,
61  int *cvalIN, int **cvalOUT,
62  double *avalIN, double **avalOUT);
63 
64  /* same as above, but memory for output was already allocated */
65  extern void mat_dh_transpose_reuse_private (int m,
66  int *rpIN, int *cvalIN,
67  double *avalIN, int *rpOUT,
68  int *cvalOUT, double *avalOUT);
69 
70 /*-------------------------------------------------------------------------
71  * utility functions for reading and writing matrices in various formats.
72  * currently recognized filetypes (formats) are:
73  * trip
74  * csr
75  * the "ignore" parameter is only used for the matrix "trip" format,
76  * and the vector "csr" and "trip" formats (which are misnamed, and identical);
77  * the intention is to skip over the first "ignore" lines of the file;
78  * this is a hack to enable reading of Matrix Market, etc, formats.
79  *-------------------------------------------------------------------------*/
80  extern void readMat (Mat_dh * Aout, char *fileType, char *fileName,
81  int ignore);
82  extern void readVec (Vec_dh * bout, char *fileType, char *fileName,
83  int ignore);
84  extern void writeMat (Mat_dh Ain, char *fileType, char *fileName);
85  extern void writeVec (Vec_dh b, char *fileType, char *fileName);
86 
87 /* Next function is primarily (?) for testing/development/debugging.
88  P_0 reads and partitions the matrix, then distributes
89  amongst the other processors.
90 */
91  extern void readMat_par (Mat_dh * Aout, char *fileType, char *fileName,
92  int ignore);
93 
94  extern void profileMat (Mat_dh A);
95  /* writes structural and numerical symmetry and other info to stdout;
96  for a single mpi task only.
97  */
98 
99 
100 
101 /*-------------------------------------------------------------------------*
102  * functions called by public Mat_dh class methods.
103  *
104  * (following notes need to be updated!)
105  *
106  * m is number of local rows;
107  * beg_row is global number of 1st locally owned row;
108  * m, beg_row, rp, cval may not be null (caller's responsiblity);
109  * if n2o is NULL, it's assumed that o2n is NULL;
110  * if
111  *
112  * error thrown:
113  * if a nonlocal column (a column index that is less than beg_row,
114  * or >= beg_row+m), and can't be located in hash table.
115  *
116  * print_triples_private() and print_mat_private() are 1-based.
117  *
118  *-------------------------------------------------------------------------*/
119 
120 /* seq or mpi */
121  extern void mat_dh_print_graph_private (int m, int beg_row, int *rp,
122  int *cval, double *aval, int *n2o,
123  int *o2n, Hash_i_dh hash,
124  FILE * fp);
125 
126 
127 /* seq; reordering not implemented */
128 /* see io_dh.h
129  int *rp, int *cval, double *aval,
130  int *n2o, int *o2n, Hash_i_dh hash, char *filename);
131 */
132 
133 /* seq only */
134  extern void mat_dh_print_csr_private (int m, int *rp, int *cval,
135  double *aval, FILE * fp);
136 
137 
138 /* seq only */
139  extern void mat_dh_read_csr_private (int *m, int **rp, int **cval,
140  double **aval, FILE * fp);
141 
142 /* seq only */
143  extern void mat_dh_read_triples_private (int ignore, int *m, int **rp,
144  int **cval, double **aval,
145  FILE * fp);
146 
147 /* seq or mpi */
148 /* see io_dh.h
149  double **aval, char *filename);
150 */
151 
152 /*-------------------------------------------------------------------------*/
153 
154  extern void create_nat_ordering_private (int m, int **p);
155  extern void destroy_nat_ordering_private (int *p);
156  extern void invert_perm (int m, int *pIN, int *pOUT);
157 
158 
159  extern void make_full_private (int m, int **rp, int **cval, double **aval);
160  /* converts upper or lower triangular to full;
161  may bomb if input is not triangular!
162  */
163 
164  extern void make_symmetric_private (int m, int **rp, int **cval,
165  double **aval);
166  /* pads with zeros to make structurally symmetric. */
167 
168  extern void make_symmetric_private (int m, int **rp, int **cval,
169  double **aval);
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 #endif
Definition: Mat_dh.h:62
void destroy_nat_ordering_private(int *p)
void readVec(Vec_dh *bout, char *ft, char *fn, int ignore)
void mat_dh_read_csr_private(int *mOUT, int **rpOUT, int **cvalOUT, double **avalOUT, FILE *fp)
void mat_dh_print_csr_private(int m, int *rp, int *cval, double *aval, FILE *fp)
void make_symmetric_private(int m, int **rpIN, int **cvalIN, double **avalIN)
void make_full_private(int m, int **rpIN, int **cvalIN, double **avalIN)
void writeVec(Vec_dh bin, char *ft, char *fn)
void create_nat_ordering_private(int m, int **p)
int mat_find_owner(int *beg_rows, int *end_rows, int index)
void mat_dh_read_triples_private(int ignore, int *mOUT, int **rpOUT, int **cvalOUT, double **avalOUT, FILE *fp)
void invert_perm(int m, int *pIN, int *pOUT)
void readMat_par(Mat_dh *Aout, char *fileType, char *fileName, int ignore)
void mat_dh_transpose_private(int m, int *RP, int **rpOUT, int *CVAL, int **cvalOUT, double *AVAL, double **avalOUT)
void mat_dh_transpose_reuse_private(int m, int *rpIN, int *cvalIN, double *avalIN, int *rpOUT, int *cvalOUT, double *avalOUT)
Definition: Vec_dh.h:52
void profileMat(Mat_dh A)
void mat_dh_print_graph_private(int m, int beg_row, int *rp, int *cval, double *aval, int *n2o, int *o2n, Hash_i_dh hash, FILE *fp)
void writeMat(Mat_dh Ain, char *ft, char *fn)
void readMat(Mat_dh *Aout, char *ft, char *fn, int ignore)