filter out only matrix files
This commit is contained in:
parent
424207914b
commit
a2422ee02b
@ -10,10 +10,13 @@ use nalgebra_sparse::io::load_coo_from_matrix_market_file;
|
|||||||
fn main() {
|
fn main() {
|
||||||
#[cfg(feature = "io")]
|
#[cfg(feature = "io")]
|
||||||
{
|
{
|
||||||
let mut file_iter = fs::read_dir("./data").unwrap();
|
let mut file_iter = fs::read_dir("data").unwrap();
|
||||||
for f in file_iter {
|
for f in file_iter {
|
||||||
println!("Benchmark file {:?}", f);
|
println!("Benchmark file {:?}", f);
|
||||||
let f = f.unwrap().path();
|
let f = f.unwrap().path();
|
||||||
|
|
||||||
|
if f.extension().map_or(false, |ext| ext == "mtx") {
|
||||||
|
println!("Benchmark file {:?}", f);
|
||||||
let sparse_input_matrix = load_coo_from_matrix_market_file::<f64, _>(&f).unwrap();
|
let sparse_input_matrix = load_coo_from_matrix_market_file::<f64, _>(&f).unwrap();
|
||||||
let sparse_input_matrix = CsrMatrix::from(&sparse_input_matrix);
|
let sparse_input_matrix = CsrMatrix::from(&sparse_input_matrix);
|
||||||
let spmm_result = &sparse_input_matrix * &sparse_input_matrix;
|
let spmm_result = &sparse_input_matrix * &sparse_input_matrix;
|
||||||
@ -25,6 +28,7 @@ fn main() {
|
|||||||
println!("sum of product is {}", sum);
|
println!("sum of product is {}", sum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#[cfg(not(feature = "io"))]
|
#[cfg(not(feature = "io"))]
|
||||||
{
|
{
|
||||||
panic!("Run with IO feature only");
|
panic!("Run with IO feature only");
|
||||||
|
Loading…
Reference in New Issue
Block a user