aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-06-28 13:23:28 +0100
committergingerBill <bill@gingerbill.org>2021-06-28 13:23:28 +0100
commitad22eda87c8c519ca2d9809533e63a3d7b34b71c (patch)
treea8363e7dd84153bb1922436d53dfdd1a28206d02
parent8d31ba492df26eaae73bda37349408a10ff17798 (diff)
Improve `linalg.transpose` type determination for square matrices
-rw-r--r--core/math/linalg/general.odin3
1 files changed, 1 insertions, 2 deletions
diff --git a/core/math/linalg/general.odin b/core/math/linalg/general.odin
index d0c558758..318605ccf 100644
--- a/core/math/linalg/general.odin
+++ b/core/math/linalg/general.odin
@@ -170,8 +170,7 @@ trace :: proc(m: $T/[$N][N]$E) -> (tr: E) {
return;
}
-
-transpose :: proc(a: $T/[$N][$M]$E) -> (m: [M][N]E) {
+transpose :: proc(a: $T/[$N][$M]$E) -> (m: (T when N == M else [M][N]E)) {
for j in 0..<M {
for i in 0..<N {
m[j][i] = a[i][j];