pub trait VectorOps<T> {
// Required methods
fn add_vec(&self, other: &Vector<T>) -> Vector<T>;
fn sub_vec(&self, other: &Vector<T>) -> Vector<T>;
fn mul_vec(&self, other: &Vector<T>) -> Vector<T>;
fn div_vec(&self, other: &Vector<T>) -> Vector<T>;
fn rem_vec(&self, other: &Vector<T>) -> Vector<T>;
fn add_scalar(&self, scalar: T) -> Vector<T>;
fn sub_scalar(&self, scalar: T) -> Vector<T>;
fn mul_scalar(&self, scalar: T) -> Vector<T>;
fn div_scalar(&self, scalar: T) -> Vector<T>;
fn rem_scalar(&self, scalar: T) -> Vector<T>;
}Expand description
Trait providing arithmetic operations for Vector<T>.
Required Methods§
sourcefn add_vec(&self, other: &Vector<T>) -> Vector<T>
fn add_vec(&self, other: &Vector<T>) -> Vector<T>
Adds another vector to this vector and returns a new vector.
sourcefn sub_vec(&self, other: &Vector<T>) -> Vector<T>
fn sub_vec(&self, other: &Vector<T>) -> Vector<T>
Subtracts another vector from this vector and returns a new vector.
sourcefn mul_vec(&self, other: &Vector<T>) -> Vector<T>
fn mul_vec(&self, other: &Vector<T>) -> Vector<T>
Multiplies this vector with another vector element-wise and returns a new vector.
sourcefn div_vec(&self, other: &Vector<T>) -> Vector<T>
fn div_vec(&self, other: &Vector<T>) -> Vector<T>
Divides this vector by another vector element-wise and returns a new vector.
sourcefn rem_vec(&self, other: &Vector<T>) -> Vector<T>
fn rem_vec(&self, other: &Vector<T>) -> Vector<T>
Computes the modulus of this vector by another vector element-wise and returns a new vector.
sourcefn add_scalar(&self, scalar: T) -> Vector<T>
fn add_scalar(&self, scalar: T) -> Vector<T>
Adds a scalar to each element of the vector and returns a new vector.
sourcefn sub_scalar(&self, scalar: T) -> Vector<T>
fn sub_scalar(&self, scalar: T) -> Vector<T>
Subtracts a scalar from each element of the vector and returns a new vector.
sourcefn mul_scalar(&self, scalar: T) -> Vector<T>
fn mul_scalar(&self, scalar: T) -> Vector<T>
Multiplies each element of the vector by a scalar and returns a new vector.
sourcefn div_scalar(&self, scalar: T) -> Vector<T>
fn div_scalar(&self, scalar: T) -> Vector<T>
Divides each element of the vector by a scalar and returns a new vector.
sourcefn rem_scalar(&self, scalar: T) -> Vector<T>
fn rem_scalar(&self, scalar: T) -> Vector<T>
Computes the modulus of each element of the vector by a scalar and returns a new vector.