Belle II Software  release-08-01-10
PlainMatrix< T, M, N > Class Template Reference

A matrix implementation to be used as an interface typ through out the track finder. More...

#include <PlainMatrix.h>

Collaboration diagram for PlainMatrix< T, M, N >:

Public Member Functions

 PlainMatrix ()=default
 Default initializing of the matrix.
 
 PlainMatrix (std::initializer_list< T > values)
 Construct from initialiser list - also for value initialisation.
 
 PlainMatrix (std::array< T, S > values)
 Construct from the given values.
 
T * data ()
 Access to the flat value array.
 
const T * data () const
 Constant access to the flat value array.
 
T & operator[] (int s)
 Flat element access at the given row i and column j.
 
operator[] (int s) const
 Constant flat element access at the given row i and column j.
 
T & operator() (int i, int j=0)
 Element access at the given row i and column j.
 
operator() (int i, int j=0) const
 Constant element access at the given row i and column j.
 
PlainMatrix< T, M, N > operator+ (const PlainMatrix< T, M, N > &rhs) const
 Elementwise addition of two matrices.
 
PlainMatrix< T, M, N > operator- (const PlainMatrix< T, M, N > &rhs) const
 Elementwise subtraction of two matrices.
 
template<int O>
PlainMatrix< T, M, O > operator* (const PlainMatrix< T, N, O > &rhs) const
 Naive matrix multiplication.
 
PlainMatrix< T, M, N > operator/ (T rhs) const
 Elementwise division of the elements of the matrix by a number.
 
template<int K, int L>
PlainMatrix< T, K, L > block (int i=0, int j=0) const
 Get the K x L block from the matrix starting at the element at position (i, j)
 
template<int K>
PlainMatrix< T, K, N > head () const
 Get the K top rows of the matrix.
 
template<int K>
PlainMatrix< T, K, N > tail () const
 Get the K bottom rows of the matrix.
 

Static Public Member Functions

static PlainMatrix< T, M, N > Zero ()
 Construct a matrix initialized with zeros.
 
static PlainMatrix< T, M, N > Identity ()
 Construct an identity matrix.
 
static PlainMatrix< T, M, N > Constant (T t)
 Construct a matrix with all elements set to a constant.
 
static constexpr size_t size ()
 Total number of values in the matrix.
 
static constexpr int rows ()
 Total number of rows in the matrix.
 
static constexpr int cols ()
 Total number of columns in the matrix.
 

Private Member Functions

T * begin ()
 The begin iterator of the flattened values.
 
T * end ()
 The end iterator of the flattened values.
 
const T * begin () const
 The begin const_iterator of the flattened values.
 
const T * end () const
 The end const_iterator of the flattened values.
 

Private Attributes

std::array< T, M *N > m_values
 Memory of the flat value content.
 

Static Private Attributes

static const int S = M * N
 Total number of elements.
 

Friends

std::ostream & operator<< (std::ostream &out, const PlainMatrix< T, M, N > &rhs)
 Output operator for debugging purposes.
 
PlainMatrix< T, M, N > operator/ (T lhs, PlainMatrix< T, M, N > &rhs)
 Elementwise division of a number by the elements of the matrix.
 

Detailed Description

template<class T, int M, int N>
class Belle2::TrackFindingCDC::PlainMatrix< T, M, N >

A matrix implementation to be used as an interface typ through out the track finder.

This represents a fixed sized matrix with dimensions known at compile time to replace the Eigen::Matrix as vocabulary type at object interfaces. Because of its limited feature set it significantly reduces the compilation time of the whole cdc track finding as the Eigen headers do not have to be included in each translation unit.

It exposes only a limited number of methods for basic interactions. For all the linear algebra algorithms use the mapToEigen function in EigenView.h But it is advised to use the linear algebra only in .cc such that transitive includes do not suffer from Eigens heavily templated implementation.

The arrangement of element in this matrix is in column-major order (same as the default for Eigen).

Definition at line 40 of file PlainMatrix.h.


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