This commit is contained in:
2026-09-02 15:31:22 -05:00
parent 3c3900a78d
commit 7d7e19b0fc

View File

@@ -92,6 +92,16 @@ pub fn Matrix(rows: comptime_int, cols: comptime_int, T: type) type {
return result;
}
pub fn abs(self: Self) Self {
var result: Self = .{ .mat = undefined };
inline for (&result.mat, self.mat) |*r_row, s_row| {
inline for (r_row, s_row) |*r, s| {
r.* = @abs(s);
}
}
return result;
}
pub const BinOp = struct {
f: @TypeOf(impl.add),