IFPACK  Development
 All Classes Namespaces Files Functions Variables Enumerations Friends Pages
mat_dh_private.h
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 #if defined(Ifpack_SHOW_DEPRECATED_WARNINGS)
47 #ifdef __GNUC__
48 #warning "The Ifpack package is deprecated"
49 #endif
50 #endif
51 
52 /* Functions called by Mat_dh, Factor_dh, and possibly others.
53  Also, a few handy functions for dealing with permutations,
54  etc.
55 
56  */
57 
58 #include "euclid_common.h"
59 #ifdef __cplusplus
60 extern "C"
61 {
62 #endif
63 
64  extern int mat_find_owner (int *beg_rows, int *end_rows, int index);
65 
66  extern void mat_dh_transpose_private (int m, int *rpIN, int **rpOUT,
67  int *cvalIN, int **cvalOUT,
68  double *avalIN, double **avalOUT);
69 
70  /* same as above, but memory for output was already allocated */
71  extern void mat_dh_transpose_reuse_private (int m,
72  int *rpIN, int *cvalIN,
73  double *avalIN, int *rpOUT,
74  int *cvalOUT, double *avalOUT);
75 
76 /*-------------------------------------------------------------------------
77  * utility functions for reading and writing matrices in various formats.
78  * currently recognized filetypes (formats) are:
79  * trip
80  * csr
81  * the "ignore" parameter is only used for the matrix "trip" format,
82  * and the vector "csr" and "trip" formats (which are misnamed, and identical);
83  * the intention is to skip over the first "ignore" lines of the file;
84  * this is a hack to enable reading of Matrix Market, etc, formats.
85  *-------------------------------------------------------------------------*/
86  extern void readMat (Mat_dh * Aout, char *fileType, char *fileName,
87  int ignore);
88  extern void readVec (Vec_dh * bout, char *fileType, char *fileName,
89  int ignore);
90  extern void writeMat (Mat_dh Ain, char *fileType, char *fileName);
91  extern void writeVec (Vec_dh b, char *fileType, char *fileName);
92 
93 /* Next function is primarily (?) for testing/development/debugging.
94  P_0 reads and partitions the matrix, then distributes
95  amongst the other processors.
96 */
97  extern void readMat_par (Mat_dh * Aout, char *fileType, char *fileName,
98  int ignore);
99 
100  extern void profileMat (Mat_dh A);
101  /* writes structural and numerical symmetry and other info to stdout;
102  for a single mpi task only.
103  */
104 
105 
106 
107 /*-------------------------------------------------------------------------*
108  * functions called by public Mat_dh class methods.
109  *
110  * (following notes need to be updated!)
111  *
112  * m is number of local rows;
113  * beg_row is global number of 1st locally owned row;
114  * m, beg_row, rp, cval may not be null (caller's responsiblity);
115  * if n2o is NULL, it's assumed that o2n is NULL;
116  * if
117  *
118  * error thrown:
119  * if a nonlocal column (a column index that is less than beg_row,
120  * or >= beg_row+m), and can't be located in hash table.
121  *
122  * print_triples_private() and print_mat_private() are 1-based.
123  *
124  *-------------------------------------------------------------------------*/
125 
126 /* seq or mpi */
127  extern void mat_dh_print_graph_private (int m, int beg_row, int *rp,
128  int *cval, double *aval, int *n2o,
129  int *o2n, Hash_i_dh hash,
130  FILE * fp);
131 
132 
133 /* seq; reordering not implemented */
134 /* see io_dh.h
135  int *rp, int *cval, double *aval,
136  int *n2o, int *o2n, Hash_i_dh hash, char *filename);
137 */
138 
139 /* seq only */
140  extern void mat_dh_print_csr_private (int m, int *rp, int *cval,
141  double *aval, FILE * fp);
142 
143 
144 /* seq only */
145  extern void mat_dh_read_csr_private (int *m, int **rp, int **cval,
146  double **aval, FILE * fp);
147 
148 /* seq only */
149  extern void mat_dh_read_triples_private (int ignore, int *m, int **rp,
150  int **cval, double **aval,
151  FILE * fp);
152 
153 /* seq or mpi */
154 /* see io_dh.h
155  double **aval, char *filename);
156 */
157 
158 /*-------------------------------------------------------------------------*/
159 
160  extern void create_nat_ordering_private (int m, int **p);
161  extern void destroy_nat_ordering_private (int *p);
162  extern void invert_perm (int m, int *pIN, int *pOUT);
163 
164 
165  extern void make_full_private (int m, int **rp, int **cval, double **aval);
166  /* converts upper or lower triangular to full;
167  may bomb if input is not triangular!
168  */
169 
170  extern void make_symmetric_private (int m, int **rp, int **cval,
171  double **aval);
172  /* pads with zeros to make structurally symmetric. */
173 
174  extern void make_symmetric_private (int m, int **rp, int **cval,
175  double **aval);
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 #endif
Definition: Mat_dh.h:68
Definition: Vec_dh.h:58