COPASI API  4.16.103
Public Types | Public Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
CLinkMatrixView Class Reference

#include <CLinkMatrix.h>

Collaboration diagram for CLinkMatrixView:
Collaboration graph
[legend]

Public Types

typedef C_FLOAT64 elementType
 

Public Member Functions

 CLinkMatrixView (const CLinkMatrix &A)
 
size_t numCols () const
 
size_t numRows () const
 
C_FLOAT64operator() (const size_t &row, const size_t &col) const
 
CLinkMatrixViewoperator= (const CLinkMatrixView &rhs)
 
 ~CLinkMatrixView ()
 

Private Attributes

const CLinkMatrixmpA
 
const size_t * mpNumIndependent
 

Static Private Attributes

static const C_FLOAT64 mUnit = 1.0
 
static const C_FLOAT64 mZero = 0.0
 

Friends

std::ostream & operator<< (std::ostream &os, const CLinkMatrixView &A)
 

Detailed Description

Definition at line 203 of file CLinkMatrix.h.

Member Typedef Documentation

Definition at line 206 of file CLinkMatrix.h.

Constructor & Destructor Documentation

CLinkMatrixView::CLinkMatrixView ( const CLinkMatrix A)

Default constructor

Parameters
constconst CLinkMatrix & A
constsize_t & mNumIndependent

Definition at line 589 of file CLinkMatrix.cpp.

References CONSTRUCTOR_TRACE.

589  :
590  mpA(&A),
const size_t & getNumIndependent() const
const CLinkMatrix * mpA
Definition: CLinkMatrix.h:209
const size_t * mpNumIndependent
Definition: CLinkMatrix.h:210
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202
CLinkMatrixView::~CLinkMatrixView ( )

Destructor.

Definition at line 594 of file CLinkMatrix.cpp.

References DESTRUCTOR_TRACE.

#define DESTRUCTOR_TRACE
Definition: copasi.h:206

Member Function Documentation

size_t CLinkMatrixView::numCols ( ) const

The number of columns of the matrix

Returns
size_t cols

Definition at line 611 of file CLinkMatrix.cpp.

References mpA, and CMatrix< CType >::numCols().

Referenced by operator<<().

612 {
613  return mpA->numCols();
614 }
const CLinkMatrix * mpA
Definition: CLinkMatrix.h:209
virtual size_t numCols() const
Definition: CMatrix.h:144
size_t CLinkMatrixView::numRows ( ) const

The number of rows of the matrix.

Returns
size_t rows

Definition at line 606 of file CLinkMatrix.cpp.

References mpA, mpNumIndependent, and CMatrix< CType >::numRows().

Referenced by operator<<().

607 {
608  return *mpNumIndependent + mpA->numRows();
609 }
virtual size_t numRows() const
Definition: CMatrix.h:138
const CLinkMatrix * mpA
Definition: CLinkMatrix.h:209
const size_t * mpNumIndependent
Definition: CLinkMatrix.h:210
C_FLOAT64& CLinkMatrixView::operator() ( const size_t &  row,
const size_t &  col 
) const
inline

Retrieve a matrix element using the c-style indexing.

Parameters
constsize_t & row
constsize_t & col
Returns
elementType & element

Definition at line 252 of file CLinkMatrix.h.

References C_FLOAT64, mpNumIndependent, mUnit, and mZero.

254  {
255  if (row >= *mpNumIndependent)
256  return *const_cast< C_FLOAT64 * >(&(*mpA)(row - *mpNumIndependent, col));
257  else if (row != col)
258  return *const_cast< C_FLOAT64 * >(&mZero);
259  else
260  return *const_cast< C_FLOAT64 * >(&mUnit);
261  }
static const C_FLOAT64 mUnit
Definition: CLinkMatrix.h:212
#define C_FLOAT64
Definition: copasi.h:92
static const C_FLOAT64 mZero
Definition: CLinkMatrix.h:211
const size_t * mpNumIndependent
Definition: CLinkMatrix.h:210
CLinkMatrixView & CLinkMatrixView::operator= ( const CLinkMatrixView rhs)

Assignment operator

Parameters
constCLinkMatrixView & rhs
Returns
CLinkMatrixView & lhs

Definition at line 598 of file CLinkMatrix.cpp.

References mpA, and mpNumIndependent.

599 {
600  mpA = rhs.mpA;
602 
603  return *this;
604 }
const CLinkMatrix * mpA
Definition: CLinkMatrix.h:209
const size_t * mpNumIndependent
Definition: CLinkMatrix.h:210

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CLinkMatrixView A 
)
friend

Output stream operator

Parameters
ostream& os
constCLinkMatrixView & A
Returns
ostream & os

Definition at line 616 of file CLinkMatrix.cpp.

618 {
619  size_t i, imax = A.numRows();
620  size_t j, jmax = A.numCols();
621  os << "Matrix(" << imax << "x" << jmax << ")" << std::endl;
622 
623  for (i = 0; i < imax; i++)
624  {
625  for (j = 0; j < jmax; j++)
626  os << "\t" << A(i, j);
627 
628  os << std::endl;
629  }
630 
631  return os;
632 }
size_t numCols() const
size_t numRows() const

Member Data Documentation

const CLinkMatrix* CLinkMatrixView::mpA
private

Definition at line 209 of file CLinkMatrix.h.

Referenced by numCols(), numRows(), and operator=().

const size_t* CLinkMatrixView::mpNumIndependent
private

Definition at line 210 of file CLinkMatrix.h.

Referenced by numRows(), operator()(), and operator=().

const C_FLOAT64 CLinkMatrixView::mUnit = 1.0
staticprivate

Definition at line 212 of file CLinkMatrix.h.

Referenced by operator()().

const C_FLOAT64 CLinkMatrixView::mZero = 0.0
staticprivate

Definition at line 211 of file CLinkMatrix.h.

Referenced by operator()().


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