mathru 0.16.2

Fundamental algorithms for scientific computing in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::algebra::linear::matrix::{Diagonal, General};

impl<T> From<General<T>> for Diagonal<T> {
    /// Construct a Diagonal view of the matrix 'matrix'. Entries of 'matrix' below and above the diagonal are ignored.
    ///
    /// # Example
    ///
    /// ```
    /// use mathru::algebra::linear::matrix::{General, Diagonal};
    /// use mathru::matrix;
    ///
    /// let m: Diagonal<f64> = matrix![1.0, 0.0;
    ///                                0.0, 1.0].into();
    /// ```
    fn from(matrix: General<T>) -> Self {
        Diagonal { matrix }
    }
}