opensrdk-linear-algebra 0.6.3

Standard linear algebra library using blas and lapack for OpenSRDK toolchain.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{matrix::Matrix, number::Number};

impl<T> Matrix<T>
where
    T: Number,
{
    /// # Identity
    pub fn identity(n: usize) -> Self {
        let mut new_matrix = Matrix::<T>::new(n, n);
        for i in 0..n {
            new_matrix[i][i] = T::one();
        }

        new_matrix
    }
}