strided-perm
Cache-efficient tensor permutation / transpose, inspired by HPTT (Springer et al., 2017).
Usage
Copy from any strided-view source view into a mutable destination view with
the same shape:
use copy_into;
use StridedArray;
let src = from_fn_col_major;
let transposed = src.view.permute.unwrap;
let mut dst = col_major;
copy_into.unwrap;
Use copy_into_col_major when the destination is known to be column-major and
you want to make that layout contract explicit.
copy_into_uninit (and copy_into_uninit_par) takes a StridedViewMut<MaybeUninit<T>>
destination over fresh storage. It runs the same engine, selected on T rather than on
MaybeUninit<T>, so the native f32/f64 kernels still apply; every element the views
describe is written exactly once, through raw pointers only.
Parallel Feature
Enable the parallel feature to use Rayon-backed copy entry points:
[]
= { = "0.4", = ["parallel"] }
# use copy_into_par;
# use StridedArray;
# let src = col_major;
# let mut dst = col_major;
copy_into_par.unwrap;
Benchmarks live in
strided-rs-benchmark-suite.
Acknowledgments and License
The transpose engine in src/hptt/ reimplements the algorithm of
HPTT by Paul Springer, Tong Su, and
Paolo Bientinesi, following the structure of the original C++ implementation
(P. Springer, T. Su, P. Bientinesi, "HPTT: A High-Performance Tensor
Transposition C++ Library", ARRAY 2017). HPTT is licensed under BSD-3-Clause
(Copyright 2018 Paul Springer); see the packaged THIRD-PARTY-LICENSES file
for the full text.
This crate is therefore licensed as (MIT OR Apache-2.0) AND BSD-3-Clause.