Amesos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SparseSolverResult.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Amesos: Direct Sparse Solver Package
5 // Copyright (2004) 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 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
25 //
26 // ***********************************************************************
27 // @HEADER
28 
29 #include "SparseSolverResult.h"
30 #include <iomanip>
31 
32 void SparseSolverResult::Print(std::ostream & os) const {
33  if ( error != UnUsedDbl ) { os << "error=" << error << " " ; }
34  if ( residual != UnUsedDbl ) { os << "residual=" << residual << std::endl ; }
35  if ( Anorm != UnUsedDbl ) { os << "Anorm=" << Anorm << " " ; }
36  if ( Bnorm != UnUsedDbl ) { os << "Bnorm=" << Bnorm << std::endl ; }
37  if ( Xnorm != UnUsedDbl ) { os << "Xnorm=" << Xnorm << std::endl ; }
38 
39 }
40 
41 void SparseSolverResult::PrintSummary(std::ostream & os) const {
42  os << std::setw(9) << std::setprecision(2) << Anorm ;
43  if ( error != UnUsedDbl && Xnorm != UnUsedDbl )
44  { os << std::setw(9) << std::setprecision(2) << error/Xnorm << " " ; } else os << " error is unknown " ;
45  if ( residual != UnUsedDbl && Bnorm != UnUsedDbl )
46  { os << std::setw(9) << std::setprecision(2) << residual/Bnorm << " " ; } else os << " residual is unknown " ;
47  os << std::setw(10) << std::setprecision(4) << total_time ;
48 #if 0
49  double TotalWallClock = 0.0 ;
50  if ( RedistribTime_.WallTime() != UnUsedDbl )
51  { TotalWallClock += RedistribTime_.WallTime() ; } ;
52  if ( SymbolicTime_.WallTime() != UnUsedDbl )
53  { TotalWallClock += SymbolicTime_.WallTime() ; } ;
54  if ( FactorTime_.WallTime() != UnUsedDbl )
55  { TotalWallClock += FactorTime_.WallTime() ; } ;
56  if ( SolveTime_.WallTime() != UnUsedDbl )
57  { TotalWallClock += SolveTime_.WallTime() ; } ;
58  os << std::setw(10) << std::setprecision(4) << TotalWallClock ;
59 #endif
60  if ( first_time != UnUsedDbl )
61  os << std::setw(10) << std::setprecision(4) << first_time ;
62  else
63  os << " na " ;
64  if ( middle_time != UnUsedDbl )
65  os << std::setw(10) << std::setprecision(4) << last_time - middle_time ;
66  else
67  os << " na " ;
68  if ( last_time != UnUsedDbl )
69  os << std::setw(10) << std::setprecision(4) << last_time - first_time ;
70  else
71  os << " na " ;
72 
73 }
#define setw(a)
virtual void Print(std::ostream &os) const
virtual void PrintSummary(std::ostream &os) const
const double UnUsedDbl
#define setprecision(a)