MCPcopy Create free account
hub / github.com/carsonpo/haystackdb / identity_matrix

Function identity_matrix

tests/math.rs:30–36  ·  view source on GitHub ↗

Helper function to create identity matrix for testing GEMV and GEMM

(size: usize)

Source from the content-addressed store, hash-verified

28
29 // Helper function to create identity matrix for testing GEMV and GEMM
30 fn identity_matrix(size: usize) -> Vec<[f32; VECTOR_SIZE]> {
31 let mut matrix = vec![[0.0; VECTOR_SIZE]; size];
32 for i in 0..size {
33 matrix[i][i] = 1.0;
34 }
35 matrix
36 }
37
38 // Helper function to create zero matrix for testing GEMV and GEMM
39 fn zero_matrix(size: usize) -> Vec<[f32; VECTOR_SIZE]> {

Callers 2

test_gemv_identityFunction · 0.85
test_gemm_identityFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_gemv_identityFunction · 0.68
test_gemm_identityFunction · 0.68