Class qOperator#
Defined in File qOperator.hpp
Class Documentation#
-
class qOperator#
Represents a quantum operator in a block-diagonal form.
This class provides methods to manipulate and display quantum operators used in the NRG calculations.
Public Functions
-
qOperator() = default#
Default constructor creates an empty block-operator.
-
inline qOperator(qmatrix<double> &opr, size_t i, size_t j)#
Construct a block operator with an initial block entry.
This constructor stores a single block
oprat block coordinates(i,j)and supports move semantics for efficient block initialization.- Parameters:
opr – The block matrix to insert.
i – Block row index.
j – Block column index.
-
inline auto getMap()#
Get the internal Storage object of the
qmatrix- Returns:
std::map<std::array<size_t, 2>, qmatrix<>>
-
inline void set(const qmatrix<double> &opr, size_t i, size_t j)#
Set a block entry in the symmetry-basis operator.
- Parameters:
opr – Matrix object stored in the
(i, j)block.i – Row block index in the symmetry basis.
j – Column block index in the symmetry basis.
-
inline void set(qmatrix<double> &opr, size_t i, size_t j)#
Set a block entry by moving a matrix into storage.
- Parameters:
opr – Matrix object to move into the
(i, j)block.i – Row block index in the symmetry basis.
j – Column block index in the symmetry basis.
-
inline std::optional<qmatrix<double>*> get(size_t i, size_t j)#
This function returns the
qmatrixpointer for the sub-blockiandj. If the sub-block is not found, it returns an emptystd::optional.- Parameters:
i – The index of the block to be returned.
j – The index of the block to be returned.
- Returns:
std::optional<qmatrix>
-
inline void unitaryTransform(qOperator &U)#
Unitarily transform this operator with a block-diagonal matrix.
The
Umatrix is a block-diagonalqmatrixand the operator is updated as \(U^\dagger qOperator U\).- Parameters:
U – The unitary matrix to transform the
qOperator. Usually we get this matrix after diagonalization of the Hamiltonian.
-
inline void clear()#
Clears the storage for the operator.
This method removes all stored matrix elements and resets the operator.
Friends
-
inline friend std::ostream &operator<<(std::ostream &out, const qOperator &val)#
Overloads the stream insertion operator for
qOperator.Allows the use of
std::cout << qOperatoror any otherostreamobject.- Parameters:
out – The output stream.
val – The
qOperatorto print.
- Returns:
The modified output stream.
-
qOperator() = default#