Skip to content

Instantly share code, notes, and snippets.

@samueleresca
Created March 25, 2023 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samueleresca/f6a3e5e4b0041b397038ac3652f05d13 to your computer and use it in GitHub Desktop.
Save samueleresca/f6a3e5e4b0041b397038ac3652f05d13 to your computer and use it in GitHub Desktop.
/// Returns the result of the matrix multiplication.
///
/// # Arguments
///
/// * `n` - The dimension of the matrix.
pub fn non_optimized(n: usize) -> Vec<Vec<f64>> {
let m1 = generate_matrix(n);
let m2 = m1.clone();
let mut res = vec![vec![0.0; n]; n];
for i in 0..n {
for j in 0..n {
for k in 0..n {
res[i][j] += m1[i][k] * m2[k][j];
}
}
}
res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment