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.