Fix link and remove reliance on One

This commit is contained in:
Andrew Cassidy 2023-05-09 23:08:50 -07:00
parent 6831027573
commit f697db6d35

View File

@ -1,7 +1,6 @@
use crate::util::checked_inv; use crate::util::checked_inv;
use crate::{Matrix, Vector}; use crate::{Matrix, Vector};
use num_traits::real::Real; use num_traits::real::Real;
use num_traits::One;
use std::iter::{Product, Sum}; use std::iter::{Product, Sum};
use std::ops::{Mul, Neg, Not}; use std::ops::{Mul, Neg, Not};
@ -15,14 +14,14 @@ pub enum Parity {
impl<T> Mul<T> for Parity impl<T> Mul<T> for Parity
where where
T: Neg<Output = T> + One, T: Neg<Output = T>,
{ {
type Output = T; type Output = T;
fn mul(self, rhs: T) -> Self::Output { fn mul(self, rhs: T) -> Self::Output {
rhs * match self { match self {
Parity::Even => T::one(), Parity::Even => rhs,
Parity::Odd => -T::one(), Parity::Odd => -rhs,
} }
} }
} }
@ -205,7 +204,7 @@ where
#[must_use] #[must_use]
fn det(&self) -> T; fn det(&self) -> T;
/// Solve for $x$ in $M xx x = b$, where $M$ is the original matrix this is a decomposition of. /// Solve for $x$ in $M xx x = b$
/// ///
/// ``` /// ```
/// # use vector_victor::decompose::LUDecomposable; /// # use vector_victor::decompose::LUDecomposable;
@ -220,7 +219,7 @@ where
/// ``` /// ```
/// ///
/// $x$ does not need to be a column-vector, it can also be a 2D matrix. For example, /// $x$ does not need to be a column-vector, it can also be a 2D matrix. For example,
/// the following is another way to calculate the [`inverse`] by solving for the identity matrix $I$. /// the following is another way to calculate the [inverse](LUDecomposable::inverse()) by solving for the identity matrix $I$.
/// ///
/// ``` /// ```
/// # use vector_victor::decompose::LUDecomposable; /// # use vector_victor::decompose::LUDecomposable;