1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// This file is part of "linbra"
// Under the MIT License
// Copyright (c) 2023 Antonin Hérault
use ;
use crateZero;
/// Linear algebra mathematical tool.
///
/// The `N` const generic parameter is used to define the number of values for
/// the vector.
///
/// $$
/// \begin{pmatrix}
/// a_{1} \\\
/// a_{2} \\\
/// \vdots \\\
/// a_{n} \\\
/// \end{pmatrix}
/// $$
/// Creates a vector `N` from an array of `N` values.
///
/// ## Example
/// ```
/// use linbra::vector::Vector;
///
/// let vec: Vector<u8, 6> = [8, 9, 10, 11, 12, 13].into();
/// assert_eq!(vec, Vector::<u8, 6>::new([8, 9, 10, 11, 12, 13]));
/// ```
/// Returns the value at index `n` in the vector.
///
/// ## Usage
/// ```
/// use linbra::vector::{ Vector, Vector3 };
///
/// let colour: Vector3<u8> = Vector::new([255, 100, 100]);
/// let red = colour[0];
/// assert_eq!(red, 255);
/// ```
/// Note this project provides a way to manage [`colours`](crate::colours).
/// Returns the value at index `n` in the vector, as mutable.
///
/// ## Usage
/// ```
/// use linbra::vector::{ Vector, Vector3 };
///
/// let mut colour: Vector3<u8> = Vector::new([255, 100, 100]);
/// colour[0] = 100;
/// assert_eq!(colour[0], 100);
/// ```
/// Note this project provides a way to manage [`colours`](crate::colours).
/// Implementations iteration on the vector by converting its data array into
/// an iterator.
/// Implements a constructor filling the vector with zeros for types
/// implementing the [`Zero`] trait.
///
/// All number-primitive types implement [`Zero`].