Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Index ¶
Index searches for x in a sorted slice S and returns the index, or -1 if not present. Assumes that the slice is sorted in increasing order.
func IndexOfZero ¶
IndexOfZero returns the index of 0 in the slice, or -1 if not present. Assumes that the slice is sorted in increasing order.
func IsSorted ¶
IsSorted returns true iff the entries in the slice S are in strictly increasing order.
func SliceToUnwrappedSlice ¶
SliceToUnwrappedSlice attempts to convert the entries in the slice S to a slice of unwrapped exponents using the given helper. If S satisfies the interface:
type SliceToUnwrappedSlicer interface { SliceToUnwrappedSlice(S slice.Interface) (unwrappedexponents.Interface, error) // SliceToUnwrappedSlice attempts to convert the entries in the slice S to a slice of unwrapped exponents. }
then S's SliceToUnwrappedSlice method will be used.
Types ¶
type Helper ¶
type Helper interface { Universe() polynomial.ExponentMonoid // Universe returns the user-facing parent of the exponents. New(capacity int) unwrappedexponents.Interface // New returns a new slice of unwrapped exponents with given capacity. Wrap(S unwrappedexponents.Interface) (Interface, error) // Wrap wraps the given slice of unwrapped exponents. ToUnwrappedElement(x object.Element) (object.Element, error) // ToUnwrappedElement attempts to map the element x from the user-facing universe to the universe of the unwrapped exponents. }
Helper defines the common interface for an exponent slice helper.
type Interface ¶
type Interface interface { slice.Interface Universe() polynomial.ExponentMonoid // Universe returns the user-facing parent of the exponents. Unwrap() unwrappedexponents.Interface // Unwrap returns the underlying internal slice of exponents. }
Interface is the interface satisfied by a slice of exponents.
func SliceContainingZero ¶
SliceContainingZero returns a slice with the single entry 0.
type PrettyPrintFunc ¶
PrettyPrintFunc returns a string str for the i-th exponent in the slice. This will panic if i is out of range.
func PrettyPrint ¶
func PrettyPrint(S Interface, names []string) (PrettyPrintFunc, error)
PrettyPrint returns a PrettyPrintFunc for the given exponents slice S and variable print names. If S satisfies the interface:
type PrettyPrinter interface { PrettyPrint(i int, names []string) string // PrettyPrint returns a string representation of the i-th exponent using the given slice of names. This will panic if the index is out of range, or if there are not enough names for the dimension. }
then S's PrettyPrint method will be used by the returned PrettyPrintFunc. Otherwise, if the underlying slice of wrapped exponents satisfies the PrettyPrinter interface, then its PrettyPrint method will be used by the returned PrettyPrintFunc. Failing that, a generic PrettyPrintFunc will be returned.