Vector

Usage

use Vector;

or

import Vector;

Submodules

proc numBits(type t) param : int  where isSubtype(t, vector)
proc min(type t) : t  where isSubtype(t, vector)
proc max(type t) : t  where isSubtype(t, vector)
record vector : writeSerializable
type eltType
param numElts : int
var data : Intrin.vectorType(eltType, numElts)
proc init(type eltType, param numElts: int)

type init

proc init(type eltType, param numElts: int, value: ?valEltType)  where isCoercible(valEltType, eltType)

init to single value

proc init(param numElts: int, value: ?eltType)

init to single value, infer type

proc init(value: vector(?eltType, ?numElts))
proc init(type eltType, param numElts: int, value: vector(eltType, numElts))
proc init=(value: vector(?))
operator =(ref lhs: vector(?), rhs: lhs.type)
proc ref set(value: vector(eltType, numElts))
proc init(type eltType, param numElts: int, values: numElts*?tupEltType)  where isCoercible(tupEltType, eltType)
proc init(values)  where isHomogeneousTupleType(values.type)
proc init=(values)  where isHomogeneousTupleType(values.type)
operator =(ref lhs, rhs)  where isSubtype(lhs.type, vector) && isHomogeneousTupleType(rhs.type) && isCoercible(rhs(0).type, lhs.eltType) && lhs.numElts == rhs.size
operator :(x: ?tupType, type t: vector(?))  where isHomogeneousTupleType(tupType) && isCoercible(x(0).type, t.eltType) && x.size == t.numElts
operator :(x: ?eltType, type t: vector(?))  where isCoercible(eltType, t.eltType)
operator :(x: vector(?eltType, ?numElts), type tupType)  where isHomogeneousTupleType(tupType) && isCoercible(eltType, tupType(0)) && tupType.size == numElts
proc toTuple() : numElts*eltType
proc type toTuple() type
proc ref set(value)  where isCoercible(value.type, eltType)
proc ref set(values)  where isHomogeneousTupleType(values.type) && isCoercible(values(0).type, eltType) && values.size == numElts
proc ref set(param idx: integral, value)  where isCoercible(value.type, eltType)
proc this(param idx: integral) : eltType
iter these() : eltType
proc ref load(ptr: c_ptrConst(eltType), idx: integral = 0, param aligned: bool = false)
proc ref load(container: ?, idx: integral = 0, param aligned: bool = false)  where isValidContainer(container, eltType)
proc store(ptr: c_ptr(eltType), idx: integral = 0, param aligned: bool = false)
proc store(ref container: ?, idx: integral = 0, param aligned: bool = false)  where isValidContainerForStore(container, eltType)
proc type load(container: ?, idx: integral = 0, param aligned: bool = false) : this
proc type loadMasked(mask: vector(?), container: ?, idx: integral = 0) : this

loadMasked is not bounds checked

proc ref loadMasked(mask: vector(?), ptr: c_ptrConst(eltType), idx: integral = 0)  where this.type.isValidLoadMask(mask.type)

loadMasked is not bounds checked

proc ref loadMasked(mask: vector(?), container: ?, idx: integral = 0)  where this.type.isValidLoadMask(mask.type) && isValidContainer(container, eltType)

loadMasked is not bounds checked

proc type indexVectorType type
proc type gather(container: ?, startIdx: integral, indexVector: this.indexVectorType, param scale: int = 0, mask: ? = none) : this

gather is not bounds checked

proc ref gather(ptr: c_ptrConst(eltType), startIdx: integral, indexVector: this.type.indexVectorType, param scale: int = 0, mask: ? = none)  where mask.type == nothing || this.type.isValidLoadMask(mask.type, onlyInts = false)

gather is not bounds checked

proc ref gather(arr: [] eltType, startIdx: integral, indexVector: this.type.indexVectorType, param scale: int = 0, mask: ? = none)  where (mask.type == nothing || this.type.isValidLoadMask(mask.type, onlyInts = false)) && isValidContainer(arr, eltType)

gather is not bounds checked

proc ref gather(tup, startIdx: integral, indexVector: this.type.indexVectorType, param scale: int = 0, mask: ? = none)  where (mask.type == nothing || this.type.isValidLoadMask(mask.type, onlyInts = false)) && isValidContainer(tup, eltType) && isHomogeneousTuple(tup)

gather is not bounds checked

proc transmute(type t) : t  where isSubtype(t, vector) && numBits(t) == numBits(this.type)
proc transmute(type t) : t  where !isSubtype(t, vector)
proc transmute(type t) : t  where isSubtype(t, vector) && numBits(t) != numBits(this.type)
proc convert(type t) : t  where isSubtype(t, vector) && numBits(t) == numBits(this.type)
proc type indices(rng: range(?)) : range(strides = strideKind.positive)
proc type indices(dom: domain(?)) : domain(?)
proc type indices(container: ?) : range(strides = strideKind.positive)  where isHomogeneousTuple(container)
proc type indices(container: ?) : domain(?)  where isArray(container)
iter type vectors(container: ?, param aligned: bool = false) : this  where isValidContainer(container, eltType)
iter type vectors(param tag: iterKind, container: ?, param aligned: bool = false) : this  where tag == iterKind.standalone && __primitive("resolves", indices(container).these(tag = tag)) && isValidContainer(container, eltType)
iter type vectors(param tag: iterKind, container: ?, param aligned: bool = false)  where tag == iterKind.leader && isValidContainer(container, eltType)
iter type vectors(param tag: iterKind, followThis, container: ?, param aligned: bool = false) : this  where tag == iterKind.follower && isValidContainer(container, eltType)
iter type vectorsRef(ref container: ?, param aligned: bool = false) ref : vectorRef(?)  where isValidContainer(container, eltType)
iter type vectorsRef(param tag: iterKind, ref container: ?, param aligned: bool = false) ref : vectorRef(?)  where tag == iterKind.standalone && __primitive("resolves", indices(container).these(tag = tag)) && isValidContainer(container, eltType)
iter type vectorsRef(param tag: iterKind, ref container: ?, param aligned: bool = false)  where tag == iterKind.leader && isValidContainer(container, eltType)
iter type vectorsRef(param tag: iterKind, followThis, ref container: ?, param aligned: bool = false) ref : vectorRef(?)  where tag == iterKind.follower && isValidContainer(container, eltType)
iter type vectorsJagged(arr: ?, pad: eltType = 0, param aligned: bool = false) : this
proc serialize(writer, ref serializer) throws
proc swapPairs(x: vector(?eltType, ?numElts)) : x.type
proc swapLowHigh(x: vector(?eltType, ?numElts)) : x.type
proc reverse(x: vector(?eltType, ?numElts)) : x.type
proc rotateLeft(x: vector(?eltType, ?numElts)) : x.type
proc rotateRight(x: vector(?eltType, ?numElts)) : x.type
proc interleaveLower(x: vector(?eltType, ?numElts), y: x.type) : x.type
proc interleaveUpper(x: vector(?eltType, ?numElts), y: x.type) : x.type
proc deinterleaveLower(x: vector(?eltType, ?numElts), y: x.type) : x.type
proc deinterleaveUpper(x: vector(?eltType, ?numElts), y: x.type) : x.type
proc pairwiseAdd(x: vector(?eltType, ?numElts), y: x.type) : x.type

pairwise add adjacent elements

x: [a, b, c, d] y: [e, f, g, h]

returns: [a+b, e+f, c+d, g+h]

proc blendLowHigh(x: vector(?eltType, ?numElts), y: x.type) : x.type

takes the low half of x and the high half of y

proc vector.isZero() : bool
proc vector.moveMask() : c_int
proc type vector.ones() : this
proc type vector.zeros() : this
proc vector.shiftLeft(param amount: int) : this.type

Shift each lane left by the given amount, shifting in zeros.

proc vector.shiftLeft(amount: this.type) : this.type
proc vector.shiftRight(param amount: int) : this.type

Shift each lane right by the given amount, shifting in zeros.

proc vector.shiftRight(amount: this.type) : this.type
proc vector.shiftRightArith(param amount: int) : this.type

Shift each lane right by the given amount, shifting in sign bits.

proc vector.shiftRightArith(amount: this.type) : this.type
proc sqrt(x: vector(?eltType, ?numElts)) : x.type
proc rsqrt(x: vector(?eltType, ?numElts)) : x.type
proc fma(x: vector(?eltType, ?numElts), y: x.type, z: x.type) : x.type
proc fms(x: vector(?eltType, ?numElts), y: x.type, z: x.type) : x.type
proc bitSelect(mask: vector(?), x: vector(?eltType, ?numElts), y: x.type) : x.type  where numBits(mask.type) == numBits(x.type)
proc andNot(x: vector(?eltType, ?numElts), y: x.type) : x.type
proc andNot(x: vector(?eltType, ?numElts), y: ?scalarType) : x.type  where isCoercible(scalarType, eltType)
proc andNot(x: ?scalarType, y: vector(?eltType, ?numElts)) : y.type  where isCoercible(scalarType, eltType)
proc min(x: vector(?eltType, ?numElts), y: x.type) : x.type
proc max(x: vector(?eltType, ?numElts), y: x.type) : x.type
proc abs(x: vector(?eltType, ?numElts)) : x.type
proc sin(x: vector(?eltType, ?numElts)) : x.type
proc cos(x: vector(?eltType, ?numElts)) : x.type
proc tan(x: vector(?eltType, ?numElts)) : x.type
proc asin(x: vector(?eltType, ?numElts)) : x.type
proc acos(x: vector(?eltType, ?numElts)) : x.type
proc atan(x: vector(?eltType, ?numElts)) : x.type