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

#include <spmh.h>

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

Classes

class  const_iterator
 

Public Member Functions

 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 ()
 
virtual
CompactSparseMatrixHandler
Copy (void) const =0
 
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
 
virtual VectorHandlerGetCol (integer icol, VectorHandler &out) const =0
 
- Public Member Functions inherited from MatrixHandler
virtual ~MatrixHandler (void)
 
virtual void Resize (integer, integer)=0
 
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 const doublerealoperator() (integer iRow, integer iCol) const =0
 
virtual doublerealoperator() (integer iRow, integer iCol)=0
 
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
 

Protected Member Functions

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

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
 

Additional Inherited Members

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

Detailed Description

template<int off>
class CompactSparseMatrixHandler_tpl< off >

Definition at line 210 of file spmh.h.

Constructor & Destructor Documentation

template<int off>
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 
)

Definition at line 148 of file spmh.cc.

References NO_OP.

154 : CompactSparseMatrixHandler(n, nn, x, i, p),
155 m_end(*this, true)
156 {
157  NO_OP;
158 }
CompactSparseMatrixHandler_tpl< off >::const_iterator m_end
Definition: spmh.h:259
#define NO_OP
Definition: myassert.h:74
CompactSparseMatrixHandler(const integer &n, const integer &nn, std::vector< doublereal > &x, const std::vector< integer > &i, const std::vector< integer > &p)
Definition: spmh.cc:49
template<int off>
CompactSparseMatrixHandler_tpl< off >::~CompactSparseMatrixHandler_tpl ( void  )
virtual

Definition at line 161 of file spmh.cc.

References NO_OP.

162 {
163  NO_OP;
164 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

template<int off>
CompactSparseMatrixHandler_tpl<off>::const_iterator CompactSparseMatrixHandler_tpl< off >::begin ( void  ) const
inline

Definition at line 262 of file spmh.h.

Referenced by main().

template<int off>
const CompactSparseMatrixHandler_tpl<off>::const_iterator& CompactSparseMatrixHandler_tpl< off >::end ( void  ) const
inline

Definition at line 266 of file spmh.h.

References CompactSparseMatrixHandler_tpl< off >::m_end.

Referenced by main().

266  {
267  return m_end;
268  };
CompactSparseMatrixHandler_tpl< off >::const_iterator m_end
Definition: spmh.h:259
template<int off>
MatrixHandler & CompactSparseMatrixHandler_tpl< off >::MatMatMul_base ( void(MatrixHandler::*)(integer iRow, integer iCol, const doublereal &dCoef)  op,
MatrixHandler out,
const MatrixHandler in 
) const
protectedvirtual

Reimplemented from MatrixHandler.

Definition at line 169 of file spmh.cc.

References ASSERT, MatrixHandler::iGetNumCols(), MatrixHandler::iGetNumRows(), SparseMatrixHandler::NCols, and SparseMatrixHandler::NRows.

172 {
173  ASSERT(in.iGetNumRows() == NCols);
174  ASSERT(out.iGetNumRows() == NRows);
175  ASSERT(in.iGetNumCols() == out.iGetNumCols());
176 
177  // NOTE: out must be zeroed by caller
178 
179  integer ncols_in = in.iGetNumCols();
180 
181  for (integer col_idx = 1; col_idx <= NCols; col_idx++) {
182  integer re = Ap[col_idx] - off;
183  integer ri = Ap[col_idx - 1] - off;
184  for ( ; ri < re; ri++) {
185  integer row_idx = Ai[ri] - off + 1;
186  const doublereal& d = Ax[ri];
187  for (integer col_in = 1; col_in <= ncols_in; col_in++) {
188  (out.*op)(row_idx, col_in, d*in(col_idx, col_in));
189  }
190  }
191  }
192 
193  return out;
194 }
virtual integer iGetNumCols(void) const =0
const std::vector< integer > & Ap
Definition: spmh.h:154
const std::vector< integer > & Ai
Definition: spmh.h:153
std::vector< doublereal > & Ax
Definition: spmh.h:152
#define ASSERT(expression)
Definition: colamd.c:977
integer NRows
Definition: spmh.h:45
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
integer NCols
Definition: spmh.h:46
virtual integer iGetNumRows(void) const =0

Here is the call graph for this function:

template<int off>
MatrixHandler & CompactSparseMatrixHandler_tpl< off >::MatTMatMul_base ( void(MatrixHandler::*)(integer iRow, integer iCol, const doublereal &dCoef)  op,
MatrixHandler out,
const MatrixHandler in 
) const
protectedvirtual

Reimplemented from MatrixHandler.

Definition at line 199 of file spmh.cc.

References ASSERT, MatrixHandler::iGetNumCols(), MatrixHandler::iGetNumRows(), SparseMatrixHandler::NCols, and SparseMatrixHandler::NRows.

202 {
203  ASSERT(in.iGetNumRows() == NRows);
204  ASSERT(out.iGetNumRows() == NCols);
205  ASSERT(in.iGetNumCols() == out.iGetNumCols());
206  // NOTE: out must be zeroed by caller
207 
208  integer ncols_in = in.iGetNumCols();
209 
210  for (integer col_idx = 1; col_idx <= NCols; col_idx++) {
211  integer re = Ap[col_idx] - off;
212  integer ri = Ap[col_idx - 1] - off;
213  for ( ; ri < re; ri++) {
214  integer row_idx = Ai[ri] - off + 1;
215  const doublereal& d = Ax[ri];
216  for (integer col_in = 1; col_in <= ncols_in; col_in++) {
217  (out.*op)(col_idx, col_in, d*in(row_idx, col_in));
218  }
219  }
220  }
221 
222  return out;
223 }
virtual integer iGetNumCols(void) const =0
const std::vector< integer > & Ap
Definition: spmh.h:154
const std::vector< integer > & Ai
Definition: spmh.h:153
std::vector< doublereal > & Ax
Definition: spmh.h:152
#define ASSERT(expression)
Definition: colamd.c:977
integer NRows
Definition: spmh.h:45
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
integer NCols
Definition: spmh.h:46
virtual integer iGetNumRows(void) const =0

Here is the call graph for this function:

template<int off>
VectorHandler & CompactSparseMatrixHandler_tpl< off >::MatTVecMul_base ( void(VectorHandler::*)(integer iRow, const doublereal &dCoef)  op,
VectorHandler out,
const VectorHandler in 
) const
protectedvirtual

Reimplemented from MatrixHandler.

Definition at line 253 of file spmh.cc.

References ASSERT, VectorHandler::iGetSize(), SparseMatrixHandler::NCols, and SparseMatrixHandler::NRows.

257 {
258  ASSERT(in.iGetSize() == NRows);
259  ASSERT(out.iGetSize() == NCols);
260 
261  // NOTE: out must be zeroed by caller
262 
263  for (integer col_idx = 1; col_idx <= NCols; col_idx++) {
264  integer re = Ap[col_idx] - off;
265  integer ri = Ap[col_idx - 1] - off;
266  for ( ; ri < re; ri++) {
267  integer row_idx = Ai[ri] - off + 1;
268  const doublereal& d = Ax[ri];
269  (out.*op)(col_idx, d*in(row_idx));
270  }
271  }
272 
273  return out;
274 }
const std::vector< integer > & Ap
Definition: spmh.h:154
virtual integer iGetSize(void) const =0
const std::vector< integer > & Ai
Definition: spmh.h:153
std::vector< doublereal > & Ax
Definition: spmh.h:152
#define ASSERT(expression)
Definition: colamd.c:977
integer NRows
Definition: spmh.h:45
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
integer NCols
Definition: spmh.h:46

Here is the call graph for this function:

template<int off>
VectorHandler & CompactSparseMatrixHandler_tpl< off >::MatVecMul_base ( void(VectorHandler::*)(integer iRow, const doublereal &dCoef)  op,
VectorHandler out,
const VectorHandler in 
) const
protectedvirtual

Reimplemented from MatrixHandler.

Definition at line 228 of file spmh.cc.

References ASSERT, VectorHandler::iGetSize(), SparseMatrixHandler::NCols, and SparseMatrixHandler::NRows.

231 {
232  ASSERT(in.iGetSize() == NCols);
233  ASSERT(out.iGetSize() == NRows);
234 
235  // NOTE: out must be zeroed by caller
236 
237  for (integer col_idx = 1; col_idx <= NCols; col_idx++) {
238  integer re = Ap[col_idx] - off;
239  integer ri = Ap[col_idx - 1] - off;
240  for ( ; ri < re; ri++) {
241  integer row_idx = Ai[ri] - off + 1;
242  const doublereal& d = Ax[ri];
243  (out.*op)(row_idx, d*in(col_idx));
244  }
245  }
246 
247  return out;
248 }
const std::vector< integer > & Ap
Definition: spmh.h:154
virtual integer iGetSize(void) const =0
const std::vector< integer > & Ai
Definition: spmh.h:153
std::vector< doublereal > & Ax
Definition: spmh.h:152
#define ASSERT(expression)
Definition: colamd.c:977
integer NRows
Definition: spmh.h:45
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
integer NCols
Definition: spmh.h:46

Here is the call graph for this function:

Member Data Documentation

template<int off>
CompactSparseMatrixHandler_tpl<off>::const_iterator CompactSparseMatrixHandler_tpl< off >::m_end
protected

Definition at line 259 of file spmh.h.

Referenced by CompactSparseMatrixHandler_tpl< off >::end().


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