Amesos Package Browser (Single Doxygen Collection) Development
amesos_amd_info.c
Go to the documentation of this file.
00001 /* ========================================================================= */
00002 /* === AMD_info ============================================================ */
00003 /* ========================================================================= */
00004 
00005 /* ------------------------------------------------------------------------- */
00006 /* AMD, Copyright (c) Timothy A. Davis,              */
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/amd                          */
00010 /* ------------------------------------------------------------------------- */
00011 
00012 /* User-callable.  Prints the output statistics for AMD.  See amd.h
00013  * for details.  If the Info array is not present, nothing is printed.
00014  */
00015 
00016 #include "amesos_amd_internal.h"
00017 
00018 #define PRI(format,x) { if (x >= 0) { PRINTF ((format, x)) ; }}
00019 
00020 GLOBAL void AMD_info
00021 (
00022     double Info [ ]
00023 )
00024 {
00025     double n, ndiv, nmultsubs_ldl, nmultsubs_lu, lnz, lnzd ;
00026 
00027     PRINTF (("\nAMD version %d.%d.%d, %s, results:\n",
00028   AMD_MAIN_VERSION, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_DATE)) ;
00029 
00030     if (!Info)
00031     {
00032   return ;
00033     }
00034 
00035     n = Info [AMD_N] ;
00036     ndiv = Info [AMD_NDIV] ;
00037     nmultsubs_ldl = Info [AMD_NMULTSUBS_LDL] ;
00038     nmultsubs_lu = Info [AMD_NMULTSUBS_LU] ;
00039     lnz = Info [AMD_LNZ] ;
00040     lnzd = (n >= 0 && lnz >= 0) ? (n + lnz) : (-1) ;
00041 
00042     /* AMD return status */
00043     PRINTF (("    status: ")) ;
00044     if (Info [AMD_STATUS] == AMD_OK)
00045     {
00046   PRINTF (("OK\n")) ;
00047     }
00048     else if (Info [AMD_STATUS] == AMD_OUT_OF_MEMORY)
00049     {
00050   PRINTF (("out of memory\n")) ;
00051     }
00052     else if (Info [AMD_STATUS] == AMD_INVALID)
00053     {
00054   PRINTF (("invalid matrix\n")) ;
00055     }
00056     else if (Info [AMD_STATUS] == AMD_OK_BUT_JUMBLED)
00057     {
00058   PRINTF (("OK, but jumbled\n")) ;
00059     }
00060     else
00061     {
00062   PRINTF (("unknown\n")) ;
00063     }
00064 
00065     /* statistics about the input matrix */
00066     PRI ("    n, dimension of A:                                  %.20g\n", n);
00067     PRI ("    nz, number of nonzeros in A:                        %.20g\n",
00068   Info [AMD_NZ]) ;
00069     PRI ("    symmetry of A:                                      %.4f\n",
00070   Info [AMD_SYMMETRY]) ;
00071     PRI ("    number of nonzeros on diagonal:                     %.20g\n",
00072   Info [AMD_NZDIAG]) ;
00073     PRI ("    nonzeros in pattern of A+A' (excl. diagonal):       %.20g\n",
00074   Info [AMD_NZ_A_PLUS_AT]) ;
00075     PRI ("    # dense rows/columns of A+A':                       %.20g\n",
00076   Info [AMD_NDENSE]) ;
00077 
00078     /* statistics about AMD's behavior  */
00079     PRI ("    memory used, in bytes:                              %.20g\n",
00080   Info [AMD_MEMORY]) ;
00081     PRI ("    # of memory compactions:                            %.20g\n",
00082   Info [AMD_NCMPA]) ;
00083 
00084     /* statistics about the ordering quality */
00085     PRINTF (("\n"
00086   "    The following approximate statistics are for a subsequent\n"
00087   "    factorization of A(P,P) + A(P,P)'.  They are slight upper\n"
00088   "    bounds if there are no dense rows/columns in A+A', and become\n"
00089   "    looser if dense rows/columns exist.\n\n")) ;
00090 
00091     PRI ("    nonzeros in L (excluding diagonal):                 %.20g\n",
00092   lnz) ;
00093     PRI ("    nonzeros in L (including diagonal):                 %.20g\n",
00094   lnzd) ;
00095     PRI ("    # divide operations for LDL' or LU:                 %.20g\n",
00096   ndiv) ;
00097     PRI ("    # multiply-subtract operations for LDL':            %.20g\n",
00098   nmultsubs_ldl) ;
00099     PRI ("    # multiply-subtract operations for LU:              %.20g\n",
00100   nmultsubs_lu) ;
00101     PRI ("    max nz. in any column of L (incl. diagonal):        %.20g\n",
00102   Info [AMD_DMAX]) ;
00103 
00104     /* total flop counts for various factorizations */
00105 
00106     if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0)
00107     {
00108   PRINTF (("\n"
00109   "    chol flop count for real A, sqrt counted as 1 flop: %.20g\n"
00110   "    LDL' flop count for real A:                         %.20g\n"
00111   "    LDL' flop count for complex A:                      %.20g\n"
00112   "    LU flop count for real A (with no pivoting):        %.20g\n"
00113   "    LU flop count for complex A (with no pivoting):     %.20g\n\n",
00114   n + ndiv + 2*nmultsubs_ldl,
00115       ndiv + 2*nmultsubs_ldl,
00116     9*ndiv + 8*nmultsubs_ldl,
00117       ndiv + 2*nmultsubs_lu,
00118     9*ndiv + 8*nmultsubs_lu)) ;
00119     }
00120 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines