MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
MatrixScale< T > Class Template Referenceabstract

#include <dgeequ.h>

Inheritance diagram for MatrixScale< T >:
Collaboration diagram for MatrixScale< T >:

Public Member Functions

 MatrixScale (const SolutionManager::ScaleOpt &scale)
 
virtual ~MatrixScale ()
 
T & ScaleMatrix (T &mh) const
 
bool ComputeScaleFactors (const T &mh)
 
- Public Member Functions inherited from MatrixScaleBase
 MatrixScaleBase (const SolutionManager::ScaleOpt &scale)
 
virtual ~MatrixScaleBase ()
 
VectorHandlerScaleRightHandSide (VectorHandler &bVH) const
 
VectorHandlerScaleSolution (VectorHandler &xVH) const
 
std::ostream & Report (std::ostream &os) const
 
const std::vector< doublereal > & GetRowScale () const
 
const std::vector< doublereal > & GetColScale () const
 
bool bGetInitialized () const
 

Static Public Member Functions

static MatrixScale< T > * Allocate (const SolutionManager::ScaleOpt &scale)
 

Protected Member Functions

virtual bool ComputeScaleFactors (const T &mh, std::vector< doublereal > &rowScale, std::vector< doublereal > &colScale)=0
 
- Protected Member Functions inherited from MatrixScaleBase
MatrixHandler::Norm_t GetCondNumNorm () const
 
virtual std::ostream & vReport (std::ostream &os) const =0
 
void Prepare (const MatrixHandler &mh, integer &nrows, integer &ncols)
 
void PrepareRows (const MatrixHandler &mh, integer &nrows)
 
void PrepareCols (const MatrixHandler &mh, integer &ncols)
 
bool bReport () const
 

Additional Inherited Members

- Protected Attributes inherited from MatrixScaleBase
std::vector< doublerealrowScale
 
std::vector< doublerealcolScale
 
doublereal dCondBefore
 
doublereal dCondAfter
 
const unsigned uFlags
 
bool bOK
 

Detailed Description

template<typename T>
class MatrixScale< T >

Definition at line 79 of file dgeequ.h.

Constructor & Destructor Documentation

template<typename T >
MatrixScale< T >::MatrixScale ( const SolutionManager::ScaleOpt scale)
inlineexplicit

Definition at line 261 of file dgeequ.h.

262  :MatrixScaleBase(scale)
263 {
264 
265 }
MatrixScaleBase(const SolutionManager::ScaleOpt &scale)
Definition: dgeequ.cc:38
template<typename T >
MatrixScale< T >::~MatrixScale ( )
virtual

Definition at line 268 of file dgeequ.h.

269 {
270 
271 }

Member Function Documentation

template<typename T >
MatrixScale< T > * MatrixScale< T >::Allocate ( const SolutionManager::ScaleOpt scale)
static

Definition at line 313 of file dgeequ.h.

References SolutionManager::ScaleOpt::algorithm, ASSERT, MBDYN_EXCEPT_ARGS, SAFENEWWITHCONSTRUCTOR, SolutionManager::SCALEA_COL_MAX, SolutionManager::SCALEA_COL_SUM, SolutionManager::SCALEA_ITERATIVE, SolutionManager::SCALEA_LAPACK, SolutionManager::SCALEA_ROW_MAX, SolutionManager::SCALEA_ROW_MAX_COL_MAX, and SolutionManager::SCALEA_ROW_SUM.

Referenced by NaiveSparseSolutionManager::GetMatrixScale().

314 {
315  MatrixScale<T>* pMatScale = 0;
316 
317  switch (scale.algorithm) {
319  SAFENEWWITHCONSTRUCTOR(pMatScale,
321  RowMaxMatrixScale<T>(scale));
322  break;
323 
325  SAFENEWWITHCONSTRUCTOR(pMatScale,
327  RowSumMatrixScale<T>(scale));
328  break;
329 
331  SAFENEWWITHCONSTRUCTOR(pMatScale,
333  ColMaxMatrixScale<T>(scale));
334  break;
335 
337  SAFENEWWITHCONSTRUCTOR(pMatScale,
339  ColSumMatrixScale<T>(scale));
340  break;
341 
343  SAFENEWWITHCONSTRUCTOR(pMatScale,
345  LapackMatrixScale<T>(scale));
346  break;
347 
349  SAFENEWWITHCONSTRUCTOR(pMatScale,
351  IterativeMatrixScale<T>(scale));
352  break;
353 
355  SAFENEWWITHCONSTRUCTOR(pMatScale,
358  break;
359  default:
360  ASSERT(0);
362  }
363 
364  return pMatScale;
365 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define ASSERT(expression)
Definition: colamd.c:977
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
ScaleAlgorithm algorithm
Definition: solman.h:145
template<typename T >
bool MatrixScale< T >::ComputeScaleFactors ( const T &  mh)
inline

Definition at line 305 of file dgeequ.h.

Referenced by ScaleMatrix(), and NaiveSparseSolutionManager::ScaleMatrixAndRightHandSide().

306 {
308 
309  return bOK;
310 }
std::vector< doublereal > colScale
Definition: dgeequ.h:68
bool ComputeScaleFactors(const T &mh)
Definition: dgeequ.h:305
std::vector< doublereal > rowScale
Definition: dgeequ.h:68
template<typename T>
virtual bool MatrixScale< T >::ComputeScaleFactors ( const T &  mh,
std::vector< doublereal > &  rowScale,
std::vector< doublereal > &  colScale 
)
protectedpure virtual
template<typename T >
T & MatrixScale< T >::ScaleMatrix ( T &  mh) const
inline

Definition at line 274 of file dgeequ.h.

References SolutionManager::SCALEF_COND_NUM.

Referenced by ScaleMatrix(), and NaiveSparseSolutionManager::ScaleMatrixAndRightHandSide().

275 {
277  dCondBefore = mh.ConditionNumber(GetCondNumNorm());
278  }
279 
280  const bool bScaleRows = !rowScale.empty();
281  const bool bScaleCols = !colScale.empty();
282 
283  for (typename T::const_iterator i = mh.begin(); i != mh.end(); ++i) {
284  doublereal dCoef = i->dCoef;
285 
286  if (bScaleRows) {
287  dCoef *= rowScale[i->iRow];
288  }
289 
290  if (bScaleCols) {
291  dCoef *= colScale[i->iCol];
292  }
293 
294  mh(i->iRow + 1, i->iCol + 1) = dCoef;
295  }
296 
297  if (uFlags & SolutionManager::SCALEF_COND_NUM) {
298  dCondAfter = mh.ConditionNumber(GetCondNumNorm());
299  }
300 
301  return mh;
302 }
doublereal dCondBefore
Definition: dgeequ.h:69
const unsigned uFlags
Definition: dgeequ.h:70
MatrixHandler::Norm_t GetCondNumNorm() const
Definition: dgeequ.h:234
std::vector< doublereal > colScale
Definition: dgeequ.h:68
doublereal dCondAfter
Definition: dgeequ.h:69
std::vector< doublereal > rowScale
Definition: dgeequ.h:68
double doublereal
Definition: colamd.c:52

The documentation for this class was generated from the following file: