Documentation ¶
Index ¶
- func AreEqual(x *Element, y *Element) bool
- func Cmp(x *Element, y *Element) (int, error)
- func DotProduct(x *Element, y *Element) (*integer.Element, error)
- type Element
- func Add(x *Element, y *Element) (*Element, error)
- func Basis(M *Parent) []*Element
- func ChangeParent(M *Parent, x object.Element) (*Element, error)
- func ConstantVector(M *Parent, c *integer.Element) *Element
- func CopySlice(S []*Element) []*Element
- func FromInt32Slice(M *Parent, S []int32) (*Element, error)
- func FromInt64Slice(M *Parent, S []int64) (*Element, error)
- func FromIntSlice(M *Parent, S []int) (*Element, error)
- func FromIntegerSlice(M *Parent, S []*integer.Element) (*Element, error)
- func FromString(M *Parent, s string) (*Element, error)
- func FromUint64Slice(M *Parent, S []uint64) (*Element, error)
- func GobDecode(dec *gob.Decoder) (*Element, error)
- func GobDecodeSlice(dec *gob.Decoder) ([]*Element, error)
- func NCopiesToSlice(a *Element, N int) []*Element
- func Negate(x *Element) *Element
- func NthBasisElement(M *Parent, n int) (*Element, error)
- func ScalarMultiplyByIntegerThenAdd(a *integer.Element, x *Element, y *Element) (*Element, error)
- func ScalarMultiplyByIntegerThenSubtract(a *integer.Element, x *Element, y *Element) (*Element, error)
- func Sort(S []*Element) ([]*Element, error)
- func Subtract(x *Element, y *Element) (*Element, error)
- func Sum(M *Parent, S ...*Element) (*Element, error)
- func ToElement(M *Parent, x object.Element) (*Element, error)
- func Zero(M *Parent) *Element
- func (x *Element) DecrementEntry(i int) (*Element, error)
- func (x *Element) DecrementEntryOrPanic(i int) *Element
- func (x *Element) Dimension() int
- func (x *Element) Entry(i int) (*integer.Element, error)
- func (x *Element) EntryOrPanic(i int) *integer.Element
- func (x *Element) GobDecode(buf []byte) error
- func (x *Element) GobEncode() ([]byte, error)
- func (x *Element) Hash() hash.Value
- func (x *Element) IncrementEntry(i int) (*Element, error)
- func (x *Element) IncrementEntryOrPanic(i int) *Element
- func (x *Element) IsEqualTo(y *Element) bool
- func (x *Element) IsGreaterThan(y *Element) bool
- func (x *Element) IsGreaterThanOrEqualTo(y *Element) bool
- func (x *Element) IsLessThan(y *Element) bool
- func (x *Element) IsLessThanOrEqualTo(y *Element) bool
- func (x *Element) IsNegative() bool
- func (x *Element) IsPositive() bool
- func (x *Element) IsZero() bool
- func (x *Element) Negate() *Element
- func (x *Element) Parent() object.Parent
- func (x *Element) ScalarMultiplyByInt64(a int64) *Element
- func (x *Element) ScalarMultiplyByInteger(a *integer.Element) *Element
- func (x *Element) ScalarMultiplyByUint64(a uint64) *Element
- func (x *Element) Sign() int
- func (x *Element) String() string
- func (x *Element) ToInt64Slice() ([]int64, error)
- func (x *Element) ToIntegerSlice() []*integer.Element
- func (x *Element) TotalDegree() *integer.Element
- type Parent
- func (M *Parent) Add(x object.Element, y object.Element) (object.Element, error)
- func (M *Parent) AreEqual(x object.Element, y object.Element) (bool, error)
- func (M *Parent) AssignName(name string)
- func (M *Parent) Basis() []object.Element
- func (M *Parent) Cmp(x object.Element, y object.Element) (int, error)
- func (M *Parent) Contains(x object.Element) bool
- func (M *Parent) Dimension() int
- func (M *Parent) InclusionMap(i int) (objectmap.Interface, error)
- func (M *Parent) IsZero(x object.Element) (bool, error)
- func (M *Parent) MonomialOrder() monomialorder.Type
- func (M *Parent) Negate(x object.Element) (object.Element, error)
- func (M *Parent) NthBasisElement(n int) (object.Element, error)
- func (M *Parent) ProjectionMap(i int) (objectmap.Interface, error)
- func (M *Parent) Rank() int
- func (M *Parent) ScalarMultiplyByInteger(n *integer.Element, x object.Element) (object.Element, error)
- func (M *Parent) Sort(S []object.Element) ([]object.Element, error)
- func (M *Parent) String() string
- func (M *Parent) Subtract(x object.Element, y object.Element) (object.Element, error)
- func (M *Parent) Sum(S ...object.Element) (object.Element, error)
- func (M *Parent) ToElement(x object.Element) (object.Element, error)
- func (M *Parent) Zero() object.Element
- type Slice
- type SortableSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element describes an integer-valued vector.
func Add ¶
Add returns the vector sum x + y. This will return an error if x and y do not have the same parent.
func ChangeParent ¶
ChangeParent returns a copy of x with the parent set to the space M of n-dimensional integer-valued vectors. If x has a ToIntegerSlice method, this will be called to allow conversion. If x cannot be cast into M -- either because the dimensions or length of the slices disagree, or because there is no known way of automatically performing the conversion -- then an error will be returned.
func ConstantVector ¶
ConstantVector returns an n-dimensional vector in M all of whose entries are c.
func FromInt32Slice ¶
FromInt32Slice returns an n-dimensional vector in M with value S. This will return an error if the length of the slice does not agree with the dimension of M.
func FromInt64Slice ¶
FromInt64Slice returns an n-dimensional vector in M with value S. This will return an error if the length of the slice does not agree with the dimension of M.
func FromIntSlice ¶
FromIntSlice returns an n-dimensional vector in M with value S. This will return an error if the length of the slice does not agree with the dimension of M.
func FromIntegerSlice ¶
FromIntegerSlice returns an n-dimensional vector in M with value S. This will return an error if the length of the slice does not agree with the dimension of M.
func FromString ¶
FromString returns the n-dimensional vector in M represented by the string s.
func FromUint64Slice ¶
FromUint64Slice returns an n-dimensional vector in M with value S. This will return an error if the length of the slice does not agree with the dimension of M.
func GobDecode ¶
GobDecode reads the next value from the given gob.Decoder and decodes it as an integer-valued vector. The decoded vector will lie in the default lattice of appropriate dimension.
func GobDecodeSlice ¶
GobDecodeSlice reads the next value from the given gob.Decoder and decodes it as a slice of integer-valued vectors. The decoded vectors will lie in the default lattice of appropriate dimension.
func NCopiesToSlice ¶
NCopiesToSlice returns a slice of length N containing the element a.
func NthBasisElement ¶
NthBasisElement returns the n-th standard basis element of M. Here the basis elements are indexed from 0 to d-1 (inclusive), where d is the dimension of M.
func ScalarMultiplyByIntegerThenAdd ¶
ScalarMultiplyByIntegerThenAdd returns a * x + y, where a is an integer, and x and y are vectors. This will return an error if x and y do not have the same parent.
func ScalarMultiplyByIntegerThenSubtract ¶
func ScalarMultiplyByIntegerThenSubtract(a *integer.Element, x *Element, y *Element) (*Element, error)
ScalarMultiplyByIntegerThenSubtract returns a * x - y, where a is an integer, and x and y are vectors. This will return an error if x and y do not have the same parent.
func Sort ¶
Sort non-destructively sorts the given slice of integer-valued vectors. The sorted slice is returned. All vectors must have the same parent, otherwise an error will be returned.
func Subtract ¶
Subtract returns the vector different x - y. This will return an error if x and y do not have the same parent.
func Sum ¶
Sum returns the sum of the elements in the slice S. The sum of the empty slice is the zero element of M. This will return an error if the elements of S do not all have M as their parent.
func ToElement ¶
ToElement returns the argument as an n-dimensional integer-valued vector in the given parent, if that's where it belongs. If necessary, if M is 1-dimensional then an attempt will be made to convert x to an integer, which will then be returned as an element in k.
func (*Element) DecrementEntry ¶
DecrementEntry returns a new n-dimensional vector equal to x, but with the i-th entry decremented by one. Entries are indexed from 0 up to one less than the dimension of the parent of x (inclusive). This will return an error if i is out of range.
func (*Element) DecrementEntryOrPanic ¶
DecrementEntryOrPanic returns a new n-dimensional vector equal to x, but with the i-th entry decremented by one. Entries are indexed from 0 up to one less than the dimension of the parent of x (inclusive). This will panic if i is out of range.
func (*Element) Entry ¶
Entry returns the i-th entry in the vector x, where the entries are indexed from 0 up to one less than the dimension of the parent of x (inclusive). This will return an error if i is out of range.
func (*Element) EntryOrPanic ¶
EntryOrPanic returns the i-th entry in the vector x, where the entries are indexed from 0 up to one less than the dimension of the parent of x (inclusive). This will panic if i is out of range.
func (*Element) GobDecode ¶
GobDecode implements the gob.GobDecoder interface. Important: Take great care that you are decoding into a new *Element; the safe way to do this is to use the GobDecode(dec *gob.Decode) function. The decoded vector will lie in the default lattice of appropriate dimension.
func (*Element) IncrementEntry ¶
IncrementEntry returns a new n-dimensional vector equal to x, but with the i-th entry incremented by one. Entries are indexed from 0 up to one less than the dimension of the parent of x (inclusive). This will return an error if i is out of range.
func (*Element) IncrementEntryOrPanic ¶
IncrementEntryOrPanic returns a new n-dimensional vector equal to x, but with the i-th entry incremented by one. Entries are indexed from 0 up to one less than the dimension of the parent of x (inclusive). This will panic if i is out of range.
func (*Element) IsGreaterThan ¶
IsGreaterThan returns true iff x and y have the same parent, and x > y.
func (*Element) IsGreaterThanOrEqualTo ¶
IsGreaterThanOrEqualTo returns true iff x and y have the same parent, and x >= y.
func (*Element) IsLessThan ¶
IsLessThan returns true iff x and y have the same parent, and x < y.
func (*Element) IsLessThanOrEqualTo ¶
IsLessThanOrEqualTo returns true iff x and y have the same parent, and x <= y.
func (*Element) ScalarMultiplyByInt64 ¶
ScalarMultiplyByInt64 returns the scalar product a * x, where a is an integer.
func (*Element) ScalarMultiplyByInteger ¶
ScalarMultiplyByInteger returns the scalar product a * x, where a is an integer.
func (*Element) ScalarMultiplyByUint64 ¶
ScalarMultiplyByUint64 returns the scalar product a * x, where a is an integer.
func (*Element) ToInt64Slice ¶
ToInt64Slice returns the vector as a slice of int64s. It returns an error if any of the entries is too large to fit in an int64.
func (*Element) ToIntegerSlice ¶
ToIntegerSlice returns the vector as a slice of integers. Note that you can modify the returned slice without affecting the vector.
func (*Element) TotalDegree ¶
TotalDegree returns the total degree of the vector x. That is, it returns the sum of the entries in x.
type Parent ¶
type Parent struct {
// contains filtered or unexported fields
}
Parent is an n-dimensional ZZ-module.
func DefaultLattice ¶
DefaultLattice returns the default space of n-dimensional integer-valued vectors with lex ordering. This is provided for use when the particular space the vector lives in is either currently undetermined, or doesn't matter. Calls to DefaultLattice (with the same value of n) always return the same n-dimensional space. This will return an error if n is negative.
func DefaultLatticeWithOrder ¶
func DefaultLatticeWithOrder(n int, c monomialorder.Type) (*Parent, error)
DefaultLatticeWithOrder returns the default space of n-dimensional integer-valued vectors with given ordering. This is provided for use when the particular space the vector lives in is either currently undetermined, or doesn't matter. Calls to DefaultLattice (with the same value of n) always return the same n-dimensional space. This will return an error if n is negative.
func NewLattice ¶
NewLattice returns a new space of n-dimensional integer-valued vectors with lex ordering. That is, it returns a copy of ZZ^n. Note that two different copies of ZZ^n will be regarded as being distinct. This will return an error if n is negative.
func NewLatticeWithOrder ¶
func NewLatticeWithOrder(n int, c monomialorder.Type) (M *Parent, err error)
NewLatticeWithOrder returns a new space of n-dimensional integer-valued vectors with given ordering. That is, it returns a copy of ZZ^n. Note that two different copies of ZZ^n will be regarded as being distinct. This will return an error if n is negative.
func (*Parent) AssignName ¶
AssignName assigns a name to M to be used by String.
func (*Parent) Contains ¶
Contains returns true iff x is an n-dimension vector in M. Note that we do not allow a natural isomorphism between two different parent ZZ-modules, hence it is not sufficient that the dimensions agree.
func (*Parent) InclusionMap ¶
InclusionMap returns the inclusion ZZ -> M into the (i+1)-th factor of the of M. This is, the inclusion maps are indexed from 0.
func (*Parent) MonomialOrder ¶
func (M *Parent) MonomialOrder() monomialorder.Type
MonomialOrder returns the monomial order being used to order the elements of M.
func (*Parent) NthBasisElement ¶
NthBasisElement returns the n-th standard basis element of M. Here the basis elements are indexed from 0 to d-1 (inclusive), where d is the dimension of M.
func (*Parent) ProjectionMap ¶
ProjectionMap returns the projection M -> ZZ onto the (i+1)-th factor of M. That is, projection maps are indexed from 0.
func (*Parent) ScalarMultiplyByInteger ¶
func (M *Parent) ScalarMultiplyByInteger(n *integer.Element, x object.Element) (object.Element, error)
ScalarMultiplyByInteger returns nx, where this is defined to be x + ... + x (n times) if n is positive, and -x - ... - x (|n| times) if n is negative.
func (*Parent) Sort ¶
Sort non-destructively sorts the given slice of integer-valued vectors. The sorted slice is returned.
func (*Parent) Subtract ¶
Subtract returns the difference x - y of the n-dimensional vectors x and y in M.
func (*Parent) Sum ¶
Sum returns the sum of the elements in the slice S. The sum of the empty slice is the zero element of M.
type Slice ¶
type Slice []*Element
Slice implements the slice.Interface for a slice of Elements.
type SortableSlice ¶
type SortableSlice []*Element
SortableSlice implements the sort.Interface interface.
func (SortableSlice) Len ¶
func (S SortableSlice) Len() int
Len is the number of elements in the slice.
func (SortableSlice) Less ¶
func (S SortableSlice) Less(i int, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (SortableSlice) Swap ¶
func (S SortableSlice) Swap(i int, j int)
Swap swaps the elements with indexes i and j.