std.simd
The entries of std.simd in the Zig reference. This page has 24 cards.
pub fn countElementsWithValue(vec: anytype, value: std.meta.Child(@TypeOf(vec))) VectorCount(@TypeOf(vec))
- Kind
- function
- Module
std.simd
pub fn countTrues(vec: anytype) VectorCount(@TypeOf(vec))
- Kind
- function
- Module
std.simd
pub fn deinterlace(comptime vec_count: usize, interlaced: anytype) [vec_count]@Vector(vectorLength(@TypeOf(interlaced)) / vec_count, std.meta.Child(@TypeOf(interlaced)))
The contents of `interlaced` is evenly split between vec_count vectors that are returned as an array.
- Kind
- function
- Module
std.simd
pub fn firstIndexOfValue(vec: anytype, value: std.meta.Child(@TypeOf(vec))) ?VectorIndex(@TypeOf(vec))
- Kind
- function
- Module
std.simd
pub fn firstTrue(vec: anytype) ?VectorIndex(@TypeOf(vec))
- Kind
- function
- Module
std.simd
pub fn interlace(vecs: anytype) @Vector(vectorLength(@TypeOf(vecs[0])) * vecs.len, std.meta.Child(@TypeOf(vecs[0])))
Returns a vector whose elements alternates between those of each input vector.
- Kind
- function
- Module
std.simd
pub fn iota(comptime T: type, comptime len: usize) @Vector(len, T)
Returns a vector containing the first `len` integers in order from 0 to `len`-1.
- Kind
- function
- Module
std.simd
pub fn join(a: anytype, b: anytype) @Vector(vectorLength(@TypeOf(a)) + vectorLength(@TypeOf(b)), std.meta.Child(@TypeOf(a)))
Returns a vector containing all elements of the first vector at the lower indices followed by all elements of the second vector at the higher indices.
- Kind
- function
- Module
std.simd
pub fn lastIndexOfValue(vec: anytype, value: std.meta.Child(@TypeOf(vec))) ?VectorIndex(@TypeOf(vec))
- Kind
- function
- Module
std.simd
pub fn lastTrue(vec: anytype) ?VectorIndex(@TypeOf(vec))
- Kind
- function
- Module
std.simd
pub fn mergeShift(a: anytype, b: anytype, comptime shift: VectorCount(@TypeOf(a, b))) @TypeOf(a, b)
Joins two vectors, shifts them leftwards (towards lower indices) and extracts the leftmost elements into a vector the length of a and b.
- Kind
- function
- Module
std.simd
pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: anytype) @TypeOf(vec)
Returns a vector whose elements are the result of performing the specified operation on the corresponding element of the input vector and every hop'th element that came before it (or after, if hop is negative).
- Kind
- function
- Module
std.simd
pub fn prefixScanWithFunc(comptime hop: isize, vec: anytype, comptime ErrorType: type, comptime func: fn (@TypeOf(vec), @TypeOf(vec)) if (ErrorType == void) @TypeOf(vec) else ErrorType!@TypeOf(vec), comptime identity: std.meta.Child(@TypeOf(vec))) if (ErrorType == void) @TypeOf(vec) else ErrorType!@TypeOf(vec)
Same as prefixScan, but with a user-provided, mathematically associative function.
- Kind
- function
- Module
std.simd
pub fn repeat(comptime len: usize, vec: anytype) @Vector(len, std.meta.Child(@TypeOf(vec)))
Returns a vector containing the same elements as the input, but repeated until the desired length is reached.
- Kind
- function
- Module
std.simd
pub fn reverseOrder(vec: anytype) @TypeOf(vec)
- Kind
- function
- Module
std.simd
pub fn rotateElementsLeft(vec: anytype, comptime amount: VectorCount(@TypeOf(vec))) @TypeOf(vec)
Elements are shifted leftwards (towards lower indices).
- Kind
- function
- Module
std.simd
pub fn rotateElementsRight(vec: anytype, comptime amount: VectorCount(@TypeOf(vec))) @TypeOf(vec)
Elements are shifted rightwards (towards higher indices).
- Kind
- function
- Module
std.simd
pub fn shiftElementsLeft(vec: anytype, comptime amount: VectorCount(@TypeOf(vec)), shift_in: std.meta.Child(@TypeOf(vec))) @TypeOf(vec)
Elements are shifted leftwards (towards lower indices).
- Kind
- function
- Module
std.simd
pub fn shiftElementsRight(vec: anytype, comptime amount: VectorCount(@TypeOf(vec)), shift_in: std.meta.Child(@TypeOf(vec))) @TypeOf(vec)
Elements are shifted rightwards (towards higher indices).
- Kind
- function
- Module
std.simd
pub fn suggestVectorLength(comptime T: type) ?comptime_int
Suggests a target-dependant vector length for a given type, or null if scalars are recommended.
- Kind
- function
- Module
std.simd
pub fn suggestVectorLengthForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ?comptime_int
- Kind
- function
- Module
std.simd
pub fn VectorCount(comptime VectorType: type) type
Returns the smallest type of unsigned ints capable of holding the length of the given vector type.
- Kind
- type function
- Module
std.simd
pub fn VectorIndex(comptime VectorType: type) type
Returns the smallest type of unsigned ints capable of indexing any element within the given vector type.
- Kind
- type function
- Module
std.simd