SMILE  v2.5
Schwarzschild Modelling Interactive expLoratory Environment
Public Member Functions | Private Attributes | List of all members
smile::CMatrixDiagonal< NumT > Struct Template Reference

matrix interface class that provides a diagonal matrix More...

#include <common.h>

Inheritance diagram for smile::CMatrixDiagonal< NumT >:
Inheritance graph
[legend]
Collaboration diagram for smile::CMatrixDiagonal< NumT >:
Collaboration graph
[legend]

Public Member Functions

 CMatrixDiagonal (size_t s1)
 
virtual bool isDense () const
 whether the matrix is dense or sparse (may be used to optimize calculations)
 
virtual size_t size1 () const
 return size for first index
 
virtual size_t size2 () const
 same for second
 
virtual size_t numElems () const
 number of possibly nonzero elements in sparse matrix More...
 
virtual NumT at (size_t i1, size_t i2) const
 return a value from the diagonal or zero if not on the diagonal
 
virtual NumT getElem (size_t index, size_t *i1, size_t *i2) const
 retrieves all values in the matrix (these are only the diagonal ones)
 
void set (size_t i1, NumT value)
 

Private Attributes

std::vector< NumT > diagonal
 diagonal matrix elements
 

Detailed Description

template<typename NumT>
struct smile::CMatrixDiagonal< NumT >

matrix interface class that provides a diagonal matrix

Member Function Documentation

template<typename NumT >
virtual size_t smile::CMatrixDiagonal< NumT >::numElems ( ) const
inlinevirtual

number of possibly nonzero elements in sparse matrix

by default all size1*size2 elements count, even if some of them are zero

Reimplemented from smile::CMatrix< NumT >.


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