00001 /*@HEADER 00002 // *********************************************************************** 00003 // 00004 // Ifpack: Object-Oriented Algebraic Preconditioner Package 00005 // Copyright (2002) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 //@HEADER 00041 */ 00042 00043 #ifndef MAT_DH_PRIVATE 00044 #define MAT_DH_PRIVATE 00045 00046 /* Functions called by Mat_dh, Factor_dh, and possibly others. 00047 Also, a few handy functions for dealing with permutations, 00048 etc. 00049 00050 */ 00051 00052 #include "euclid_common.h" 00053 #ifdef __cplusplus 00054 extern "C" 00055 { 00056 #endif 00057 00058 extern int mat_find_owner (int *beg_rows, int *end_rows, int index); 00059 00060 extern void mat_dh_transpose_private (int m, int *rpIN, int **rpOUT, 00061 int *cvalIN, int **cvalOUT, 00062 double *avalIN, double **avalOUT); 00063 00064 /* same as above, but memory for output was already allocated */ 00065 extern void mat_dh_transpose_reuse_private (int m, 00066 int *rpIN, int *cvalIN, 00067 double *avalIN, int *rpOUT, 00068 int *cvalOUT, double *avalOUT); 00069 00070 /*------------------------------------------------------------------------- 00071 * utility functions for reading and writing matrices in various formats. 00072 * currently recognized filetypes (formats) are: 00073 * trip 00074 * csr 00075 * the "ignore" parameter is only used for the matrix "trip" format, 00076 * and the vector "csr" and "trip" formats (which are misnamed, and identical); 00077 * the intention is to skip over the first "ignore" lines of the file; 00078 * this is a hack to enable reading of Matrix Market, etc, formats. 00079 *-------------------------------------------------------------------------*/ 00080 extern void readMat (Mat_dh * Aout, char *fileType, char *fileName, 00081 int ignore); 00082 extern void readVec (Vec_dh * bout, char *fileType, char *fileName, 00083 int ignore); 00084 extern void writeMat (Mat_dh Ain, char *fileType, char *fileName); 00085 extern void writeVec (Vec_dh b, char *fileType, char *fileName); 00086 00087 /* Next function is primarily (?) for testing/development/debugging. 00088 P_0 reads and partitions the matrix, then distributes 00089 amongst the other processors. 00090 */ 00091 extern void readMat_par (Mat_dh * Aout, char *fileType, char *fileName, 00092 int ignore); 00093 00094 extern void profileMat (Mat_dh A); 00095 /* writes structural and numerical symmetry and other info to stdout; 00096 for a single mpi task only. 00097 */ 00098 00099 00100 00101 /*-------------------------------------------------------------------------* 00102 * functions called by public Mat_dh class methods. 00103 * 00104 * (following notes need to be updated!) 00105 * 00106 * m is number of local rows; 00107 * beg_row is global number of 1st locally owned row; 00108 * m, beg_row, rp, cval may not be null (caller's responsiblity); 00109 * if n2o is NULL, it's assumed that o2n is NULL; 00110 * if 00111 * 00112 * error thrown: 00113 * if a nonlocal column (a column index that is less than beg_row, 00114 * or >= beg_row+m), and can't be located in hash table. 00115 * 00116 * print_triples_private() and print_mat_private() are 1-based. 00117 * 00118 *-------------------------------------------------------------------------*/ 00119 00120 /* seq or mpi */ 00121 extern void mat_dh_print_graph_private (int m, int beg_row, int *rp, 00122 int *cval, double *aval, int *n2o, 00123 int *o2n, Hash_i_dh hash, 00124 FILE * fp); 00125 00126 00127 /* seq; reordering not implemented */ 00128 /* see io_dh.h 00129 int *rp, int *cval, double *aval, 00130 int *n2o, int *o2n, Hash_i_dh hash, char *filename); 00131 */ 00132 00133 /* seq only */ 00134 extern void mat_dh_print_csr_private (int m, int *rp, int *cval, 00135 double *aval, FILE * fp); 00136 00137 00138 /* seq only */ 00139 extern void mat_dh_read_csr_private (int *m, int **rp, int **cval, 00140 double **aval, FILE * fp); 00141 00142 /* seq only */ 00143 extern void mat_dh_read_triples_private (int ignore, int *m, int **rp, 00144 int **cval, double **aval, 00145 FILE * fp); 00146 00147 /* seq or mpi */ 00148 /* see io_dh.h 00149 double **aval, char *filename); 00150 */ 00151 00152 /*-------------------------------------------------------------------------*/ 00153 00154 extern void create_nat_ordering_private (int m, int **p); 00155 extern void destroy_nat_ordering_private (int *p); 00156 extern void invert_perm (int m, int *pIN, int *pOUT); 00157 00158 00159 extern void make_full_private (int m, int **rp, int **cval, double **aval); 00160 /* converts upper or lower triangular to full; 00161 may bomb if input is not triangular! 00162 */ 00163 00164 extern void make_symmetric_private (int m, int **rp, int **cval, 00165 double **aval); 00166 /* pads with zeros to make structurally symmetric. */ 00167 00168 extern void make_symmetric_private (int m, int **rp, int **cval, 00169 double **aval); 00170 00171 #ifdef __cplusplus 00172 } 00173 #endif 00174 #endif
1.7.6.1