mat_dh_private.h

00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2009) 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 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 */
00029 
00030 #ifndef MAT_DH_PRIVATE
00031 #define MAT_DH_PRIVATE
00032 
00033 /* Functions called by Mat_dh, Factor_dh, and possibly others.
00034    Also, a few handy functions for dealing with permutations,
00035    etc.
00036  
00037  */
00038 
00039 #include "euclid_common.h"
00040 #ifdef __cplusplus
00041 extern "C"
00042 {
00043 #endif
00044 
00045   extern int mat_find_owner (int *beg_rows, int *end_rows, int index);
00046 
00047   extern void mat_dh_transpose_private (int m, int *rpIN, int **rpOUT,
00048                     int *cvalIN, int **cvalOUT,
00049                     double *avalIN, double **avalOUT);
00050 
00051   /* same as above, but memory for output was already allocated */
00052   extern void mat_dh_transpose_reuse_private (int m,
00053                           int *rpIN, int *cvalIN,
00054                           double *avalIN, int *rpOUT,
00055                           int *cvalOUT, double *avalOUT);
00056 
00057 /*-------------------------------------------------------------------------
00058  * utility functions for reading and writing matrices in various formats.
00059  * currently recognized filetypes (formats) are:
00060  *    trip
00061  *    csr
00062  * the "ignore" parameter is only used for the matrix "trip" format,
00063  * and the vector "csr" and "trip" formats (which are misnamed, and identical);
00064  * the intention is to skip over the first "ignore" lines of the file;
00065  * this is a hack to enable reading of Matrix Market, etc, formats. 
00066  *-------------------------------------------------------------------------*/
00067   extern void readMat (Mat_dh * Aout, char *fileType, char *fileName,
00068                int ignore);
00069   extern void readVec (Vec_dh * bout, char *fileType, char *fileName,
00070                int ignore);
00071   extern void writeMat (Mat_dh Ain, char *fileType, char *fileName);
00072   extern void writeVec (Vec_dh b, char *fileType, char *fileName);
00073 
00074 /* Next function is primarily (?) for testing/development/debugging.
00075    P_0 reads and partitions the matrix, then distributes 
00076    amongst the other processors.
00077 */
00078   extern void readMat_par (Mat_dh * Aout, char *fileType, char *fileName,
00079                int ignore);
00080 
00081   extern void profileMat (Mat_dh A);
00082   /* writes structural and numerical symmetry and other info to stdout;
00083      for a single mpi task only.
00084    */
00085 
00086 
00087 
00088 /*-------------------------------------------------------------------------*
00089  * functions called by public Mat_dh class methods.
00090  *
00091  *   (following notes need to be updated!)
00092  *
00093  *         m is number of local rows;
00094  *         beg_row is global number of 1st locally owned row;
00095  *         m, beg_row, rp, cval may not be null (caller's responsiblity);
00096  *         if n2o is NULL, it's assumed that o2n is NULL;
00097  *         if 
00098  *
00099  *         error thrown:
00100  *         if a nonlocal column (a column index that is less than beg_row,
00101  *         or >= beg_row+m), and can't be located in hash table.
00102  *
00103  *         print_triples_private() and print_mat_private() are 1-based.
00104  *
00105  *-------------------------------------------------------------------------*/
00106 
00107 /* seq or mpi */
00108   extern void mat_dh_print_graph_private (int m, int beg_row, int *rp,
00109                       int *cval, double *aval, int *n2o,
00110                       int *o2n, Hash_i_dh hash,
00111                       FILE * fp);
00112 
00113 
00114 /* seq; reordering not implemented */
00115 /* see io_dh.h
00116                                 int *rp, int *cval, double *aval, 
00117                            int *n2o, int *o2n, Hash_i_dh hash, char *filename);
00118 */
00119 
00120 /* seq only */
00121   extern void mat_dh_print_csr_private (int m, int *rp, int *cval,
00122                     double *aval, FILE * fp);
00123 
00124 
00125 /* seq only */
00126   extern void mat_dh_read_csr_private (int *m, int **rp, int **cval,
00127                        double **aval, FILE * fp);
00128 
00129 /* seq only */
00130   extern void mat_dh_read_triples_private (int ignore, int *m, int **rp,
00131                        int **cval, double **aval,
00132                        FILE * fp);
00133 
00134 /* seq or mpi */
00135 /* see io_dh.h
00136                                      double **aval, char *filename);
00137 */
00138 
00139 /*-------------------------------------------------------------------------*/
00140 
00141   extern void create_nat_ordering_private (int m, int **p);
00142   extern void destroy_nat_ordering_private (int *p);
00143   extern void invert_perm (int m, int *pIN, int *pOUT);
00144 
00145 
00146   extern void make_full_private (int m, int **rp, int **cval, double **aval);
00147   /* converts upper or lower triangular to full;
00148      may bomb if input is not triangular!
00149    */
00150 
00151   extern void make_symmetric_private (int m, int **rp, int **cval,
00152                       double **aval);
00153   /* pads with zeros to make structurally symmetric. */
00154 
00155   extern void make_symmetric_private (int m, int **rp, int **cval,
00156                       double **aval);
00157 
00158 #ifdef __cplusplus
00159 }
00160 #endif
00161 #endif

Generated on Tue Jul 13 09:27:14 2010 for IFPACK by  doxygen 1.4.7