PTEMS  0.1.0-dev+git.81fd0e4
PolyTopic Element Method Solver
ptems::MatrixVectorView< T, S, INC, IsConst, Column > Class Template Reference

A "view" object for accessing matrix rows or columns. More...

#include <ptems/matrix.hpp>

Public Types

typedef BasicMatrix< T, Column ? S :1, Column ? 1 :S > MatrixType
 Typedef for the type of a matrix this row/column will be converted to by ToMatrix. More...
 

Public Member Functions

template<std::size_t D = S, typename = std::enable_if_t<(D == S) && Column>>
constexpr operator BasicVector< T, D > ()
 Implicitly convert the column into a vector. More...
 
constexpr BasicVector< T, S > ToVector ()
 Convert the row or column into a vector. More...
 
constexpr MatrixType ToMatrix ()
 Convert the row or column into a matrix representing a row or column vector, respectively. More...
 
constexpr T operator[] (std::size_t i) const
 Get the specified entry in the row/column. More...
 
template<bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr T & operator[] (std::size_t i)
 Gets a mutable reference to specified entry in the row/column. More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator= (U val)
 Sets all entries in the row/column to the specified constant. More...
 
template<typename U , std::size_t I, bool IsC, bool Col, bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator= (const MatrixVectorView< U, S, I, IsC, Col > &val)
 Sets the entries in the row/column to the specified vector. More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator= (const BasicVector< U, S > &val)
 Sets the entries in the row/column to the specified vector. More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator= (const BasicMatrix< U, S, 1 > &val)
 Sets the entries in the row/column to the specified column vector (matrix) More...
 
template<typename U , bool Const = IsConst, std::size_t S1 = S, typename = std::enable_if_t<(S != 1) && (S1 == S) && (Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator= (const BasicMatrix< U, 1, S1 > &val)
 Sets the entries in the row/column to the specified row vector (matrix) More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator+= (U val)
 Sets all entries in the row/column to the specified constant. More...
 
template<typename U , std::size_t I, bool IsC, bool Col, bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator+= (const MatrixVectorView< U, S, I, IsC, Col > &val)
 Sets the entries in the row/column to the specified vector. More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator+= (const BasicVector< U, S > &val)
 Sets the entries in the row/column to the specified vector. More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator+= (const BasicMatrix< U, S, 1 > &val)
 Sets the entries in the row/column to the specified column vector (matrix) More...
 
template<typename U , bool Const = IsConst, std::size_t S1 = S, typename = std::enable_if_t<(S != 1) && (S1 == S) && (Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator+= (const BasicMatrix< U, 1, S1 > &val)
 Sets the entries in the row/column to the specified row vector (matrix) More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator-= (U val)
 Sets all entries in the row/column to the specified constant. More...
 
template<typename U , std::size_t I, bool IsC, bool Col, bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator-= (const MatrixVectorView< U, S, I, IsC, Col > &val)
 Sets the entries in the row/column to the specified vector. More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator-= (const BasicVector< U, S > &val)
 Sets the entries in the row/column to the specified vector. More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator-= (const BasicMatrix< U, S, 1 > &val)
 Sets the entries in the row/column to the specified column vector (matrix) More...
 
template<typename U , bool Const = IsConst, std::size_t S1 = S, typename = std::enable_if_t<(S != 1) && (S1 == S) && (Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator-= (const BasicMatrix< U, 1, S1 > &val)
 Sets the entries in the row/column to the specified row vector (matrix) More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator*= (U val)
 Sets all entries in the row/column to the specified constant. More...
 
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorViewoperator/= (U val)
 Sets all entries in the row/column to the specified constant. More...
 

Friends

template<typename U , std::size_t N1, std::size_t M1>
class BasicMatrix
 

Detailed Description

template<typename T, std::size_t S, std::size_t INC, bool IsConst, bool Column>
class ptems::MatrixVectorView< T, S, INC, IsConst, Column >

A "view" object for accessing matrix rows or columns.

Warning
This type is a "view", and as such is only valid to be used while the original Matrix is still active. Accessing entries in this view after the matrix is out of scope is undefined behaviour.
Template Parameters
SThe size of the matrix row
INCThe increment between entries in the view (1 for a row view, M for a column view)
IsConsttrue if the view is const; false otherwise
Columntrue if represents a column, false if represents a row

Member Typedef Documentation

◆ MatrixType

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
typedef BasicMatrix<T, Column ? S : 1, Column ? 1 : S> ptems::MatrixVectorView< T, S, INC, IsConst, Column >::MatrixType

Typedef for the type of a matrix this row/column will be converted to by ToMatrix.

Member Function Documentation

◆ operator BasicVector< T, D >()

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<std::size_t D = S, typename = std::enable_if_t<(D == S) && Column>>
constexpr ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator BasicVector< T, D > ( )
inlineexplicitconstexpr

Implicitly convert the column into a vector.

Note
Only valid for a column view
Returns
Vector copy of the row/column

◆ operator*=()

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator*= ( val)
inlineconstexpr

Sets all entries in the row/column to the specified constant.

Template Parameters
UType of the scalar constant to set values to
Parameters
valThe value to set all row/column entries to
Returns
this

◆ operator+=() [1/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, std::size_t S1 = S, typename = std::enable_if_t<(S != 1) && (S1 == S) && (Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator+= ( const BasicMatrix< U, 1, S1 > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified row vector (matrix)

Template Parameters
UType of the components of the matrix containing the values to set the entries to
Parameters
valThe matrix containing the values to set the row/column entries to
Returns
this

◆ operator+=() [2/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator+= ( const BasicMatrix< U, S, 1 > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified column vector (matrix)

Template Parameters
UType of the components of the matrix containing the values to set the entries to
Parameters
valThe matrix containing the values to set the row/column entries to
Returns
this

◆ operator+=() [3/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator+= ( const BasicVector< U, S > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified vector.

Template Parameters
UType of the components of the vector containing the values to set the entries to
Parameters
valThe vector containing the values to set the row/column entries to
Returns
this

◆ operator+=() [4/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , std::size_t I, bool IsC, bool Col, bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator+= ( const MatrixVectorView< U, S, I, IsC, Col > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified vector.

Template Parameters
UType of the components of the vector containing the values to set the entries to
Parameters
valThe vector containing the values to set the row/column entries to
Returns
this

◆ operator+=() [5/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator+= ( val)
inlineconstexpr

Sets all entries in the row/column to the specified constant.

Template Parameters
UType of the scalar constant to set values to
Parameters
valThe value to set all row/column entries to
Returns
this

◆ operator-=() [1/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, std::size_t S1 = S, typename = std::enable_if_t<(S != 1) && (S1 == S) && (Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator-= ( const BasicMatrix< U, 1, S1 > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified row vector (matrix)

Template Parameters
UType of the components of the matrix containing the values to set the entries to
Parameters
valThe matrix containing the values to set the row/column entries to
Returns
this

◆ operator-=() [2/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator-= ( const BasicMatrix< U, S, 1 > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified column vector (matrix)

Template Parameters
UType of the components of the matrix containing the values to set the entries to
Parameters
valThe matrix containing the values to set the row/column entries to
Returns
this

◆ operator-=() [3/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator-= ( const BasicVector< U, S > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified vector.

Template Parameters
UType of the components of the vector containing the values to set the entries to
Parameters
valThe vector containing the values to set the row/column entries to
Returns
this

◆ operator-=() [4/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , std::size_t I, bool IsC, bool Col, bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator-= ( const MatrixVectorView< U, S, I, IsC, Col > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified vector.

Template Parameters
UType of the components of the vector containing the values to set the entries to
Parameters
valThe vector containing the values to set the row/column entries to
Returns
this

◆ operator-=() [5/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator-= ( val)
inlineconstexpr

Sets all entries in the row/column to the specified constant.

Template Parameters
UType of the scalar constant to set values to
Parameters
valThe value to set all row/column entries to
Returns
this

◆ operator/=()

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator/= ( val)
inlineconstexpr

Sets all entries in the row/column to the specified constant.

Template Parameters
UType of the scalar constant to set values to
Parameters
valThe value to set all row/column entries to
Returns
this

◆ operator=() [1/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, std::size_t S1 = S, typename = std::enable_if_t<(S != 1) && (S1 == S) && (Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator= ( const BasicMatrix< U, 1, S1 > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified row vector (matrix)

Template Parameters
UType of the components of the matrix containing the values to set the entries to
Parameters
valThe matrix containing the values to set the row/column entries to
Returns
this

◆ operator=() [2/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator= ( const BasicMatrix< U, S, 1 > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified column vector (matrix)

Template Parameters
UType of the components of the matrix containing the values to set the entries to
Parameters
valThe matrix containing the values to set the row/column entries to
Returns
this

◆ operator=() [3/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator= ( const BasicVector< U, S > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified vector.

Template Parameters
UType of the components of the vector containing the values to set the entries to
Parameters
valThe vector containing the values to set the row/column entries to
Returns
this

◆ operator=() [4/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , std::size_t I, bool IsC, bool Col, bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator= ( const MatrixVectorView< U, S, I, IsC, Col > &  val)
inlineconstexpr

Sets the entries in the row/column to the specified vector.

Template Parameters
UType of the components of the vector containing the values to set the entries to
Parameters
valThe vector containing the values to set the row/column entries to
Returns
this

◆ operator=() [5/5]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<typename U , bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr MatrixVectorView& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator= ( val)
inlineconstexpr

Sets all entries in the row/column to the specified constant.

Template Parameters
UType of the scalar constant to set values to
Parameters
valThe value to set all row/column entries to
Returns
this

◆ operator[]() [1/2]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
template<bool Const = IsConst, typename = std::enable_if_t<(Const == IsConst) && !Const>>
constexpr T& ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator[] ( std::size_t  i)
inlineconstexpr

Gets a mutable reference to specified entry in the row/column.

Note
Only available if a non-const view
Parameters
iThe index of the entry
Returns
Reference to the entry

◆ operator[]() [2/2]

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
constexpr T ptems::MatrixVectorView< T, S, INC, IsConst, Column >::operator[] ( std::size_t  i) const
inlineconstexpr

Get the specified entry in the row/column.

Parameters
iThe index of the entry
Returns
The value in the entry

◆ ToMatrix()

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
constexpr MatrixType ptems::MatrixVectorView< T, S, INC, IsConst, Column >::ToMatrix ( )
inlineconstexpr

Convert the row or column into a matrix representing a row or column vector, respectively.

Returns
Vector copy of the row/column

◆ ToVector()

template<typename T , std::size_t S, std::size_t INC, bool IsConst, bool Column>
constexpr BasicVector<T, S> ptems::MatrixVectorView< T, S, INC, IsConst, Column >::ToVector ( )
inlineconstexpr

Convert the row or column into a vector.

Returns
Vector copy of the row/column

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