ring

package
v0.0.2-0...-db6250e Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: CC0-1.0, CC0-1.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DotProduct

func DotProduct(R Interface, S1 []object.Element, S2 []object.Element) (object.Element, error)

DotProduct returns the dot-product of the slices S1 and S2. That is, it returns S1[0] * S2[0] + ... + S1[k] * S2[k], where k+1 is the minimum of len(S1) and len(S2). The dot-product of two empty slices is the zero element. If R satisfies the interface:

type DotProducter interface {
	DotProduct(S1 []object.Element, S2 []object.Element)
		(object.Element, error) // DotProduct returns the dot-product
			 of the slices S1 and S2. That is, it returns
			 S1[0] * S2[0] + ... + S1[k] * S2[k], where k+1 is the
			 minimum of len(S1) and len(S2). The dot-product of two
			 empty slices is the zero element.
}

then R's DotProduct method will be called.

func Product

func Product(R Interface, S ...object.Element) (object.Element, error)

Product returns the product of the elements in the slice S. The product of the empty slice is one. If R satisfies the interface:

type Producter interface {
	Product(S ...object.Element) (object.Element, error) // Product
	   returns the product of the elements in the slice S. The product
	   of the empty slice is one.
}

then R's Product method will be called.

func Sum

func Sum(R Interface, S ...object.Element) (object.Element, error)

Sum returns the sum of the elements in the slice S. The sum of the empty slice is the zero element. If R satisfies the interface:

type Sumer interface {
	Sum(S ...object.Element) (object.Element, error) // Sum returns
	   the sum of the elements in the slice S. The sum of the empty
	   slice is the zero element.
}

then R's Sum method will be called.

Types

type Interface

type Interface interface {
	abeliangroup.Interface
	One() object.Element                                                 // One returns the multiplicative identity of the ring.
	IsOne(x object.Element) (bool, error)                                // IsOne returns true iff x is the multiplicative identity element of the ring.
	Multiply(x object.Element, y object.Element) (object.Element, error) // Multiply returns the product x * y.
	Power(x object.Element, k *integer.Element) (object.Element, error)  // Power returns x^k.
}

Interface defines the ring interface that all rings must satisfy.

type IsUniter

type IsUniter interface {
	IsUnit(x object.Element) (bool, object.Element, error) // IsUnit returns true iff x is a multiplicative unit in the ring. If true, also returns the inverse element y such that x * y = 1.
}

IsUniter is an optional interface a ring may support, providing an IsUnit method.

Jump to

Keyboard shortcuts

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