code: def convmtx_numpy(
      x: np.ndarray,
      filter_length: int,
      delay: int = 0,
      n_steps: Optional[int] = None,
  ) -> np.ndarray:
      """Construct a causal convolutional matrix from x delayed by `delay` samples.
  
      Args:
          x: input signal, shape (N,)
          filter_length: length of the filter in samples
          delay: delay the signal by a number of samples
          n_steps: total number of time steps (rows) for the output matrix
  
      Returns:
          Convolutional matrix, shape (n_steps, filter_length)
      """
      if x.ndim != 1:
          raise ValueError(
              f"Expecting one-dimensional signal. Received signal with shape {x.shape}"
          )
  
      if n_steps is None:
          # Keep the same length as the input signal
          n_steps = len(x)
  
      # pad as necessary
      x_pad = np.hstack([np.zeros(delay), x])
      if (pad_len := n_steps - len(x_pad)) > 0:
          x_pad = np.hstack([x_pad, np.zeros(pad_len)])
      else:
          x_pad = x_pad[:n_steps]
  
      return scipy.linalg.toeplitz(
          x_pad, np.hstack([x_pad[0], np.zeros(filter_length - 1)])
      )
  
imports: import math
  from typing import Iterable, Optional, Union
  import librosa
  import numpy
  import numpy.typing
  import scipy
  import soundfile
  import torch
  from scipy.spatial.distance import pdist, squareform
  from nemo.utils import logging
label_desc: Use image node_id 15 for calling a global function with example usage: convmtx_numpy(x, filter_length, delay, n_steps) and returns: scipy