{ } Raw JSON

bundles / scipy latest / scipy / optimize / _numdiff / group_columns

function

scipy.optimize._numdiff:group_columns

source: /scipy/optimize/_numdiff.py :217

Signature

def   group_columns ( A order = 0 )

Summary

Group columns of a 2-D matrix for sparse finite differencing [1].

Extended Summary

Two columns are in the same group if in each row at least one of them has zero. A greedy sequential algorithm is used to construct groups.

Parameters

A : array_like or sparse array, shape (m, n)

Matrix of which to group columns.

order : int, iterable of int with shape (n,) or None

Permutation array which defines the order of columns enumeration. If int or None, a random permutation is used with order used as a random seed. Default is 0, that is use a random permutation but guarantee repeatability.

Returns

groups : ndarray of int, shape (n,)

Contains values from 0 to n_groups-1, where n_groups is the number of found groups. Each value groups[i] is an index of a group to which ith column assigned. The procedure was helpful only if n_groups is significantly less than n.

Aliases

  • scipy.optimize._differentiable_functions.group_columns