multicalc 0.5.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
15
16
17
18
use num_complex::ComplexFloat;

///utility to convert the transpose the matrix
///takes an input of a matrix of shape MxN, and returns the matrix as NxM
pub fn transpose<T: ComplexFloat, const NUM_ROWS: usize, const NUM_COLUMNS: usize>(matrix: &[[T; NUM_COLUMNS]; NUM_ROWS]) -> [[T; NUM_ROWS]; NUM_COLUMNS]
{
    let mut result = [[T::zero(); 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];
        }
    }

    return result;
}