MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
CColMatrixHandler< off > Class Template Reference

#include <ccmh.h>

Inheritance diagram for CColMatrixHandler< off >:
Collaboration diagram for CColMatrixHandler< off >:

Public Member Functions

 CColMatrixHandler (std::vector< doublereal > &x, const std::vector< integer > &i, const std::vector< integer > &p)
 
virtual ~CColMatrixHandler ()
 
CompactSparseMatrixHandlerCopy (void) const
 
doublerealoperator() (integer i_row, integer i_col)
 
const doublerealoperator() (integer i_row, integer i_col) const
 
void Resize (integer ir, integer ic)
 
VectorHandlerGetCol (integer icol, VectorHandler &out) const
 
MatrixHandlerMulAndSumWithShift (MatrixHandler &out, doublereal s=1., integer drow=0, integer dcol=0) const
 
MatrixHandlerFakeThirdOrderMulAndSumWithShift (MatrixHandler &out, std::vector< bool > b, doublereal s=1., integer drow=0, integer dcol=0) const
 
- Public Member Functions inherited from CompactSparseMatrixHandler_tpl< off >
 CompactSparseMatrixHandler_tpl (const integer &n, const integer &nn, std::vector< doublereal > &x, const std::vector< integer > &i, const std::vector< integer > &p)
 
virtual ~CompactSparseMatrixHandler_tpl (void)
 
CompactSparseMatrixHandler_tpl
< off >::const_iterator 
begin (void) const
 
const
CompactSparseMatrixHandler_tpl
< off >::const_iterator
end (void) const
 
- Public Member Functions inherited from CompactSparseMatrixHandler
 CompactSparseMatrixHandler (const integer &n, const integer &nn, std::vector< doublereal > &x, const std::vector< integer > &i, const std::vector< integer > &p)
 
virtual ~CompactSparseMatrixHandler ()
 
void AddUnchecked (const CompactSparseMatrixHandler &m)
 
virtual const doublerealpdGetMat (void) const
 
void Reset (void)
 
virtual integer MakeCompressedColumnForm (doublereal *const Ax, integer *const Ai, integer *const Ap, int offset=0) const
 
virtual integer MakeCompressedColumnForm (std::vector< doublereal > &Ax, std::vector< integer > &Ai, std::vector< integer > &Ap, int offset=0) const
 
virtual integer MakeIndexForm (doublereal *const Ax, integer *const Arow, integer *const Acol, integer *const AcolSt, int offset=0) const
 
virtual integer MakeIndexForm (std::vector< doublereal > &Ax, std::vector< integer > &Arow, std::vector< integer > &Acol, std::vector< integer > &AcolSt, int offset=0) const
 
- Public Member Functions inherited from SparseMatrixHandler
const integer Nz () const
 
 SparseMatrixHandler (const integer &n, const integer &nn=0)
 
virtual ~SparseMatrixHandler (void)
 
integer iGetNumRows (void) const
 
integer iGetNumCols (void) const
 
- Public Member Functions inherited from MatrixHandler
virtual ~MatrixHandler (void)
 
virtual void ResizeReset (integer, integer)
 
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 MatrixHandleroperator+= (const SubMatrixHandler &SubMH)
 
virtual MatrixHandleroperator-= (const SubMatrixHandler &SubMH)
 
virtual MatrixHandleroperator+= (const VariableSubMatrixHandler &SubMH)
 
virtual MatrixHandleroperator-= (const VariableSubMatrixHandler &SubMH)
 
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
 

Additional Inherited Members

- Public Types inherited from MatrixHandler
enum  Norm_t { NORM_1, NORM_INF }
 
- Protected Member Functions inherited from CompactSparseMatrixHandler_tpl< off >
MatrixHandlerMatMatMul_base (void(MatrixHandler::*op)(integer iRow, integer iCol, const doublereal &dCoef), MatrixHandler &out, const MatrixHandler &in) const
 
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 inherited from CompactSparseMatrixHandler_tpl< off >
CompactSparseMatrixHandler_tpl
< off >::const_iterator 
m_end
 
- Protected Attributes inherited from CompactSparseMatrixHandler
bool bMatDuplicate
 
std::vector< doublereal > & Ax
 
const std::vector< integer > & Ai
 
const std::vector< integer > & Ap
 
- Protected Attributes inherited from SparseMatrixHandler
integer NRows
 
integer NCols
 
integer NZ
 

Detailed Description

template<int off>
class CColMatrixHandler< off >

Definition at line 46 of file ccmh.h.

Constructor & Destructor Documentation

template<int off>
CColMatrixHandler< off >::CColMatrixHandler ( std::vector< doublereal > &  x,
const std::vector< integer > &  i,
const std::vector< integer > &  p 
)

Definition at line 41 of file ccmh.cc.

References NO_OP.

44 : CompactSparseMatrixHandler_tpl<off>(p.size() - 1, p.size() - 1, x, i, p)
45 {
46  NO_OP;
47 }
#define NO_OP
Definition: myassert.h:74
template<int off>
CColMatrixHandler< off >::~CColMatrixHandler ( )
virtual

Definition at line 50 of file ccmh.cc.

References NO_OP.

51 {
52  NO_OP;
53 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

template<int off>
CompactSparseMatrixHandler * CColMatrixHandler< off >::Copy ( void  ) const
virtual

Implements CompactSparseMatrixHandler.

Definition at line 59 of file ccmh.cc.

References CompactSparseMatrixHandler::bMatDuplicate.

60 {
61  std::vector<doublereal> *pax =
62  new std::vector<doublereal>(CompactSparseMatrixHandler_tpl<off>::Ax);
66  p->bMatDuplicate = true;
67 
68  return p;
69 }
template<int off>
MatrixHandler & CColMatrixHandler< off >::FakeThirdOrderMulAndSumWithShift ( MatrixHandler out,
std::vector< bool b,
doublereal  s = 1.,
integer  drow = 0,
integer  dcol = 0 
) const

Definition at line 132 of file ccmh.cc.

References SparseMatrixHandler::iGetNumCols(), MatrixHandler::iGetNumCols(), SparseMatrixHandler::iGetNumRows(), MatrixHandler::iGetNumRows(), MatrixHandler::IncCoef(), and MBDYN_EXCEPT_ARGS.

137 {
138  silent_cerr("CColMatrixHandler<off>::FakeThirdOrderMulAndSumWithShift "
139  "called" << std::endl);
141  if ((out.iGetNumCols() < SparseMatrixHandler::iGetNumCols() + dcol)
142  || (out.iGetNumRows() < SparseMatrixHandler::iGetNumRows() + drow)) {
143  silent_cerr("Assertion fault "
144  "in CColMatrixHandler<off>::MulAndSumWithShift"
145  << std::endl);
147  }
148  drow = drow + 1;
149  for (integer col = 0; col < SparseMatrixHandler::iGetNumCols(); col++) {
151  integer idxe = CompactSparseMatrixHandler_tpl<off>::Ap[col + 1] - off;
152  integer newcol = col + dcol + 1;
153  for (; idx < idxe; idx++) {
154  if (b[CompactSparseMatrixHandler_tpl<off>::Ai[idx] - off]) {
155  out.IncCoef(CompactSparseMatrixHandler_tpl<off>::Ai[idx] - off + drow,
157  }
158  }
159  }
160  return out;
161 }
virtual integer iGetNumCols(void) const =0
virtual void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: mh.cc:374
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iGetNumRows(void) const
Definition: spmh.h:113
integer iGetNumCols(void) const
Definition: spmh.h:117
long int integer
Definition: colamd.c:51
virtual integer iGetNumRows(void) const =0

Here is the call graph for this function:

template<int off>
VectorHandler & CColMatrixHandler< off >::GetCol ( integer  icol,
VectorHandler out 
) const
virtual

Implements SparseMatrixHandler.

Definition at line 82 of file ccmh.cc.

References SparseMatrixHandler::iGetNumCols(), and MBDYN_EXCEPT_ARGS.

83 {
84  // NOTE: out must be zeroed by caller
85 
86  if (icol > SparseMatrixHandler::iGetNumCols()) {
88  }
89 
92 
93  for ( ; idx < idxe; idx++) {
94  out(CompactSparseMatrixHandler_tpl<off>::Ai[idx] - off + 1) =
96  }
97 
98  return out;
99 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iGetNumCols(void) const
Definition: spmh.h:117
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

template<int off>
MatrixHandler & CColMatrixHandler< off >::MulAndSumWithShift ( MatrixHandler out,
doublereal  s = 1.,
integer  drow = 0,
integer  dcol = 0 
) const

Definition at line 104 of file ccmh.cc.

References SparseMatrixHandler::iGetNumCols(), MatrixHandler::iGetNumCols(), SparseMatrixHandler::iGetNumRows(), MatrixHandler::iGetNumRows(), MatrixHandler::IncCoef(), and MBDYN_EXCEPT_ARGS.

106 {
107  silent_cerr("CColMatrixHandler<off>::MulAndSumWithShift called"
108  << std::endl);
110  if ((out.iGetNumCols() < SparseMatrixHandler::iGetNumCols() + dcol)
111  || (out.iGetNumRows() < SparseMatrixHandler::iGetNumRows() + drow)) {
112  silent_cerr("Assertion fault "
113  "in CColMatrixHandler<off>::MulAndSumWithShift"
114  << std::endl);
116  }
117  drow = drow + 1;
118  for (integer col = 0; col < SparseMatrixHandler::iGetNumCols(); col++) {
120  integer idxe = CompactSparseMatrixHandler_tpl<off>::Ap[col + 1] - off;
121  integer newcol = col + dcol + 1;
122  for (; idx < idxe; idx++) {
123  out.IncCoef(CompactSparseMatrixHandler_tpl<off>::Ai[idx] - off + drow,
125  }
126  }
127  return out;
128 }
virtual integer iGetNumCols(void) const =0
virtual void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: mh.cc:374
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iGetNumRows(void) const
Definition: spmh.h:113
integer iGetNumCols(void) const
Definition: spmh.h:117
long int integer
Definition: colamd.c:51
virtual integer iGetNumRows(void) const =0

Here is the call graph for this function:

template<int off>
doublereal& CColMatrixHandler< off >::operator() ( integer  i_row,
integer  i_col 
)
inlinevirtual

Implements MatrixHandler.

Definition at line 66 of file ccmh.h.

References ASSERTMSGBREAK, SparseMatrixHandler::iGetNumCols(), SparseMatrixHandler::iGetNumRows(), and MBDYN_EXCEPT_ARGS.

66  {
67  ASSERTMSGBREAK(i_row > 0 && i_row <= SparseMatrixHandler::iGetNumRows(),
68  "Error in CColMatrixHandler::operator(), "
69  "row index out of range");
70  ASSERTMSGBREAK(i_col > 0 && i_col <= SparseMatrixHandler::iGetNumCols(),
71  "Error in CColMatrixHandler::operator(), "
72  "col index out of range");
73  i_row--;
74  integer row_begin = CompactSparseMatrixHandler_tpl<off>::Ap[i_col - 1] - off;
75  integer row_end = CompactSparseMatrixHandler_tpl<off>::Ap[i_col] - off - 1;
76  integer idx;
77  integer row;
78 
79  if (row_begin == (CompactSparseMatrixHandler_tpl<off>::Ap[i_col] - off)
80  || (CompactSparseMatrixHandler_tpl<off>::Ai[row_begin] - off) > i_row
81  || (CompactSparseMatrixHandler_tpl<off>::Ai[row_end] - off) < i_row)
82  {
83  /* matrix must be rebuilt */
85  }
86 
87  while (row_end >= row_begin) {
88  idx = (row_begin + row_end)/2;
90  if (i_row < row) {
91  row_end = idx - 1;
92  } else if (i_row > row) {
93  row_begin = idx + 1;
94  } else {
96  }
97  }
98 
99  /* matrix must be rebuilt */
101  };
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iGetNumRows(void) const
Definition: spmh.h:113
integer iGetNumCols(void) const
Definition: spmh.h:117
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

template<int off>
const doublereal& CColMatrixHandler< off >::operator() ( integer  i_row,
integer  i_col 
) const
inlinevirtual

Implements MatrixHandler.

Definition at line 103 of file ccmh.h.

References ASSERTMSGBREAK, SparseMatrixHandler::iGetNumCols(), SparseMatrixHandler::iGetNumRows(), and Zero1.

103  {
104  ASSERTMSGBREAK(i_row > 0 && i_row <= SparseMatrixHandler::iGetNumRows(),
105  "Error in CColMatrixHandler::operator(), "
106  "row index out of range");
107  ASSERTMSGBREAK(i_col > 0 && i_col <= SparseMatrixHandler::iGetNumCols(),
108  "Error in CColMatrixHandler::operator(), "
109  "col index out of range");
110  i_row--;
111  integer row_begin = CompactSparseMatrixHandler_tpl<off>::Ap[i_col - 1] - off;
112  integer row_end = CompactSparseMatrixHandler_tpl<off>::Ap[i_col] - off - 1;
113  integer idx;
114  integer row;
115 
116  if (row_begin == CompactSparseMatrixHandler_tpl<off>::Ap[i_col] - off
117  || CompactSparseMatrixHandler_tpl<off>::Ai[row_begin] - off > i_row
118  || CompactSparseMatrixHandler_tpl<off>::Ai[row_end] - off < i_row)
119  {
121  }
122 
123  while (row_end >= row_begin) {
124  idx = (row_begin + row_end)/2;
126  if (i_row < row) {
127  row_end = idx - 1;
128  } else if (i_row > row) {
129  row_begin = idx + 1;
130  } else {
132  }
133  }
134 
136  };
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
integer iGetNumRows(void) const
Definition: spmh.h:113
integer iGetNumCols(void) const
Definition: spmh.h:117
const doublereal Zero1
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

template<int off>
void CColMatrixHandler< off >::Resize ( integer  ir,
integer  ic 
)
virtual

Implements MatrixHandler.

Definition at line 73 of file ccmh.cc.

References MBDYN_EXCEPT_ARGS.

74 {
75  silent_cerr("CColMatrixHandler<off>::Resize called" << std::endl);
77 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63

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