<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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)