Convert a pure state to a density matrix

def asdensity(self) -> 'Density':
        """Convert a pure state to a density matrix"""
        matrix = bk.outer(self.tensor, bk.conj(self.tensor))
        return Density(matrix, self.qubits, self._memory)