Triangular Map

template<Number ElemType, MatrixTriangularType UpLo, DataLocation Location>
class TriangularMap : public HighFM::MatrixBase<TriangularMap<ElemType, UpLo, Location>>, public HighFM::DataMap<ElemType, Location>

An upper or lower triangular matrix (if it is square) or trapezoidal matrix (if it is non-square). This object acts a map over a dense Matrix, such that all changes in this object will be reflected in the original matrix, and vice versa.

A TriangularMap can be explicitly created by calling upper_triangular() or lower_triangular() from an existing Matrix. Some matrix factorizations, such as QR and LQ, also return this object.

Template Parameters:
  • ElemType – Data type of the entries.

  • UpLo – Indicate if it is a kLower or kUpper triangular/trapezoidal matrix.

  • Location – Location of the data

Constructor

TriangularMap()

Creates an empty TriangularMap.

template<template<typename, typename> typename OtherStorage>
TriangularMap(const Matrix<ElemType, Location, OtherStorage> &mat)

Creates a TriangularMap from a dense Matrix.

Parameters:

mat[in] another TriangularMap to use as the data source.

TriangularMap(const TriangularMap &other)

Creates a TriangularMap from an other TriangularMap. This will just duplicate the map without copying the data.

Parameters:

other[in] another TriangularMap to use as the data source.

Destructor

virtual ~TriangularMap() = default

Default destructor.

Assignment

template<Number T>
inline TriangularMap &operator=(T scalar)

Sets all elements in the container to scalar.

Parameters:

scalar[in] scalar to use as the data source

Returns:

*this.

template<DataLocation OtherLoc>
TriangularMap &operator=(const TriangularMap<ElemType, UpLo, OtherLoc> &other)

Copies the content from other to this container.

Parameters:

other[in] a TriangularMap to use as the data source

Returns:

*this.

TriangularMap &operator=(const TriangularMap &other)

Copies the content from other to this container.

Parameters:

other[in] another TriangularMap to use as the data source.

Returns:

*this.

Element Access

ElemType &operator()(index_t row, index_t col)
Parameters:
  • row[in] index of the row.

  • col[in] index of the column.

Returns:

The element at (row, col).

ElemType operator()(index_t row, index_t col) const
Parameters:
  • row[in] index of the row.

  • col[in] index of the row.

Returns:

The element at (row, col).

Capacity

index_t rows() const noexcept
Returns:

The number of rows in the TriangularMap.

index_t cols() const noexcept
Returns:

The number of columns in the TriangularMap.

virtual index_t size() const noexcept
Returns:

The number of elements in the TriangularMap.

index_t lead_dim() const noexcept
Returns:

The leading dimension of the TriangularMap.

Modifiers

void swap(TriangularMap &other) noexcept

Swaps the Matrix content with the other TriangularMap, including any memory allocation (if applicable).

Parameters:

other[in] another TriangularMap to exchange content with.

void map_to(MatrixData<ElemType> data)

Replaces the managed container.

Parameters:

data[in] struct containing the information about the container

template<template<typename, typename> typename OtherStorage>
void map_to(const Matrix<ElemType, Location, OtherStorage> &other)

Replaces the managed container.

Parameters:

other[in] a Matrix to use as the data source

internal::ConjugateTransposeOp<TriangularMap, internal::kTranspose> T() const
Returns:

An abstract expression representing the transpose of the TriangularMap.

internal::ConjugateTransposeOp<TriangularMap, internal::kAdjoint> H() const
Returns:

An abstract expression representing the adjoint (conjugate transpose) of the TriangularMap. This is equivalent to T() if the matrix is real.

internal::ConjugateOp<TriangularMap> conj() const
Returns:

An abstract expression representing the conjugate of the TriangularMap. If the matrix is real, this is a noop.

MatrixData<ElemType> mat_data() const
Returns:

a simple struct with a pointer to the container and its dimensions.