Repository: scipy/scipy

Issue:
DOC: Sparse arrays: todense() does not return numpy.matrix
### Issue with current documentation:

The documentation states that the `todense()` method of each of the sparse array classes returns a `numpy.matrix` but they return a `numpy.ndarray`.

### Idea or request for content:

Modify the documentation to state the return type is `numpy.ndarray`.

### Additional context (e.g. screenshots, GIFs)

_No response_


Discussion:
@henry50 would you be interested in opening a PR?

Resolving patch:
diff --git a/scipy/sparse/_base.py b/scipy/sparse/_base.py
--- a/scipy/sparse/_base.py
+++ b/scipy/sparse/_base.py
@@ -928,7 +928,7 @@ def _getrow(self, i):
 
     def todense(self, order=None, out=None):
         """
-        Return a dense representation of this sparse array/matrix.
+        Return a dense representation of this sparse array.
 
         Parameters
         ----------
@@ -940,21 +940,19 @@ def todense(self, order=None, out=None):
             argument.
 
         out : ndarray, 2-D, optional
-            If specified, uses this array (or `numpy.matrix`) as the
-            output buffer instead of allocating a new array to
-            return. The provided array must have the same shape and
-            dtype as the sparse array/matrix on which you are calling the
-            method.
+            If specified, uses this array as the output buffer
+            instead of allocating a new array to return. The
+            provided array must have the same shape and dtype as
+            the sparse array on which you are calling the method.
 
         Returns
         -------
-        arr : numpy.matrix, 2-D
-            A NumPy matrix object with the same shape and containing
-            the same data represented by the sparse array/matrix, with the
-            requested memory order. If `out` was passed and was an
-            array (rather than a `numpy.matrix`), it will be filled
-            with the appropriate values and returned wrapped in a
-            `numpy.matrix` object that shares the same memory.
+        arr : ndarray, 2-D
+            An array with the same shape and containing the same
+            data represented by the sparse array, with the requested
+            memory order. If `out` was passed, the same object is
+            returned after being modified in-place to contain the
+            appropriate values.
         """
         return self._ascontainer(self.toarray(order=order, out=out))
 
diff --git a/scipy/sparse/_matrix.py b/scipy/sparse/_matrix.py
--- a/scipy/sparse/_matrix.py
+++ b/scipy/sparse/_matrix.py
@@ -111,3 +111,35 @@ def getrow(self, i):
         matrix (row vector).
         """
         return self._getrow(i)
+
+    def todense(self, order=None, out=None):
+        """
+        Return a dense representation of this sparse matrix.
+
+        Parameters
+        ----------
+        order : {'C', 'F'}, optional
+            Whether to store multi-dimensional data in C (row-major)
+            or Fortran (column-major) order in memory. The default
+            is 'None', which provides no ordering guarantees.
+            Cannot be specified in conjunction with the `out`
+            argument.
+
+        out : ndarray, 2-D, optional
+            If specified, uses this array (or `numpy.matrix`) as the
+            output buffer instead of allocating a new array to
+            return. The provided array must have the same shape and
+            dtype as the sparse matrix on which you are calling the
+            method.
+
+        Returns
+        -------
+        arr : numpy.matrix, 2-D
+            A NumPy matrix object with the same shape and containing
+            the same data represented by the sparse matrix, with the
+            requested memory order. If `out` was passed and was an
+            array (rather than a `numpy.matrix`), it will be filled
+            with the appropriate values and returned wrapped in a
+            `numpy.matrix` object that shares the same memory.
+        """
+        return super().todense(order, out)


Test patch: