OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
FMatrix< T, R, C > Class Template Reference

A templated representation for matrices. More...

#include <FMatrix.h>

Inheritance diagram for FMatrix< T, R, C >:
Collaboration diagram for FMatrix< T, R, C >:

Public Types

typedef T value_type
 The value type of the array.
typedef T * iterator
 Iterator for the array.
typedef const T * const_iterator
 Iterator for constant array.
typedef T * row_iterator
 Iterator for access by rows.
typedef const T * const_row_iterator
 Iterator for access by rows.
typedef FSlice< T, N > col_iterator
 Iterator for access by columns.
typedef FConstSlice< T, N > const_col_iterator
 Iterator for access by columns.

Public Member Functions

 FMatrix ()
 Default constructor.
 FMatrix (const FMatrix &)
 Copy constructor.
 FMatrix (const FArray2D< T, R, C > &)
 Conversion from two-dimensional array.
 FMatrix (const T &t)
 Constructor.
FMatrixoperator= (const FMatrix &)
 Assignment.
 FMatrix (const T *t)
 Constructor.
FMatrixoperator= (const FArray2D< T, R, C > &)
 Convert and assign.
FMatrixoperator*= (const T &)
 Multiply by scalar and assign.
FMatrixoperator/= (const T &)
 Divide by scalar and assign.
FMatrixoperator+= (const FMatrix &)
 Add matrix and assign.
FMatrixoperator-= (const FMatrix &)
 Subtract ,atrix and assign.
FMatrix< T, C, R > transpose () const
 FMatrix transpose.
T & operator() (int r, int c)
 Get element.
int nrows () const
 Get number of rows.
int ncols () const
 Get number of columns.
int size () const
 Get total size.
iterator begin ()
 Get beginning of data.
iterator end ()
 Get pointer past end of data.
row_iterator row_begin (int r)
 Get row iterator.
row_iterator row_end (int r)
 Get row iterator.
row_iterator operator[] (int r)
 Get row iterator.
col_iterator col_begin (int c)
 Get column iterator.
col_iterator col_end (int c)
 Get column iterator.
void getColumn (FArray1D< T, M > &toArray, int c) const
 Fetch column.
void getRow (FArray1D< T, N > &toArray, int r) const
 Fetch row.
void putColumn (const FArray1D< T, M > &fromArray, int c)
 Store column.
void putRow (const FArray1D< T, N > &fromArray, int r)
 Store row.
void swapColumns (int c1, int c2)
 Exchange columns.
void swapRows (int r1, int r2)
 Exchange rows.

Protected Attributes

data [M *N]

Static Protected Attributes

static const int SIZE

Detailed Description

template<class T, int R, int C>
class FMatrix< T, R, C >

A templated representation for matrices.

Definition at line 39 of file FMatrix.h.

Member Typedef Documentation

◆ col_iterator

typedef FSlice<T, N> FArray2D< T, M, N >::col_iterator
inherited

Iterator for access by columns.

Definition at line 60 of file FArray2D.h.

◆ const_col_iterator

typedef FConstSlice<T, N> FArray2D< T, M, N >::const_col_iterator
inherited

Iterator for access by columns.

Definition at line 63 of file FArray2D.h.

◆ const_iterator

typedef const T* FArray2D< T, M, N >::const_iterator
inherited

Iterator for constant array.

Definition at line 51 of file FArray2D.h.

◆ const_row_iterator

typedef const T* FArray2D< T, M, N >::const_row_iterator
inherited

Iterator for access by rows.

Definition at line 57 of file FArray2D.h.

◆ iterator

typedef T* FArray2D< T, M, N >::iterator
inherited

Iterator for the array.

Definition at line 48 of file FArray2D.h.

◆ row_iterator

typedef T* FArray2D< T, M, N >::row_iterator
inherited

Iterator for access by rows.

Definition at line 54 of file FArray2D.h.

◆ value_type

typedef T FArray2D< T, M, N >::value_type
inherited

The value type of the array.

Definition at line 45 of file FArray2D.h.

Constructor & Destructor Documentation

◆ FMatrix() [1/5]

template<class T, int R, int C>
FMatrix< T, R, C >::FMatrix ( )

Default constructor.

Definition at line 131 of file FMatrix.h.

References FArray2D< T, R, C >::FArray2D().

Referenced by FMatrix(), operator*=(), operator+=(), operator-=(), operator/=(), operator=(), operator=(), and transpose().

Here is the call graph for this function:

◆ FMatrix() [2/5]

template<class T, int R, int C>
FMatrix< T, R, C >::FMatrix ( const FMatrix< T, R, C > & rhs)

Copy constructor.

Definition at line 137 of file FMatrix.h.

References FArray2D< T, R, C >::FArray2D(), and FMatrix().

Here is the call graph for this function:

◆ FMatrix() [3/5]

template<class T, int R, int C>
FMatrix< T, R, C >::FMatrix ( const FArray2D< T, R, C > & rhs)

Conversion from two-dimensional array.

Definition at line 143 of file FMatrix.h.

References FArray2D< T, R, C >::FArray2D().

Here is the call graph for this function:

◆ FMatrix() [4/5]

template<class T, int R, int C>
FMatrix< T, R, C >::FMatrix ( const T & t)
explicit

Constructor.

Definition at line 149 of file FMatrix.h.

References FArray2D< T, R, C >::FArray2D().

Here is the call graph for this function:

◆ FMatrix() [5/5]

template<class T, int R, int C>
FMatrix< T, R, C >::FMatrix ( const T * t)
explicit

Constructor.

Definition at line 155 of file FMatrix.h.

References FArray2D< T, R, C >::FArray2D().

Here is the call graph for this function:

Member Function Documentation

◆ begin()

FArray2D< T, M, N >::iterator FArray2D< T, M, N >::begin ( )
inlineinherited

Get beginning of data.

Definition at line 100 of file FArray2D.h.

◆ col_begin()

FArray2D< T, M, N >::col_iterator FArray2D< T, M, N >::col_begin ( int c)
inherited

Get column iterator.

Definition at line 150 of file FArray2D.h.

References c.

◆ col_end()

FArray2D< T, M, N >::col_iterator FArray2D< T, M, N >::col_end ( int c)
inherited

Get column iterator.

Definition at line 155 of file FArray2D.h.

References c.

◆ end()

FArray2D< T, M, N >::iterator FArray2D< T, M, N >::end ( )
inlineinherited

Get pointer past end of data.

Definition at line 105 of file FArray2D.h.

◆ getColumn()

void FArray2D< T, M, N >::getColumn ( FArray1D< T, M > & toArray,
int c ) const
inherited

Fetch column.

Definition at line 170 of file FArray2D.h.

References c.

◆ getRow()

void FArray2D< T, M, N >::getRow ( FArray1D< T, N > & toArray,
int r ) const
inherited

Fetch row.

Definition at line 174 of file FArray2D.h.

◆ ncols()

int FArray2D< T, M, N >::ncols ( ) const
inlineinherited

Get number of columns.

Definition at line 92 of file FArray2D.h.

◆ nrows()

int FArray2D< T, M, N >::nrows ( ) const
inlineinherited

Get number of rows.

Definition at line 89 of file FArray2D.h.

◆ operator()()

T & FArray2D< T, M, N >::operator() ( int r,
int c )
inlineinherited

Get element.

Definition at line 81 of file FArray2D.h.

References c.

◆ operator*=()

template<class T, int R, int C>
FMatrix< T, R, C > & FMatrix< T, R, C >::operator*= ( const T & rhs)

Multiply by scalar and assign.

Definition at line 175 of file FMatrix.h.

References begin(), end(), and FMatrix().

Here is the call graph for this function:

◆ operator+=()

template<class T, int R, int C>
FMatrix< T, R, C > & FMatrix< T, R, C >::operator+= ( const FMatrix< T, R, C > & array)

Add matrix and assign.

Definition at line 191 of file FMatrix.h.

References begin(), FArray2D< T, M, N >::begin(), end(), and FMatrix().

Here is the call graph for this function:

◆ operator-=()

template<class T, int R, int C>
FMatrix< T, R, C > & FMatrix< T, R, C >::operator-= ( const FMatrix< T, R, C > & array)

Subtract ,atrix and assign.

Definition at line 199 of file FMatrix.h.

References begin(), FArray2D< T, M, N >::begin(), end(), and FMatrix().

Here is the call graph for this function:

◆ operator/=()

template<class T, int R, int C>
FMatrix< T, R, C > & FMatrix< T, R, C >::operator/= ( const T & rhs)

Divide by scalar and assign.

Definition at line 183 of file FMatrix.h.

References begin(), end(), and FMatrix().

Here is the call graph for this function:

◆ operator=() [1/2]

template<class T, int R, int C>
FMatrix< T, R, C > & FMatrix< T, R, C >::operator= ( const FArray2D< T, R, C > & rhs)

Convert and assign.

Definition at line 168 of file FMatrix.h.

References FArray2D< T, R, C >::FArray2D(), FMatrix(), and FArray2D< T, M, N >::operator=().

Here is the call graph for this function:

◆ operator=() [2/2]

template<class T, int R, int C>
FMatrix< T, R, C > & FMatrix< T, R, C >::operator= ( const FMatrix< T, R, C > & rhs)

Assignment.

Definition at line 161 of file FMatrix.h.

References FMatrix(), and FArray2D< T, M, N >::operator=().

Here is the call graph for this function:

◆ operator[]()

FArray2D< T, M, N >::row_iterator FArray2D< T, M, N >::operator[] ( int r)
inherited

Get row iterator.

Definition at line 140 of file FArray2D.h.

◆ putColumn()

void FArray2D< T, M, N >::putColumn ( const FArray1D< T, M > & fromArray,
int c )
inherited

Store column.

Definition at line 179 of file FArray2D.h.

References c.

◆ putRow()

void FArray2D< T, M, N >::putRow ( const FArray1D< T, N > & fromArray,
int r )
inherited

Store row.

Definition at line 184 of file FArray2D.h.

◆ row_begin()

FArray2D< T, M, N >::row_iterator FArray2D< T, M, N >::row_begin ( int r)
inherited

Get row iterator.

Definition at line 120 of file FArray2D.h.

Referenced by FMatrix< T, R, C >::transpose().

◆ row_end()

FArray2D< T, M, N >::row_iterator FArray2D< T, M, N >::row_end ( int r)
inherited

Get row iterator.

Definition at line 125 of file FArray2D.h.

Referenced by FMatrix< T, R, C >::transpose().

◆ size()

int FArray2D< T, M, N >::size ( ) const
inlineinherited

Get total size.

Definition at line 95 of file FArray2D.h.

◆ swapColumns()

void FArray2D< T, M, N >::swapColumns ( int c1,
int c2 )
inherited

Exchange columns.

Definition at line 189 of file FArray2D.h.

◆ swapRows()

void FArray2D< T, M, N >::swapRows ( int r1,
int r2 )
inherited

Exchange rows.

Definition at line 194 of file FArray2D.h.

◆ transpose()

template<class T, int R, int C>
FMatrix< T, C, R > FMatrix< T, R, C >::transpose ( ) const

FMatrix transpose.

Definition at line 207 of file FMatrix.h.

References FArray2D< T, M, N >::col_begin(), FMatrix(), FArray2D< T, R, C >::row_begin(), and FArray2D< T, R, C >::row_end().

Here is the call graph for this function:

Member Data Documentation

◆ data

T FArray2D< T, M, N >::data[M *N]
protectedinherited

Definition at line 199 of file FArray2D.h.

◆ SIZE

const int FArray2D< T, M, N >::SIZE
staticprotectedinherited

Definition at line 202 of file FArray2D.h.


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