diff options
| author | gingerBill <bill@gingerbill.org> | 2021-10-25 15:36:00 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-10-25 15:36:00 +0100 |
| commit | 7ac156755b09ded90db5d01e1a43da8338d5ff7c (patch) | |
| tree | 4b9901f7df03949d0d0b505af2c59d6866fef11c /core/runtime | |
| parent | 973ca6824c570d23ed95b061005a3daa935cb9dc (diff) | |
Reorder code
Diffstat (limited to 'core/runtime')
| -rw-r--r-- | core/runtime/core_builtin_matrix.odin | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/core/runtime/core_builtin_matrix.odin b/core/runtime/core_builtin_matrix.odin index 548dd6874..32f2e303b 100644 --- a/core/runtime/core_builtin_matrix.odin +++ b/core/runtime/core_builtin_matrix.odin @@ -50,6 +50,21 @@ matrix_trace :: proc(m: $M/matrix[$N, N]$T) -> (trace: T) { return } +@(builtin) +matrix_minor :: proc(m: $M/matrix[$N, N]$T, row, column: int) -> (minor: T) where N > 1 { + K :: N-1 + cut_down: matrix[K, K]T + for col_idx in 0..<K { + j := col_idx + int(col_idx >= column) + for row_idx in 0..<K { + i := row_idx + int(row_idx >= row) + cut_down[row_idx, col_idx] = m[i, j] + } + } + return determinant(cut_down) +} + + @(builtin) matrix1x1_determinant :: proc(m: $M/matrix[1, 1]$T) -> (det: T) { @@ -108,19 +123,6 @@ matrix3x3_adjugate :: proc(m: $M/matrix[3, 3]$T) -> (y: M) { return } -@(builtin) -matrix_minor :: proc(m: $M/matrix[$N, N]$T, row, column: int) -> (minor: T) where N > 1 { - K :: N-1 - cut_down: matrix[K, K]T - for col_idx in 0..<K { - j := col_idx + int(col_idx >= column) - for row_idx in 0..<K { - i := row_idx + int(row_idx >= row) - cut_down[row_idx, col_idx] = m[i, j] - } - } - return determinant(cut_down) -} @(builtin) matrix4x4_adjugate :: proc(x: $M/matrix[4, 4]$T) -> (y: M) { |