code: def shear(
      X: _ArrayOrSparseMatrix, *, factor: int = 1, axis: int = -1
  ) -> _ArrayOrSparseMatrix:
      """Shear a matrix by a given factor.
  
      The column ``X[:, n]`` will be displaced (rolled)
      by ``factor * n``
  
      This is primarily useful for converting between lag and recurrence
      representations: shearing with ``factor=-1`` converts the main diagonal
      to a horizontal.  Shearing with ``factor=1`` converts a horizontal to
      a diagonal.
  
      Parameters
      ----------
      X : np.ndarray [ndim=2] or scipy.sparse matrix
          The array to be sheared
      factor : integer
          The shear factor: ``X[:, n] -> np.roll(X[:, n], factor * n)``
      axis : integer
          The axis along which to shear
  
      Returns
      -------
      X_shear : same type as ``X``
          The sheared matrix
  
      Examples
      --------
      >>> E = np.eye(3)
      >>> librosa.util.shear(E, factor=-1, axis=-1)
      array([[1., 1., 1.],
             [0., 0., 0.],
             [0., 0., 0.]])
      >>> librosa.util.shear(E, factor=-1, axis=0)
      array([[1., 0., 0.],
             [1., 0., 0.],
             [1., 0., 0.]])
      >>> librosa.util.shear(E, factor=1, axis=-1)
      array([[1., 0., 0.],
             [0., 0., 1.],
             [0., 1., 0.]])
      """
      if not np.issubdtype(type(factor), np.integer):
          raise ParameterError(
              f"factor={factor} must be integer-valued"
          )
  
      # Suppress type checks because mypy doesn't like numba jitting
      # or scipy sparse conversion
      if scipy.sparse.isspmatrix(X):
          return __shear_sparse(X, factor=factor, axis=axis)  # type: ignore
      else:
          return __shear_dense(X, factor=factor, axis=axis)
  
imports: from __future__ import annotations
  import scipy.ndimage
  import scipy.sparse
  import numpy
  import numba
  from numpy.lib.stride_tricks import as_strided
  from .._cache import cache
  from .exceptions import ParameterError
  from .deprecation import Deprecated
  from numpy.typing import ArrayLike, DTypeLike
  from typing import Any, Callable, Iterable, List, Dict, Optional, Sequence, Tuple, TypeVar, Union, overload
  from typing_extensions import Literal
  from .._typing import _SequenceLike, _FloatLike_co, _ComplexLike_co
label_desc: Use image node_id 33 for calling a global function with example usage: shear(X) and returns: __shear_sparse, __shear_dense