uint64number

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreEqual

func AreEqual(x *Element, y *Element) bool

AreEqual returns true iff x equals y.

func Cmp

func Cmp(x *Element, y *Element) int

Cmp returns -1 if x < y, 0 if x == y, and +1 if x > y.

Types

type Element

type Element struct {
	// contains filtered or unexported fields
}

Element is an uint64-valued element.

func Add

func Add(x *Element, y *Element) (*Element, error)

Add returns the sum x + y, or an error if the result is out of range.

func FromInt

func FromInt(n int) (*Element, error)

FromInt returns a new uint64-valued element, or an error if n is negative.

func FromInt32

func FromInt32(n int32) (*Element, error)

FromInt32 returns a new uint64-valued element, or an error if n is negative.

func FromInt64

func FromInt64(n int64) (*Element, error)

FromInt64 returns a new uint64-valued element, or an error if n is negative.

func FromInteger

func FromInteger(n *integer.Element) (*Element, error)

FromInteger returns a new uint64-valued element, or an error if out of range.

func FromString

func FromString(s string) (*Element, error)

FromString returns the uint64-valued element represented by the string s, or an error if s is malformed or the value is out of range.

func FromUint64

func FromUint64(n uint64) *Element

FromUint64 returns a new uint64-valued element.

func GobDecode

func GobDecode(dec *gob.Decoder) (*Element, error)

GobDecode reads the next value from the given gob.Decoder and decodes it as a uint64-valued element.

func GobDecodeSlice

func GobDecodeSlice(dec *gob.Decoder) ([]*Element, error)

GobDecodeSlice reads the next value from the given gob.Decoder and decodes it as a slice of uint64-valued elements.

func Multiply

func Multiply(x *Element, y *Element) (*Element, error)

Multiply returns the product x * y, or an error if the result is out of range.

func MultiplyThenAdd

func MultiplyThenAdd(x *Element, y *Element, z *Element) (*Element, error)

MultiplyThenAdd returns x * y + z, or an error if out of range

func MultiplyThenSubtract

func MultiplyThenSubtract(x *Element, y *Element, z *Element) (*Element, error)

MultiplyThenSubtract returns x * y - z, or an error if out of range

func One

func One() *Element

One returns the multiplicative identity element.

func Power

func Power(x *Element, k *integer.Element) (*Element, error)

Power returns x^k, or an error if the result is out of range.

func PowerInt64

func PowerInt64(x *Element, k int64) (*Element, error)

PowerInt64 returns x^k, or an error if the result is out of range.

func Subtract

func Subtract(x *Element, y *Element) (*Element, error)

Subtract returns the difference x - y, or an error if the result is out of range.

func ToElement

func ToElement(x object.Element) (*Element, error)

ToElement attempts to convert the given object.Element to an uint64-valued element.

func Zero

func Zero() *Element

Zero returns the additive identity element.

func (*Element) Decrement

func (x *Element) Decrement() (*Element, error)

Decrement returns x - 1, or an error if out of range.

func (*Element) GobDecode

func (x *Element) GobDecode(buf []byte) error

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.

func (*Element) GobEncode

func (x *Element) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (*Element) Hash

func (x *Element) Hash() hash.Value

Hash returns a hash value for the element.

func (*Element) Increment

func (x *Element) Increment() (*Element, error)

Increment returns x + 1, or an error if out of range.

func (*Element) Int64

func (x *Element) Int64() (int64, error)

Int64 returns the value as a int64, or an error if out of range.

func (*Element) IsEqualTo

func (x *Element) IsEqualTo(y *Element) bool

IsEqualTo returns true iff x is equal to y.

func (*Element) IsEqualToUint64

func (x *Element) IsEqualToUint64(y uint64) bool

IsEqualToUint64 returns true iff x is equal to y.

func (*Element) IsGreaterThan

func (x *Element) IsGreaterThan(y *Element) bool

IsGreaterThan returns true iff x > y.

func (*Element) IsGreaterThanOrEqualTo

func (x *Element) IsGreaterThanOrEqualTo(y *Element) bool

IsGreaterThanOrEqualTo returns true iff x >= y.

func (*Element) IsLessThan

func (x *Element) IsLessThan(y *Element) bool

IsLessThan returns true iff x < y.

func (*Element) IsLessThanOrEqualTo

func (x *Element) IsLessThanOrEqualTo(y *Element) bool

IsLessThanOrEqualTo returns true iff x <= y.

func (*Element) IsOne

func (x *Element) IsOne() bool

IsOne returns true iff x is the multiplicative identity element.

func (*Element) IsPositive

func (x *Element) IsPositive() bool

IsPositive returns true iff x > 0.

func (*Element) IsZero

func (x *Element) IsZero() bool

IsZero returns true iff x is the additive identity element.

func (*Element) Parent

func (x *Element) Parent() object.Parent

Parent returns the parent of the element.

func (*Element) ScalarMultiplyByInteger

func (x *Element) ScalarMultiplyByInteger(n *integer.Element) (*Element, error)

ScalarMultiplyByInteger returns n * x, or an error if out of range.

func (*Element) ScalarMultiplyByUint64

func (x *Element) ScalarMultiplyByUint64(n uint64) (*Element, error)

ScalarMultiplyByUint64 returns n * x, or an error if out of range.

func (*Element) String

func (x *Element) String() string

String returns a string representation of the element.

func (*Element) ToInteger

func (x *Element) ToInteger() *integer.Element

ToInteger returns the value as an integer.

func (*Element) Uint64

func (x *Element) Uint64() uint64

Uint64 returns the value as an uint64.

type Parent

type Parent struct{}

Parent is the (unique) set of uint64-valued elements.

func Set

func Set() Parent

Set returns the (unique) set of uint64-valued elements. Note that this isn't really a ring since, for example, the range of the values is bounded and hence isn't closed under addition.

func (Parent) Add

Add returns x + y, or an error if the result is out of range.

func (Parent) AreEqual

func (R Parent) AreEqual(x object.Element, y object.Element) (bool, error)

AreEqual returns true iff x and y are both contained in the parent, and x = y.

func (Parent) Cmp

func (R Parent) Cmp(x object.Element, y object.Element) (int, error)

Cmp returns -1 if x < y, 0 if x == y, and +1 if x > y.

func (Parent) Contains

func (R Parent) Contains(x object.Element) bool

Contains returns true iff x is an element of this parent, or can naturally be regarded as an element of this parent.

func (Parent) IsOne

func (R Parent) IsOne(x object.Element) (bool, error)

IsOne returns true iff x is the multiplicative identity element.

func (Parent) IsZero

func (R Parent) IsZero(x object.Element) (bool, error)

IsZero returns true iff x is the additive identity element.

func (Parent) Multiply

func (R Parent) Multiply(x object.Element, y object.Element) (object.Element, error)

Multiply returns the product x * y, or an error if the result is out of range.

func (Parent) One

func (R Parent) One() object.Element

One returns the multiplicative identity element.

func (Parent) Power

func (R Parent) Power(x object.Element, k *integer.Element) (object.Element, error)

Power returns x^k, or an error if the result is out of range.

func (Parent) ScalarMultiplyByInteger

func (R Parent) ScalarMultiplyByInteger(n *integer.Element, x object.Element) (object.Element, error)

ScalarMultiplyByInteger returns the product n * x, or an error if the result is out of range.

func (Parent) String

func (R Parent) String() string

String returns a string representation of the parent.

func (Parent) ToElement

func (R Parent) ToElement(x object.Element) (object.Element, error)

ToElement returns x as an element of this parent, or an error if x cannot naturally be regarded as an element of this parent.

func (Parent) Zero

func (R Parent) Zero() object.Element

Zero returns the additive identity element.

Jump to

Keyboard shortcuts

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