use nalgebra::base::allocator::Allocator;
use nalgebra::base::{DefaultAllocator, DimName, VectorN};
use num_traits::identities::One;
use std::fmt::Debug;
use std::ops::{Add, AddAssign, Div, Mul, MulAssign, Sub};
pub trait ScalarT:
Copy
+ PartialOrd
+ Debug
+ Add<Output = Self>
+ AddAssign
+ Mul<Output = Self>
+ MulAssign
+ Sub<Output = Self>
+ Div<Output = Self>
+ One
{
}
impl<T> ScalarT for T where
T: Copy
+ PartialOrd
+ Debug
+ Add<Output = Self>
+ AddAssign
+ Mul<Output = Self>
+ MulAssign
+ Sub<Output = Self>
+ Div<Output = Self>
+ One
{
}
pub trait VectorT:
Clone + Debug + Add<Output = Self> + Mul<<Self as VectorT>::Field, Output = Self>
{
type Field: ScalarT;
}
impl<N, D> VectorT for VectorN<N, D>
where
N: 'static + ScalarT,
D: DimName,
DefaultAllocator: Allocator<N, D>,
{
type Field = N;
}