Impurity and bath Operators#

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

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 the qOperator for the ith and jth symmetry basis.

Parameters:
  • opr – : Matrix object

  • i – : ith symmetry block

  • j – : jth symmetry block

inline std::optional<qmatrix<double>*> get(size_t i, size_t j)

This function returns the qmatrix pointer for the sub-block i and j. If the sub-block is not found, it returns an empty std::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)

This function unitary transform the qOperator by the U matrix. The U matrix is a block-diagonal matrix of qmatrix type. The qOperator is transformed as \f U^\dagger \cdot qOperator \cdot U \f

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.

inline void display(std::ostream &out) const

Prints the qOperator to the output stream.

Avoid calling this function if the size of the qOperator is large.

Parameters:

out – Output stream to print to.

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 << qOperator or any other ostream object.

Parameters:
  • out – The output stream.

  • val – The qOperator to print.

Returns:

The modified output stream.