adding base matrix management
Build / build (push) Successful in 1m33s
Test / build (push) Successful in 10m31s

This commit is contained in:
2026-05-11 01:48:13 +02:00
parent 9d20363ae8
commit 769009ad5e
8 changed files with 145 additions and 11 deletions
+26 -4
View File
@@ -33,12 +33,12 @@ pub const case = struct {
// To test with all important module options
const module_options = [_]spv.Module.ModuleOptions{
.{
.use_simd_vectors_specializations = true,
},
.{
.use_simd_vectors_specializations = false,
},
//.{
// .use_simd_vectors_specializations = true,
//},
};
for (module_options) |opt| {
@@ -78,7 +78,7 @@ pub const case = struct {
}
pub fn random(comptime T: type) T {
var prng: std.Random.DefaultPrng = .init(@intCast(std.Io.Timestamp.now(std.testing.io, .real).toMicroseconds()));
var prng: std.Random.DefaultPrng = .init(@intCast(std.Io.Timestamp.now(std.testing.io, .real).toNanoseconds()));
const rand = prng.random();
return switch (@typeInfo(T)) {
@@ -91,6 +91,13 @@ pub const case = struct {
}
break :blk vec;
},
.array => |a| blk: {
var arr: [a.len]a.child = undefined;
inline for (0..a.len) |i| {
arr[i] = random(a.child);
}
break :blk arr;
},
inline else => unreachable,
};
}
@@ -107,6 +114,21 @@ pub const case = struct {
}
};
}
pub fn Mat(comptime len: usize, comptime T: type) type {
return struct {
const Self = @This();
val: [len][len]T,
pub fn format(self: *const Self, w: *std.Io.Writer) std.Io.Writer.Error!void {
inline for (0..len) |i| {
inline for (0..len) |j| {
try w.print("{d}", .{self.val[i][j]});
if (i < len - 1 or j < len - 1) try w.writeAll(", ");
}
}
}
};
}
};
test {