Task: Fix output of `DensityMatrix.partial_transpose` to match input dimensions (Qiskit/qiskit#10163)

org: Qiskit
repo: qiskit
pr_number: 10163
issue_title: Fix output of `DensityMatrix.partial_transpose` to match input dimensions
issue_body: <!--\r\n⚠️ If you do not respect this template, your pull request will be closed.\r\n⚠️ Your pull request title should be short detailed and understandable for all.\r\n⚠️ Also, please add a release note file using reno if the change needs to be\r\n  documented in the release notes.\r\n⚠️ If your pull request fixes an open issue, please link to the issue.\r\n\r\n- [ ] I have added the tests to cover my changes.\r\n- [ ] I have updated the documentation accordingly.\r\n- [ ] I have read the CONTRIBUTING document.\r\n-->\r\n\r\n### Summary\r\nAdd dimensions to the `DensityMatrix` returned by `partial_transpose` so its dimensions match those of the input density matrix.\r\n\r\n\r\n### Details and comments\r\nFix #10155 \r\n\r\n
resolved_issues: number: 10155
title: `DensityMatrix.partial_transpose` does not preserve input dimensions
body: ### Environment\r\n\r\n- **Qiskit Terra version**: to be released in 0.24.0\r\n- **Python version**: 3.10\r\n- **Operating system**: MacOS\r\n\r\n\r\n### What is happening?\r\n\r\nThe `partial_transpose` should return a density matrix of the same dimensionality as the input `DensityMatrix` object. When the dimensions are for systems different than qubits, the dimensions are currently not preserved. \r\n\r\n### How can we reproduce the issue?\r\n\r\nFor in the following example, the dimensions of the output density matrix ρ2 are (9,) but they should be (3,3).\r\n\r\n```python\r\n>>> import numpy as np\r\n>>> from qiskit.quantum_info import Statevector, DensityMatrix\r\n>>> ψ = Statevector(np.array([1,0,0,0,1,0,0,0,1])*1/np.sqrt(3),dims=(3,3))\r\n>>> ρ1 = DensityMatrix(ψ)\r\n>>> ρ1.dims()\r\n(3, 3)\r\n>>> ρ2 = ρ1.partial_transpose([0])\r\n>>> ρ2.dims()\r\n(9,)\r\n```\r\n\r\n### What should happen?\r\n\r\nIt should be an easy fix. The function should return:\r\n```python\r\nreturn DensityMatrix(rho, dims=self.dims())\r\n```\r\n\r\ninstead of just:\r\n```python\r\nreturn DensityMatrix(rho)\r\n```\r\n\r\n### Any suggestions?\r\n\r\n_No response_

Reference solution:
fix_patch: diff --git a/qiskit/quantum_info/states/densitymatrix.py b/qiskit/quantum_info/states/densitymatrix.py\nindex 124a382f01d1..3103ef23036a 100644\n--- a/qiskit/quantum_info/states/densitymatrix.py\n+++ b/qiskit/quantum_info/states/densitymatrix.py\n@@ -832,4 +832,4 @@ def partial_transpose(self, qargs):\n             lst[i], lst[i + n] = lst[i + n], lst[i]\n         rho = np.transpose(arr, lst)\n         rho = np.reshape(rho, self._op_shape.shape)\n-        return DensityMatrix(rho)\n+        return DensityMatrix(rho, dims=self.dims())\ndiff --git a/releasenotes/notes/fix-partial-transpose-output-dims-3082fcf4147055dc.yaml b/releasenotes/notes/fix-partial-transpose-output-dims-3082fcf4147055dc.yaml\nnew file mode 100644\nindex 000000000000..edba41333ce8\n--- /dev/null\n+++ b/releasenotes/notes/fix-partial-transpose-output-dims-3082fcf4147055dc.yaml\n@@ -0,0 +1,5 @@\n+---\n+fixes:\n+  - |\n+    Fixed the dimensions of the output density matrix from :meth:`.DensityMatrix.partial_transpose`\n+    so they match the dimensions of the corresponding input density matrix.\n