| 2 Array containers that support vector space operations on floats. |
2 Array containers that support vector space operations on floats. |
| 3 For working with small vectors in $ℝ^2$ or $ℝ^3$. |
3 For working with small vectors in $ℝ^2$ or $ℝ^3$. |
| 4 */ |
4 */ |
| 5 |
5 |
| 6 use crate::euclidean::*; |
6 use crate::euclidean::*; |
| 7 use crate::instance::{BasicDecomposition, Instance, Ownable}; |
7 use crate::instance::{BasicDecomposition, Instance, MyCow, Ownable}; |
| 8 use crate::linops::{Linear, Mapping, VectorSpace, AXPY}; |
8 use crate::linops::{Linear, Mapping, VectorSpace, AXPY}; |
| 9 use crate::mapping::Space; |
9 use crate::mapping::Space; |
| 10 use crate::maputil::{map1, map1_mut, map2, map2_mut, FixedLength, FixedLengthMut}; |
10 use crate::maputil::{map1, map1_mut, map2, map2_mut, FixedLength, FixedLengthMut}; |
| 11 use crate::norms::*; |
11 use crate::norms::*; |
| 12 use crate::types::{Float, Num, SignedNum}; |
12 use crate::types::{Float, Num, SignedNum}; |
| 37 } |
37 } |
| 38 |
38 |
| 39 /// Returns an owned instance of a reference. |
39 /// Returns an owned instance of a reference. |
| 40 fn clone_owned(&self) -> Self::OwnedVariant { |
40 fn clone_owned(&self) -> Self::OwnedVariant { |
| 41 self.clone() |
41 self.clone() |
| |
42 } |
| |
43 |
| |
44 fn owned_cow<'b>(self) -> MyCow<'b, Self::OwnedVariant> |
| |
45 where |
| |
46 Self: 'b, |
| |
47 { |
| |
48 MyCow::Owned(self) |
| |
49 } |
| |
50 |
| |
51 #[inline] |
| |
52 fn ref_owned_cow<'b>(&'b self) -> MyCow<'b, Self::OwnedVariant> |
| |
53 where |
| |
54 Self: 'b, |
| |
55 { |
| |
56 MyCow::Borrowed(self) |
| 42 } |
57 } |
| 43 } |
58 } |
| 44 |
59 |
| 45 impl<F: Display, const N: usize> Display for Loc<N, F> { |
60 impl<F: Display, const N: usize> Display for Loc<N, F> { |
| 46 // Required method |
61 // Required method |