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