ltfatpy.tools package

Content

lcm

This module computes the least common multiple

ltfatpy.tools.lcm.lcm(X, Y)[source]

Compute the least common multiple

  • Inputs:
Parameters:
  • X (int) – The first of the two integers for which to compute the least common multiple
  • Y (int) – The second of the two integers for which to compute the least common multiple
  • Outputs:
Returns:Least common multiple of X and Y
Return type:int

postpad

This module pads or truncates arrays

Ported from ltfat_2.1.0/mex/postpad.m

ltfatpy.tools.postpad.postpad(x, L, C=0.0, dim=None)[source]

Pads or truncates an array to a specified length

  • Usage:

    y = postpad(x, L)
    y = postpad(x, L, C)
    y = postpad(x, L, C, dim)
  • Input parameters:

Parameters:
  • x (numpy.ndarray) – Input array
  • L (int) – Length of the output array
  • C (float) – Value of the padded entries
  • dim (int) – Axis over which to pad or truncate x
  • Ouput parameters:
Returns:Padded or truncated array
Return type:numpy.ndarray

postpad(x, L) will add zeros to the end of the vector x, until the result has length L. If L is less than the length of the signal, it will be truncated. postpad works along the first non-singleton dimension.

postpad(x, L, C) will add entries with a value of C instead of zeros.

postpad(x, L, C, dim) works along dimension dim instead of the first non-singleton.

See also

middlepad()