I have a case where I am implementing some unrolling with comptime and I need a seperate sum item for each element. I have something like this:
// Initialize sums
var sums: [N]@Vector(vector_width, f32) = undefined;
inline for (0..N) |j| {
sums[j] = @splat(0.0);
}
var offset: usize = 0;
for (0..vec_len) |_| {
const xvec: @Vector(vector_width, f32) = x[offset..][0..vector_width].*;
inline for (0..N) |j| {
const wvec: @Vector(vector_width, f32) = wrows[j][offset..][0..vector_width].*;
sums[j] += xvec * wvec;
}
offset += vector_width;
}
Is there a way in Zig to have the variables declared but NOT in array? I am not sure this even makes much sense as an idea I am still getting used to meta programming in zig.