qm/v.rs
1//! vector
2//!
3
4pub mod v3;
5pub mod v4;
6
7use num::Float;
8
9use crate::m::TMatrix;
10
11/// TVector
12pub trait TVector<F: Float + std::fmt::Debug> {
13 /// constructor
14 fn new(v: &Vec<F>) -> Self;
15 /// check equal with precision
16 fn prec_eq(&self, e: F, v: &impl TVector<F>) -> bool;
17 /// to_vec
18 fn to_vec(&self) -> Vec<F>;
19 /// like as slice
20 fn me(&self) -> &[F];
21 /// a dot self
22 fn dot(&self, a: &impl TVector<F>) -> F;
23 /// m dot self
24 fn dot_mv(&self, m: &impl TMatrix<F>) -> Self;
25 /// self cross b
26 fn cross(&self, b: &impl TVector<F>) -> Self;
27}