Trait cgmath::Vector
[−]
[src]
pub trait Vector<S: BaseNum>: Array1<S> + Zero + One { fn from_value(s: S) -> Self; fn add_s(&self, s: S) -> Self; fn sub_s(&self, s: S) -> Self; fn mul_s(&self, s: S) -> Self; fn div_s(&self, s: S) -> Self; fn rem_s(&self, s: S) -> 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, s: S); fn sub_self_s(&mut self, s: S); fn mul_self_s(&mut self, s: S); fn div_self_s(&mut self, s: S); fn rem_self_s(&mut self, s: S); 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 comp_add(&self) -> S; fn comp_mul(&self) -> S; fn comp_min(&self) -> S; fn comp_max(&self) -> S; fn dot(&self, v: &Self) -> S { ... } }
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 Methods
fn from_value(s: S) -> Self
Construct a vector from a single value, replicating it.
fn add_s(&self, s: S) -> Self
Add a scalar to this vector, returning a new vector.
fn sub_s(&self, s: S) -> Self
Subtract a scalar from this vector, returning a new vector.
fn mul_s(&self, s: S) -> Self
Multiply this vector by a scalar, returning a new vector.
fn div_s(&self, s: S) -> Self
Divide this vector by a scalar, returning a new vector.
fn rem_s(&self, s: S) -> Self
Take the remainder of this vector by a scalar, returning a new vector.
fn add_v(&self, v: &Self) -> Self
Add this vector to another, returning a new vector.
fn sub_v(&self, v: &Self) -> Self
Subtract another vector from this one, returning a new vector.
fn mul_v(&self, v: &Self) -> Self
Multiply this vector by another, returning a new vector.
fn div_v(&self, v: &Self) -> Self
Divide this vector by another, returning a new vector.
fn rem_v(&self, v: &Self) -> Self
Take the remainder of this vector by another, returning a new scalar.
fn add_self_s(&mut self, s: S)
Add a scalar to this vector in-place.
fn sub_self_s(&mut self, s: S)
Subtract a scalar from this vector, in-place.
fn mul_self_s(&mut self, s: S)
Multiply this vector by a scalar, in-place.
fn div_self_s(&mut self, s: S)
Divide this vector by a scalar, in-place.
fn rem_self_s(&mut self, s: S)
Take the remainder of this vector by a scalar, in-place.
fn add_self_v(&mut self, v: &Self)
Add another vector to this one, in-place.
fn sub_self_v(&mut self, v: &Self)
Subtract another vector from this one, in-place.
fn mul_self_v(&mut self, v: &Self)
Multiply this matrix by another, in-place.
fn div_self_v(&mut self, v: &Self)
Divide this matrix by anothor, in-place.
fn rem_self_v(&mut self, v: &Self)
Take the remainder of this vector by another, in-place.
fn comp_add(&self) -> S
The sum of each component of the vector.
fn comp_mul(&self) -> S
The product of each component of the vector.
fn comp_min(&self) -> S
The minimum component of the vector.
fn comp_max(&self) -> S
The maximum component of the vector.
Provided Methods
fn dot(&self, v: &Self) -> S
Vector dot product.