diff options
| author | gingerBill <bill@gingerbill.org> | 2021-03-26 16:24:56 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-03-26 16:24:56 +0000 |
| commit | 43ac6ca8f4e68e87f673768d22429119422c325f (patch) | |
| tree | 37f8703caaf8c62274f8383fc7411fb8b95a60dc /core/math | |
| parent | 62d2656f69cf2302d27a0059b7d3f9ade01df100 (diff) | |
Add `linalg.matrix_cast`
Diffstat (limited to 'core/math')
| -rw-r--r-- | core/math/linalg/general.odin | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/math/linalg/general.odin b/core/math/linalg/general.odin index 0236f6130..84001184f 100644 --- a/core/math/linalg/general.odin +++ b/core/math/linalg/general.odin @@ -317,11 +317,12 @@ cubic :: proc(v1, v2, v3, v4: $T/[$N]$E, s: E) -> T { array_cast :: proc(v: $A/[$N]$T, $Elem_Type: typeid) -> (w: [N]Elem_Type) { - for _, i in v do w[i] = Elem_Type(v[i]); + for i in 0..<N { + w[i] = Elem_Type(v[i]); + } return; } - matrix_cast :: proc(v: $A/[$M][$N]$T, $Elem_Type: typeid) -> (w: [M][N]Elem_Type) { for i in 0..<M { for j in 0..<N { |