Template Numerical Library version\ main:bb09b17
|
Base class for the implementation of concrete matrix types. More...
#include <TNL/Matrices/MatrixBase.h>
Public Types | |
using | ConstValuesViewType = typename ValuesViewType::ConstViewType |
Type of constant vector view holding values of matrix elements. | |
using | DeviceType = Device |
The device where the matrix is allocated. | |
using | IndexType = Index |
The type used for matrix elements indexing. | |
using | RealType = std::remove_const_t< Real > |
The type of matrix elements. | |
using | RowCapacitiesType = Containers::Vector< Index, Device, Index > |
using | ValuesViewType = Containers::VectorView< Real, Device, Index > |
Type of vector view holding values of matrix elements. | |
Public Member Functions | |
__cuda_callable__ | MatrixBase ()=default |
Basic constructor with no parameters. | |
__cuda_callable__ | MatrixBase (const MatrixBase &view)=default |
Shallow copy constructor. | |
__cuda_callable__ | MatrixBase (IndexType rows, IndexType columns, ValuesViewType values) |
Constructor with matrix dimensions and matrix elements values. | |
__cuda_callable__ | MatrixBase (MatrixBase &&view) noexcept=default |
Move constructor. | |
IndexType | getAllocatedElementsCount () const |
Tells the number of allocated matrix elements. | |
__cuda_callable__ IndexType | getColumns () const |
Returns number of matrix columns. | |
virtual IndexType | getNonzeroElementsCount () const |
Computes a current number of nonzero matrix elements. | |
__cuda_callable__ IndexType | getRows () const |
Returns number of matrix rows. | |
__cuda_callable__ ValuesViewType & | getValues () |
Returns a reference to a vector with the matrix elements values. | |
__cuda_callable__ const ValuesViewType & | getValues () const |
Returns a constant reference to a vector with the matrix elements values. | |
template<typename Matrix > | |
bool | operator!= (const Matrix &matrix) const |
Comparison operator with another arbitrary matrix view type. | |
template<typename MatrixT > | |
bool | operator!= (const MatrixT &matrix) const |
__cuda_callable__ MatrixBase & | operator= (const MatrixBase &)=delete |
Copy-assignment operator. | |
__cuda_callable__ MatrixBase & | operator= (MatrixBase &&)=delete |
Move-assignment operator. | |
template<typename Matrix > | |
bool | operator== (const Matrix &matrix) const |
Comparison operator with another arbitrary matrix view type. | |
template<typename MatrixT > | |
bool | operator== (const MatrixT &matrix) const |
Static Public Member Functions | |
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 | |
__cuda_callable__ void | bind (IndexType rows, IndexType columns, ValuesViewType values) |
Re-initializes the internal attributes of the base class. | |
Protected Attributes | |
IndexType | columns = 0 |
IndexType | rows = 0 |
ValuesViewType | values |
Base class for the implementation of concrete matrix types.
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. |
__cuda_callable__ TNL::Matrices::MatrixBase< Real, Device, Index, MatrixType, Organization >::MatrixBase | ( | IndexType | rows, |
IndexType | columns, | ||
ValuesViewType | values ) |
Constructor with matrix dimensions and matrix elements values.
The matrix elements values are passed in a form vector view.
rows | is a number of matrix rows. |
columns | is a number of matrix columns. |
values | is a vector view with matrix elements values. |
|
default |
Shallow copy constructor.
view | is an input matrix view. |
|
defaultnoexcept |
Move constructor.
view | is an input matrix view. |
|
protected |
Re-initializes the internal attributes of the base class.
Note that this function is protected to ensure that the user cannot modify the base class of a matrix. For the same reason, in future code development we also need to make sure that all non-const functions in the base class return by value and not by reference.
|
nodiscard |
Tells the number of allocated matrix elements.
In the case of dense matrices, this is just product of the number of rows and the number of columns. But for other matrix types like sparse matrices, this can be different.
|
nodiscard |
Returns number of matrix columns.
|
nodiscardvirtual |
Computes a current number of nonzero matrix elements.
Reimplemented in TNL::Matrices::MultidiagonalMatrixBase< Real, Device, Index, Organization >, TNL::Matrices::MultidiagonalMatrixBase< double, Devices::Host, int, Algorithms::Segments::DefaultElementsOrganization< Devices::Host >::getOrganization() >, TNL::Matrices::Sandbox::SparseSandboxMatrixView< Real, Device, Index, MatrixType >, TNL::Matrices::Sandbox::SparseSandboxMatrixView< double, Devices::Host, int, GeneralMatrix >, TNL::Matrices::SparseMatrixBase< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >, TNL::Matrices::SparseMatrixBase< double, Devices::Host, int, GeneralMatrix, Algorithms::Segments::CSR< Devices::Host, int, typename Allocators::Default< Devices::Host >::template Allocator< int > >::ViewType, typename ChooseSparseMatrixComputeReal< double, int >::type >, TNL::Matrices::SparseMatrixBase< Real, Devices::Host, int, GeneralMatrix, std::conditional_t< std::is_const_v< Real >, Algorithms::Segments::CSRView< Devices::Host, int >::ConstViewType, Algorithms::Segments::CSRView< Devices::Host, int > >, typename ChooseSparseMatrixComputeReal< Real, int >::type >, TNL::Matrices::SparseMatrixBase< Real, TNL::Devices::Host, IndexType, TNL::Matrices::GeneralMatrix, Segments< TNL::Devices::Host, IndexType, typename Allocators::Default< TNL::Devices::Host >::template Allocator< IndexType > >::ViewType, typename ChooseSparseMatrixComputeReal< Real, IndexType >::type >, TNL::Matrices::SparseMatrixBase< RealType, DeviceType, IndexType, Matrices::GeneralMatrix, Segments< DeviceType, IndexType, typename Allocators::Default< DeviceType >::template Allocator< IndexType > >::ViewType, typename ChooseSparseMatrixComputeReal< RealType, IndexType >::type >, TNL::Matrices::TridiagonalMatrixBase< Real, Device, Index, Organization >, and TNL::Matrices::TridiagonalMatrixBase< double, Devices::Host, int, Algorithms::Segments::DefaultElementsOrganization< Devices::Host >::getOrganization() >.
|
inlinestaticnodiscardconstexpr |
Matrix elements organization getter.
|
nodiscard |
Returns number of matrix rows.
|
nodiscard |
Returns a reference to a vector with the matrix elements values.
|
nodiscard |
Returns a constant reference to a vector with the matrix elements values.
|
inlinestaticnodiscardconstexpr |
Test of binary matrix type.
|
inlinestaticnodiscardconstexpr |
Test of symmetric matrix type.
|
nodiscard |
Comparison operator with another arbitrary matrix view type.
matrix | is the right-hand side matrix. |
|
delete |
Copy-assignment operator.
It is a deleted function, because matrix assignment in general requires reallocation.
|
nodiscard |
Comparison operator with another arbitrary matrix view type.
matrix | is the right-hand side matrix. |