Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(length int, _ int, newEs exponents.NewFunc, newCs coefficients.NewFunc, f Func) (exponents.Interface, coefficients.Interface, error)
Run performs a recursive binary split on the range 0..length. When the resulting sub-range is of length at most minsize the function f will be called. The results from f are merged into the returned parallel slices of exponents and coefficients. The resulting slices are sorted in strictly-increasing exponent order (so all monomials appearing amongst the terms are distinct) and with all coefficients non-zero.
Types ¶
type Func ¶
type Func func(start int, finish int, newEs exponents.NewFunc, newCs coefficients.NewFunc) (exponents.Interface, coefficients.Interface, error)
Func is the base function of the recursion. It should iterate over the range start <= i < finish, and return parallel slices of exponents and coefficients.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator provides a way of iterating over multiple slices of exponents and coefficients, sorted in exponent order.
func NewIterator ¶
func NewIterator(Es []exponents.Interface, Cs []coefficients.Interface, cmp compare.CmpFunc) (*Iterator, error)
NewIterator returns a new iterator for the given parallel slices of exponents and coefficients, using the given exponent comparator cmp. The pairs of exponents and coefficients will be iterated over in increasing exponent order. Be sure to call Close on the iterator when finished to ensure that there are no memory leaks. Note that no attempt is made to exclude zero coefficients, or to sum repeated instances of the same exponent. Assumes that the input slices are sorted in increasing exponent order.
func (*Iterator) Close ¶
Close closes the iterator and returns the last error encountered during iteration (if any).
type MergeAndSumIterator ¶
type MergeAndSumIterator struct {
// contains filtered or unexported fields
}
func NewMergeAndSumIterator ¶
func NewMergeAndSumIterator(Es []exponents.Interface, Cs []coefficients.Interface, L monomialorder.Interface, K ring.Interface) (*MergeAndSumIterator, error)
NewMergeAndSumIterator returns a new iterator for the given parallel slices of exponents and coefficients. The pairs of exponents and coefficients will be iterated over in increasing exponent order. Duplicate exponents will have their coefficients summed, and any exponent with zero coefficient will be skipped. Be sure to call Close on the iterator when finished to ensure that there are no memory leaks. Assumes that the input slices are sorted in increasing exponent order. Here L is the parent of the exponents in Es, and K is the parent of the coefficients in Cs.
func (*MergeAndSumIterator) Close ¶
func (m *MergeAndSumIterator) Close() error
Close closes the iterator and returns the last error encountered during iteration (if any).
func (*MergeAndSumIterator) HasNext ¶
func (m *MergeAndSumIterator) HasNext() bool
HasNext returns true iff there is a next element in the iterator.