Template Numerical Library: TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization > Class Template Reference

Template Numerical Library version\ main:be7e16d88

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization > Class Template Reference

Implementation of sparse tridiagonal matrix. More...

`#include <TNL/Matrices/TridiagonalMatrixView.h>`

Inheritance diagram for TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization >:
[legend]
Collaboration diagram for TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization >:
[legend]

## Public Types
using | ConstViewType = TridiagonalMatrixView< std::add_const_t< Real >, Device, Index, Organization >
| Matrix view type for constant instances.
template<typename _Real = Real, typename _Device = Device, typename _Index = Index, ElementsOrganization Organization_ = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization()>
using | Self = TridiagonalMatrixView< _Real, _Device, _Index, Organization_ >
| Helper type for getting self type or its modifications.
using | ViewType = TridiagonalMatrixView< Real, Device, Index, Organization >
Public Types inherited from TNL::Matrices::TridiagonalMatrixBase< double, Devices::Host, int, Algorithms::Segments::DefaultElementsOrganization< Devices::Host >::getOrganization() >
using | ConstRowView
| Type for accessing constant matrix rows.
using | DeviceType
| The device where the matrix is allocated.
using | IndexerType
using | IndexType
| The type used for matrix elements indexing.
using | RealType
| The type of matrix elements.
using | RowView
| Type for accessing matrix rows.
Public Types inherited from TNL::Matrices::MatrixBase< double, Devices::Host, int, GeneralMatrix, Organization >
using | ConstValuesViewType
| Type of constant vector view holding values of matrix elements.
using | DeviceType
| The device where the matrix is allocated.
using | IndexType
| The type used for matrix elements indexing.
using | RealType
| The type of matrix elements.
using | RowCapacitiesType
using | ValuesViewType
| Type of vector view holding values of matrix elements.

## Public Member Functions
__cuda_callable__ | TridiagonalMatrixView ()=default
| Constructor with no parameters.
__cuda_callable__ | TridiagonalMatrixView (const TridiagonalMatrixView &)=default
| Copy constructor.
__cuda_callable__ | TridiagonalMatrixView (TridiagonalMatrixView &&) noexcept=default
| Move constructor.
__cuda_callable__ | TridiagonalMatrixView (typename Base::ValuesViewType values, typename Base::IndexerType indexer)
| Constructor with all necessary data and views.
__cuda_callable__ void | bind (TridiagonalMatrixView view)
| Method for rebinding (reinitialization) using another tridiagonal matrix view.
ConstViewType | getConstView () const
| Returns a non-modifiable view of the tridiagonal matrix.
ViewType | getView ()
| Returns a modifiable view of the tridiagonal matrix.
TridiagonalMatrixView & | operator= (const TridiagonalMatrixView &)=delete
| Copy-assignment operator.
TridiagonalMatrixView & | operator= (TridiagonalMatrixView &&)=delete
| Move-assignment operator.
Public Member Functions inherited from TNL::Matrices::TridiagonalMatrixBase< double, Devices::Host, int, Algorithms::Segments::DefaultElementsOrganization< Devices::Host >::getOrganization() >
__cuda_callable__ | TridiagonalMatrixBase ()=default
| Constructor with no parameters.
__cuda_callable__ void | addElement (IndexType row, IndexType column, const RealType &value, const RealType &thisElementMultiplicator=1.0)
| Add element at given row and column to given value.
void | addMatrix (const TridiagonalMatrixBase< Real_, Device_, Index_, Organization_ > &matrix, const RealType &matrixMultiplicator=1.0, const RealType &thisMatrixMultiplicator=1.0)
void | forAllElements (Function &function) const
| This method calls forElements for all matrix rows (for constant instances).
void | forAllRows (Function &&function)
| Method for parallel iteration over all matrix rows.
void | forElements (IndexType begin, IndexType end, Function &function) const
| Method for iteration over all matrix rows for constant instances.
void | forRows (IndexType begin, IndexType end, Function &&function)
| Method for parallel iteration over matrix rows from interval [begin, end).
void | getCompressedRowLengths (Vector &rowLengths) const
| Computes number of non-zeros in each row.
__cuda_callable__ RealType | getElement (IndexType row, IndexType column) const
| Returns value of matrix element at position given by its row and column index.
__cuda_callable__ const IndexerType & | getIndexer () const
| This method returns matrix elements indexer used by this matrix.
IndexType | getNonzeroElementsCount () const
| Returns number of non-zero matrix elements.
__cuda_callable__ RowView | getRow (IndexType rowIdx)
| Non-constant getter of simple structure for accessing given matrix row.
void | getRowCapacities (Vector &rowCapacities) const
| Compute capacities of all rows.
bool | operator!= (const TridiagonalMatrixBase< Real_, Device_, Index_, Organization_ > &matrix) const
| Comparison operator with another multidiagonal matrix.
TridiagonalMatrixBase & | operator= (const TridiagonalMatrixBase &)=delete
| Copy-assignment operator.
bool | operator== (const TridiagonalMatrixBase< Real_, Device_, Index_, Organization_ > &matrix) const
| Comparison operator with another tridiagonal matrix.
void | print (std::ostream &str) const
| Method for printing the matrix to output stream.
void | reduceAllRows (Fetch &&fetch, const Reduce &reduce, Keep &&keep, const FetchReal &identity) const
| Method for performing general reduction on all matrix rows for constant instances.
void | reduceRows (IndexType begin, IndexType end, Fetch &&fetch, const Reduce &reduce, Keep &&keep, const FetchReal &identity) const
| Method for performing general reduction on matrix rows for constant instances.
void | sequentialForAllRows (Function &function) const
| This method calls sequentialForRows for all matrix rows (for constant instances).
void | sequentialForRows (IndexType begin, IndexType end, Function &function) const
| Method for sequential iteration over all matrix rows for constant instances.
__cuda_callable__ void | setElement (IndexType row, IndexType column, const RealType &value)
| Sets element at given row and column to given value.
void | setValue (const RealType &value)
| Set all matrix elements to given value.
void | vectorProduct (const InVector &inVector, OutVector &outVector, RealType matrixMultiplicator=1.0, RealType outVectorMultiplicator=0.0, IndexType begin=0, IndexType end=0) const
| Computes product of matrix and vector.
Public Member Functions inherited from TNL::Matrices::MatrixBase< double, Devices::Host, int, GeneralMatrix, Organization >
__cuda_callable__ | MatrixBase ()=default
| Basic constructor with no parameters.
IndexType | getAllocatedElementsCount () const
| Tells the number of allocated matrix elements.
__cuda_callable__ IndexType | getColumns () const
| Returns number of matrix columns.
__cuda_callable__ IndexType | getRows () const
| Returns number of matrix rows.
__cuda_callable__ const ValuesViewType & | getValues () const
| Returns a constant reference to a vector with the matrix elements values.
__cuda_callable__ MatrixBase & | operator= (const MatrixBase &)=delete
| Copy-assignment operator.

## Additional Inherited Members
Static Public Member Functions inherited from TNL::Matrices::TridiagonalMatrixBase< double, Devices::Host, int, Algorithms::Segments::DefaultElementsOrganization< Devices::Host >::getOrganization() >
static std::string | getSerializationType ()
| Returns string with serialization type.
Static Public Member Functions inherited from TNL::Matrices::MatrixBase< double, Devices::Host, int, GeneralMatrix, Organization >
static constexpr ElementsOrganization | getOrganization ()
| Matrix elements organization getter.
static constexpr bool | isBinary ()
| Test of binary matrix type.
static constexpr bool | isSymmetric ()
| Test of symmetric matrix type.
Protected Member Functions inherited from TNL::Matrices::TridiagonalMatrixBase< double, Devices::Host, int, Algorithms::Segments::DefaultElementsOrganization< Devices::Host >::getOrganization() >
__cuda_callable__ void | bind (typename Base::ValuesViewType values, IndexerType indexer)
| Re-initializes the internal attributes of the base class.
__cuda_callable__ IndexType | getElementIndex (IndexType row, IndexType column) const
Protected Member Functions inherited from TNL::Matrices::MatrixBase< double, Devices::Host, int, GeneralMatrix, Organization >
__cuda_callable__ void | bind (IndexType rows, IndexType columns, ValuesViewType values)
| Re-initializes the internal attributes of the base class.
Protected Attributes inherited from TNL::Matrices::TridiagonalMatrixBase< double, Devices::Host, int, Algorithms::Segments::DefaultElementsOrganization< Devices::Host >::getOrganization() >
IndexerType | indexer
Protected Attributes inherited from TNL::Matrices::MatrixBase< double, Devices::Host, int, GeneralMatrix, Organization >
IndexType | columns
IndexType | rows
ValuesViewType | values

## Detailed Description

template<typename Real = double, typename Device = Devices::Host, typename Index = int, ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization()>
class TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization >

Implementation of sparse tridiagonal matrix.

It serves as an accessor to SparseMatrix for example when passing the matrix to lambda functions. SparseMatrix view can be also created in CUDA kernels.

See TridiagonalMatrix for more details.

Template Parameters

  Real | is a type of matrix elements.
  Device | is a device where the matrix is allocated.
  Index | is a type for indexing of the matrix elements.
  Organization | tells the ordering of matrix elements. It is either RowMajorOrder or ColumnMajorOrder.

## Constructor & Destructor Documentation

## ◆ TridiagonalMatrixView()

template<typename Real = double, typename Device = Devices::Host, typename Index = int, ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization()>

__cuda_callable__ TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization >::TridiagonalMatrixView | ( | typename Base::ValuesViewType | values,
|  | typename Base::IndexerType | indexer )

Constructor with all necessary data and views.

Parameters

  values | is a vector view with matrix elements values
  indexer | is an indexer of matrix elements

## Member Function Documentation

## ◆ bind()

template<typename Real = double, typename Device = Devices::Host, typename Index = int, ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization()>

__cuda_callable__ void TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization >::bind | ( | TridiagonalMatrixView< Real, Device, Index, Organization > | view | ) |

Method for rebinding (reinitialization) using another tridiagonal matrix view.

Parameters

  view | The tridiagonal matrix view to be bound.

## ◆ getConstView()

template<typename Real = double, typename Device = Devices::Host, typename Index = int, ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization()>

ConstViewType TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization >::getConstView | ( |  | ) | const
| nodiscard

Returns a non-modifiable view of the tridiagonal matrix.

Returns
  tridiagonal matrix view.

## ◆ getView()

template<typename Real = double, typename Device = Devices::Host, typename Index = int, ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization()>

ViewType TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization >::getView | ( |  | ) |
| nodiscard

Returns a modifiable view of the tridiagonal matrix.

Returns
  tridiagonal matrix view.

## ◆ operator=()

template<typename Real = double, typename Device = Devices::Host, typename Index = int, ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization()>

TridiagonalMatrixView & TNL::Matrices::TridiagonalMatrixView< Real, Device, Index, Organization >::operator= | ( | const TridiagonalMatrixView< Real, Device, Index, Organization > & |  | ) |
| delete

Copy-assignment operator.

It is a deleted function, because matrix assignment in general requires reallocation.

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

- src/TNL/Matrices/TridiagonalMatrixView.h