-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #932 from rust-ndarray/append-row-column
append, append_row, append_column: methods for appending an array or single rows and columns
- Loading branch information
Showing
13 changed files
with
1,447 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#![feature(test)] | ||
|
||
extern crate test; | ||
use test::Bencher; | ||
|
||
use ndarray::prelude::*; | ||
|
||
#[bench] | ||
fn select_axis0(bench: &mut Bencher) { | ||
let a = Array::<f32, _>::zeros((256, 256)); | ||
let selectable = vec![0, 1, 2, 0, 1, 3, 0, 4, 16, 32, 128, 147, 149, 220, 221, 255, 221, 0, 1]; | ||
bench.iter(|| { | ||
a.select(Axis(0), &selectable) | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn select_axis1(bench: &mut Bencher) { | ||
let a = Array::<f32, _>::zeros((256, 256)); | ||
let selectable = vec![0, 1, 2, 0, 1, 3, 0, 4, 16, 32, 128, 147, 149, 220, 221, 255, 221, 0, 1]; | ||
bench.iter(|| { | ||
a.select(Axis(1), &selectable) | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn select_1d(bench: &mut Bencher) { | ||
let a = Array::<f32, _>::zeros(1024); | ||
let mut selectable = (0..a.len()).step_by(17).collect::<Vec<_>>(); | ||
selectable.extend(selectable.clone().iter().rev()); | ||
|
||
bench.iter(|| { | ||
a.select(Axis(0), &selectable) | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.