OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | List of all members
Matrix< T > Class Template Reference

Matrix. More...

#include <Matrix.h>

Inheritance diagram for Matrix< T >:
Inheritance graph
[legend]
Collaboration diagram for Matrix< T >:
Collaboration graph
[legend]

Public Member Functions

 Matrix ()
 Default constructor. More...
 
 Matrix (const Array2D< T > &)
 Conversion. More...
 
 Matrix (int rows, int cols)
 Constructor. More...
 
 Matrix (int rows, int cols, const T &t)
 Constructor. More...
 
 Matrix (const Matrix &)
 
 ~Matrix ()
 
Matrix< T > & operator= (const Matrix< T > &)
 
Matrix< T > & operator= (const Array2D< T > &)
 Convert and assign. More...
 
Matrix< T > & operator*= (const T &)
 Multiply by scalar and assign. More...
 
Matrix< T > & operator/= (const T &)
 Divide by scalar and assign. More...
 
Matrix< T > & operator+= (const Matrix< T > &)
 Add matrix and assign.. More...
 
Matrix< T > & operator-= (const Matrix< T > &)
 Subtract matrix and assign. More...
 
Matrix< T > & operator+= (const T &)
 Add scalar. More...
 
Matrix< T > & operator-= (const T &)
 Subtract scalar. More...
 
Matrix< T > & operator*= (const Matrix< T > &)
 Multiply by matrix and assign. More...
 
Matrix< T > transpose () const
 Matrix transpose. More...
 
Matrix< T > dotm (const Matrix< T > &) const
 Matrix product. More...
 
Vector< T > dotcv (const Vector< T > &) const
 Matrix times column vector. More...
 
Vector< T > dotrv (const Vector< T > &) const
 Row vector times matrix. More...
 
- Public Member Functions inherited from Array2D< T >
 Array2D ()
 Default constructor. More...
 
 Array2D (int rows, int cols)
 Constructor. More...
 
 Array2D (int rows, int cols, const T &t)
 Constructor. More...
 
 Array2D (const Array2D &)
 
 ~Array2D ()
 
Array2D< T > & operator= (const Array2D< T > &)
 
T & operator() (int r, int c)
 Get element reference. More...
 
const T & operator() (int r, int c) const
 Get element value. More...
 
int nrows () const
 Get number of rows. More...
 
int ncols () const
 Get number of columns. More...
 
int size () const
 Get total size (rows times columns). More...
 
iterator begin ()
 Get pointer to beginning of data. More...
 
iterator end ()
 Get pointer past end of data. More...
 
const_iterator begin () const
 Get pointer to beginning of data. More...
 
const_iterator end () const
 Get pointer past end of data. More...
 
row_iterator row_begin (int r)
 Get row iterator. More...
 
row_iterator row_end (int r)
 Get row iterator. More...
 
const_row_iterator row_begin (int r) const
 Get row iterator. More...
 
const_row_iterator row_end (int r) const
 Get row iterator. More...
 
row_iterator operator[] (int r)
 Get row iterator. More...
 
const_row_iterator operator[] (int r) const
 Get row iterator. More...
 
col_iterator col_begin (int c)
 Get column iterator. More...
 
col_iterator col_end (int c)
 Get column iterator. More...
 
const_col_iterator col_begin (int c) const
 Get column iterator. More...
 
const_col_iterator col_end (int c) const
 Get column iterator. More...
 
void getColumn (Array1D< T > &toArray, int c) const
 Fetch column. More...
 
void getRow (Array1D< T > &toArray, int r) const
 Fetch row. More...
 
void putColumn (const Array1D< T > &fromArray, int c)
 Store column. More...
 
void putRow (const Array1D< T > &fromArray, int r)
 Store row. More...
 
void swapColumns (int c1, int c2)
 Exchange columns. More...
 
void swapRows (int row1, int row2)
 Exchange rows. More...
 

Additional Inherited Members

- Public Types inherited from Array2D< T >
typedef T value_type
 The value type of the array. More...
 
typedef T * iterator
 The iterator type for sequential access to all elements. More...
 
typedef const T * const_iterator
 The iterator type for sequential access to all elements. More...
 
typedef T * row_iterator
 The iterator type for access by rows. More...
 
typedef const T * const_row_iterator
 The iterator type for access by rows for a constant array. More...
 
typedef SliceIterator< T > col_iterator
 The iterator type for access by columns. More...
 
typedef ConstSliceIterator< T > const_col_iterator
 The iterator type for access by columns for a constant array. More...
 
- Protected Attributes inherited from Array2D< T >
int rows
 
int cols
 
int len
 
T * data
 

Detailed Description

template<class T>
class Matrix< T >

Matrix.

Definition at line 39 of file Matrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/5]

template<class T >
Matrix< T >::Matrix

Default constructor.

Definition at line 140 of file Matrix.h.

◆ Matrix() [2/5]

template<class T >
Matrix< T >::Matrix ( const Array2D< T > &  rhs)

Conversion.

Definition at line 152 of file Matrix.h.

◆ Matrix() [3/5]

template<class T >
Matrix< T >::Matrix ( int  rows,
int  cols 
)

Constructor.

Definition at line 158 of file Matrix.h.

◆ Matrix() [4/5]

template<class T >
Matrix< T >::Matrix ( int  rows,
int  cols,
const T &  t 
)

Constructor.

Definition at line 164 of file Matrix.h.

References Array2D< T >::cols, Array2D< T >::data, min(), Array2D< T >::rows, and Attrib::Legacy::Distribution::T.

Here is the call graph for this function:

◆ Matrix() [5/5]

template<class T >
Matrix< T >::Matrix ( const Matrix< T > &  rhs)

Definition at line 146 of file Matrix.h.

◆ ~Matrix()

template<class T >
Matrix< T >::~Matrix

Definition at line 173 of file Matrix.h.

Member Function Documentation

◆ dotcv()

template<class T >
Vector< T > Matrix< T >::dotcv ( const Vector< T > &  B) const

Matrix times column vector.

Definition at line 362 of file Matrix.h.

References Array1D< T >::begin(), nr, Attrib::Distribution::R, Array1D< T >::size(), and Attrib::Legacy::Distribution::T.

Referenced by operator*().

Here is the call graph for this function:

◆ dotm()

template<class T >
Matrix< T > Matrix< T >::dotm ( const Matrix< T > &  B) const

Matrix product.

Definition at line 340 of file Matrix.h.

References Array2D< T >::col_begin(), Array2D< T >::ncols(), Array2D< T >::nrows(), Attrib::Distribution::R, and Attrib::Legacy::Distribution::T.

Referenced by operator*().

Here is the call graph for this function:

◆ dotrv()

template<class T >
Vector< T > Matrix< T >::dotrv ( const Vector< T > &  B) const

Row vector times matrix.

Definition at line 379 of file Matrix.h.

References Array1D< T >::begin(), Array1D< T >::end(), Attrib::Distribution::R, Array1D< T >::size(), and Attrib::Legacy::Distribution::T.

Referenced by operator*().

Here is the call graph for this function:

◆ operator*=() [1/2]

template<class T >
Matrix< T > & Matrix< T >::operator*= ( const Matrix< T > &  array)

Multiply by matrix and assign.

Definition at line 252 of file Matrix.h.

◆ operator*=() [2/2]

template<class T >
Matrix< T > & Matrix< T >::operator*= ( const T &  val)

Multiply by scalar and assign.

Definition at line 192 of file Matrix.h.

References begin(), and end().

Here is the call graph for this function:

◆ operator+=() [1/2]

template<class T >
Matrix< T > & Matrix< T >::operator+= ( const Matrix< T > &  array)

Add matrix and assign..

Definition at line 208 of file Matrix.h.

References Array2D< T >::begin(), begin(), end(), Array2D< T >::ncols(), and Array2D< T >::nrows().

Here is the call graph for this function:

◆ operator+=() [2/2]

template<class T >
Matrix< T > & Matrix< T >::operator+= ( const T &  val)

Add scalar.

Definition at line 230 of file Matrix.h.

References min(), and Hypervolume::n.

Here is the call graph for this function:

◆ operator-=() [1/2]

template<class T >
Matrix< T > & Matrix< T >::operator-= ( const Matrix< T > &  array)

Subtract matrix and assign.

Definition at line 219 of file Matrix.h.

References Array2D< T >::begin(), begin(), end(), Array2D< T >::ncols(), and Array2D< T >::nrows().

Here is the call graph for this function:

◆ operator-=() [2/2]

template<class T >
Matrix< T > & Matrix< T >::operator-= ( const T &  val)

Subtract scalar.

Definition at line 241 of file Matrix.h.

References min(), and Hypervolume::n.

Here is the call graph for this function:

◆ operator/=()

template<class T >
Matrix< T > & Matrix< T >::operator/= ( const T &  val)

Divide by scalar and assign.

Definition at line 200 of file Matrix.h.

References begin(), and end().

Here is the call graph for this function:

◆ operator=() [1/2]

template<class T >
Matrix< T > & Matrix< T >::operator= ( const Array2D< T > &  rhs)

Convert and assign.

Definition at line 185 of file Matrix.h.

References Array2D< T >::operator=().

Here is the call graph for this function:

◆ operator=() [2/2]

template<class T >
Matrix< T > & Matrix< T >::operator= ( const Matrix< T > &  rhs)

Definition at line 178 of file Matrix.h.

References Array2D< T >::operator=().

Here is the call graph for this function:

◆ transpose()

template<class T >
Matrix< T > Matrix< T >::transpose

Matrix transpose.

Definition at line 259 of file Matrix.h.

References nr, and Attrib::Distribution::R.


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