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
//!
//!Traits for structures with an addition and scalar multiplication operation
//!
//!# Implementation
//!
//!This module builds upon the and behaves in a way similar to the [group-like](crate::algebra::group_like)
//!structures, though, at this point in time, there are no additional properties or operations
//!for structs to consider when targeting this module's systems.
//!
//!# Usage
//!
//!Similarly to the [group-like](crate::algebra::group_like) module, there are a number of
//!trait aliases corresponding to a system of module-like algebraic structures that form a heirarchy
//!as represented in the following diagram:
//!
//!```text
//! Affine Space Additive Abelian Group
//! | |
//! | Ring Module
//! | |
//! ----Vector Space-----
//! |
//! Algebra
//!```
//!
//!Where:
//! * A [ring-module](RingModule) is an [additive abelian group](AddAbelianGroup)
//! with a scalar multiplication operation with elements from a particular [Ring]
//! * A [vector-space](VectorSpace) is a ring-module with scalars that form a field
//! * An [algebra](Algebra) is a vector-space with a distributive multiplication operation
//! * An [affine-space](AffineSpace) is a set with a subtraction operation producing a vector
//! * <i>for more information see the trait-level documentation</i>
//!
pub use ;
use crate*;
use crate;
///
///A product between two vectors or module elements resulting in a scalar that is semi-linear in both arguments
///
///Rigorously, a σ-sesquilinear form is a mapping `•:M⨯M->R` from a Ring Module to its base ring such that:
/// * `(x+y)•z = x•z + y•z`
/// * `x•(y+z) = x•y + x•y`
/// * `(c*x)•y = c*(x•y)`
/// * `x•(c*y) = (x•y)*σ(c)` where `σ:R->R` is some anti-automorphism, usually the complex conjugate
/// or the identity map
///
/// # Notes on Definition
///
///It is additionally worth emphasizing that in general, while there are a number of other properties
///commonly added to this list, none of them should be assumed without the addition of the appropriate
///marker trait. In particular:
/// * `x•(c*y)` may not equal `(x•y)*c`
/// * `x•y` may not equal `y•x`
/// * `x•y = 0` does not necessarily imply `y•x = 0`
///
///However, if these properties are desired, then the following additional traits can be implemented
///or used:
/// * [ReflexiveForm]: `x•y = 0` implies `y•x = 0`
/// * as a consequence, [Orthogonality](SesquilinearForm::orthogonal) becomes a reflexive property
/// * [SymSesquilinearForm]: `σ(x•y) = y•x`
/// * [SkewSesquilinearForm]: `σ(x•y) = -y•x`
/// * [BilinearForm]: `x•(c*y) = (x•y)*c`, ie, `σ(x) = x` for all `x`
/// * If also a [SymSesquilinearForm], this implies `x•y = y•x`
/// * If also a [SkewSesquilinearForm], this implies `x•y = -y•x`
/// * [ComplexSesquilinearForm]: `x•(c*y) = (x•y)*̅c`, ie `R ⊆ ℂ` and `σ(x) = ̅x` for all `x`
/// * If also a [SymSesquilinearForm], this implies `x•y = ̅y̅•̅x`
/// * If also a [SkewSesquilinearForm], this implies `x•y = -̅y̅•̅x`
///
/// # Examples
///
/// * Dot product of finite dimensional spaces and modules: `x•y = Σ(xₖ*yₖ)`
/// * Inner Product of real and complex vector spaces of any dimension
/// * Complex and Hyper-complex moduli: `z*̅w`
/// * The "Cross-Product" in 2D real-vector spaces: `x₁*y₂ - x₂*y₁`
/// * Alternatively, the mapping taking two vectors to the determinant of the matrix with
/// the vectors as its columns
/// * Minkowski metric: `ds² = dx² + dy² + dz² - dt²`
/// * Scalar product of the conformal model of Geometric algebra
///
///A [SesquilinearForm] where `x•y = 0` implies `y•x = 0`
///
///A [SesquilinearForm] where `σ(x•y) = y•x`
///
///The is a property implemented on _most_ sesquilinear forms, but a notable exception is the
///the "Cross-Product" 2D vectors: `x₁*y₂ - x₂*y₁`
///
///
///A [SesquilinearForm] where `σ(x•y) = -y•x`
///
///An example of which is the 2D "Cross-Product": `x₁*y₂ - x₂*y₁`
///
///A [SesquilinearForm] where `x•(c*y) = (x•y)*c` and `σ(x) = x`
///A [BilinearForm] where `x•y = y•x`
///A [ComplexSesquilinearForm] where `x•y = ̅y̅•̅x`