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

Shallow matrix wrapping an existing array. More...

#include <ShallowMatrix.h>

Public Member Functions

 ShallowMatrix (Scalar *values)
 Constructs a non-initialized matrix.
 
 ShallowMatrix (const ShallowMatrix &copy)
 Shallow copy.
 
ShallowMatrix & operator= (const ShallowMatrix &copy)
 Shallow copy.
 
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
 Convert the scalar type.
 
Scalar * data ()
 Return pointer back to original data.
 
const Scalar * data () const
 

Private Attributes

Scalar * _values
 Values of the matrix components.
 

Detailed Description

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

Shallow matrix wrapping an existing array.

You are in charge of handling the underlying memory, i.e. the class does neither allocate anything nor destroy anything

Definition at line 29 of file ShallowMatrix.h.

Constructor & Destructor Documentation

◆ ShallowMatrix() [1/2]

template<int Rows, int Cols, typename Scalar >
tarch::la::ShallowMatrix< Rows, Cols, Scalar >::ShallowMatrix ( Scalar *  values)

Constructs a non-initialized matrix.

◆ ShallowMatrix() [2/2]

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

Shallow copy.

Member Function Documentation

◆ cols()

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

Returns the number of columns in the matrix.

◆ convertScalar()

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

Convert the scalar type.

Can also be used to convert a shallow matrix into a proper one, i.e. to deep copy.

◆ data() [1/2]

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

Return pointer back to original data.

Definition at line 121 of file ShallowMatrix.h.

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

Referenced by peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__generate_dastgen_input_file(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_file_name(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_full_qualified_file_name(), exaparty.api.particle.Particle.Particle::__init__(), exaparty.api.particle.Particle.Particle::_add_dependency_checks(), exaparty.api.particle.Particle.Particle::_dependency_checks_modify_steps(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_enum_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_double_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_integer_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_string_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_user_defined_attributes(), peano4.api.datamodel.PatchToDoubleArray.PatchToDoubleArray::_get_dictionary_for_output(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::construct_output(), peano4.api.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::construct_output(), peano4.api.datamodel.PatchToDoubleArray.PatchToDoubleArray::construct_output(), peano4.api.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::construct_output(), peano4.api.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::construct_output(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_header_file_include(), peano4.api.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::get_header_file_include(), peano4.api.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_header_file_include(), peano4.api.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_header_file_include(), peano4.api.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_header_file_include(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_stack_container(), peano4.api.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_stack_container(), peano4.api.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_stack_container(), peano4.api.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_stack_container(), peano4.api.datamodel.DaStGen2.DaStGen2::hosts_smart_pointer_attribute(), exaparty.api.particle.Particle.Particle::readme_descriptor(), exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius::set_parameters(), exaparty.api.particle.SPHParticle.SPHParticle::set_parameters(), and exaparty.api.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::ShallowMatrix< Rows, Cols, Scalar >::data ( ) const

Definition at line 125 of file ShallowMatrix.h.

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

Referenced by peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__generate_dastgen_input_file(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_file_name(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::__get_full_qualified_file_name(), exaparty.api.particle.Particle.Particle::__init__(), exaparty.api.particle.Particle.Particle::_add_dependency_checks(), exaparty.api.particle.Particle.Particle::_dependency_checks_modify_steps(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_boolean_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_double_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_enum_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_integer_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_double_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_peano_integer_array_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_string_attributes(), exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle::_generate_user_defined_attributes(), peano4.api.datamodel.PatchToDoubleArray.PatchToDoubleArray::_get_dictionary_for_output(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::construct_output(), peano4.api.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::construct_output(), peano4.api.datamodel.PatchToDoubleArray.PatchToDoubleArray::construct_output(), peano4.api.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::construct_output(), peano4.api.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::construct_output(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_header_file_include(), peano4.api.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector::get_header_file_include(), peano4.api.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_header_file_include(), peano4.api.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_header_file_include(), peano4.api.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_header_file_include(), peano4.api.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool::get_stack_container(), peano4.api.datamodel.PatchToDoubleArray.PatchToDoubleArray::get_stack_container(), peano4.api.datamodel.PatchToDoubleArrayOnHeap.PatchToDoubleArrayOnHeap::get_stack_container(), peano4.api.datamodel.PatchToDoubleArrayWithSmartPointer.PatchToDoubleArrayWithSmartPointer::get_stack_container(), peano4.api.datamodel.DaStGen2.DaStGen2::hosts_smart_pointer_attribute(), exaparty.api.particle.Particle.Particle::readme_descriptor(), exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius::set_parameters(), exaparty.api.particle.SPHParticle.SPHParticle::set_parameters(), and exaparty.api.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::ShallowMatrix< 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 72 of file ShallowMatrix.h.

References tarch::la::ShallowMatrix< Rows, Cols, Scalar >::_values, assertion5, and tarch::la::ShallowMatrix< 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::ShallowMatrix< 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 90 of file ShallowMatrix.h.

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

Here is the call graph for this function:

◆ operator=()

template<int Rows, int Cols, typename Scalar >
ShallowMatrix & tarch::la::ShallowMatrix< Rows, Cols, Scalar >::operator= ( const ShallowMatrix< Rows, Cols, Scalar > &  copy)

Shallow copy.

◆ rows()

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

Returns the number of rows in the matrix.

◆ size()

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

Returns the number of total elements in the matrix.

Referenced by tarch.plotter.api.input.Patch.Patch::__repr__().

Here is the caller graph for this function:

◆ toPrettyString()

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

◆ toString()

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

Field Documentation

◆ _values

template<int Rows, int Cols, typename Scalar >
Scalar* tarch::la::ShallowMatrix< Rows, Cols, Scalar >::_values
private

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