ndarray_cg/vector/
arithmetics.rs1mod private
3{
4 use crate::*;
5 use vector::arithmetics::inner_product::*;
6
7 impl< E : MatEl + NdFloat, const LEN : usize > Vector< E, LEN >
8 {
9 pub fn normalize( self ) -> Self
11 {
12 normalized( &self )
13 }
14
15 pub fn mag( &self ) -> E
17 {
18 mag( self )
19 }
20
21 pub fn mag2( &self ) -> E
23 {
24 mag2( self )
25 }
26
27 pub fn min( self, rhs : Self ) -> Self
29 {
30 min( &self, &rhs )
31 }
32
33 pub fn max( self, rhs : Self ) -> Self
35 {
36 max( &self, &rhs )
37 }
38
39 pub fn distance( &self, rhs: &Self ) -> E
41 {
42 ( rhs - self ).mag()
43 }
44
45 pub fn distance_squared( &self, rhs: &Self ) -> E
47 {
48 ( rhs - self ).mag2()
49 }
50 }
51
52}
53
54crate::mod_interface!
55{
56 own use ::mdmath_core::vector::inner_product;
57
58 layer mul;
60 layer sub;
62 layer add;
64 layer div;
66}