cmake introduction
A short example project for the CMake build system
Public Member Functions | Private Attributes | List of all members
core::Matrix< Scalar > Class Template Reference

A dense quadratic matrix of arbitrary size. More...

#include <matrix.h>

Public Member Functions

 Matrix (int _size)
 constructor of an _size by _size matrix More...
 
virtual ~Matrix ()
 destructor, delete memory created during construction More...
 
Scalar & operator() (int i, int j)
 access and change individual elements More...
 
Scalar operator() (int i, int j) const
 access individual elements More...
 
int get_size () const
 get the number of rows/columns More...
 
Scalar * get_values ()
 get the array of elements of the matrix More...
 
const Scalar * get_values () const
 get the array of elements of the matrix More...
 
template<typename OUTPUT_STREAM >
void print_formatted (OUTPUT_STREAM &os, const unsigned int precision=3, const bool scientific=true, const unsigned int width_=0, const char *zero_string="*", const double denominator=1., const double threshold=0.) const
 print the matrix in some nice form More...
 

Private Attributes

int size
 the number of rows/columns More...
 
Scalar * values
 the entries of the matrix (row-wise) More...
 

Detailed Description

template<typename Scalar>
class core::Matrix< Scalar >

A dense quadratic matrix of arbitrary size.

The template is typically a double.

Definition at line 19 of file matrix.h.

Constructor & Destructor Documentation

◆ Matrix()

template<typename Scalar>
core::Matrix< Scalar >::Matrix ( int  _size)
inline

constructor of an _size by _size matrix

Parameters
_sizenumber of rows/columns of square matrix.

Definition at line 24 of file matrix.h.

◆ ~Matrix()

template<typename Scalar>
virtual core::Matrix< Scalar >::~Matrix ( )
inlinevirtual

destructor, delete memory created during construction

Definition at line 31 of file matrix.h.

Member Function Documentation

◆ get_size()

template<typename Scalar>
int core::Matrix< Scalar >::get_size ( ) const
inline

get the number of rows/columns

Definition at line 52 of file matrix.h.

Here is the caller graph for this function:

◆ get_values() [1/2]

template<typename Scalar>
Scalar* core::Matrix< Scalar >::get_values ( )
inline

get the array of elements of the matrix

Note
be careful with this. Do not delete it!
use saver const version, if possible

Definition at line 58 of file matrix.h.

Here is the caller graph for this function:

◆ get_values() [2/2]

template<typename Scalar>
const Scalar* core::Matrix< Scalar >::get_values ( ) const
inline

get the array of elements of the matrix

Definition at line 62 of file matrix.h.

◆ operator()() [1/2]

template<typename Scalar>
Scalar& core::Matrix< Scalar >::operator() ( int  i,
int  j 
)
inline

access and change individual elements

The parameters i and j must be within \([1,\_size]\), otherwise the program terminates with an error.

Definition at line 40 of file matrix.h.

◆ operator()() [2/2]

template<typename Scalar>
Scalar core::Matrix< Scalar >::operator() ( int  i,
int  j 
) const
inline

access individual elements

Warning
no checks are done for i and j.

Definition at line 48 of file matrix.h.

◆ print_formatted()

template<typename Scalar>
template<typename OUTPUT_STREAM >
void core::Matrix< Scalar >::print_formatted ( OUTPUT_STREAM &  os,
const unsigned int  precision = 3,
const bool  scientific = true,
const unsigned int  width_ = 0,
const char *  zero_string = "*",
const double  denominator = 1.,
const double  threshold = 0. 
) const
inline

print the matrix in some nice form

Parameters
[in,out]osstream to which the matrix is written
Todo:
more documentation, please!

Definition at line 72 of file matrix.h.

Here is the caller graph for this function:

Member Data Documentation

◆ size

template<typename Scalar>
int core::Matrix< Scalar >::size
private

the number of rows/columns

Definition at line 116 of file matrix.h.

◆ values

template<typename Scalar>
Scalar* core::Matrix< Scalar >::values
private

the entries of the matrix (row-wise)

Definition at line 117 of file matrix.h.


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