1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
use crate::{matrix::Matrix, number::Number};

impl<T> Matrix<T>
where
    T: Number,
{
    /// # Determinant
    /// for triangle matrix
    /// To apply this method to none triangle matrix, use LU decomposition or Cholesky decomposition.
    pub fn det(&self) -> T {
        (0..self.rows).into_iter().map(|i| self[i][i]).product()
    }
}