docstr: Test convmtx against convolve and sum.
  Multiplication of convmtx_mc of input with a vectorized multi-channel filter
  should match the sum of convolution of each input channel with the corresponding
  filter.
docstr_tok: ["Test","convmtx","against","convolve","and","sum",".","Multiplication","of","convmtx_mc","of","input","with","a","vectorized","multi-channel","filter","should","match","the","sum","of","convolution","of","each","input","channel","with","the","corresponding","filter","."]
code: def test_convmtx_mc(
      self, num_channels: int, filter_length: int, delay: int
  ):
      """Test convmtx against convolve and sum.
      Multiplication of convmtx_mc of input with a vectorized multi-channel filter
      should match the sum of convolution of each input channel with the corresponding
      filter.
      """
      atol = 1e-6
      random_seed = 42
      num_examples = 10
      num_samples = 2000
  
      _rng = np.random.default_rng(seed=random_seed)
  
      for n in range(num_examples):
          x = _rng.normal(size=(num_samples, num_channels))
          f = _rng.normal(size=(filter_length, num_channels))
  
          CM = convmtx_mc_numpy(
              x=x, filter_length=filter_length, delay=delay
          )
  
          # Multiply convmtx_mc with the vectorized filter
          uut = CM @ f.transpose().reshape(-1, 1)
          uut = uut.squeeze(1)
  
          # Calculate reference as sum of convolutions
          golden_ref = 0
          for m in range(num_channels):
              x_m_delayed = np.hstack([np.zeros(delay), x[:, m]])
              golden_ref += np.convolve(
                  x_m_delayed, f[:, m], mode="full"
              )[: len(x)]
  
          assert np.allclose(
              uut, golden_ref, atol=atol
          ), f"Example {n}: UUT not matching the reference."
  
imports: import os
  from collections import namedtuple
  from typing import List, Type, Union
  import librosa
  import matplotlib.pyplot
  import numpy
  import pytest
  import scipy
  import soundfile
  import torch
  from nemo.collections.asr.parts.preprocessing.segment import AudioSegment
  from nemo.collections.asr.parts.utils.audio_utils import SOUND_VELOCITY
  from nemo.collections.asr.parts.utils.audio_utils import calculate_sdr_numpy, convmtx_mc_numpy, db2mag, estimated_coherence, generate_approximate_noise_field, get_segment_start, mag2db, pow2db, rms, select_channels, theoretical_coherence, toeplitz
label_desc: Use image node_id 6 for calling the TestAudioUtilsElements obj's underlying member method code with example usage: obj.test_convmtx_mc(num_channels, filter_length, delay) without return types