#[non_exhaustive]pub struct NormOptions {
pub ord: NormOrd,
pub axes: Option<AxisVec>,
pub keep_dims: KeepDims,
}Expand description
Options for a norm.
axes are signed (-1 is the last axis) and normalized against the input
rank; None reduces every axis.
§Examples
use tenferro_linalg::{KeepDims, NormOptions, NormOrd};
use tenferro_tensor::AxisVec;
let axes: AxisVec = [0, -1].into_iter().collect();
let options = NormOptions::default()
.ord(NormOrd::Inf)
.axes(Some(axes.clone()))
.keep_dims(KeepDims::Yes);
assert_eq!(options.ord, NormOrd::Inf);
assert_eq!(options.axes, Some(axes));
assert_eq!(options.keep_dims, KeepDims::Yes);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ord: NormOrdThe order of the norm.
axes: Option<AxisVec>Axes to reduce (signed); None reduces all axes.
keep_dims: KeepDimsWhether reduced axes stay as size-one axes.
Implementations§
Source§impl NormOptions
impl NormOptions
Sourcepub fn ord(self, ord: NormOrd) -> Self
pub fn ord(self, ord: NormOrd) -> Self
Return options with the requested order.
§Examples
use tenferro_linalg::{NormOptions, NormOrd};
assert_eq!(NormOptions::default().ord(NormOrd::Zero).ord, NormOrd::Zero);Sourcepub fn axes(self, axes: Option<AxisVec>) -> Self
pub fn axes(self, axes: Option<AxisVec>) -> Self
Return options reducing the given signed axes (None reduces all).
§Examples
use tenferro_linalg::NormOptions;
use tenferro_tensor::AxisVec;
let axes: AxisVec = [1].into_iter().collect();
assert_eq!(NormOptions::default().axes(Some(axes.clone())).axes, Some(axes));Trait Implementations§
Source§impl Clone for NormOptions
impl Clone for NormOptions
Source§impl Debug for NormOptions
impl Debug for NormOptions
Source§impl Default for NormOptions
impl Default for NormOptions
Source§impl PartialEq for NormOptions
impl PartialEq for NormOptions
impl StructuralPartialEq for NormOptions
Auto Trait Implementations§
impl Freeze for NormOptions
impl RefUnwindSafe for NormOptions
impl Send for NormOptions
impl Sync for NormOptions
impl Unpin for NormOptions
impl UnsafeUnpin for NormOptions
impl UnwindSafe for NormOptions
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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