pub trait Vector: Copy + Clonewhere
Self: Array<Element = Self::Scalar>,{
type Scalar: BaseNum;
Show 24 methods
// Required methods
fn from_value(scalar: Self::Scalar) -> Self;
fn add_s(self, scalar: Self::Scalar) -> Self;
fn sub_s(self, scalar: Self::Scalar) -> Self;
fn mul_s(self, scalar: Self::Scalar) -> Self;
fn div_s(self, scalar: Self::Scalar) -> Self;
fn rem_s(self, scalar: Self::Scalar) -> Self;
fn add_v(self, v: Self) -> Self;
fn sub_v(self, v: Self) -> Self;
fn mul_v(self, v: Self) -> Self;
fn div_v(self, v: Self) -> Self;
fn rem_v(self, v: Self) -> Self;
fn add_self_s(&mut self, scalar: Self::Scalar);
fn sub_self_s(&mut self, scalar: Self::Scalar);
fn mul_self_s(&mut self, scalar: Self::Scalar);
fn div_self_s(&mut self, scalar: Self::Scalar);
fn rem_self_s(&mut self, scalar: Self::Scalar);
fn add_self_v(&mut self, v: Self);
fn sub_self_v(&mut self, v: Self);
fn mul_self_v(&mut self, v: Self);
fn div_self_v(&mut self, v: Self);
fn rem_self_v(&mut self, v: Self);
fn dot(self, other: Self) -> Self::Scalar;
// Provided methods
fn zero() -> Self { ... }
fn one() -> Self { ... }
}
Expand description
A trait that specifies a range of numeric operations for vectors. Not all of these make sense from a linear algebra point of view, but are included for pragmatic reasons.
Required Associated Types§
Required Methods§
sourcefn from_value(scalar: Self::Scalar) -> Self
fn from_value(scalar: Self::Scalar) -> Self
Construct a vector from a single value, replicating it.
sourcefn add_s(self, scalar: Self::Scalar) -> Self
fn add_s(self, scalar: Self::Scalar) -> Self
Add a scalar to this vector, returning a new vector.
sourcefn sub_s(self, scalar: Self::Scalar) -> Self
fn sub_s(self, scalar: Self::Scalar) -> Self
Subtract a scalar from this vector, returning a new vector.
sourcefn mul_s(self, scalar: Self::Scalar) -> Self
fn mul_s(self, scalar: Self::Scalar) -> Self
Multiply this vector by a scalar, returning a new vector.
sourcefn div_s(self, scalar: Self::Scalar) -> Self
fn div_s(self, scalar: Self::Scalar) -> Self
Divide this vector by a scalar, returning a new vector.
sourcefn rem_s(self, scalar: Self::Scalar) -> Self
fn rem_s(self, scalar: Self::Scalar) -> Self
Take the remainder of this vector by a scalar, returning a new vector.
sourcefn rem_v(self, v: Self) -> Self
fn rem_v(self, v: Self) -> Self
Take the remainder of this vector by another, returning a new scalar.
sourcefn add_self_s(&mut self, scalar: Self::Scalar)
fn add_self_s(&mut self, scalar: Self::Scalar)
Add a scalar to this vector in-place.
sourcefn sub_self_s(&mut self, scalar: Self::Scalar)
fn sub_self_s(&mut self, scalar: Self::Scalar)
Subtract a scalar from this vector, in-place.
sourcefn mul_self_s(&mut self, scalar: Self::Scalar)
fn mul_self_s(&mut self, scalar: Self::Scalar)
Multiply this vector by a scalar, in-place.
sourcefn div_self_s(&mut self, scalar: Self::Scalar)
fn div_self_s(&mut self, scalar: Self::Scalar)
Divide this vector by a scalar, in-place.
sourcefn rem_self_s(&mut self, scalar: Self::Scalar)
fn rem_self_s(&mut self, scalar: Self::Scalar)
Take the remainder of this vector by a scalar, in-place.
sourcefn add_self_v(&mut self, v: Self)
fn add_self_v(&mut self, v: Self)
Add another vector to this one, in-place.
sourcefn sub_self_v(&mut self, v: Self)
fn sub_self_v(&mut self, v: Self)
Subtract another vector from this one, in-place.
sourcefn mul_self_v(&mut self, v: Self)
fn mul_self_v(&mut self, v: Self)
Multiply this matrix by another, in-place.
sourcefn div_self_v(&mut self, v: Self)
fn div_self_v(&mut self, v: Self)
Divide this matrix by anothor, in-place.
sourcefn rem_self_v(&mut self, v: Self)
fn rem_self_v(&mut self, v: Self)
Take the remainder of this vector by another, in-place.