Documentation ¶
Index ¶
- type GaussianInt
- func (g *GaussianInt) Add(a, b *GaussianInt) *GaussianInt
- func (g *GaussianInt) CmpNorm(a *GaussianInt) int
- func (g *GaussianInt) Conj(origin *GaussianInt) *GaussianInt
- func (g *GaussianInt) Copy() *GaussianInt
- func (g *GaussianInt) Div(a, b *GaussianInt) *GaussianInt
- func (g *GaussianInt) Equals(a *GaussianInt) bool
- func (g *GaussianInt) GCD(a, b *GaussianInt) *GaussianInt
- func (g *GaussianInt) IsOne() bool
- func (g *GaussianInt) IsZero() bool
- func (g *GaussianInt) Norm() *big.Int
- func (g *GaussianInt) Prod(a, b *GaussianInt) *GaussianInt
- func (g *GaussianInt) Set(a *GaussianInt) *GaussianInt
- func (g *GaussianInt) String() string
- func (g *GaussianInt) Sub(a, b *GaussianInt) *GaussianInt
- func (g *GaussianInt) Update(r, i *big.Int) *GaussianInt
- type HurwitzInt
- func (h *HurwitzInt) Add(a, b *HurwitzInt) *HurwitzInt
- func (h *HurwitzInt) CmpNorm(a *HurwitzInt) int
- func (h *HurwitzInt) Conj(origin *HurwitzInt) *HurwitzInt
- func (h *HurwitzInt) Copy() *HurwitzInt
- func (h *HurwitzInt) Div(a, b *HurwitzInt) *HurwitzInt
- func (h *HurwitzInt) Equals(a *HurwitzInt) bool
- func (h *HurwitzInt) GCRD(a, b *HurwitzInt) *HurwitzInt
- func (h *HurwitzInt) Init() *HurwitzInt
- func (h *HurwitzInt) IsZero() bool
- func (h *HurwitzInt) Norm() *big.Int
- func (h *HurwitzInt) Prod(a, b *HurwitzInt) *HurwitzInt
- func (h *HurwitzInt) Set(a *HurwitzInt) *HurwitzInt
- func (h *HurwitzInt) String() string
- func (h *HurwitzInt) Sub(a, b *HurwitzInt) *HurwitzInt
- func (h *HurwitzInt) Update(r, i, j, k *big.Int, doubled bool) *HurwitzInt
- func (h *HurwitzInt) Val() (r, i, j, k *big.Float)
- func (h *HurwitzInt) ValInt() (r, i, j, k *big.Int)
- func (h *HurwitzInt) Zero() *HurwitzInt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GaussianInt ¶
GaussianInt implements Gaussian integer In number theory, a Gaussian integer is a complex number whose real and imaginary parts are both integers
func NewGaussianInt ¶
func NewGaussianInt(r *big.Int, i *big.Int) *GaussianInt
NewGaussianInt declares a new Gaussian integer with the real part and imaginary part
func (*GaussianInt) Add ¶
func (g *GaussianInt) Add(a, b *GaussianInt) *GaussianInt
Add adds two Gaussian integers
func (*GaussianInt) CmpNorm ¶
func (g *GaussianInt) CmpNorm(a *GaussianInt) int
CmpNorm compares the norm of two Gaussian integers
func (*GaussianInt) Conj ¶
func (g *GaussianInt) Conj(origin *GaussianInt) *GaussianInt
Conj obtains the conjugate of the original Gaussian integer
func (*GaussianInt) Copy ¶
func (g *GaussianInt) Copy() *GaussianInt
Copy copies the Gaussian integer
func (*GaussianInt) Div ¶
func (g *GaussianInt) Div(a, b *GaussianInt) *GaussianInt
Div performs Euclidean division of two Gaussian integers, i.e. a/b the remainder is stored in the Gaussian integer that calls the method the quotient is returned as a new Gaussian integer
func (*GaussianInt) Equals ¶
func (g *GaussianInt) Equals(a *GaussianInt) bool
Equals checks if two Gaussian integers are equal
func (*GaussianInt) GCD ¶
func (g *GaussianInt) GCD(a, b *GaussianInt) *GaussianInt
GCD calculates the greatest common divisor of two Gaussian integers using Euclidean algorithm the result is stored in the Gaussian integer that calls the method and returned
func (*GaussianInt) IsOne ¶
func (g *GaussianInt) IsOne() bool
IsOne returns true if the Gaussian integer is equal to one
func (*GaussianInt) IsZero ¶
func (g *GaussianInt) IsZero() bool
IsZero returns true if the Gaussian integer is equal to zero
func (*GaussianInt) Norm ¶
func (g *GaussianInt) Norm() *big.Int
Norm obtains the norm of the Gaussian integer
func (*GaussianInt) Prod ¶
func (g *GaussianInt) Prod(a, b *GaussianInt) *GaussianInt
Prod returns the products of two Gaussian integers
func (*GaussianInt) Set ¶
func (g *GaussianInt) Set(a *GaussianInt) *GaussianInt
Set sets the Gaussian integer to the given Gaussian integer
func (*GaussianInt) String ¶
func (g *GaussianInt) String() string
String returns the string representation of the Gaussian integer
func (*GaussianInt) Sub ¶
func (g *GaussianInt) Sub(a, b *GaussianInt) *GaussianInt
Sub subtracts two Gaussian integers
func (*GaussianInt) Update ¶
func (g *GaussianInt) Update(r, i *big.Int) *GaussianInt
Update updates the Gaussian integer with the given real and imaginary parts
type HurwitzInt ¶
type HurwitzInt struct {
// contains filtered or unexported fields
}
HurwitzInt implements Hurwitz quaternion (or Hurwitz integer) a + bi + cj + dk The set of all Hurwitz quaternion is H = {a + bi + cj + dk | a, b, c, d are all integers or all half-integers} A mixture of integers and half-integers is excluded In the struct each scalar is twice the original scalar so that all the scalars can be stored using big integers for computation efficiency
func NewHurwitzInt ¶
func NewHurwitzInt(r, i, j, k *big.Int, doubled bool) *HurwitzInt
NewHurwitzInt declares a new integral quaternion with the real, i, j, and k parts If isDouble is true, the arguments r, i, j, k are twice the original scalars
func (*HurwitzInt) Add ¶
func (h *HurwitzInt) Add(a, b *HurwitzInt) *HurwitzInt
Add adds two integral quaternions
func (*HurwitzInt) CmpNorm ¶
func (h *HurwitzInt) CmpNorm(a *HurwitzInt) int
CmpNorm compares the norm of two Hurwitz integers
func (*HurwitzInt) Conj ¶
func (h *HurwitzInt) Conj(origin *HurwitzInt) *HurwitzInt
Conj obtains the conjugate of the original integral quaternion
func (*HurwitzInt) Copy ¶
func (h *HurwitzInt) Copy() *HurwitzInt
Copy copies the integral quaternion
func (*HurwitzInt) Div ¶
func (h *HurwitzInt) Div(a, b *HurwitzInt) *HurwitzInt
Div performs Euclidean division of two Hurwitz integers, i.e. a/b the remainder is stored in the Hurwitz integer that calls the method the quotient is returned as a new Hurwitz integer
func (*HurwitzInt) Equals ¶
func (h *HurwitzInt) Equals(a *HurwitzInt) bool
Equals checks if the two Hurwitz integers are equal
func (*HurwitzInt) GCRD ¶
func (h *HurwitzInt) GCRD(a, b *HurwitzInt) *HurwitzInt
GCRD calculates the greatest common right-divisor of two Hurwitz integers using Euclidean algorithm The GCD is unique only up to multiplication by a unit (multiplication on the left in the case of a GCRD, and on the right in the case of a GCLD) the result is stored in the Hurwitz integer that calls the method and returned
func (*HurwitzInt) IsZero ¶
func (h *HurwitzInt) IsZero() bool
IsZero returns true if the Hurwitz integer is zero
func (*HurwitzInt) Norm ¶
func (h *HurwitzInt) Norm() *big.Int
Norm obtains the norm of the integral quaternion
func (*HurwitzInt) Prod ¶
func (h *HurwitzInt) Prod(a, b *HurwitzInt) *HurwitzInt
Prod returns the Hamilton product of two integral quaternions the product (a1 + b1j + c1k + d1)(a2 + b2j + c2k + d2) is determined by the products of the basis elements and the distributive law
func (*HurwitzInt) Set ¶
func (h *HurwitzInt) Set(a *HurwitzInt) *HurwitzInt
Set sets the Hurwitz integer to the given Hurwitz integer
func (*HurwitzInt) String ¶
func (h *HurwitzInt) String() string
String returns the string representation of the integral quaternion
func (*HurwitzInt) Sub ¶
func (h *HurwitzInt) Sub(a, b *HurwitzInt) *HurwitzInt
Sub subtracts two integral quaternions
func (*HurwitzInt) Update ¶
func (h *HurwitzInt) Update(r, i, j, k *big.Int, doubled bool) *HurwitzInt
Update updates the integral quaternion with the given real, i, j, and k parts
func (*HurwitzInt) Val ¶
func (h *HurwitzInt) Val() (r, i, j, k *big.Float)
Val reveals value of a Hurwitz integer
func (*HurwitzInt) ValInt ¶
func (h *HurwitzInt) ValInt() (r, i, j, k *big.Int)
ValInt reveals value of a Hurwitz integer in integer
func (*HurwitzInt) Zero ¶
func (h *HurwitzInt) Zero() *HurwitzInt
Zero sets the Hurwitz integer to zero