Yield an iterator over the states (:class:`.TensorKet` instances)
        that form the canonical basis of the Hilbert space

        Raises:
            .BasisNotSetError: if the Hilbert space has no defined basis

def basis_states(self):
        """Yield an iterator over the states (:class:`.TensorKet` instances)
        that form the canonical basis of the Hilbert space

        Raises:
            .BasisNotSetError: if the Hilbert space has no defined basis
        """
        from qnet.algebra.core.state_algebra import BasisKet, TensorKet
        # importing locally avoids circular import
        ls_bases = [ls.basis_labels for ls in self.local_factors]
        for label_tuple in cartesian_product(*ls_bases):
            yield TensorKet(
                *[BasisKet(label, hs=ls) for (ls, label)
                  in zip(self.local_factors, label_tuple)])