5 releases

Uses old Rust 2015

0.2.3 Feb 20, 2024
0.2.2 Nov 8, 2022
0.2.1 Mar 31, 2021
0.2.0 Jan 5, 2019
0.1.0 Jan 2, 2019

#102 in Algorithms

Download history 26408/week @ 2024-07-30 34276/week @ 2024-08-06 26754/week @ 2024-08-13 36466/week @ 2024-08-20 31356/week @ 2024-08-27 35977/week @ 2024-09-03 36722/week @ 2024-09-10 35707/week @ 2024-09-17 38403/week @ 2024-09-24 42340/week @ 2024-10-01 44290/week @ 2024-10-08 50097/week @ 2024-10-15 47130/week @ 2024-10-22 46206/week @ 2024-10-29 44745/week @ 2024-11-05 38683/week @ 2024-11-12

184,512 downloads per month
Used in 366 crates (18 directly)

MIT/Apache

22KB
237 lines

transpose

crate license documentation minimum rustc 1.26

Utility for transposing multi-dimensional data See the API Documentation for more details.

transpose is #![no_std]

Example

// Create a 2D array in row-major order: the rows of our 2D array are contiguous,
// and the columns are strided
let input_array = vec![ 1, 2, 3,
                        4, 5, 6];

// Treat our 6-element array as a 2D 3x2 array, and transpose it to a 2x3 array
let mut output_array = vec![0; 6];
transpose::transpose(&input_array, &mut output_array, 3, 2);

// The rows have become the columns, and the columns have become the rows
let expected_array =  vec![ 1, 4,
                            2, 5,
                            3, 6];
assert_eq!(output_array, expected_array);

Compatibility

The transpose crate requires rustc 1.26 or greater.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~190–255KB