mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Add linalg.matrix_cast
This commit is contained in:
@@ -3,7 +3,7 @@ package container
|
|||||||
Priority_Queue :: struct(T: typeid) {
|
Priority_Queue :: struct(T: typeid) {
|
||||||
data: Array(T),
|
data: Array(T),
|
||||||
len: int,
|
len: int,
|
||||||
priority: proc(item: T) -> int
|
priority: proc(item: T) -> int,
|
||||||
}
|
}
|
||||||
|
|
||||||
priority_queue_init_none :: proc(q: ^$Q/Priority_Queue($T), f: proc(item: T) -> int, allocator := context.allocator) {
|
priority_queue_init_none :: proc(q: ^$Q/Priority_Queue($T), f: proc(item: T) -> int, allocator := context.allocator) {
|
||||||
|
|||||||
@@ -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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
matrix_cast :: proc(v: $A/[$M][$N]$T, $Elem_Type: typeid) -> (w: [M][N]Elem_Type) {
|
matrix_cast :: proc(v: $A/[$M][$N]$T, $Elem_Type: typeid) -> (w: [M][N]Elem_Type) {
|
||||||
for i in 0..<M {
|
for i in 0..<M {
|
||||||
for j in 0..<N {
|
for j in 0..<N {
|
||||||
|
|||||||
Reference in New Issue
Block a user