From 900fe95ba0b54dcc83ad2dbb2f16df8482135c61 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 12 Feb 2024 12:08:43 +0000 Subject: [PATCH] Split out `linalg.identity` between matrices and array-based matrix --- core/math/linalg/general.odin | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/math/linalg/general.odin b/core/math/linalg/general.odin index 9d9309f12..667546e78 100644 --- a/core/math/linalg/general.odin +++ b/core/math/linalg/general.odin @@ -172,13 +172,23 @@ projection :: proc "contextless" (x, normal: $T/[$N]$E) -> T where IS_NUMERIC(E) } @(require_results) -identity :: proc "contextless" ($T: typeid/[$N][N]$E) -> (m: T) #no_bounds_check { +identity_array_based_matrix :: proc "contextless" ($T: typeid/[$N][N]$E) -> (m: T) #no_bounds_check { for i in 0.. T #no_bounds_check { + return 1 +} + +identity :: proc{ + identity_array_based_matrix, + identity_matrix, +} + transpose :: intrinsics.transpose @(require_results)