Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SliceToUnwrappedSlice ¶
func SliceToUnwrappedSlice(h Helper, S slice.Interface) (T unwrappedcoefficients.Interface, err error)
SliceToUnwrappedSlice attempts to convert the entries in the slice S to a slice of unwrapped coefficients using the given helper. If S satisfies the interface:
type SliceToUnwrappedSlicer interface { SliceToUnwrappedSlice(S slice.Interface) (unwrappedcoefficients.Interface, error) // SliceToUnwrappedSlice attempts to convert the entries in the slice S to a slice of unwrapped coefficients. }
then S's SliceToUnwrappedSlice method will be used.
Types ¶
type Helper ¶
type Helper interface { Universe() ring.Interface // Universe returns the user-facing parent of the coefficients. New(capacity int) unwrappedcoefficients.Interface // New returns a new slice of unwrapped coefficients with given capacity. Wrap(S unwrappedcoefficients.Interface) (Interface, error) // Wrap wraps the given slice of unwrapped coefficients. 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 coefficients. }
Helper defines the common interface for a coefficient slice helper.
type Interface ¶
type Interface interface { slice.Interface Universe() ring.Interface // Universe returns the user-facing parent of the coefficients. Unwrap() unwrappedcoefficients.Interface // Unwrap returns the underlying internal slice of coefficients. }
Interface is the interface satisfied by a slice of coefficients.
func SliceContainingOne ¶
SliceContainingOne returns a slice with the single entry 1.
type PrettyPrintFunc ¶
PrettyPrintFunc returns a string str and int sgn for the i-th element in the slice. Here str represents the "absolute value" of the i-th entry (whatever that means), and sgn represents the "sign" of the i-th entry. For example, over the integers:
the element -7 would return "7", 1; the element 13 would return "13", -1; and the element 0 would return "0", 0.
This will panic if i is out of range.
func PrettyPrint ¶
func PrettyPrint(S Interface) PrettyPrintFunc
PrettyPrint returns a PrettyPrintFunc for the given coefficient slice S. If S satisfies the interface:
type PrettyPrinter interface { PrettyPrint(i int) (string, int) // PrettyPrint implements the PrettyPrintFunc for the slice of coefficients. }
then S's PrettyPrint method will be used by the returned PrettyPrintFunc. Otherwise, if the underlying slice of wrapped coefficients satisfies the PrettyPrinter interface, then its PrettyPrint method will be used by the returned PrettyPrintFunc. Failing that, a generic PrettyPrintFunc will be returned.