nalgebra/src/traits/scalar_op.rs
Sébastien Crozet 347883caa1 Rework of the traits for Vectors.
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.
2013-08-18 18:33:25 +02:00

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);
}