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)
def asdensity ( self ) -> 'Density' : matrix = bk . outer ( self . tensor , bk . conj ( self . tensor ) ) return Density ( matrix , self . qubits , self . _memory )
Convert a pure state to a density matrix