Documentation ¶
Overview ¶
Package vec64 provides functions for efficiently manipulating fixed-length arrays of size 64.
It is one of several packages, each operating on a single size of array:
- github.com/duncanpierce/vector/vec2 for arrays of length 2
- github.com/duncanpierce/vector/vec4 for arrays of length 4
- github.com/duncanpierce/vector/vec8 for arrays of length 8
- github.com/duncanpierce/vector/vec16 for arrays of length 16
- github.com/duncanpierce/vector/vec32 for arrays of length 32
- github.com/duncanpierce/vector/vec64 for arrays of length 64
Index ¶
- Constants
- func Abs[Element constraintsExt.OrderedNumber](m Bool, a [Length]Element) (r [Length]Element)
- func Add[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
- func And[Element constraints.Integer](m Bool, a, b [Length]Element) (r [Length]Element)
- func AndNot[Element constraints.Integer](m Bool, a, b [Length]Element) (r [Length]Element)
- func Blend[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
- func Broadcast[Element constraintsExt.Number](a Element) (r [Length]Element)
- func Convert[OldType, NewType constraintsExt.OrderedNumber](m Bool, a [Length]OldType) (r [Length]NewType)
- func Deinterlace[Element constraintsExt.Number](n int, a [Length]Element) (r, s [Length / 2]Element)
- func Div[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
- func ElementMax[Element constraints.Ordered](m Bool, a [Length]Element) (min Element, ok bool)
- func ElementMin[Element constraints.Ordered](m Bool, a [Length]Element) (min Element, ok bool)
- func ElementProduct[Element constraintsExt.Number](m Bool, a [Length]Element) (r Element)
- func ElementSum[Element constraintsExt.Number](m Bool, a [Length]Element) (r Element)
- func FMA[Element constraintsExt.Number](m Bool, a, b, c [Length]Element) (r [Length]Element)
- func Gather[Element constraintsExt.Number](m Bool, p [Length]*Element) (r [Length]Element)
- func GatherSlice[Element constraintsExt.Number, Index constraints.Integer](m Bool, s []Element, index [Length]Index) (r [Length]Element)
- func Interlace[Element constraintsExt.Number](n int, a, b [Length / 2]Element) (r [Length]Element)
- func LeadingZeros[Element constraints.Unsigned](m Bool, a [Length]Element) (r [Length]int)
- func Max[Element constraintsExt.OrderedNumber](m Bool, a, b [Length]Element) (r [Length]Element)
- func Min[Element constraintsExt.OrderedNumber](m Bool, a, b [Length]Element) (r [Length]Element)
- func Mul[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
- func Neg[Element constraintsExt.Number](m Bool, a [Length]Element) (r [Length]Element)
- func Not[Element constraints.Integer](m Bool, a [Length]Element) (r [Length]Element)
- func OnesCount[Element constraints.Unsigned](m Bool, a [Length]Element) (r [Length]int)
- func Or[Element constraints.Integer](m Bool, a, b [Length]Element) (r [Length]Element)
- func Permute[Index constraints.Integer, Element constraintsExt.Number](m Bool, a [Length]Index, b [Length]Element) (r [Length]Element)
- func ReduceElements[Element any](m Bool, a [Length]Element, f func(x, y Element) Element) (result Element, ok bool)
- func RotateLeft[T constraints.Unsigned, U constraints.Integer](m Bool, a [Length]T, b [Length]U) (r [Length]T)
- func Scatter[Element constraintsExt.Number](m Bool, p [Length]*Element, a [Length]Element)
- func ScatterSlice[Element constraintsExt.Number, Index constraints.Integer](m Bool, s []Element, index [Length]Index, a [Length]Element)
- func ShiftLeft[T, U constraints.Integer](m Bool, a [Length]T, b [Length]U) (r [Length]T)
- func ShiftRight[T, U constraints.Integer](m Bool, a [Length]T, b [Length]U) (r [Length]T)
- func Sub[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
- func TrailingZeros[Element constraints.Unsigned](m Bool, a [Length]Element) (r [Length]int)
- func Xor[Element constraints.Integer](m Bool, a, b [Length]Element) (r [Length]Element)
- func Zero[Element constraintsExt.Number](m Bool, a [Length]Element) (r [Length]Element)
- type Bool
- func AndNotZero[Element constraints.Integer](m Bool, a, b [Length]Element) (r Bool)
- func Equal[Element constraints.Ordered](m Bool, a, b [Length]Element) (r Bool)
- func Greater[Element constraints.Ordered](m Bool, a, b [Length]Element) (r Bool)
- func GreaterOrEqual[Element constraints.Ordered](m Bool, a, b [Length]Element) (r Bool)
- func IsDuplicate[Element constraintsExt.Number](m Bool, a [Length]Element) (r Bool)
- func IsInf[Element constraints.Float](m Bool, a [Length]Element, sign int) (r Bool)
- func IsNaN[Element constraints.Float](m Bool, a [Length]Element) (r Bool)
- func Less[Element constraints.Ordered](m Bool, a, b [Length]Element) (r Bool)
- func LessOrEqual[Element constraints.Ordered](m Bool, a, b [Length]Element) (r Bool)
- func NotEqual[Element constraints.Ordered](m Bool, a, b [Length]Element) (r Bool)
- func SelectAll() (r Bool)
- func SelectFirst(n int) (r Bool)
- func SelectLast(n int) (r Bool)
- func SelectNone() (r Bool)
- func (m Bool) AllTrue() bool
- func (m Bool) And(n Bool) (r Bool)
- func (m Bool) AndNot(n Bool) (r Bool)
- func (m Bool) AnyTrue() bool
- func (m Bool) CountTrue() int
- func (m Bool) FirstTrue() (i int, ok bool)
- func (m Bool) For(f func(i int, c bool))
- func (m Bool) ForTrue(f func(i int))
- func (m Bool) IsTrue(i int) bool
- func (m Bool) Not() (r Bool)
- func (m Bool) Or(n Bool) (r Bool)
- func (m Bool) Set(i int, b bool) (r Bool)
- func (m Bool) ShiftLeft(i int) (r Bool)
- func (m Bool) ShiftRight(i int) (r Bool)
- func (m Bool) Xor(n Bool) (r Bool)
Constants ¶
const Length = 64
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
func Abs[Element constraintsExt.OrderedNumber](m Bool, a [Length]Element) (r [Length]Element)
func Add ¶
func Add[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
func AndNot ¶
func AndNot[Element constraints.Integer](m Bool, a, b [Length]Element) (r [Length]Element)
func Blend ¶
func Blend[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
Blend returns a vector with each element drawn from b if the corresponding mask bit in m is set or a if the bit is not set. Unlike most other vector functions, Blend does not set elements in the result to zero if the corresponding mask bit is not set.
func Broadcast ¶
func Broadcast[Element constraintsExt.Number](a Element) (r [Length]Element)
Broadcast returns a vector with a single value a copied into every element. This can be used to combine a vector with a scalar; for example: multiply every element of a vector by 10 `b := vec2.Mul(mask.SelectAll(), a, vec2.Broadcast(10))`
(Note: README-DESIGN.md explains absence of mask parameter)
func Convert ¶
func Convert[OldType, NewType constraintsExt.OrderedNumber](m Bool, a [Length]OldType) (r [Length]NewType)
Convert returns a vector with all elements converted to another numeric type.
func Deinterlace ¶
func Deinterlace[Element constraintsExt.Number](n int, a [Length]Element) (r, s [Length / 2]Element)
Deinterlace splits a vector into 2 half-length vectors r and s, placing n consecutive elements in r, then n consecutive elements in s. This is repeated until all the elements of a are present in r and s. This is the reverse of Interlace.
func Div ¶
func Div[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
func ElementMax ¶
func ElementMax[Element constraints.Ordered](m Bool, a [Length]Element) (min Element, ok bool)
ElementMax returns the maximum of the elements selected by the Bool mask. If no elements are selected by the Bool mask, the result ok is false.
func ElementMin ¶
func ElementMin[Element constraints.Ordered](m Bool, a [Length]Element) (min Element, ok bool)
ElementMin returns the minimum of the elements selected by the Bool mask. If no elements are selected by the Bool mask, the result ok is false.
func ElementProduct ¶
func ElementProduct[Element constraintsExt.Number](m Bool, a [Length]Element) (r Element)
ElementProduct multiplies each element selected by the Bool mask and returns their product. If no elements are selected by the Bool mask, the result is 1.
func ElementSum ¶
func ElementSum[Element constraintsExt.Number](m Bool, a [Length]Element) (r Element)
ElementSum adds each element selected by the Bool mask and returns their sum. If no elements are selected by the Bool mask, the result is 0.
func FMA ¶
func FMA[Element constraintsExt.Number](m Bool, a, b, c [Length]Element) (r [Length]Element)
func Gather ¶
func Gather[Element constraintsExt.Number](m Bool, p [Length]*Element) (r [Length]Element)
func GatherSlice ¶
func GatherSlice[Element constraintsExt.Number, Index constraints.Integer](m Bool, s []Element, index [Length]Index) (r [Length]Element)
func Interlace ¶
func Interlace[Element constraintsExt.Number](n int, a, b [Length / 2]Element) (r [Length]Element)
Interlace copies elements from two half-length vectors a and b into a single vector, taking n consecutive elements from a, then n consecutive elements from b. This is repeated until all elements of a and b have been included in the result. For example, if n is 1, the first few elements of the result will contain elements a[0], b[0], a[1], b[1], a[2], b[2], etc. If n is 2 the first few elements of the result will contain a[0], a[1], b[0], b[1], a[2], a[3], b[2], b[3], etc. Panics if n is greater than vector length or is not a power of 2.
func LeadingZeros ¶
func Max ¶
func Max[Element constraintsExt.OrderedNumber](m Bool, a, b [Length]Element) (r [Length]Element)
func Min ¶
func Min[Element constraintsExt.OrderedNumber](m Bool, a, b [Length]Element) (r [Length]Element)
func Mul ¶
func Mul[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
func Permute ¶
func Permute[Index constraints.Integer, Element constraintsExt.Number](m Bool, a [Length]Index, b [Length]Element) (r [Length]Element)
Permute returns a masked vector containing elements from b chosen from indices in a. An element from b may appear more than once in the result, or may be absent.
func ReduceElements ¶
func RotateLeft ¶
func RotateLeft[T constraints.Unsigned, U constraints.Integer](m Bool, a [Length]T, b [Length]U) (r [Length]T)
func Scatter ¶
func Scatter[Element constraintsExt.Number](m Bool, p [Length]*Element, a [Length]Element)
func ScatterSlice ¶
func ScatterSlice[Element constraintsExt.Number, Index constraints.Integer](m Bool, s []Element, index [Length]Index, a [Length]Element)
func ShiftRight ¶
func Sub ¶
func Sub[Element constraintsExt.Number](m Bool, a, b [Length]Element) (r [Length]Element)
func TrailingZeros ¶
Types ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
func AndNotZero ¶
func AndNotZero[Element constraints.Integer](m Bool, a, b [Length]Element) (r Bool)
func GreaterOrEqual ¶
func GreaterOrEqual[Element constraints.Ordered](m Bool, a, b [Length]Element) (r Bool)
func IsDuplicate ¶
func IsDuplicate[Element constraintsExt.Number](m Bool, a [Length]Element) (r Bool)
IsDuplicate checks elements of vector a for values which are equal to one another. If several elements have the same value, exactly one is chosen as the original. Elements other than the original are deemed to be duplicates and have the corresponding bit set in the boolean vector result. It is not defined which value is chosen as the original. Your code should assume it is chosen at random.
func LessOrEqual ¶
func LessOrEqual[Element constraints.Ordered](m Bool, a, b [Length]Element) (r Bool)
func SelectFirst ¶
func SelectLast ¶
func SelectNone ¶
func SelectNone() (r Bool)