KASKADE 7 development version
Public Types | Public Member Functions | Related Functions | List of all members
Kaskade::NumaDenseMatrix< Entry > Class Template Reference

A dense matrix class tailored towards NUMA architectures. More...

#include <numaMatrix.hh>

Detailed Description

template<class Entry>
class Kaskade::NumaDenseMatrix< Entry >

A dense matrix class tailored towards NUMA architectures.

The class satisfies the Dune ISTL recursive matrix interface similar to Dune::Matrix. The data storage, however, is organized in such a way as to benefit from NUMA architectures: the rows of the matrix are distributed evenly over the nodes. This implies that a good load balancing can only be achieved for matrices with (significantly) more rows than NUMA nodes. Avoid flat, long matrices.

There is no guarantee about placement or ordering of matrix elements, in particular none about the contiguity of element storage.

Template Parameters
Entrythe entry type (usually a Dune::FieldMatrix<n,m,double>)

\TODO: Currently, the implementation is mainly intended to gather a bag of coefficient vectors in one place, rather than to provide a fully-fledged matrix class.

Definition at line 447 of file numaMatrix.hh.

Inheritance diagram for Kaskade::NumaDenseMatrix< Entry >:

Public Types

typedef size_t size_type
 
typedef Entry value_type
 
typedef Dune::FieldTraits< Entry >::field_type field_type
 the type of the scalar field. More...
 
typedef Dune::FieldTraits< field_type >::real_type real_type
 
typedef NumaDenseMatrixDetail::RowIterator< Entry > RowIterator
 
typedef NumaDenseMatrixDetail::RowIterator< Entry const > ConstRowIterator
 
typedef RowIterator::value_type row_type
 
typedef ConstRowIterator::value_type const_row_type
 

Public Member Functions

size_type M () const
 Return the number of columns. More...
 
real_type frobenius_norm () const
 frobenius norm: sqrt(sum over squared frobenius norms of entries) More...
 
real_type frobenius_norm2 () const
 frobenius norm squared: sum over squared frobenius norms of entries More...
 
Construction, assignment, and resize.
 NumaDenseMatrix ()=default
 Creates a 0 x 0 matrix. More...
 
 NumaDenseMatrix (NumaDenseMatrix const &a)=default
 Copy constructor. More...
 
 NumaDenseMatrix (NumaDenseMatrix &&a)=default
 Move constructor. More...
 
 NumaDenseMatrix (size_type r, size_type c, value_type v=value_type())
 Creates an r x c matrix with given entries. More...
 
NumaDenseMatrixoperator= (NumaDenseMatrix const &a)=default
 Copy assignment. More...
 
Selfoperator= (field_type const &a)
 Assignment from scalar. More...
 
void resize (size_type r, size_type c)
 Resizes the matrix to r x c, leaving the entries in an undefined state. More...
 
void setSize (size_type r, size_type c)
 Resizes the matrix to r x c, leaving the entries in an undefined state. More...
 
Entry access
RowIterator begin ()
 Get iterator to first row. More...
 
RowIterator end ()
 Get iterator to one beyond last row. More...
 
ConstRowIterator begin () const
 Get const iterator to first row. More...
 
ConstRowIterator end () const
 Get const iterator to one beyond last row. More...
 
row_type operator[] (size_type row)
 The subscript operator. More...
 
const_row_type const operator[] (size_type row) const
 The const subscript operator. More...
 
Linear algebra operations.
Selfoperator*= (field_type const &a)
 Multiplication with a scalar. More...
 
Selfoperator/= (field_type const &scalar)
 Division by a scalar. More...
 
Selfoperator+= (Self const &b)
 Matrix addition. Both matrices have to have the same sizes. More...
 
Selfoperator-= (Self const &b)
 Matrix subtraction. More...
 

Related Functions

(Note that these are not member functions.)

template<class Entry >
std::ostream & operator<< (std::ostream &out, NumaDenseMatrix< Entry > const &mat)
 

Member Typedef Documentation

◆ const_row_type

template<class Entry >
typedef ConstRowIterator::value_type Kaskade::NumaDenseMatrix< Entry >::const_row_type

Definition at line 466 of file numaMatrix.hh.

◆ ConstRowIterator

template<class Entry >
typedef NumaDenseMatrixDetail::RowIterator<Entry const> Kaskade::NumaDenseMatrix< Entry >::ConstRowIterator

Definition at line 463 of file numaMatrix.hh.

◆ field_type

template<class Entry >
typedef Dune::FieldTraits<Entry>::field_type Kaskade::NumaDenseMatrix< Entry >::field_type

the type of the scalar field.

Definition at line 459 of file numaMatrix.hh.

◆ real_type

template<class Entry >
typedef Dune::FieldTraits<field_type>::real_type Kaskade::NumaDenseMatrix< Entry >::real_type

Definition at line 460 of file numaMatrix.hh.

◆ row_type

template<class Entry >
typedef RowIterator::value_type Kaskade::NumaDenseMatrix< Entry >::row_type

Definition at line 465 of file numaMatrix.hh.

◆ RowIterator

template<class Entry >
typedef NumaDenseMatrixDetail::RowIterator<Entry> Kaskade::NumaDenseMatrix< Entry >::RowIterator

Definition at line 462 of file numaMatrix.hh.

◆ size_type

template<class Entry >
typedef size_t Kaskade::NumaDenseMatrix< Entry >::size_type

Definition at line 453 of file numaMatrix.hh.

◆ value_type

template<class Entry >
typedef Entry Kaskade::NumaDenseMatrix< Entry >::value_type

Definition at line 454 of file numaMatrix.hh.

Constructor & Destructor Documentation

◆ NumaDenseMatrix() [1/4]

template<class Entry >
Kaskade::NumaDenseMatrix< Entry >::NumaDenseMatrix ( )
default

Creates a 0 x 0 matrix.

◆ NumaDenseMatrix() [2/4]

template<class Entry >
Kaskade::NumaDenseMatrix< Entry >::NumaDenseMatrix ( NumaDenseMatrix< Entry > const &  a)
default

Copy constructor.

◆ NumaDenseMatrix() [3/4]

template<class Entry >
Kaskade::NumaDenseMatrix< Entry >::NumaDenseMatrix ( NumaDenseMatrix< Entry > &&  a)
default

Move constructor.

◆ NumaDenseMatrix() [4/4]

template<class Entry >
Kaskade::NumaDenseMatrix< Entry >::NumaDenseMatrix ( size_type  r,
size_type  c,
value_type  v = value_type() 
)
inline

Creates an r x c matrix with given entries.

Definition at line 491 of file numaMatrix.hh.

Member Function Documentation

◆ begin() [1/2]

template<class Entry >
RowIterator Kaskade::NumaDenseMatrix< Entry >::begin ( )
inline

Get iterator to first row.

Definition at line 539 of file numaMatrix.hh.

Referenced by Kaskade::NumaDenseMatrix< Entry >::operator<<().

◆ begin() [2/2]

template<class Entry >
ConstRowIterator Kaskade::NumaDenseMatrix< Entry >::begin ( ) const
inline

Get const iterator to first row.

Definition at line 549 of file numaMatrix.hh.

◆ end() [1/2]

template<class Entry >
RowIterator Kaskade::NumaDenseMatrix< Entry >::end ( )
inline

Get iterator to one beyond last row.

Definition at line 544 of file numaMatrix.hh.

Referenced by Kaskade::NumaDenseMatrix< Entry >::operator<<().

◆ end() [2/2]

template<class Entry >
ConstRowIterator Kaskade::NumaDenseMatrix< Entry >::end ( ) const
inline

Get const iterator to one beyond last row.

Definition at line 554 of file numaMatrix.hh.

◆ frobenius_norm()

template<class Entry >
real_type Kaskade::NumaDenseMatrix< Entry >::frobenius_norm ( ) const
inline

frobenius norm: sqrt(sum over squared frobenius norms of entries)

Definition at line 625 of file numaMatrix.hh.

◆ frobenius_norm2()

template<class Entry >
real_type Kaskade::NumaDenseMatrix< Entry >::frobenius_norm2 ( ) const
inline

frobenius norm squared: sum over squared frobenius norms of entries

Definition at line 630 of file numaMatrix.hh.

Referenced by Kaskade::NumaDenseMatrix< Entry >::frobenius_norm().

◆ M()

template<class Entry >
size_type Kaskade::NumaDenseMatrix< Entry >::M ( ) const
inline

Return the number of columns.

Definition at line 577 of file numaMatrix.hh.

◆ operator*=()

template<class Entry >
Self & Kaskade::NumaDenseMatrix< Entry >::operator*= ( field_type const &  a)
inline

Multiplication with a scalar.

Definition at line 587 of file numaMatrix.hh.

◆ operator+=()

template<class Entry >
Self & Kaskade::NumaDenseMatrix< Entry >::operator+= ( Self const &  b)
inline

Matrix addition. Both matrices have to have the same sizes.

Definition at line 605 of file numaMatrix.hh.

◆ operator-=()

template<class Entry >
Self & Kaskade::NumaDenseMatrix< Entry >::operator-= ( Self const &  b)
inline

Matrix subtraction.

Definition at line 614 of file numaMatrix.hh.

◆ operator/=()

template<class Entry >
Self & Kaskade::NumaDenseMatrix< Entry >::operator/= ( field_type const &  scalar)
inline

Division by a scalar.

Definition at line 596 of file numaMatrix.hh.

◆ operator=() [1/2]

template<class Entry >
Self & Kaskade::NumaDenseMatrix< Entry >::operator= ( field_type const &  a)
inline

Assignment from scalar.

Definition at line 503 of file numaMatrix.hh.

◆ operator=() [2/2]

template<class Entry >
NumaDenseMatrix & Kaskade::NumaDenseMatrix< Entry >::operator= ( NumaDenseMatrix< Entry > const &  a)
default

Copy assignment.

◆ operator[]() [1/2]

template<class Entry >
row_type Kaskade::NumaDenseMatrix< Entry >::operator[] ( size_type  row)
inline

The subscript operator.

Rows do not exist as persistent data structures in the matrix. Hence the subscript operator returns a row object (in fact a view onto data held by the matrix) by value.

Definition at line 562 of file numaMatrix.hh.

◆ operator[]() [2/2]

template<class Entry >
const_row_type const Kaskade::NumaDenseMatrix< Entry >::operator[] ( size_type  row) const
inline

The const subscript operator.

Rows do not exist as persistent data structures in the matrix. Hence the subscript operator returns a row object (in fact a view onto data held by the matrix) by value.

Definition at line 570 of file numaMatrix.hh.

◆ resize()

template<class Entry >
void Kaskade::NumaDenseMatrix< Entry >::resize ( size_type  r,
size_type  c 
)
inline

Resizes the matrix to r x c, leaving the entries in an undefined state.

On resize, all row objects and iterators are invalidated. This method adheres to the Dune::DynamicMatrix interface.

Definition at line 514 of file numaMatrix.hh.

Referenced by Kaskade::NumaDenseMatrix< Entry >::setSize().

◆ setSize()

template<class Entry >
void Kaskade::NumaDenseMatrix< Entry >::setSize ( size_type  r,
size_type  c 
)
inline

Resizes the matrix to r x c, leaving the entries in an undefined state.

On resize, all row objects and iterators are invalidated. This method adheres to the Dune::Matrix interface.

Definition at line 524 of file numaMatrix.hh.

Friends And Related Function Documentation

◆ operator<<()

template<class Entry >
std::ostream & operator<< ( std::ostream &  out,
NumaDenseMatrix< Entry > const &  mat 
)
related

Definition at line 640 of file numaMatrix.hh.


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