Utilities

pyroomacoustics.adaptive.util.autocorr(x)

Fast autocorrelation computation using the FFT

pyroomacoustics.adaptive.util.hankel_multiplication(c, r, A, mkl=True, **kwargs)

Compute numpy.dot(scipy.linalg.hankel(c,r=r), A) using the FFT.

Parameters:
  • c (ndarray) – the first column of the Hankel matrix

  • r (ndarray) – the last row of the Hankel matrix

  • A (ndarray) – the matrix to multiply on the right

  • mkl (bool, optional) – if True, use the mkl_fft package if available

pyroomacoustics.adaptive.util.hankel_stride_trick(x, shape)

Make a Hankel matrix from a vector using stride tricks

Parameters:
  • x (ndarray) – a vector that contains the concatenation of the first column and first row of the Hankel matrix to build without repetition of the lower left corner value of the matrix

  • shape (tuple) – the shape of the Hankel matrix to build, it must satisfy x.shape[0] == shape[0] + shape[1] - 1

pyroomacoustics.adaptive.util.mkl_toeplitz_multiplication(c, r, A, A_padded=False, out=None, fft_len=None)

Compute numpy.dot(scipy.linalg.toeplitz(c,r), A) using the FFT from the mkl_fft package.

Parameters:
  • c (ndarray) – the first column of the Toeplitz matrix

  • r (ndarray) – the first row of the Toeplitz matrix

  • A (ndarray) – the matrix to multiply on the right

  • A_padded (bool, optional) – the A matrix can be pre-padded with zeros by the user, if this is the case set to True

  • out (ndarray, optional) – an ndarray to store the output of the multiplication

  • fft_len (int, optional) – specify the length of the FFT to use

pyroomacoustics.adaptive.util.naive_toeplitz_multiplication(c, r, A)

Compute numpy.dot(scipy.linalg.toeplitz(c,r), A)

Parameters:
  • c (ndarray) – the first column of the Toeplitz matrix

  • r (ndarray) – the first row of the Toeplitz matrix

  • A (ndarray) – the matrix to multiply on the right

pyroomacoustics.adaptive.util.toeplitz_multiplication(c, r, A, **kwargs)

Compute numpy.dot(scipy.linalg.toeplitz(c,r), A) using the FFT.

Parameters:
  • c (ndarray) – the first column of the Toeplitz matrix

  • r (ndarray) – the first row of the Toeplitz matrix

  • A (ndarray) – the matrix to multiply on the right

pyroomacoustics.adaptive.util.toeplitz_opt_circ_approx(r, matrix=False)

Optimal circulant approximation of a symmetric Toeplitz matrix by Tony F. Chan

Parameters:
  • r (ndarray) – the first row of the symmetric Toeplitz matrix

  • matrix (bool, optional) – if True, the full symetric Toeplitz matrix is returned, otherwise, only the first column

pyroomacoustics.adaptive.util.toeplitz_strang_circ_approx(r, matrix=False)

Circulant approximation to a symetric Toeplitz matrix by Gil Strang

Parameters:
  • r (ndarray) – the first row of the symmetric Toeplitz matrix

  • matrix (bool, optional) – if True, the full symetric Toeplitz matrix is returned, otherwise, only the first column