Class qOperator

Class Documentation

class qOperator

qOperator is a class to store the oprator sub-blocks only where this has a finite value. It does not store any thing if the sub-blocks don’t have any finite element. Remember that the get function is an std::optional.

Public Functions

qOperator() = default
inline qOperator(qmatrix<double> &opr, size_t i, size_t j)
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 void set(qmatrix<double> &opr, size_t i, size_t j)
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()

Clear the storage for the operator.

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

Print the qOperator to the output stream. Avoid calling this function if the size of the qOperator is large.

Parameters:

out – Output stream

Friends

inline friend std::ostream &operator<<(std::ostream &out, const qOperator &val)

We can use std::cout << qOperator ; or any other ostream object.

Parameters:
  • out

  • val

Returns: