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
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
//! This module defines the `Octonion` struct and its core implementations, providing
//! a robust representation and arithmetic for octonion numbers.
//!
//! # Octonion Numbers
//! Octonions are a non-associative, non-commutative extension of quaternion numbers,
//! forming an 8-dimensional normed division algebra over the real numbers.
//! An octonion can be expressed in the form:
//!
//! `s + e₁i + e₂j + e₃k + e₄l + e₅m + e₆n + e₇p`
//!
//! where `s` is the scalar part and `e₁` through `e₇` are the imaginary (vector) parts,
//! each multiplied by an imaginary unit. These imaginary units satisfy specific
//! multiplication rules, which are typically represented by a Fano plane or a
//! multiplication table.
//!
//! # Cayley-Dickson Construction
//! The multiplication rules for octonions implemented in this module follow the
//! Cayley-Dickson construction. This construction defines a doubling process
//! that generates complex numbers from real numbers, quaternions from complex numbers,
//! and octonions from quaternions. Key properties of octonion multiplication include:
//!
//! - **Non-commutativity:** For two octonions `a` and `b`, `a * b ≠ b * a` in general.
//! - **Non-associativity:** For three octonions `a`, `b`, and `c`, `(a * b) * c ≠ a * (b * c)` in general.
//!
//! Despite these differences from more familiar number systems, octonions retain
//! properties such as distributivity over addition and an inverse for every non-zero octonion.
//!
//! The multiplication table, based on the Fano plane, defines how the imaginary units
//! multiply. A common representation (used here) is:
//!
//! - `eᵢ * eᵢ = -1` for `i = 1..7`
//! - `e₁ * e₂ = e₃`, `e₂ * e₁ = -e₃`
//! - `e₁ * e₃ = -e₂`, `e₃ * e₁ = e₂`
//! - `e₆ * e₇ = e₁`, `e₇ * e₆ = -e₁`
//!
//! These rules are meticulously applied in the `Mul` implementation for the `Octonion` struct.
//!
//! # Structure
//! The `Octonion` struct is a generic representation, parameterized by a floating-point type `F`.
//! It holds eight components: `s` (scalar) and `e1` through `e7` (imaginary units).
//!
use crateRealField;
/// Represents an octonion number with a scalar part and seven imaginary parts.
///
/// An octonion is an 8-dimensional hypercomplex number, extending quaternions.
/// It consists of a scalar component `s` and seven imaginary components `e1` through `e7`.
///
/// # Type Parameters
/// * `F` - The floating-point type used for the components of the octonion (e.g., `f32`, `f64`).
///
/// # Fields
/// * `s` - The scalar (real) part of the octonion.
/// * `e1` - The coefficient of the first imaginary unit.
/// * `e2` - The coefficient of the second imaginary unit.
/// * `e3` - The coefficient of the third imaginary unit.
/// * `e4` - The coefficient of the fourth imaginary unit.
/// * `e5` - The coefficient of the fifth imaginary unit.
/// * `e6` - The coefficient of the sixth imaginary unit.
/// * `e7` - The coefficient of the seventh imaginary unit.
///
/// # Derives
/// * `Copy`: Allows instances of `Octonion` to be copied by bitwise copy.
/// * `Clone`: Implements cloning behavior for `Octonion`.
/// * `Default`: Provides a default (zero) value for `Octonion`.
pub type Octonion32 = ;
pub type Octonion64 = ;