Peano
Loading...
Searching...
No Matches
tarch::la::Matrix< Rows, Cols, Scalar > Class Template Reference

Static (i.e. More...

#include <Matrix.h>

Public Member Functions

 Matrix ()
 Constructs a non-initialized matrix.
 
 Matrix (const Scalar &value)
 Constructs an initialized matrix.
 
 Matrix (std::initializer_list< Scalar > values)
 
int rows () const
 Returns the number of rows in the matrix.
 
int cols () const
 Returns the number of columns in the matrix.
 
int size () const
 Returns the number of total elements in the matrix.
 
Scalar & operator() (int rowIndex, int colIndex)
 Returns element at given row and column index (from 0..size-1).
 
const Scalar & operator() (int rowIndex, int colIndex) const
 Returns const element at given row and column index (from 0..size-1).
 
std::string toString () const
 
std::string toPrettyString (int numberOfDigits=4) const
 
template<typename NewScalarType >
tarch::la::Matrix< Rows, Cols, NewScalarType > convertScalar () const
 
Scalar * data ()
 This routine returns a pointer to the first data element.
 
const Scalar * data () const
 

Private Attributes

Scalar _values [Rows *Cols]
 Values of the matrix components.
 

Detailed Description

template<int Rows, int Cols, typename Scalar>
class tarch::la::Matrix< Rows, Cols, Scalar >

Static (i.e.

compiletime) sized matrix type.

Definition at line 31 of file Matrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/3]

template<int Rows, int Cols, typename Scalar >
tarch::la::Matrix< Rows, Cols, Scalar >::Matrix ( )

Constructs a non-initialized matrix.

Definition at line 8 of file Matrix.cpph.

◆ Matrix() [2/3]

template<int Rows, int Cols, typename Scalar >
tarch::la::Matrix< Rows, Cols, Scalar >::Matrix ( const Scalar & value)

Constructs an initialized matrix.

Definition at line 14 of file Matrix.cpph.

◆ Matrix() [3/3]

template<int Rows, int Cols, typename Scalar >
tarch::la::Matrix< Rows, Cols, Scalar >::Matrix ( std::initializer_list< Scalar > values)

Definition at line 23 of file Matrix.cpph.

Member Function Documentation

◆ cols()

template<int Rows, int Cols, typename Scalar >
int tarch::la::Matrix< Rows, Cols, Scalar >::cols ( ) const

Returns the number of columns in the matrix.

Definition at line 39 of file Matrix.cpph.

Referenced by tarch::la::tests::MatrixTest::testConstruction().

Here is the caller graph for this function:

◆ convertScalar()

template<int Rows, int Cols, typename Scalar >
template<typename NewScalarType >
tarch::la::Matrix< Rows, Cols, NewScalarType > tarch::la::Matrix< Rows, Cols, Scalar >::convertScalar ( ) const

Definition at line 100 of file Matrix.cpph.

◆ data() [1/2]

template<int Rows, int Cols, typename Scalar >
Scalar * tarch::la::Matrix< Rows, Cols, Scalar >::data ( )

This routine returns a pointer to the first data element.

Not a beautiful one as it harms the OO idea, but in many cases it is convenient to have this operation.

Definition at line 115 of file Matrix.h.

References tarch::la::Matrix< Rows, Cols, Scalar >::_values.

Referenced by peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__generate_dastgen_input_file(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_file_name(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_full_qualified_file_name(), swift2.particle.Particle.Particle::__init__(), swift2.particle.Particle.Particle::_add_dependency_checks(), swift2.particle.Particle.Particle::_dependency_checks_modify_steps(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_enum_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_double_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_integer_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_string_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_user_defined_attributes(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::_get_dictionary_for_output(), toolbox::multiprecision::compress(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::construct_output(), peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::construct_output(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::construct_output(), peano4.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::construct_output(), peano4.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::construct_output(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_header_file_include(), peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::get_header_file_include(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_header_file_include(), peano4.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_header_file_include(), peano4.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_header_file_include(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_stack_container(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_stack_container(), peano4.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_stack_container(), peano4.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_stack_container(), swift2.particle.Particle.Particle::readme_descriptor(), swift2.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius::set_parameters(), swift2.particle.SPHParticle.SPHParticle::set_parameters(), and swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize::set_parameters().

Here is the caller graph for this function:

◆ data() [2/2]

template<int Rows, int Cols, typename Scalar >
const Scalar * tarch::la::Matrix< Rows, Cols, Scalar >::data ( ) const

Definition at line 119 of file Matrix.h.

References tarch::la::Matrix< Rows, Cols, Scalar >::_values.

Referenced by peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__generate_dastgen_input_file(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_file_name(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_full_qualified_file_name(), swift2.particle.Particle.Particle::__init__(), swift2.particle.Particle.Particle::_add_dependency_checks(), swift2.particle.Particle.Particle::_dependency_checks_modify_steps(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_enum_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_double_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_integer_array_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_string_attributes(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_user_defined_attributes(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::_get_dictionary_for_output(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::construct_output(), peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::construct_output(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::construct_output(), peano4.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::construct_output(), peano4.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::construct_output(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_header_file_include(), peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::get_header_file_include(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_header_file_include(), peano4.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_header_file_include(), peano4.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_header_file_include(), peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_stack_container(), peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_stack_container(), peano4.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_stack_container(), peano4.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_stack_container(), swift2.particle.Particle.Particle::readme_descriptor(), swift2.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius::set_parameters(), swift2.particle.SPHParticle.SPHParticle::set_parameters(), and swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize::set_parameters().

Here is the caller graph for this function:

◆ operator()() [1/2]

template<int Rows, int Cols, typename Scalar >
Scalar & tarch::la::Matrix< Rows, Cols, Scalar >::operator() ( int rowIndex,
int colIndex )

Returns element at given row and column index (from 0..size-1).

See also
Vector::operator[] for remarks on SSE efficiency

Definition at line 70 of file Matrix.h.

References tarch::la::Matrix< Rows, Cols, Scalar >::_values, assertion5, and tarch::la::Matrix< Rows, Cols, Scalar >::toString().

Here is the call graph for this function:

◆ operator()() [2/2]

template<int Rows, int Cols, typename Scalar >
const Scalar & tarch::la::Matrix< Rows, Cols, Scalar >::operator() ( int rowIndex,
int colIndex ) const

Returns const element at given row and column index (from 0..size-1).

Definition at line 88 of file Matrix.h.

References tarch::la::Matrix< Rows, Cols, Scalar >::_values, assertion5, and tarch::la::Matrix< Rows, Cols, Scalar >::toString().

Here is the call graph for this function:

◆ rows()

template<int Rows, int Cols, typename Scalar >
int tarch::la::Matrix< Rows, Cols, Scalar >::rows ( ) const

Returns the number of rows in the matrix.

Definition at line 33 of file Matrix.cpph.

Referenced by tarch::la::tests::MatrixTest::testConstruction().

Here is the caller graph for this function:

◆ size()

template<int Rows, int Cols, typename Scalar >
int tarch::la::Matrix< Rows, Cols, Scalar >::size ( ) const

Returns the number of total elements in the matrix.

Definition at line 45 of file Matrix.cpph.

Referenced by peano4.visualisation.input.Patch.Patch::__repr__(), kernel_impl.Enumerator::fetch(), kernel_impl.Enumerator::lower(), tarch::la::tests::MatrixTest::testConstruction(), and kernel_impl.Enumerator::upper().

Here is the caller graph for this function:

◆ toPrettyString()

template<int Rows, int Cols, typename Scalar >
std::string tarch::la::Matrix< Rows, Cols, Scalar >::toPrettyString ( int numberOfDigits = 4) const

Definition at line 73 of file Matrix.cpph.

References tarch::la::abs().

Here is the call graph for this function:

◆ toString()

template<int Rows, int Cols, typename Scalar >
std::string tarch::la::Matrix< Rows, Cols, Scalar >::toString ( ) const

Field Documentation

◆ _values

template<int Rows, int Cols, typename Scalar >
Scalar tarch::la::Matrix< Rows, Cols, Scalar >::_values[Rows *Cols]
private

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