Geometry.apply_square_cost(arr, axis=0)[source]#

Apply elementwise-square of cost matrix to array (vector or matrix).

This function applies the ground geometry’s cost matrix, to perform either output = C arr (if axis=1) output = C’ arr (if axis=0) where C is [num_a, num_b], when the cost matrix itself is computed as a squared-Euclidean distance between vectors, and therefore admits an explicit low-rank factorization.

  • arr (ndarray) – array.

  • axis (int) – axis of the array on which the cost matrix should be applied.

Return type



An array, [num_b, p] if axis=0 or [num_a, p] if axis=1.