Dense matrices
Given an operator in the form of an OpSum object and a Hilbert space (block), a dense matrix representation of the operator on the computational basis of the block can be computed using the matrix function.
In C++, XDiag is using the Armadillo library with the arma namespace. The Armadillo library serves as the linear algebra backend of XDiag and can be used to perform further calculations. The matrix function returns a real matrix (arma::mat). Whenever the operator has complex matrix elements, the complex-valued counterpart matrixC must be used instead, which returns an arma::cx_mat. In Julia, this distinction is not necessary: matrix automatically returns a real or complex matrix depending on the operator.
To compute all eigenvalues and eigenvectors of a Hamiltonian, i.e. to perform a full exact diagonalization, standard linear algebra routines can be used.
In Julia, the eigen and Symmetric functions are part of the Linear Algebra standard library. In C++, arma::eig_sym is the corresponding Armadillo routine for the eigendecomposition of a symmetric (or hermitian) matrix.