makeallmatricesbzvc

◼ makeallmatricesbzvc[op,bz] computes the matrix representation of the operator op in the basis bz (occupation number representation). 
◼ makeallmatricesbzop[op,bz] computes the matrix representation of the operator op in the basis bz (creation operator representation).

◼ All pairs of invariant subspaces are considered.

◼ NOTE: Only the pairs of subspaces which give non-zero matrix elements are returned.

◼ See also:  makematricesbzop, makematricesbzvc, matrixrepresentationvc.

Further examples

Load sneg, let c be a fermionic operator

<< sneg`sneg`;
snegfermionoperators[c];

Two-site Hubbard model

snegrealconstants[t, U];
H = 
      t hop[c[1], c[2]] + 
        U Plus  @@  hubbard /@ {c[1], c[2]}

Generate the basis states and produce Hamiltonian matrices in invariant subspaces. Hamiltonian operator is by definition diagonal with respect to the invariant subspaces!

bz = qsbasis[{c[1], c[2]}];
MatrixForm[bz]
ham = makeallmatricesbzop[H, bz];
MatrixForm @ 
      Map[{First[#], MatrixForm @ Last[#]} & , ham]

Matrix elements of the creation operator

ham = 
        makeallmatricesbzop[c[CR, 1, DO], bz];
MatrixForm @ 
      Map[{First[#], MatrixForm @ Last[#]} & , ham]