Trait alga::linear::NormedSpace

source ·
pub trait NormedSpace: VectorSpace<Field = Self::ComplexField> {
    type RealField: RealField;
    type ComplexField: ComplexField<RealField = Self::RealField>;

    // Required methods
    fn norm_squared(&self) -> Self::RealField;
    fn norm(&self) -> Self::RealField;
    fn normalize(&self) -> Self;
    fn normalize_mut(&mut self) -> Self::RealField;
    fn try_normalize(&self, eps: Self::RealField) -> Option<Self>;
    fn try_normalize_mut(
        &mut self,
        eps: Self::RealField
    ) -> Option<Self::RealField>;
}
Expand description

A normed vector space.

Required Associated Types§

source

type RealField: RealField

The result of the norm (not necessarily the same same as the field used by this vector space).

source

type ComplexField: ComplexField<RealField = Self::RealField>

The field of this space must be this complex number.

Required Methods§

source

fn norm_squared(&self) -> Self::RealField

The squared norm of this vector.

source

fn norm(&self) -> Self::RealField

The norm of this vector.

source

fn normalize(&self) -> Self

Returns a normalized version of this vector.

source

fn normalize_mut(&mut self) -> Self::RealField

Normalizes this vector in-place and returns its norm.

source

fn try_normalize(&self, eps: Self::RealField) -> Option<Self>

Returns a normalized version of this vector unless its norm as smaller or equal to eps.

source

fn try_normalize_mut(&mut self, eps: Self::RealField) -> Option<Self::RealField>

Normalizes this vector in-place or does nothing if its norm is smaller or equal to eps.

If the normalization succeeded, returns the old normal of this vector.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl NormedSpace for f32

§

type RealField = f32

§

type ComplexField = f32

source§

fn norm_squared(&self) -> Self::RealField

source§

fn norm(&self) -> Self::RealField

source§

fn normalize(&self) -> Self

source§

fn normalize_mut(&mut self) -> Self::RealField

source§

fn try_normalize(&self, eps: Self::RealField) -> Option<Self>

source§

fn try_normalize_mut(&mut self, eps: Self::RealField) -> Option<Self::RealField>

source§

impl NormedSpace for f64

§

type RealField = f64

§

type ComplexField = f64

source§

fn norm_squared(&self) -> Self::RealField

source§

fn norm(&self) -> Self::RealField

source§

fn normalize(&self) -> Self

source§

fn normalize_mut(&mut self) -> Self::RealField

source§

fn try_normalize(&self, eps: Self::RealField) -> Option<Self>

source§

fn try_normalize_mut(&mut self, eps: Self::RealField) -> Option<Self::RealField>

source§

impl<N: RealField> NormedSpace for Complex<N>

§

type RealField = N

§

type ComplexField = N

source§

fn norm_squared(&self) -> Self::RealField

source§

fn norm(&self) -> Self::RealField

source§

fn normalize(&self) -> Self

source§

fn normalize_mut(&mut self) -> Self::RealField

source§

fn try_normalize(&self, eps: Self::RealField) -> Option<Self>

source§

fn try_normalize_mut(&mut self, eps: Self::RealField) -> Option<Self::RealField>

Implementors§