Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Morpheus::MatrixBase< Container, ValueType, Properties > Class Template Reference

Base class used to derive new matrices. More...

#include <Morpheus_MatrixBase.hpp>

Inheritance diagram for Morpheus::MatrixBase< Container, ValueType, Properties >:
Inheritance graph
[legend]
Collaboration diagram for Morpheus::MatrixBase< Container, ValueType, Properties >:
Collaboration graph
[legend]

Public Types

using type = MatrixBase< Container, ValueType, Properties... >
 The traits associated with the particular container.
 
using traits = ContainerTraits< Container, ValueType, Properties... >
 The type of the indices held by the container.
 
using size_type = typename traits::size_type
 
- Public Types inherited from Morpheus::ContainerTraits< Container, ValueType, Properties... >
enum  
 
enum  
 
using value_type = ValueType
 The type of values held by the container.
 
using const_value_type = typename std::add_const< ValueType >::type
 The const type of values held by the container.
 
using non_const_value_type = typename std::remove_const< ValueType >::type
 The non-const type of values held by the container.
 
using index_type = IndexType
 The type of indices held by the container.
 
using size_type = size_t
 The size type of the container.
 
using non_const_index_type = typename std::remove_const< IndexType >::type
 The non-const type of indices held by the container.
 
using array_layout = ArrayLayout
 The storage layout of data held by the container.
 
using backend = Backend
 The backend out of which algorithms will be dispatched from.
 
using execution_space = ExecutionSpace
 The space in which member functions will be executed in.
 
using memory_space = MemorySpace
 The space in which data will be stored in.
 
using device_type = Morpheus::Device< execution_space, memory_space, backend >
 A device aware of the execution, memory spaces and backend.
 
using memory_traits = MemoryTraits
 Represents the user's intended access behaviour.
 
using host_mirror_backend = typename Morpheus::HostMirror< backend >::backend
 The host equivalent backend.
 
using type = Container< value_type, index_type, array_layout, backend, memory_traits >
 The complete type of the container.
 
using HostMirror = Container< non_const_value_type, non_const_index_type, array_layout, Morpheus::Device< typename host_mirror_backend::execution_space, typename host_mirror_backend::memory_space, typename host_mirror_backend::backend >, typename Kokkos::MemoryManaged >
 The host mirror equivalent for the container. More...
 
using pointer = typename std::add_pointer< type >::type
 The pointer type of the container.
 
using const_pointer = typename std::add_pointer< typename std::add_const< type >::type >::type
 The const pointer type of the container.
 
using reference = typename std::add_lvalue_reference< type >::type
 The reference type of the container.
 
using const_reference = typename std::add_lvalue_reference< typename std::add_const< type >::type >::type
 The const reference type of the container.
 

Public Member Functions

 MatrixBase ()
 Default constructor. More...
 
 MatrixBase (size_type rows, size_type cols, size_type entries=0)
 Construct a MatrixBase object with shape (num_rows, num_cols) and number of non-zeros equal to num_entries. More...
 
void resize (size_type rows, size_type cols, size_type entries)
 Resizes MatrixBase with shape of (num_rows, num_cols) and sets number of non-zero entries to num_entries. More...
 
size_type nrows () const
 Number of rows of the matrix. More...
 
size_type ncols () const
 Number of columns of the matrix. More...
 
size_type nnnz () const
 Number of non-zeros of the matrix. More...
 
void set_nrows (const size_type rows)
 Set the number of rows of the matrix. More...
 
void set_ncols (const size_type cols)
 Set the number of columns of the matrix. More...
 
void set_nnnz (const size_type nnz)
 Set the number of non-zeros of the matrix. More...
 
MatrixStructure structure () const
 The specialized structure of the matrix e.g Symmetric. More...
 
MatrixOptions options () const
 Information about specific characteristics of the matrix e.g has short rows. More...
 
void set_structure (MatrixStructure op)
 Set the structure of the matrix. More...
 
void set_options (MatrixOptions op)
 Set the characteristics of the matrix. More...
 

Detailed Description

template<template< class, class... > class Container, class ValueType, class... Properties>
class Morpheus::MatrixBase< Container, ValueType, Properties >

Base class used to derive new matrices.

Template Parameters
ContainerType of the new container we are deriving.
ValueTypeType of values to store
PropertiesOptional properties to modify the behaviour of the container. Sensible defaults are selected based on the configuration. Please refer to impl/Morpheus_ContainerTraits.hpp to find out more about the valid properties.
Overview
The MatrixBase class is used to organize common information that is often found across the different matrix types/formats. Examples of such information is the shape of the matrix, a specific structure might have (e.g Symmetric) or any specific properties such as it has short rows.
Example
The example below shows how to define a new matrix class that will inherit from MatrixBase.
#include <Morpheus_Core.hpp>
template <class ValueType, class... Properties>
class NewMatrix : public MatrixBase<NewMatrix, ValueType, Properties...>{
using base = MatrixBase<NewMatrix, ValueType, Properties...>;
// Implementation
}
Base class used to derive new matrices.
Definition: Morpheus_MatrixBase.hpp:70
A wrapper that checks if the provided type is a scalar type.
Definition: Morpheus_TypeTraits.hpp:85

Constructor & Destructor Documentation

◆ MatrixBase() [1/2]

template<template< class, class... > class Container, class ValueType , class... Properties>
Morpheus::MatrixBase< Container, ValueType, Properties >::MatrixBase ( )
inline

Default constructor.

◆ MatrixBase() [2/2]

template<template< class, class... > class Container, class ValueType , class... Properties>
Morpheus::MatrixBase< Container, ValueType, Properties >::MatrixBase ( size_type  rows,
size_type  cols,
size_type  entries = 0 
)
inline

Construct a MatrixBase object with shape (num_rows, num_cols) and number of non-zeros equal to num_entries.

Parameters
num_rowsNumber of rows of the matrix.
num_colsNumber of columns of the matrix.
num_entriesNumber of non-zero values in the matrix.

Member Function Documentation

◆ ncols()

template<template< class, class... > class Container, class ValueType , class... Properties>
size_type Morpheus::MatrixBase< Container, ValueType, Properties >::ncols ( ) const
inline

Number of columns of the matrix.

Returns
size_type

◆ nnnz()

template<template< class, class... > class Container, class ValueType , class... Properties>
size_type Morpheus::MatrixBase< Container, ValueType, Properties >::nnnz ( ) const
inline

Number of non-zeros of the matrix.

Returns
size_type

◆ nrows()

template<template< class, class... > class Container, class ValueType , class... Properties>
size_type Morpheus::MatrixBase< Container, ValueType, Properties >::nrows ( ) const
inline

Number of rows of the matrix.

Returns
size_type

◆ options()

template<template< class, class... > class Container, class ValueType , class... Properties>
MatrixOptions Morpheus::MatrixBase< Container, ValueType, Properties >::options ( ) const
inline

Information about specific characteristics of the matrix e.g has short rows.

Returns
MatrixOptions

◆ resize()

template<template< class, class... > class Container, class ValueType , class... Properties>
void Morpheus::MatrixBase< Container, ValueType, Properties >::resize ( size_type  rows,
size_type  cols,
size_type  entries 
)
inline

Resizes MatrixBase with shape of (num_rows, num_cols) and sets number of non-zero entries to num_entries.

Parameters
num_rowsNumber of rows of resized matrix.
num_colsNumber of columns of resized matrix.
num_entriesNumber of non-zero entries in resized matrix.

◆ set_ncols()

template<template< class, class... > class Container, class ValueType , class... Properties>
void Morpheus::MatrixBase< Container, ValueType, Properties >::set_ncols ( const size_type  cols)
inline

Set the number of columns of the matrix.

Parameters
rowsNumber of columns

◆ set_nnnz()

template<template< class, class... > class Container, class ValueType , class... Properties>
void Morpheus::MatrixBase< Container, ValueType, Properties >::set_nnnz ( const size_type  nnz)
inline

Set the number of non-zeros of the matrix.

Parameters
rowsNumber of non-zeros

◆ set_nrows()

template<template< class, class... > class Container, class ValueType , class... Properties>
void Morpheus::MatrixBase< Container, ValueType, Properties >::set_nrows ( const size_type  rows)
inline

Set the number of rows of the matrix.

Parameters
rowsNumber of rows

◆ set_options()

template<template< class, class... > class Container, class ValueType , class... Properties>
void Morpheus::MatrixBase< Container, ValueType, Properties >::set_options ( MatrixOptions  op)
inline

Set the characteristics of the matrix.

Parameters
opEnum for available options

◆ set_structure()

template<template< class, class... > class Container, class ValueType , class... Properties>
void Morpheus::MatrixBase< Container, ValueType, Properties >::set_structure ( MatrixStructure  op)
inline

Set the structure of the matrix.

Parameters
opEnum for the matrix structure

◆ structure()

template<template< class, class... > class Container, class ValueType , class... Properties>
MatrixStructure Morpheus::MatrixBase< Container, ValueType, Properties >::structure ( ) const
inline

The specialized structure of the matrix e.g Symmetric.

Returns
MatrixStructure

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