expr

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinearExpression

type LinearExpression[E constraint.Element] []Term[E]

func NewLinearExpression

func NewLinearExpression[E constraint.Element](vID int, cID E) LinearExpression[E]

NewLinearExpression helper to initialize a linear expression with one term

func (LinearExpression[E]) Clone

func (l LinearExpression[E]) Clone() LinearExpression[E]

func (LinearExpression[E]) Equal

func (l LinearExpression[E]) Equal(o LinearExpression[E]) bool

Equals returns true if both SORTED expressions are the same

pre conditions: l and o are sorted

func (LinearExpression[E]) HashCode

func (l LinearExpression[E]) HashCode() [16]byte

HashCode returns a collision-resistant identifier of the linear expression. It is constructed from the hash codes of the terms.

func (LinearExpression[E]) Len

func (l LinearExpression[E]) Len() int

Len return the length of the Variable (implements Sort interface)

func (LinearExpression[E]) Less

func (l LinearExpression[E]) Less(i, j int) bool

Less returns true if variableID for term at i is less than variableID for term at j (implements Sort interface)

func (LinearExpression[E]) Swap

func (l LinearExpression[E]) Swap(i, j int)

Swap swaps terms in the Variable (implements Sort interface)

type Term

type Term[E constraint.Element] struct {
	VID   int
	Coeff E
}

func NewTerm

func NewTerm[E constraint.Element](vID int, cID E) Term[E]

func (Term[E]) HashCode

func (t Term[E]) HashCode() [16]byte

HashCode returns a collision resistant hash code identifier for the term.

func (*Term[E]) SetCoeff

func (t *Term[E]) SetCoeff(c E)

func (Term[E]) WireID

func (t Term[E]) WireID() int

TODO @gbotrel make that return a uint32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL