ptypy.engines.utils.reduce_dimension#

ptypy.engines.utils.reduce_dimension(a, dim, local_indices=None)#

Apply a low-rank approximation on a.

Parameters:
  • a (ndarray) – 3D numpy array

  • dim (int) – The number of dimensions to retain. The case dim=0 (which would just reduce all layers to a mean) is not implemented.

  • local_indices – Used for Containers distributed across nodes. Local indices of the current node.

Returns:

where:
  • reduced array is the result of dimensionality reduction (same shape as a)

  • modes: 3D array of length dim containing eigenmodes (aka singular vectors)

  • coefficients: 2D matrix representing the decomposition of a.

Return type:

reduced array, modes, coefficients