multicalc 0.6.0

Rust scientific computing for single and multi-variable calculus
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/// Transposes an MxN matrix into an NxM matrix.
pub fn transpose<const NUM_ROWS: usize, const NUM_COLUMNS: usize>(
    matrix: &[[f64; NUM_COLUMNS]; NUM_ROWS],
) -> [[f64; NUM_ROWS]; NUM_COLUMNS] {
    let mut result = [[0.0; NUM_ROWS]; NUM_COLUMNS];

    for row_index in 0..NUM_COLUMNS {
        for col_index in 0..NUM_ROWS {
            result[row_index][col_index] = matrix[col_index][row_index];
        }
    }

    result
}