MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
NaivePermMatrixHandler Class Reference

#include <naivemh.h>

Inheritance diagram for NaivePermMatrixHandler:
Collaboration diagram for NaivePermMatrixHandler:

Classes

class  const_iterator
 

Public Member Functions

NaivePermMatrixHandler::const_iterator begin (void) const
 
const
NaivePermMatrixHandler::const_iterator
end (void) const
 
 NaivePermMatrixHandler (integer iSize, const std::vector< integer > &tperm, const std::vector< integer > &invperm)
 
 NaivePermMatrixHandler (NaiveMatrixHandler *const nmh, const std::vector< integer > &tperm, const std::vector< integer > &invperm)
 
virtual ~NaivePermMatrixHandler (void)
 
const std::vector< integer > & GetPerm (void) const
 
const std::vector< integer > & GetInvPerm (void) const
 
virtual const doublerealoperator() (integer iRow, integer iCol) const
 
virtual doublerealoperator() (integer iRow, integer iCol)
 
- Public Member Functions inherited from NaiveMatrixHandler
NaiveMatrixHandler::const_iterator begin (void) const
 
const
NaiveMatrixHandler::const_iterator
end (void) const
 
 NaiveMatrixHandler (const integer n, NaiveMatrixHandler *const nmh=0)
 
virtual ~NaiveMatrixHandler (void)
 
integer iGetNumRows (void) const
 
integer iGetNumCols (void) const
 
void Reset (void)
 
virtual void Resize (integer, integer)
 
virtual MatrixHandleroperator+= (const SubMatrixHandler &SubMH)
 
virtual MatrixHandleroperator-= (const SubMatrixHandler &SubMH)
 
virtual MatrixHandleroperator+= (const VariableSubMatrixHandler &SubMH)
 
virtual MatrixHandleroperator-= (const VariableSubMatrixHandler &SubMH)
 
void MakeCCStructure (std::vector< integer > &Ai, std::vector< integer > &Ap)
 
- Public Member Functions inherited from MatrixHandler
virtual ~MatrixHandler (void)
 
virtual void ResizeReset (integer, integer)
 
virtual const doublerealpdGetMat (void) const
 
virtual doublerealpdGetMat (void)
 
virtual integerpiGetRows (void) const
 
virtual integerpiGetCols (void) const
 
virtual integer PacMat (void)
 
virtual void PutCoef (integer iRow, integer iCol, const doublereal &dCoef)
 
virtual void IncCoef (integer iRow, integer iCol, const doublereal &dCoef)
 
virtual void DecCoef (integer iRow, integer iCol, const doublereal &dCoef)
 
virtual const doublerealdGetCoef (integer iRow, integer iCol) const
 
virtual MatrixHandleroperator= (const MatrixHandler &MH)
 
virtual MatrixHandlerScalarMul (const doublereal &d)
 
virtual MatrixHandlerMatMatMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatTMatMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatMatIncMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatTMatIncMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatMatDecMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatTMatDecMul (MatrixHandler &out, const MatrixHandler &in) const
 
virtual VectorHandlerMatVecMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatTVecMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatVecIncMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatTVecIncMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatVecDecMul (VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatTVecDecMul (VectorHandler &out, const VectorHandler &in) const
 
virtual doublereal ConditionNumber (enum Norm_t eNorm=NORM_1) const
 
virtual doublereal Norm (enum Norm_t eNorm=NORM_1) const
 

Protected Member Functions

virtual MatrixHandlerMatMatMul_base (void(MatrixHandler::*op)(integer iRow, integer iCol, const doublereal &dCoef), MatrixHandler &out, const MatrixHandler &in) const
 
virtual MatrixHandlerMatTMatMul_base (void(MatrixHandler::*op)(integer iRow, integer iCol, const doublereal &dCoef), MatrixHandler &out, const MatrixHandler &in) const
 
virtual VectorHandlerMatVecMul_base (void(VectorHandler::*op)(integer iRow, const doublereal &dCoef), VectorHandler &out, const VectorHandler &in) const
 
virtual VectorHandlerMatTVecMul_base (void(VectorHandler::*op)(integer iRow, const doublereal &dCoef), VectorHandler &out, const VectorHandler &in) const
 

Protected Attributes

const std::vector< integer > & perm
 
const std::vector< integer > & invperm
 
const_iterator m_end
 
- Protected Attributes inherited from NaiveMatrixHandler
integer iSize
 
bool bOwnsMemory
 
doublereal ** ppdRows
 
integer ** ppiRows
 
integer ** ppiCols
 
char ** ppnonzero
 
integerpiNzr
 
integerpiNzc
 
const_iterator m_end
 

Additional Inherited Members

- Public Types inherited from MatrixHandler
enum  Norm_t { NORM_1, NORM_INF }
 

Detailed Description

Definition at line 211 of file naivemh.h.

Constructor & Destructor Documentation

NaivePermMatrixHandler::NaivePermMatrixHandler ( integer  iSize,
const std::vector< integer > &  tperm,
const std::vector< integer > &  invperm 
)

Definition at line 538 of file naivemh.cc.

References ASSERT, invperm, NaiveMatrixHandler::iSize, and perm.

Referenced by NaiveSparsePermSolutionManager< T >::NaiveSparsePermSolutionManager().

541 : NaiveMatrixHandler(iSize), perm(tperm), invperm(tinvperm), m_end(*this, true)
542 {
543  ASSERT(perm.size() == (size_t)iSize);
544  ASSERT(invperm.size() == (size_t)iSize);
545 
546 #ifdef DEBUG
547  for (integer i = 0; i < iSize; ++i) {
548  ASSERT(invperm[i] >= 0 && invperm[i] < iSize);
549  ASSERT(perm[i] >= 0 && perm[i] < iSize);
550  }
551 #endif
552 }
const_iterator m_end
Definition: naivemh.h:246
const std::vector< integer > & perm
Definition: naivemh.h:213
NaiveMatrixHandler(const NaiveMatrixHandler &)
#define ASSERT(expression)
Definition: colamd.c:977
const std::vector< integer > & invperm
Definition: naivemh.h:214
long int integer
Definition: colamd.c:51
integer iSize
Definition: naivemh.h:58
NaivePermMatrixHandler::NaivePermMatrixHandler ( NaiveMatrixHandler *const  nmh,
const std::vector< integer > &  tperm,
const std::vector< integer > &  invperm 
)

Definition at line 554 of file naivemh.cc.

References ASSERT, invperm, NaiveMatrixHandler::iSize, NO_OP, and perm.

557 : NaiveMatrixHandler(0, nmh), perm(tperm), invperm(tinvperm), m_end(*this, true)
558 {
559  ASSERT(perm.size() == (size_t)iSize);
560  ASSERT(invperm.size() == (size_t)iSize);
561 
562 #ifdef DEBUG
563  for (integer i = 0; i < iSize; ++i) {
564  ASSERT(invperm[i] >= 0 && invperm[i] < iSize);
565  ASSERT(perm[i] >= 0 && perm[i] < iSize);
566  }
567 #endif
568 
569  NO_OP;
570 }
const_iterator m_end
Definition: naivemh.h:246
#define NO_OP
Definition: myassert.h:74
const std::vector< integer > & perm
Definition: naivemh.h:213
NaiveMatrixHandler(const NaiveMatrixHandler &)
#define ASSERT(expression)
Definition: colamd.c:977
const std::vector< integer > & invperm
Definition: naivemh.h:214
long int integer
Definition: colamd.c:51
integer iSize
Definition: naivemh.h:58
NaivePermMatrixHandler::~NaivePermMatrixHandler ( void  )
virtual

Definition at line 572 of file naivemh.cc.

References DEBUGCOUTFNAME.

573 {
574  DEBUGCOUTFNAME("NaivePermMatrixHandler::~NaivePermMatrixHandler");
575 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256

Member Function Documentation

NaivePermMatrixHandler::const_iterator NaivePermMatrixHandler::begin ( void  ) const
inline

Definition at line 249 of file naivemh.h.

Referenced by main().

249  {
250  return const_iterator(*this);
251  };
const NaivePermMatrixHandler::const_iterator& NaivePermMatrixHandler::end ( void  ) const
inline

Definition at line 253 of file naivemh.h.

References m_end.

Referenced by main().

253  {
254  return m_end;
255  };
const_iterator m_end
Definition: naivemh.h:246
const std::vector< integer > & NaivePermMatrixHandler::GetInvPerm ( void  ) const

Definition at line 591 of file naivemh.cc.

References ASSERT, invperm, and NaiveMatrixHandler::iSize.

592 {
593 #ifdef DEBUG
594  ASSERT(invperm.size() == (size_t)iSize);
595 
596  for (integer i = 0; i < iSize; ++i) {
597  ASSERT(invperm[i] >= 0 && invperm[i] < iSize);
598  }
599 #endif
600  return invperm;
601 }
#define ASSERT(expression)
Definition: colamd.c:977
const std::vector< integer > & invperm
Definition: naivemh.h:214
long int integer
Definition: colamd.c:51
integer iSize
Definition: naivemh.h:58
const std::vector< integer > & NaivePermMatrixHandler::GetPerm ( void  ) const

Definition at line 578 of file naivemh.cc.

References ASSERT, NaiveMatrixHandler::iSize, and perm.

579 {
580 #ifdef DEBUG
581  ASSERT(perm.size() == (size_t)iSize);
582 
583  for (integer i = 0; i < iSize; ++i) {
584  ASSERT(perm[i] >= 0 && perm[i] < iSize);
585  }
586 #endif
587  return perm;
588 }
const std::vector< integer > & perm
Definition: naivemh.h:213
#define ASSERT(expression)
Definition: colamd.c:977
long int integer
Definition: colamd.c:51
integer iSize
Definition: naivemh.h:58
MatrixHandler & NaivePermMatrixHandler::MatMatMul_base ( void(MatrixHandler::*)(integer iRow, integer iCol, const doublereal &dCoef)  op,
MatrixHandler out,
const MatrixHandler in 
) const
protectedvirtual

Reimplemented from NaiveMatrixHandler.

Definition at line 605 of file naivemh.cc.

References ASSERT, MatrixHandler::iGetNumCols(), MatrixHandler::iGetNumRows(), invperm, NaiveMatrixHandler::iSize, perm, NaiveMatrixHandler::piNzc, NaiveMatrixHandler::ppdRows, and NaiveMatrixHandler::ppiCols.

608 {
609 #ifdef DEBUG
610  ASSERT(perm.size() == (size_t)iSize);
611  ASSERT(invperm.size() == (size_t)iSize);
612 
613  for (integer i = 0; i < iSize; ++i) {
614  ASSERT(invperm[i] >= 0 && invperm[i] < iSize);
615  ASSERT(perm[i] >= 0 && perm[i] < iSize);
616  }
617 #endif
618 
619  ASSERT(in.iGetNumRows() == iSize);
620  ASSERT(out.iGetNumRows() == iSize);
621  ASSERT(out.iGetNumCols() == in.iGetNumCols());
622 
623  integer in_ncols = in.iGetNumCols();
624 
625  for (integer ir = 0; ir < iSize; ir++) {
626  for (integer idx = 0; idx < piNzc[ir]; idx++) {
627  integer ic = ppiCols[ir][idx];
628  for (integer ik = 1; ik <= in_ncols; ik++) {
629  (out.*op)(ir + 1, ik, ppdRows[ir][ic]*in(invperm[ic] + 1, ik));
630  }
631  }
632  }
633 
634  return out;
635 }
doublereal ** ppdRows
Definition: naivemh.h:60
virtual integer iGetNumCols(void) const =0
integer * piNzc
Definition: naivemh.h:63
const std::vector< integer > & perm
Definition: naivemh.h:213
integer ** ppiCols
Definition: naivemh.h:61
#define ASSERT(expression)
Definition: colamd.c:977
const std::vector< integer > & invperm
Definition: naivemh.h:214
long int integer
Definition: colamd.c:51
integer iSize
Definition: naivemh.h:58
virtual integer iGetNumRows(void) const =0

Here is the call graph for this function:

MatrixHandler & NaivePermMatrixHandler::MatTMatMul_base ( void(MatrixHandler::*)(integer iRow, integer iCol, const doublereal &dCoef)  op,
MatrixHandler out,
const MatrixHandler in 
) const
protectedvirtual

Reimplemented from NaiveMatrixHandler.

Definition at line 638 of file naivemh.cc.

References ASSERT, MatrixHandler::iGetNumCols(), MatrixHandler::iGetNumRows(), invperm, NaiveMatrixHandler::iSize, perm, NaiveMatrixHandler::piNzr, NaiveMatrixHandler::ppdRows, and NaiveMatrixHandler::ppiRows.

641 {
642 #ifdef DEBUG
643  ASSERT(perm.size() == (size_t)iSize);
644  ASSERT(invperm.size() == (size_t)iSize);
645 
646  for (integer i = 0; i < iSize; ++i) {
647  ASSERT(invperm[i] >= 0 && invperm[i] < iSize);
648  ASSERT(perm[i] >= 0 && perm[i] < iSize);
649  }
650 #endif
651  ASSERT(in.iGetNumRows() == iSize);
652  ASSERT(out.iGetNumRows() == iSize);
653  ASSERT(out.iGetNumCols() == in.iGetNumCols());
654 
655  integer in_ncols = in.iGetNumCols();
656 
657  for (integer ic = 0; ic < iSize; ic++) {
658  for (integer idx = 0; idx < piNzr[ic]; idx++) {
659  integer ir = ppiRows[ic][idx];
660  for (integer ik = 1; ik <= in_ncols; ik++) {
661  (out.*op)(invperm[ic] + 1, ik, ppdRows[ir][ic]*in(ir + 1, ik));
662  }
663  }
664  }
665 
666  return out;
667 }
doublereal ** ppdRows
Definition: naivemh.h:60
integer * piNzr
Definition: naivemh.h:63
virtual integer iGetNumCols(void) const =0
integer ** ppiRows
Definition: naivemh.h:61
const std::vector< integer > & perm
Definition: naivemh.h:213
#define ASSERT(expression)
Definition: colamd.c:977
const std::vector< integer > & invperm
Definition: naivemh.h:214
long int integer
Definition: colamd.c:51
integer iSize
Definition: naivemh.h:58
virtual integer iGetNumRows(void) const =0

Here is the call graph for this function:

VectorHandler & NaivePermMatrixHandler::MatTVecMul_base ( void(VectorHandler::*)(integer iRow, const doublereal &dCoef)  op,
VectorHandler out,
const VectorHandler in 
) const
protectedvirtual

Reimplemented from NaiveMatrixHandler.

Definition at line 698 of file naivemh.cc.

References ASSERT, VectorHandler::iGetSize(), invperm, NaiveMatrixHandler::iSize, perm, NaiveMatrixHandler::piNzr, NaiveMatrixHandler::ppdRows, and NaiveMatrixHandler::ppiRows.

701 {
702 #ifdef DEBUG
703  ASSERT(perm.size() == (size_t)iSize);
704  ASSERT(invperm.size() == (size_t)iSize);
705 
706  for (integer i = 0; i < iSize; ++i) {
707  ASSERT(invperm[i] >= 0 && invperm[i] < iSize);
708  ASSERT(perm[i] >= 0 && perm[i] < iSize);
709  }
710 #endif
711  ASSERT(in.iGetSize() == iSize);
712  ASSERT(out.iGetSize() == iSize);
713 
714  for (integer ic = 0; ic < iSize; ic++) {
715  for (integer idx = 0; idx < piNzr[ic]; idx++) {
716  integer ir = ppiRows[ic][idx];
717  (out.*op)(invperm[ic] + 1, ppdRows[ir][ic]*in(ir + 1));
718  }
719  }
720 
721  return out;
722 }
doublereal ** ppdRows
Definition: naivemh.h:60
integer * piNzr
Definition: naivemh.h:63
integer ** ppiRows
Definition: naivemh.h:61
virtual integer iGetSize(void) const =0
const std::vector< integer > & perm
Definition: naivemh.h:213
#define ASSERT(expression)
Definition: colamd.c:977
const std::vector< integer > & invperm
Definition: naivemh.h:214
long int integer
Definition: colamd.c:51
integer iSize
Definition: naivemh.h:58

Here is the call graph for this function:

VectorHandler & NaivePermMatrixHandler::MatVecMul_base ( void(VectorHandler::*)(integer iRow, const doublereal &dCoef)  op,
VectorHandler out,
const VectorHandler in 
) const
protectedvirtual

Reimplemented from NaiveMatrixHandler.

Definition at line 671 of file naivemh.cc.

References ASSERT, VectorHandler::iGetSize(), invperm, NaiveMatrixHandler::iSize, perm, NaiveMatrixHandler::piNzc, NaiveMatrixHandler::ppdRows, and NaiveMatrixHandler::ppiCols.

674 {
675 #ifdef DEBUG
676  ASSERT(perm.size() == (size_t)iSize);
677  ASSERT(invperm.size() == (size_t)iSize);
678 
679  for (integer i = 0; i < iSize; ++i) {
680  ASSERT(invperm[i] >= 0 && invperm[i] < iSize);
681  ASSERT(perm[i] >= 0 && perm[i] < iSize);
682  }
683 #endif
684  ASSERT(in.iGetSize() == iSize);
685  ASSERT(out.iGetSize() == iSize);
686 
687  for (integer ir = 0; ir < iSize; ir++) {
688  for (integer idx = 0; idx < piNzc[ir]; idx++) {
689  integer ic = ppiCols[ir][idx];
690  (out.*op)(ir + 1, ppdRows[ir][ic]*in(invperm[ic] + 1));
691  }
692  }
693 
694  return out;
695 }
doublereal ** ppdRows
Definition: naivemh.h:60
integer * piNzc
Definition: naivemh.h:63
virtual integer iGetSize(void) const =0
const std::vector< integer > & perm
Definition: naivemh.h:213
integer ** ppiCols
Definition: naivemh.h:61
#define ASSERT(expression)
Definition: colamd.c:977
const std::vector< integer > & invperm
Definition: naivemh.h:214
long int integer
Definition: colamd.c:51
integer iSize
Definition: naivemh.h:58

Here is the call graph for this function:

virtual const doublereal& NaivePermMatrixHandler::operator() ( integer  iRow,
integer  iCol 
) const
inlinevirtual

Reimplemented from NaiveMatrixHandler.

Definition at line 274 of file naivemh.h.

References ASSERT, NaiveMatrixHandler::iGetNumCols(), NaiveMatrixHandler::iGetNumRows(), NaiveMatrixHandler::operator()(), and perm.

274  {
275  ASSERT(iRow > 0);
276  ASSERT(iRow <= iGetNumRows());
277  ASSERT(iCol > 0);
278  ASSERT(iCol <= iGetNumCols());
279 
280  ASSERT(perm.size() == (size_t)iGetNumRows());
281  ASSERT(perm.size() == (size_t)iGetNumCols());
282 
283  /* FIXME: stupid 0/1 based arrays... */
284  iCol = perm[iCol - 1] + 1;
285  return NaiveMatrixHandler::operator()(iRow, iCol);
286  };
integer iGetNumRows(void) const
Definition: naivemh.h:111
integer iGetNumCols(void) const
Definition: naivemh.h:115
const std::vector< integer > & perm
Definition: naivemh.h:213
#define ASSERT(expression)
Definition: colamd.c:977
virtual const doublereal & operator()(integer iRow, integer iCol) const
Definition: naivemh.h:173

Here is the call graph for this function:

virtual doublereal& NaivePermMatrixHandler::operator() ( integer  iRow,
integer  iCol 
)
inlinevirtual

Reimplemented from NaiveMatrixHandler.

Definition at line 289 of file naivemh.h.

References ASSERT, NaiveMatrixHandler::iGetNumCols(), NaiveMatrixHandler::iGetNumRows(), NaiveMatrixHandler::operator()(), and perm.

289  {
290  ASSERT(iRow > 0);
291  ASSERT(iRow <= iGetNumRows());
292  ASSERT(iCol > 0);
293  ASSERT(iCol <= iGetNumCols());
294 
295  ASSERT(perm.size() == (size_t)iGetNumRows());
296  ASSERT(perm.size() == (size_t)iGetNumCols());
297 
298  /* FIXME: stupid 0/1 based arrays... */
299  iCol = perm[iCol - 1] + 1;
300  return NaiveMatrixHandler::operator()(iRow, iCol);
301  };
integer iGetNumRows(void) const
Definition: naivemh.h:111
integer iGetNumCols(void) const
Definition: naivemh.h:115
const std::vector< integer > & perm
Definition: naivemh.h:213
#define ASSERT(expression)
Definition: colamd.c:977
virtual const doublereal & operator()(integer iRow, integer iCol) const
Definition: naivemh.h:173

Here is the call graph for this function:

Member Data Documentation

const_iterator NaivePermMatrixHandler::m_end
protected

Definition at line 246 of file naivemh.h.

Referenced by end().


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