Amesos Package Browser (Single Doxygen Collection) Development
amesos_camd_info.c
Go to the documentation of this file.
00001 /* ========================================================================= */
00002 /* === CAMD_info =========================================================== */
00003 /* ========================================================================= */
00004 
00005 /* ------------------------------------------------------------------------- */
00006 /* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen,           */
00007 /* Patrick R. Amestoy, and Iain S. Duff.  See ../README.txt for License.     */
00008 /* email: davis at cise.ufl.edu    CISE Department, Univ. of Florida.        */
00009 /* web: http://www.cise.ufl.edu/research/sparse/camd                         */
00010 /* ------------------------------------------------------------------------- */
00011 
00012 /* User-callable.  Prints the output statistics for CAMD.  See camd.h
00013  * for details.  If the Info array is not present, nothing is printed.
00014  */
00015 
00016 #include "amesos_camd_internal.h"
00017 
00018 #define PRI(format,x) { if (x >= 0) { PRINTF ((format, x)) ; }}
00019 
00020 GLOBAL void CAMD_info
00021 (
00022     double Info [ ]
00023 )
00024 {
00025     double n, ndiv, nmultsubs_ldl, nmultsubs_lu, lnz, lnzd ;
00026 
00027     if (!Info)
00028     {
00029   return ;
00030     }
00031 
00032     n = Info [CAMD_N] ;
00033     ndiv = Info [CAMD_NDIV] ;
00034     nmultsubs_ldl = Info [CAMD_NMULTSUBS_LDL] ;
00035     nmultsubs_lu = Info [CAMD_NMULTSUBS_LU] ;
00036     lnz = Info [CAMD_LNZ] ;
00037     lnzd = (n >= 0 && lnz >= 0) ? (n + lnz) : (-1) ;
00038 
00039     /* CAMD return status */
00040     PRINTF ((
00041   "\ncamd:  approximate minimum degree ordering, results:\n"
00042   "    status: ")) ;
00043     if (Info [CAMD_STATUS] == CAMD_OK)
00044     {
00045   PRINTF (("OK\n")) ;
00046     }
00047     else if (Info [CAMD_STATUS] == CAMD_OUT_OF_MEMORY)
00048     {
00049   PRINTF (("out of memory\n")) ;
00050     }
00051     else if (Info [CAMD_STATUS] == CAMD_INVALID)
00052     {
00053   PRINTF (("invalid matrix\n")) ;
00054     }
00055     else if (Info [CAMD_STATUS] == CAMD_OK_BUT_JUMBLED)
00056     {
00057   PRINTF (("OK, but jumbled\n")) ;
00058     }
00059     else
00060     {
00061   PRINTF (("unknown\n")) ;
00062     }
00063 
00064     /* statistics about the input matrix */
00065     PRI ("    n, dimension of A:                                  %.20g\n", n);
00066     PRI ("    nz, number of nonzeros in A:                        %.20g\n",
00067   Info [CAMD_NZ]) ;
00068     PRI ("    symmetry of A:                                      %.4f\n",
00069   Info [CAMD_SYMMETRY]) ;
00070     PRI ("    number of nonzeros on diagonal:                     %.20g\n",
00071   Info [CAMD_NZDIAG]) ;
00072     PRI ("    nonzeros in pattern of A+A' (excl. diagonal):       %.20g\n",
00073   Info [CAMD_NZ_A_PLUS_AT]) ;
00074     PRI ("    # dense rows/columns of A+A':                       %.20g\n",
00075   Info [CAMD_NDENSE]) ;
00076 
00077     /* statistics about CAMD's behavior  */
00078     PRI ("    memory used, in bytes:                              %.20g\n",
00079   Info [CAMD_MEMORY]) ;
00080     PRI ("    # of memory compactions:                            %.20g\n",
00081   Info [CAMD_NCMPA]) ;
00082 
00083     /* statistics about the ordering quality */
00084     PRINTF (("\n"
00085   "    The following approximate statistics are for a subsequent\n"
00086   "    factorization of A(P,P) + A(P,P)'.  They are slight upper\n"
00087   "    bounds if there are no dense rows/columns in A+A', and become\n"
00088   "    looser if dense rows/columns exist.\n\n")) ;
00089 
00090     PRI ("    nonzeros in L (excluding diagonal):                 %.20g\n",
00091   lnz) ;
00092     PRI ("    nonzeros in L (including diagonal):                 %.20g\n",
00093   lnzd) ;
00094     PRI ("    # divide operations for LDL' or LU:                 %.20g\n",
00095   ndiv) ;
00096     PRI ("    # multiply-subtract operations for LDL':            %.20g\n",
00097   nmultsubs_ldl) ;
00098     PRI ("    # multiply-subtract operations for LU:              %.20g\n",
00099   nmultsubs_lu) ;
00100     PRI ("    max nz. in any column of L (incl. diagonal):        %.20g\n",
00101   Info [CAMD_DMAX]) ;
00102 
00103     /* total flop counts for various factorizations */
00104 
00105     if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0)
00106     {
00107   PRINTF (("\n"
00108   "    chol flop count for real A, sqrt counted as 1 flop: %.20g\n"
00109   "    LDL' flop count for real A:                         %.20g\n"
00110   "    LDL' flop count for complex A:                      %.20g\n"
00111   "    LU flop count for real A (with no pivoting):        %.20g\n"
00112   "    LU flop count for complex A (with no pivoting):     %.20g\n\n",
00113   n + ndiv + 2*nmultsubs_ldl,
00114       ndiv + 2*nmultsubs_ldl,
00115     9*ndiv + 8*nmultsubs_ldl,
00116       ndiv + 2*nmultsubs_lu,
00117     9*ndiv + 8*nmultsubs_lu)) ;
00118     }
00119 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines