Returns the “logical shape” of the array.
The “logical shape” is the shape that’s left when the node-depending dimension has been eliminated.
Takes a sequence of bools and turns it into an array of indices to be used to extract the subset from the full set.
Example:
>>> full_to_subset_indices([False, True, True])
array([1 2])
Takes a sequence of bools and generates it into an array of indices to be used to extract the subset from the full set.
Example:
>>> list(full_to_all_subset_indices([[False, True, True], [True,False,True]]))
[array([1 2]), array([3 5]
Takes a sequence of bools and generates it into an array of indices to be used to insert the subset into the full set.
Example:
>>> list(partial_to_all_subset_indices([[False, True, True], [True,False,True]]))
[array([0 1]), array([2 3]
Carry out a modified [1] Gram-Schmidt orthonormalization on vectors.
If, during orthonormalization, the 2-norm of a vector drops below discard_threshold, then this vector is silently discarded. If discard_threshold is None, then no vector will ever be dropped, and a zero 2-norm encountered during orthonormalization will throw a RuntimeError.
[1] http://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process
Return a permutation matrix.
If to_indices is specified, the resulting permutation matrix P satisfies the condition
P * e[i] = e[to_indices[i]] for i=1,...,len(to_indices)
where e[i] is the i-th unit vector. The height of P is determined either implicitly by the maximum of to_indices or explicitly by the parameter h.
If from_indices is specified, the resulting permutation matrix P satisfies the condition
P * e[from_indices[i]] = e[i] for i=1,...,len(from_indices)
where e[i] is the i-th unit vector. The width of P is determined either implicitly by the maximum of from_indices of explicitly by the parameter w.
If both to_indices and from_indices is specified, a ValueError exception is raised.
Assuming that abscissae and errors are connected by a law of the form
error = constant * abscissa ^ (-order),
this function finds, in a least-squares sense, the best approximation of constant and order for the given data set. It returns a tuple (constant, order).
Return a Cuthill-McKee ordering for the given graph.
See (for example) Y. Saad, Iterative Methods for Sparse Linear System, 2nd edition, p. 76.
graph is given as an adjacency mapping, i.e. each node is mapped to a list of its neighbors.