Useful Helper Routines

Operator Subsetting

hedge.tools.indexing.count_subset(subset)
hedge.tools.indexing.full_to_subset_indices(subset, base=0)

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])
hedge.tools.indexing.full_to_all_subset_indices(subsets, base=0)

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]
hedge.tools.indexing.partial_to_all_subset_indices(subsets, base=0)

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]

Mathematical Helpers

Convergence Tests

hedge.tools.convergence.estimate_order_of_convergence(abscissae, errors)

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).

class hedge.tools.convergence.EOCRecorder