(matrix: &Vec<[f32; VECTOR_SIZE]>, vector: &[f32; VECTOR_SIZE])
| 1 | use crate::constants::VECTOR_SIZE; |
| 2 | |
| 3 | pub fn gemv(matrix: &Vec<[f32; VECTOR_SIZE]>, vector: &[f32; VECTOR_SIZE]) -> Vec<f32> { |
| 4 | let mut result = vec![0f32; VECTOR_SIZE]; |
| 5 | for (i, row) in matrix.iter().enumerate() { |
| 6 | let mut sum = 0f32; |
| 7 | for j in 0..VECTOR_SIZE { |
| 8 | sum += row[j] * vector[j]; |
| 9 | } |
| 10 | result[i] = sum; |
| 11 | } |
| 12 | result |
| 13 | } |
no outgoing calls