forked from M-Labs/nalgebra
347883caa1
The goal is to make traits less fine-grained for vectors, and reduce the amount of `use`. - Scalar{Mul, Div} are removed, replaced by Mul<N, V> and Div<N, V>, - Ring and DivisionRing are removed. Use Num instead. - VectorSpace, Dot, and Norm are removed, replaced by the new, higher-level traits. Add four traits: - Vec: common operations on vectors. Replaces VectorSpace and Dot. - AlgebraicVec: Vec + the old Norm trait. - VecExt: Vec + every other traits vectors implement. - AlgebraicVecExt: AlgebraicVec + VecExt.
22 lines
533 B
Rust
22 lines
533 B
Rust
/**
|
|
* Trait of objects having an addition with a scalar.
|
|
*/
|
|
pub trait ScalarAdd<N> {
|
|
/// Gets the result of an addition by a scalar.
|
|
fn scalar_add(&self, &N) -> Self;
|
|
|
|
/// In-place version of `scalar_add`.
|
|
fn scalar_add_inplace(&mut self, &N);
|
|
}
|
|
|
|
/**
|
|
* Trait of objects having a subtraction with a scalar.
|
|
*/
|
|
pub trait ScalarSub<N> {
|
|
/// Gets the result of a subtraction by a scalar.
|
|
fn scalar_sub(&self, &N) -> Self;
|
|
|
|
/// In-place version of `scalar_sub`.
|
|
fn scalar_sub_inplace(&mut self, &N);
|
|
}
|