From fb51e005030fa3fa5e039a1475de2d93ae2bf184 Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Tue, 13 Aug 2024 13:14:54 -0700 Subject: [PATCH] Remove unnecessary type annotations These annotations are only needed for statically sized matrices. --- lang-trials/rust-benchmark/src/engine.rs | 22 ++-------------------- lang-trials/rust-benchmark/src/main.rs | 3 ++- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/lang-trials/rust-benchmark/src/engine.rs b/lang-trials/rust-benchmark/src/engine.rs index a2661aa..04377fd 100644 --- a/lang-trials/rust-benchmark/src/engine.rs +++ b/lang-trials/rust-benchmark/src/engine.rs @@ -4,17 +4,8 @@ use std::f64::consts::{PI, E}; /*use typenum::{B1, UInt, UTerm};*/ /* dynamic matrices */ -pub fn rand_eigval_series(time_res: usize) -> Vec, Dyn>> - where - N: ToTypenum + DimName + DimSub, - DefaultAllocator: - Allocator + - Allocator + - Allocator<>::Output> + - Allocator>::Output> -{ +pub fn rand_eigval_series(dim: usize, time_res: usize) -> Vec, Dyn>> { // initialize the random matrix - let dim = N::try_to_usize().unwrap(); let mut rand_mat = DMatrix::::from_fn(dim, dim, |j, k| { let n = j*dim + k; E*((n*n) as f64) % 2.0 - 1.0 @@ -44,17 +35,8 @@ pub fn rand_eigval_series(time_res: usize) -> Vec, Dyn>> } /* dynamic single float matrices */ -/*pub fn rand_eigval_series(time_res: usize) -> Vec, Dyn>> - where - N: ToTypenum + DimName + DimSub, - DefaultAllocator: - Allocator + - Allocator + - Allocator<>::Output> + - Allocator>::Output> -{ +/*pub fn rand_eigval_series(dim: usize, time_res: usize) -> Vec, Dyn>> { // initialize the random matrix - let dim = N::try_to_usize().unwrap(); let mut rand_mat = DMatrix::::from_fn(dim, dim, |j, k| { let n = j*dim + k; (E as f32)*((n*n) as f32) % 2.0_f32 - 1.0_f32 diff --git a/lang-trials/rust-benchmark/src/main.rs b/lang-trials/rust-benchmark/src/main.rs index 9662dd7..01364e5 100644 --- a/lang-trials/rust-benchmark/src/main.rs +++ b/lang-trials/rust-benchmark/src/main.rs @@ -19,7 +19,8 @@ fn main() { on_mount(move || { let performance = window().unwrap().performance().unwrap(); let start_time = performance.now(); - let eigval_series = engine::rand_eigval_series::(time_res); + /*let eigval_series = engine::rand_eigval_series::(time_res);*/ + let eigval_series = engine::rand_eigval_series(60, time_res); let run_time = performance.now() - start_time; run_time_report.set(run_time);