Repository: scipy/scipy
File: scipy/spatial/transform/_rotation.py (Python)

Code before:
        """
        return Rotation(quat, normalize=True, scalar_first=scalar_first)

    @staticmethod
    @xp_capabilities(
        skip_backends=[("dask.array", "missing linalg.cross/det functions")]
    )
    def from_matrix(matrix: ArrayLike, *, assume_valid: bool = False) -> Rotation:
        """Initialize from rotation matrix.

        Rotations in 3 dimensions can be represented with 3 x 3 orthogonal
        matrices [1]_. If the input is not orthogonal, an approximation is
        created by orthogonalizing the input matrix using the method described
        in [2]_, and then converting the orthogonal rotation matrices to
        quaternions using the algorithm described in [3]_. Matrices must be
        right-handed.

        Parameters
        ----------
        matrix : array_like, shape (..., 3, 3)
            A single matrix or an ND array of matrices, where the last two dimensions
            contain the rotation matrices.
        assume_valid : bool, optional
            Must be False unless users can guarantee the input is a valid rotation
            matrix, i.e. it is orthogonal, rows and columns have unit norm and the
            determinant is 1. Setting this to True without ensuring these properties
            is unsafe behavior. If True, normalization steps are skipped, which can
            improve runtime performance. Default is False.

        Returns
        -------
        rotation : `Rotation` instance
            Object containing the rotations represented by the rotation
            matrices.

        References
        ----------
        .. [1] https://en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions
        .. [2] https://en.wikipedia.org/wiki/Orthogonal_Procrustes_problem
        .. [3] F. Landis Markley, "Unit Quaternion from Rotation Matrix",
               Journal of guidance, control, and dynamics vol. 31.2, pp.
               440-442, 2008.

        Examples
        --------
        >>> from scipy.spatial.transform import Rotation as R
        >>> import numpy as np

        Initialize a single rotation:

        >>> r = R.from_matrix([

Review comment (bug):
It might be obvious for users (which I'm not): which norm is it? 

Also, if I'm doing the normalization myself: is there any target tolerance on how close the determinant is to 1 in floating-point? IOW, if I normalize it myself and it's 1e-10 off, am I in trouble? 1e-5? what are the failure modes, is there some diagnostics, what do I need to watch out for?

Code after:
        """
        return Rotation(quat, normalize=True, scalar_first=scalar_first)

    @staticmethod
    @xp_capabilities(
        skip_backends=[("dask.array", "missing linalg.cross/det functions")]
    )
    def from_matrix(matrix: ArrayLike, *, assume_valid: bool = False) -> Rotation:
        """Initialize from rotation matrix.

        Rotations in 3 dimensions can be represented with 3 x 3 orthogonal
        matrices [1]_. If the input is not orthogonal, an approximation is
        created by orthogonalizing the input matrix using the method described
        in [2]_, and then converting the orthogonal rotation matrices to
        quaternions using the algorithm described in [3]_. Matrices must be
        right-handed.

        Parameters
        ----------
        matrix : array_like, shape (..., 3, 3)
            A single matrix or an ND array of matrices, where the last two dimensions
            contain the rotation matrices.
        assume_valid : bool, optional
            Must be False unless users can guarantee the input is a valid rotation
            matrix, i.e. it is orthogonal, rows and columns have unit norm and the
            determinant is 1. Setting this to True without ensuring these properties
            is unsafe and will silently lead to incorrect results. If True,
            normalization steps are skipped, which can improve runtime performance.
            Default is False.

        Returns
        -------
        rotation : `Rotation` instance
            Object containing the rotations represented by the rotation
            matrices.

        References
        ----------
        .. [1] https://en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions
        .. [2] https://en.wikipedia.org/wiki/Orthogonal_Procrustes_problem
        .. [3] F. Landis Markley, "Unit Quaternion from Rotation Matrix",
               Journal of guidance, control, and dynamics vol. 31.2, pp.
               440-442, 2008.

        Examples
        --------
        >>> from scipy.spatial.transform import Rotation as R
        >>> import numpy as np

        Initialize a single rotation: