#[non_exhaustive]pub enum NormOrd {
Frobenius,
Zero,
Inf,
NegInf,
P(f64),
}Expand description
The order of a norm.
Each variant maps one to one onto the former Option<f64> argument:
Frobenius is None, Zero is Some(0.0), Inf and NegInf are
Some(+inf) and Some(-inf), and P(p) is Some(p) for a finite nonzero
p. The meaning of P(p) depends on how many axes are reduced:
- one axis (a vector norm): the entrywise
p-norm; - two axes (a matrix norm):
P(1.0)/P(-1.0)are the largest / smallest absolute column sum,P(2.0)/P(-2.0)the largest / smallest singular value, and any otherpthe entrywisep-norm of the matrix; - more axes: the entrywise
p-norm over all reduced axes.
Zero counts the entries that are not equal to zero, not the entries with
|x| > 0: a NaN counts as nonzero, +0.0 and -0.0 count as zero, and
±inf count as nonzero; for complex dtypes an entry is zero exactly when
both components are zero. Inf / NegInf are the largest / smallest
absolute entry (vector) or absolute row sum (matrix).
Frobenius is the Euclidean norm of the reduced entries. P(p) with
p == 0, an infinite p or a NaN p is rejected as an invalid argument;
use Zero, Inf or NegInf instead.
§Examples
use tenferro_linalg::NormOrd;
assert_eq!(NormOrd::default(), NormOrd::Frobenius);
let spectral = NormOrd::P(2.0);
assert_eq!(spectral, NormOrd::P(2.0));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Frobenius
The Euclidean (Frobenius) norm of the reduced entries.
Zero
The number of entries not equal to zero.
The predicate is x != 0, not |x| > 0: a NaN entry counts as nonzero,
+0.0 and -0.0 count as zero, and ±inf count as nonzero. For complex
dtypes an entry is zero exactly when both components are zero.
Inf
The largest absolute entry, or the largest absolute row sum.
NegInf
The smallest absolute entry, or the smallest absolute row sum.
P(f64)
The p-norm for a finite nonzero p.
Trait Implementations§
impl Copy for NormOrd
impl StructuralPartialEq for NormOrd
Auto Trait Implementations§
impl Freeze for NormOrd
impl RefUnwindSafe for NormOrd
impl Send for NormOrd
impl Sync for NormOrd
impl Unpin for NormOrd
impl UnsafeUnpin for NormOrd
impl UnwindSafe for NormOrd
Blanket Implementations§
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more