RealTimeTransport 1.0.0
Real-time simulation of quantum transport processes
Loading...
Searching...
No Matches
RealTimeTransport::BlockDiagonalMatrix Class Reference

#include <RealTimeTransport/BlockMatrices/BlockDiagonalMatrix.h>

This class represents a complex valued block diagonal matrix.

Public Types

using Scalar = SciCore::Complex
 Type representing the matrix elements.
 
using MatrixType = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>
 Type representing a matrix block.
 

Public Member Functions

 BlockDiagonalMatrix () noexcept
 Constructs an empty block diagonal matrix.
 
 BlockDiagonalMatrix (BlockDiagonalMatrix &&other) noexcept
 Move constructor.
 
 BlockDiagonalMatrix (const BlockDiagonalMatrix &other)
 Copy constructor.
 
 BlockDiagonalMatrix (std::vector< MatrixType > &&blocks) noexcept
 Constructs a block diagonal matrix with given blocks.
 
template<typename DenseMatrixT >
 BlockDiagonalMatrix (const DenseMatrixT &matrix, const std::vector< int > &blockDimensions)
 Constructs a block diagonal matrix from a dense matrix where the dimensions of the blocks are given by blockDimensions.
 
BlockDiagonalMatrixoperator= (BlockDiagonalMatrix &&other) noexcept
 Move assignment operator.
 
BlockDiagonalMatrixoperator= (const BlockDiagonalMatrix &other)
 Copy assignment operator.
 
bool operator== (const BlockDiagonalMatrix &other) const
 Equality comparison operator.
 
bool operator!= (const BlockDiagonalMatrix &other) const
 Inequality comparison operator.
 
BlockDiagonalMatrixoperator+= (const BlockDiagonalMatrix &rhs)
 Adds the block diagonal matrix rhs to the object.
 
BlockDiagonalMatrixoperator-= (const BlockDiagonalMatrix &rhs)
 Subtracts the block diagonal matrix rhs from the object.
 
BlockDiagonalMatrixoperator*= (const BlockDiagonalMatrix &rhs)
 Multiplies the block diagonal matrix rhs from the right to object.
 
BlockDiagonalMatrixoperator*= (SciCore::Real scalar)
 Multiplies the object by the a scalar.
 
BlockDiagonalMatrixoperator*= (SciCore::Complex scalar)
 Multiplies the object by the a scalar.
 
int numBlocks () const noexcept
 Multiplies the number of blocks.
 
int totalRows () const noexcept
 Returns the total number of rows.
 
int totalCols () const noexcept
 Returns the total number of columns.
 
std::vector< int > blockDimensions () const
 Returns a vector containing the dimensions of each block.
 
MatrixTypeoperator() (int i)
 Returns the matrix block with index i.
 
const MatrixTypeoperator() (int i) const
 Returns the matrix block with index i.
 
void fromBlocks (std::vector< MatrixType > &&newBlocks)
 Creates a new block diagonal matrix from given blocks.
 
template<typename DenseMatrixT >
void fromDense (const DenseMatrixT &matrix, const std::vector< int > &blockDimensions)
 Constructs a block diagonal matrix from a dense matrix where the dimensions of the blocks are given by blockDimensions.
 
void setZero (const std::vector< int > &blockDimensions)
 Sets the matrix to zero with block dimensions blockDimensions.
 
MatrixType toDense () const
 Returns a dense matrix representation.
 
const Scalarelement (int row, int column) const
 Returns the matrix element at a given row and column.
 
Scalarelement (int row, int colum)
 Returns the matrix element at a given row and column.
 

Static Public Member Functions

static BlockDiagonalMatrix Zero (const std::vector< int > &blockDimensions)
 Returns a matrix with given blockDimensions that is zero everywhere.
 
static BlockDiagonalMatrix Identity (const std::vector< int > &blockDimensions)
 Returns a matrix with given blockDimensions equal to the identity matrix.