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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
//! Vector spaces and related algebraic structures.
//!
//! This module provides traits for vector spaces and their specializations
//! that are compatible with multidimensional array implementations.
//!
//! # Vector Space Structures
//!
//! - **Module**: A structure with scalar multiplication from a ring
//! - **FreeModule**: A module with a basis
//! - **VectorSpace**: A space supporting scalar multiplication and vector operations
//! - **InnerProductSpace**: A vector space with an inner product operation
//! - **NormedVectorSpace**: A vector space with a norm function
//! - **EuclideanSpace**: A vector space with Euclidean properties
use crateField;
use crateAdditiveAbelianGroup;
use crateRing;
use ;
use ;
/// Represents a vector space over a field.
///
/// # Mathematical Definition
/// A vector space V over a field F is a set equipped with vector addition
/// and scalar multiplication operations, satisfying the vector space axioms:
///
/// 1. (u + v) + w = u + (v + w) for all u, v, w ∈ V (associativity of addition)
/// 2. v + u = u + v for all u, v ∈ V (commutativity of addition)
/// 3. There exists 0 ∈ V such that v + 0 = v for all v ∈ V (zero vector)
/// 4. For each v ∈ V, there exists -v ∈ V such that v + (-v) = 0 (additive inverse)
/// 5. a(bv) = (ab)v for all a, b ∈ F and v ∈ V (compatibility of scalar multiplication)
/// 6. 1v = v for all v ∈ V, where 1 is the multiplicative identity in F
/// 7. a(u + v) = au + av for all a ∈ F and u, v ∈ V (distributivity over vector addition)
/// 8. (a + b)v = av + bv for all a, b ∈ F and v ∈ V (distributivity over field addition)
///
/// # Properties
/// - Supports operations like addition, subtraction, and scalar multiplication
/// - Elements can be represented as linear combinations of basis vectors
/// - The number of basis elements determines the dimension of the space
/// Represents an inner product space.
///
/// # Mathematical Definition
/// An inner product space is a vector space equipped with an inner product operation
/// that allows for notions of length, angle, and orthogonality.
///
/// The inner product ⟨·,·⟩ satisfies:
/// 1. ⟨u, v⟩ = ⟨v, u⟩* (conjugate symmetry)
/// 2. ⟨au + bv, w⟩ = a⟨u, w⟩ + b⟨v, w⟩ (linearity in first argument)
/// 3. ⟨v, v⟩ > 0 for all v ≠ 0 (positive definiteness)
///
/// # Properties
/// - Induces a natural norm: ||v|| = √⟨v, v⟩
/// - Allows definition of angles between vectors
/// - Enables orthogonal decompositions
/// Represents a normed vector space.
///
/// # Mathematical Definition
/// A normed vector space is a vector space equipped with a norm function
/// that assigns a non-negative length to each vector.
///
/// # Properties
/// - The norm satisfies: ||v|| ≥ 0, ||v|| = 0 iff v = 0, ||av|| = |a|·||v||, ||u+v|| ≤ ||u||+||v||
/// - Induces a metric: d(u,v) = ||u-v||
/// - Every inner product space is a normed space, but not vice versa
/// Represents a Euclidean space.
///
/// # Mathematical Definition
/// A Euclidean space is a finite-dimensional inner product space over the real numbers,
/// equipped with the standard Euclidean inner product.
///
/// # Properties
/// - Has a natural notion of distance and angle
/// - Can be identified with R^n for some n
/// - Supports geometric operations like orthogonal projections
/// Represents a module over a ring R.
///
/// # Mathematical Definition
/// A module M over a ring R is an additive abelian group (M, +) together with
/// a scalar multiplication operation R × M → M, denoted (r, m) ↦ r·m,
/// satisfying the following axioms for all r, s ∈ R and m, n ∈ M:
///
/// 1. r·(m + n) = r·m + r·n
/// 2. (r + s)·m = r·m + s·m
/// 3. (r·s)·m = r·(s·m)
/// 4. 1·m = m (if R has multiplicative identity 1)
///
/// # Properties
/// - Generalizes vector spaces by allowing scalars from rings instead of fields
/// - Includes vector spaces, abelian groups, and ideals as special cases
/// - Examples: R-modules, Z-modules (abelian groups), vector spaces over fields
/// Represents a free module over a ring with a finite basis.
///
/// # Mathematical Definition
/// A free module F over a ring R is a module that has a basis (a linearly independent
/// generating set). For any set S, the free module on S over R, denoted R⟨S⟩, is a module
/// with basis elements indexed by S.
///
/// # Properties
/// - Every element can be written uniquely as a linear combination of basis elements
/// - The dimension (or rank) is the cardinality of any basis
/// - Examples: Rⁿ is a free module over R, vector spaces are free modules over fields