hypercomplex-engine 0.4.2.7__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {hypercomplex_engine-0.4.2.7/hypercomplex_engine.egg-info → hypercomplex_engine-0.5.0}/PKG-INFO +2 -1
  2. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/README.md +1 -0
  3. hypercomplex_engine-0.5.0/hypercomplex_engine/core/fast/fast_dual.py +60 -0
  4. hypercomplex_engine-0.5.0/hypercomplex_engine/core/holographic/dual.py +50 -0
  5. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/validation.py +6 -6
  6. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/facade.py +3 -32
  7. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0/hypercomplex_engine.egg-info}/PKG-INFO +2 -1
  8. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine.egg-info/SOURCES.txt +2 -1
  9. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/pyproject.toml +1 -1
  10. hypercomplex_engine-0.5.0/tests/test_dual_tuple_regression.py +55 -0
  11. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/tests/test_fast_mode.py +19 -9
  12. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/tests/test_fixes_0_4.py +0 -17
  13. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/tests/test_mega_mother.py +6 -6
  14. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/tests/test_split_dim.py +0 -4
  15. hypercomplex_engine-0.5.0/tests/test_strict_dual_3tuple.py +143 -0
  16. hypercomplex_engine-0.4.2.7/hypercomplex_engine/core/fast/fast_dual.py +0 -188
  17. hypercomplex_engine-0.4.2.7/hypercomplex_engine/core/holographic/dual.py +0 -90
  18. hypercomplex_engine-0.4.2.7/tests/test_dual_tuple_regression.py +0 -93
  19. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/LICENSE +0 -0
  20. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/NOTICE +0 -0
  21. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/__init__.py +0 -0
  22. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/__init__.py +0 -0
  23. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/basis_element.py +0 -0
  24. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/basis_notation.py +0 -0
  25. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/fast/__init__.py +0 -0
  26. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/fast/bit_utils.py +0 -0
  27. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/fast/fast_split.py +0 -0
  28. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/fast/fast_standard.py +0 -0
  29. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/holographic/__init__.py +0 -0
  30. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/holographic/split.py +0 -0
  31. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/holographic/standard.py +0 -0
  32. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/table_builder/__init__.py +0 -0
  33. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/table_builder/common.py +0 -0
  34. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/table_builder/dual.py +0 -0
  35. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/table_builder/split.py +0 -0
  36. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/core/table_builder/standard.py +0 -0
  37. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/printer/__init__.py +0 -0
  38. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/printer/cd_format.py +0 -0
  39. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine/printer/cd_table_printer.py +0 -0
  40. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine.egg-info/dependency_links.txt +0 -0
  41. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine.egg-info/requires.txt +0 -0
  42. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/hypercomplex_engine.egg-info/top_level.txt +0 -0
  43. {hypercomplex_engine-0.4.2.7 → hypercomplex_engine-0.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hypercomplex-engine
3
- Version: 0.4.2.7
3
+ Version: 0.5.0
4
4
  Summary: Fast O(1)/O(n) multiplication engine for arbitrary dimensions and table generator for ordinary, split, and dual Cayley-Dickson algebras.
5
5
  Author-email: Maher Ben Abdessalem <ba.maher94@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -1123,6 +1123,7 @@ doi = "10.6084/m9.figshare.33705022.v8"
1123
1123
 
1124
1124
  ```
1125
1125
 
1126
+
1126
1127
  ### Acknowledgments
1127
1128
 
1128
1129
  The author gratefully acknowledges **Prof. Derek Abbott**, **Dr. James M. Chappell**, and PhD candidate **Greg P. Wilmot** from the University of Adelaide, Australia, for the opportunity of collaboration and a deeper study of hypercomplex numbers. Special thanks go to **Greg P. Wilmot** for his work on the structure of Cayley-Dickson algebras and for acknowledging the author's contribution to his paper, *"Structure of the Cayley-Dickson algebras"* ([arXiv:2505.11747](https://arxiv.org)).
@@ -1095,6 +1095,7 @@ doi = "10.6084/m9.figshare.33705022.v8"
1095
1095
 
1096
1096
  ```
1097
1097
 
1098
+
1098
1099
  ### Acknowledgments
1099
1100
 
1100
1101
  The author gratefully acknowledges **Prof. Derek Abbott**, **Dr. James M. Chappell**, and PhD candidate **Greg P. Wilmot** from the University of Adelaide, Australia, for the opportunity of collaboration and a deeper study of hypercomplex numbers. Special thanks go to **Greg P. Wilmot** for his work on the structure of Cayley-Dickson algebras and for acknowledging the author's contribution to his paper, *"Structure of the Cayley-Dickson algebras"* ([arXiv:2505.11747](https://arxiv.org)).
@@ -0,0 +1,60 @@
1
+ from ..validation import Validation
2
+ from .fast_standard import FastStandard
3
+ from .fast_split import FastSplit
4
+
5
+ class FastDual:
6
+ """
7
+ Dual Cayley-Dickson O(1) multiplier.
8
+
9
+ STRICT 3-TUPLE INPUT:
10
+ (sign, local_index, eps_flag)
11
+
12
+ local_index must be strictly < 2^dim.
13
+ eps_flag must be 0 or 1.
14
+ """
15
+
16
+ def __init__(self, split: bool = False):
17
+ self._split_mode = bool(split)
18
+ self._standard = FastStandard()
19
+ self._split = FastSplit() if self._split_mode else None
20
+
21
+ def multiply(self, t1: tuple, t2: tuple, dim: int) -> tuple:
22
+ dim = Validation.dimension(dim)
23
+ Validation.basis_tuple(t1, allow_zero=True, allow_eps=True)
24
+ Validation.basis_tuple(t2, allow_zero=True, allow_eps=True)
25
+
26
+ # STRICT 3-TUPLE UNPACKING
27
+ s1, i, i_eps = int(t1[0]), int(t1[1]), int(t1[2])
28
+ s2, j, j_eps = int(t2[0]), int(t2[1]), int(t2[2])
29
+
30
+ if s1 == 0 or s2 == 0:
31
+ return (0, 0, 0)
32
+
33
+ sign, idx, eps = self.multiply_indices(i, j, dim, i_eps, j_eps)
34
+ return (s1 * s2 * sign, idx, eps)
35
+
36
+ def multiply_indices(self, i: int, j: int, dim: int, i_eps_flag: int = 0, j_eps_flag: int = 0) -> tuple:
37
+ dim = Validation.dimension(dim)
38
+ half = 1 << dim
39
+
40
+ # STRICT LOCAL ENFORCEMENT: No more global overflow!
41
+ if i < 0 or i >= half:
42
+ raise ValueError(f"local index must be in [0, {half - 1}] for dual dim={dim}, got {i}")
43
+ if j < 0 or j >= half:
44
+ raise ValueError(f"local index must be in [0, {half - 1}] for dual dim={dim}, got {j}")
45
+
46
+ i_eps = bool(i_eps_flag)
47
+ j_eps = bool(j_eps_flag)
48
+
49
+ # Nilpotency: eps^2 = 0
50
+ if i_eps and j_eps:
51
+ return (0, 0, 0)
52
+
53
+ # Base multiplication (parent algebra)
54
+ if self._split_mode:
55
+ base_sign, local_idx = self._split.multiply_indices(i, j, dim)
56
+ else:
57
+ base_sign, local_idx = self._standard.multiply_indices(i, j)
58
+
59
+ eps_flag = 1 if (i_eps or j_eps) else 0
60
+ return (base_sign, local_idx, eps_flag)
@@ -0,0 +1,50 @@
1
+ from ..validation import Validation
2
+ from .standard import StandardHolographic
3
+ from .split import SplitHolographic
4
+
5
+ class DualHolographic:
6
+ """
7
+ Dual Cayley-Dickson holographic multiplier.
8
+ STRICT 3-TUPLE INPUT: (sign, local_index, eps_flag)
9
+ """
10
+
11
+ def __init__(self, split: bool = False):
12
+ self._split_mode = bool(split)
13
+ self._standard = StandardHolographic()
14
+ self._split = SplitHolographic() if self._split_mode else None
15
+
16
+ def multiply(self, t1: tuple, t2: tuple, dim: int) -> tuple:
17
+ Validation.basis_tuple(t1, allow_zero=True, allow_eps=True)
18
+ Validation.basis_tuple(t2, allow_zero=True, allow_eps=True)
19
+ dim = Validation.dimension(dim)
20
+
21
+ # STRICT 3-TUPLE UNPACKING
22
+ s1, i, i_eps_flag = int(t1[0]), int(t1[1]), int(t1[2])
23
+ s2, j, j_eps_flag = int(t2[0]), int(t2[1]), int(t2[2])
24
+
25
+ if s1 == 0 or s2 == 0:
26
+ return (0, 0, 0)
27
+
28
+ half = 1 << dim
29
+
30
+ # STRICT LOCAL ENFORCEMENT
31
+ if i < 0 or i >= half:
32
+ raise ValueError(f"local index must be in [0, {half - 1}] for dual dim={dim}, got {i}")
33
+ if j < 0 or j >= half:
34
+ raise ValueError(f"local index must be in [0, {half - 1}] for dual dim={dim}, got {j}")
35
+
36
+ i_eps = bool(i_eps_flag)
37
+ j_eps = bool(j_eps_flag)
38
+
39
+ # Nilpotency
40
+ if i_eps and j_eps:
41
+ return (0, 0, 0)
42
+
43
+ # Base multiplication
44
+ if self._split_mode:
45
+ base_sign, local_idx = self._split.multiply_indices(i, j, dim)
46
+ else:
47
+ base_sign, local_idx = self._standard.multiply_indices(i, j)
48
+
49
+ eps_flag = 1 if (i_eps or j_eps) else 0
50
+ return (s1 * s2 * base_sign, local_idx, eps_flag)
@@ -54,12 +54,12 @@ class Validation:
54
54
  if not isinstance(data, tuple):
55
55
  raise TypeError(f"Expected tuple, got {type(data).__name__}")
56
56
 
57
- if len(data) not in (2, 3):
58
- raise ValueError(f"Basis tuple must have length 2 or 3, got {len(data)}")
59
-
60
- if len(data) == 3 and not allow_eps:
61
- raise ValueError("3-tuple epsilon form is not allowed here")
62
-
57
+ if allow_eps:
58
+ if len(data) != 3:
59
+ raise ValueError(f"Dual basis tuple must have length 3 (sign, index, eps), got {len(data)}")
60
+ else:
61
+ if len(data) != 2:
62
+ raise ValueError(f"Standard/Split basis tuple must have length 2 (sign, index), got {len(data)}")
63
63
 
64
64
  sign = data[0]
65
65
  index = data[1]
@@ -126,33 +126,6 @@ def _unpack_table(table):
126
126
  )
127
127
 
128
128
 
129
- def _as_dual_global(t: tuple, dim: int) -> tuple:
130
- """
131
- Converts a dual input tuple into a global 2-tuple.
132
-
133
- Accepts:
134
- (sign, global_index)
135
- (sign, local_index, eps_flag)
136
-
137
- Returns:
138
- (sign, global_index)
139
- """
140
- sign = int(t[0])
141
- idx = int(t[1])
142
-
143
- if sign == 0:
144
- return (0, 0)
145
-
146
- half = 1 << Validation.dimension(dim)
147
-
148
- if len(t) >= 3:
149
- eps = int(t[2])
150
-
151
- if eps == 1 and idx < half:
152
- idx += half
153
-
154
- return (sign, idx)
155
-
156
129
 
157
130
  # ----------------------------------------------------------------------
158
131
  # Public simple API
@@ -280,11 +253,9 @@ def multiply(
280
253
  return (0, 0, 0)
281
254
  return (0, 0)
282
255
 
283
- # Dual inputs may be local 3-tuples: (sign, local_index, eps)
284
- if kind in ("dual", "dual_split"):
285
- a = _as_dual_global(a, dim)
286
- b = _as_dual_global(b, dim)
287
-
256
+ # Dual inputs are strictly local 3-tuples: (sign, local_index, eps_flag).
257
+ # We pass them directly to the engines. No global overflow conversion needed.
258
+
288
259
  # ------------------------------------------------------------------
289
260
  # O(1) engine
290
261
  # ------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hypercomplex-engine
3
- Version: 0.4.2.7
3
+ Version: 0.5.0
4
4
  Summary: Fast O(1)/O(n) multiplication engine for arbitrary dimensions and table generator for ordinary, split, and dual Cayley-Dickson algebras.
5
5
  Author-email: Maher Ben Abdessalem <ba.maher94@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -1123,6 +1123,7 @@ doi = "10.6084/m9.figshare.33705022.v8"
1123
1123
 
1124
1124
  ```
1125
1125
 
1126
+
1126
1127
  ### Acknowledgments
1127
1128
 
1128
1129
  The author gratefully acknowledges **Prof. Derek Abbott**, **Dr. James M. Chappell**, and PhD candidate **Greg P. Wilmot** from the University of Adelaide, Australia, for the opportunity of collaboration and a deeper study of hypercomplex numbers. Special thanks go to **Greg P. Wilmot** for his work on the structure of Cayley-Dickson algebras and for acknowledging the author's contribution to his paper, *"Structure of the Cayley-Dickson algebras"* ([arXiv:2505.11747](https://arxiv.org)).
@@ -34,4 +34,5 @@ tests/test_dual_tuple_regression.py
34
34
  tests/test_fast_mode.py
35
35
  tests/test_fixes_0_4.py
36
36
  tests/test_mega_mother.py
37
- tests/test_split_dim.py
37
+ tests/test_split_dim.py
38
+ tests/test_strict_dual_3tuple.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hypercomplex-engine"
7
- version = "0.4.2.7"
7
+ version = "0.5.0"
8
8
  authors = [
9
9
  { name="Maher Ben Abdessalem", email="ba.maher94@gmail.com" },
10
10
  ]
@@ -0,0 +1,55 @@
1
+ """Regression tests for dual-engine tuple normalization and facade zero handling.
2
+
3
+ History:
4
+ - 0.4.0: DualHolographic ignored the eps flag while FastDual promoted it
5
+ (engines diverged on identical 3-tuple input).
6
+ - 0.4.0 hotfix attempt: DualHolographic read t[2] unconditionally, crashing
7
+ with IndexError on documented 2-tuple input and breaking the facade's
8
+ engine="holographic" dual path (which normalizes to 2-tuples).
9
+ - 0.4.1: both fixed; facade validates before zero-propagation.
10
+ """
11
+
12
+ import pytest
13
+
14
+ # Adjust these imports to whatever hypercomplex/__init__.py exports.
15
+ from hypercomplex_engine import multiply, FastDual, DualHolographic
16
+ from hypercomplex_engine.core.validation import Validation
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+ # ---------- facade routes, including the path that crashed ----------
25
+
26
+ @pytest.mark.parametrize("engine", ["fast", "holographic"])
27
+ def test_facade_dual_both_engines(engine):
28
+ assert multiply("dual", (1, 3,0), (1, 5,0), dim=3, engine=engine) == \
29
+ multiply("dual", (1, 3,0), (1, 5,0), dim=3, engine="fast")
30
+
31
+
32
+
33
+
34
+ # ---------- zero handling: validated, shape-correct, convention documented ----------
35
+
36
+ def test_facade_zero_shapes():
37
+ assert multiply("dual", (0, 2, 0), (1, 3, 0), dim=2) == (0, 0, 0)
38
+ assert multiply("dual_split", (1, 2, 0), (0, 3, 0), dim=2) == (0, 0, 0)
39
+ with pytest.raises((TypeError, ValueError)):
40
+ assert multiply("standard", (0, 2, 0), (1, 3, 0), dim=2) == (0, 0)
41
+ with pytest.raises((TypeError, ValueError)): # formal zero
42
+ assert multiply("split", (0, 2, 0), (1, 3, 0), dim=2) == (0, 0)
43
+
44
+
45
+ def test_facade_malformed_raises_validation_error():
46
+ with pytest.raises((TypeError, ValueError)):
47
+ multiply("dual", 5, (1, 1), dim=2) # not a tuple
48
+ with pytest.raises((TypeError, ValueError)):
49
+ multiply("standard", (1, 2, 3, 4), (1, 1)) # wrong arity
50
+
51
+ # ---------- nilpotency still intact ----------
52
+
53
+ @pytest.mark.parametrize("engine", ["fast", "holographic"])
54
+ def test_nilpotency(engine):
55
+ assert multiply("dual", (1, 0,1), (1, 0,1), dim=0, engine=engine) == (0, 0, 0)
@@ -111,7 +111,7 @@ class TestFastDual:
111
111
  fast = FastDual(split=False)
112
112
 
113
113
  # eps*e0 has global index 2 when dim=1
114
- result = fast.multiply((1, 2), (1, 2), dim=1)
114
+ result = fast.multiply((1, 0, 1), (1, 0, 1), dim=1)
115
115
 
116
116
  assert result == (0, 0, 0)
117
117
 
@@ -119,7 +119,7 @@ class TestFastDual:
119
119
  fast = FastDual(split=False)
120
120
 
121
121
  # e1 * e1 = -e0
122
- result = fast.multiply((1, 1), (1, 1), dim=1)
122
+ result = fast.multiply((1, 1, 0), (1, 1, 0), dim=1)
123
123
 
124
124
  assert result == (-1, 0, 0)
125
125
 
@@ -127,7 +127,7 @@ class TestFastDual:
127
127
  fast = FastDual(split=False)
128
128
 
129
129
  # e0 * (eps*e0) = eps*e0
130
- result = fast.multiply((1, 0), (1, 2), dim=1)
130
+ result = fast.multiply((1, 0, 0), (1, 0,1), dim=1)
131
131
 
132
132
  assert result == (1, 0, 1)
133
133
 
@@ -137,7 +137,7 @@ class TestFastDual:
137
137
  # local tuple: (sign, local_index, eps_flag)
138
138
  eps_e0 = (1, 0, 1)
139
139
 
140
- result = fast.multiply((1, 0), eps_e0, dim=1)
140
+ result = fast.multiply((1, 0, 0), eps_e0, dim=1)
141
141
 
142
142
  assert result == (1, 0, 1)
143
143
 
@@ -151,10 +151,20 @@ class TestFastDual:
151
151
  signs, indices, eps = builder.build(dim, split=split)
152
152
 
153
153
  total = 1 << (dim + 1)
154
-
154
+ half = 1 << (dim)
155
155
  for i in range(total):
156
156
  for j in range(total):
157
- s, idx, e = fast.multiply_indices(i, j, dim)
157
+ i_eps=0
158
+ j_eps=0
159
+ a = i
160
+ b = j
161
+ if(i>half-1):
162
+ a= i - half
163
+ i_eps=1
164
+ if(j>half-1):
165
+ b= j - half
166
+ j_eps = 1
167
+ s, idx, e = fast.multiply_indices(a, b, dim,i_eps,j_eps)
158
168
 
159
169
  assert int(signs[i, j]) == s, \
160
170
  f"Dual O(1) sign mismatch split={split}, ({i},{j})"
@@ -179,19 +189,19 @@ class TestFacadefast:
179
189
  assert multiply("split", (1, 1), (1, 1), dim=1, engine="fast") == (1, 0)
180
190
 
181
191
  def test_dual(self):
182
- result = multiply("dual", (1, 1), (1, 1), dim=1, engine="fast")
192
+ result = multiply("dual", (1, 1, 0), (1, 1, 0), dim=1, engine="fast")
183
193
  assert result == (-1, 0, 0)
184
194
 
185
195
  def test_dual_local_tuple_chaining(self):
186
196
  # eps*e0 as local tuple
187
197
  eps_e0 = (1, 0, 1)
188
198
 
189
- result = multiply("dual", (1, 0), eps_e0, dim=1, engine="fast")
199
+ result = multiply("dual", (1, 0, 0), eps_e0, dim=1, engine="fast")
190
200
 
191
201
  assert result == (1, 0, 1)
192
202
 
193
203
  # Now reuse result directly
194
- result2 = multiply("dual", result, (1, 0), dim=1, engine="fast")
204
+ result2 = multiply("dual", result, (1, 0, 0), dim=1, engine="fast")
195
205
 
196
206
  assert result2 == (1, 0, 1)
197
207
 
@@ -16,23 +16,6 @@ from hypercomplex_engine import (
16
16
 
17
17
  # --- 1. dual nilpotency: one canonical zero across every engine -----------
18
18
 
19
- @pytest.mark.parametrize("split", [False, True])
20
- @pytest.mark.parametrize("n", [1, 2, 3])
21
- def test_dual_engines_agree_everywhere(n, split):
22
- fast = FastDual(split=split)
23
- holo = DualHolographic(split=split)
24
- signs, indices, eps = DualTableBuilder().build(n, split=split)
25
- size = 1 << (n + 1)
26
-
27
- for i, j in itertools.product(range(size), repeat=2):
28
- f = tuple(fast.multiply((1, i), (1, j), dim=n))
29
- h = tuple(holo.multiply((1, i), (1, j), dim=n))
30
- assert f == h, (i, j, f, h)
31
-
32
- if signs[i, j] == 0:
33
- assert f == (0, 0, 0)
34
- else:
35
- assert f == (int(signs[i, j]), int(indices[i, j]), int(eps[i, j]))
36
19
 
37
20
 
38
21
  @pytest.mark.parametrize("kind", ["dual", "dual_split"])
@@ -262,24 +262,24 @@ class TestDualHolographic:
262
262
 
263
263
  def test_nilpotency(self):
264
264
  holo = DualHolographic(split=False)
265
- result = holo.multiply((1, 1), (1, 1), dim=0)
265
+ result = holo.multiply((1, 0, 1), (1, 0, 1), dim=0)
266
266
  assert result[0] == 0 # zero element
267
267
 
268
268
  def test_base_product_no_eps(self):
269
269
  holo = DualHolographic(split=False)
270
- result = holo.multiply((1, 1), (1, 1), dim=1)
270
+ result = holo.multiply((1, 1, 0), (1, 1, 0), dim=1)
271
271
  assert result[0] == -1 # sign
272
272
  assert result[2] == 0 # no epsilon
273
273
 
274
274
  def test_one_eps_factor(self):
275
275
  holo = DualHolographic(split=False)
276
276
  # e0 * (eps*e0) = eps*e0
277
- result = holo.multiply((1, 0), (1, 2), dim=1)
277
+ result = holo.multiply((1, 0, 0), (1, 1,1), dim=1)
278
278
  assert result[2] == 1 # has epsilon
279
279
 
280
280
  def test_zero_propagation(self):
281
281
  holo = DualHolographic(split=False)
282
- result = holo.multiply((0, 0), (1, 1), dim=1)
282
+ result = holo.multiply((0, 0,0), (1, 1,0), dim=1)
283
283
  assert result[0] == 0
284
284
 
285
285
 
@@ -461,7 +461,7 @@ class TestFacade:
461
461
  assert multiply("split", (1, 1), (1, 1), dim=1) == (1, 0)
462
462
 
463
463
  def test_multiply_dual(self):
464
- result = multiply("dual", (1, 1), (1, 1), dim=1)
464
+ result = multiply("dual", (1, 1, 0), (1, 1, 0), dim=1)
465
465
  assert result[0] == -1
466
466
  assert result[2] == 0
467
467
 
@@ -517,7 +517,7 @@ class TestEndToEnd:
517
517
 
518
518
  def test_dual_nilpotency_workflow(self):
519
519
  """ε² = 0 in dual algebra."""
520
- result = multiply("dual", (1, 4), (1, 4), dim=2)
520
+ result = multiply("dual", (1, 0, 1), (1, 0, 1), dim=2)
521
521
  assert result[0] == 0
522
522
 
523
523
  def test_notation_roundtrip_in_context(self):
@@ -23,10 +23,6 @@ def test_split_result_depends_on_dim(engine):
23
23
  assert multiply("split", (1, 2), (1, 2), dim=dim, engine=engine) == (-1, 0)
24
24
 
25
25
 
26
- @pytest.mark.parametrize("eps", [0, 1])
27
- def test_split_rejects_epsilon_three_tuples_with_clear_message(eps):
28
- with pytest.raises(ValueError, match="3-tuple"):
29
- multiply("split", (1, 1, eps), (1, 2), dim=2)
30
26
 
31
27
 
32
28
  def test_standard_needs_no_dim():
@@ -0,0 +1,143 @@
1
+ """
2
+ Phase 1 Validation: Strict 3-Tuple Contract for Dual Algebras.
3
+
4
+ This test suite asserts that:
5
+ 1. The old 2-tuple "global overflow" format (e.g., (1, 4) for dim=2) is REJECTED.
6
+ 2. The new strict 3-tuple format (sign, local_index, eps_flag) is ENFORCED.
7
+ 3. The mathematical invariants (nilpotency, parent matching) remain perfectly intact.
8
+ 4. The Fast O(1) and Holographic O(n) engines agree perfectly under the new contract.
9
+ """
10
+ import pytest
11
+ from hypercomplex_engine import (
12
+ multiply,
13
+ FastDual, DualHolographic,
14
+ FastStandard, FastSplit
15
+ )
16
+
17
+
18
+ class TestFacadeStrictness:
19
+ """Validates that the top-level multiply() function enforces tuple lengths."""
20
+
21
+ def test_facade_rejects_2tuple_overflow_for_dual(self):
22
+ # Old behavior: (1, 4) with dim=2 meant eps*e0 (since 4 >= 2^2).
23
+ # New behavior: Must raise ValueError because it's a 2-tuple.
24
+ with pytest.raises(ValueError, match="must have length 3"):
25
+ multiply("dual", (1, 4), (1, 0), dim=2)
26
+
27
+ def test_facade_rejects_2tuple_overflow_for_dual_split(self):
28
+ with pytest.raises(ValueError, match="must have length 3"):
29
+ multiply("dual_split", (1, 5), (1, 1), dim=2)
30
+
31
+ def test_facade_rejects_3tuple_for_standard(self):
32
+ # Standard algebra must strictly be 2-tuples.
33
+ with pytest.raises(ValueError, match="must have length 2"):
34
+ multiply("standard", (1, 1, 0), (1, 2))
35
+
36
+ def test_facade_rejects_3tuple_for_split(self):
37
+ with pytest.raises(ValueError, match="must have length 2"):
38
+ multiply("split", (1, 1, 0), (1, 2), dim=2)
39
+
40
+ def test_facade_accepts_3tuple_for_dual(self):
41
+ # e1 * eps = eps*e1
42
+ result = multiply("dual", (1, 1, 0), (1, 0, 1), dim=2)
43
+ assert result == (1, 1, 1)
44
+
45
+ def test_facade_accepts_3tuple_for_dual_split(self):
46
+ # split e1 * e1 = +e0 -> eps * e1 * e1 = +eps*e0
47
+ result = multiply("dual_split", (1, 1, 1), (1, 1, 0), dim=1)
48
+ assert result == (1, 0, 1)
49
+
50
+
51
+ class TestEngineStrictness:
52
+ """Validates that the low-level engines reject out-of-bounds local indices."""
53
+
54
+ @pytest.mark.parametrize("split", [False, True])
55
+ def test_fast_rejects_out_of_bounds_local_index(self, split):
56
+ fast = FastDual(split=split)
57
+ # dim=2 -> half=4. local_index must be < 4.
58
+ # Passing 4 should raise ValueError, not silently treat it as eps.
59
+ with pytest.raises(ValueError, match="local index must be in"):
60
+ fast.multiply_indices(4, 1, dim=2, i_eps_flag=0, j_eps_flag=0)
61
+
62
+ @pytest.mark.parametrize("split", [False, True])
63
+ def test_holographic_rejects_out_of_bounds_local_index(self, split):
64
+ holo = DualHolographic(split=split)
65
+ with pytest.raises(ValueError, match="local index must be in"):
66
+ holo.multiply((1, 4, 0), (1, 1, 0), dim=2)
67
+
68
+
69
+ class TestMathematicalInvariants:
70
+ """Ensures the core math hasn't broken during the migration."""
71
+
72
+ @pytest.mark.parametrize("split", [False, True])
73
+ @pytest.mark.parametrize("dim", [1, 2, 3])
74
+ def test_nilpotency_eps_squared_is_zero(self, split, dim):
75
+ fast = FastDual(split=split)
76
+ holo = DualHolographic(split=split)
77
+
78
+ half = 1 << dim
79
+ for i in range(half):
80
+ for j in range(half):
81
+ # (eps * e_i) * (eps * e_j) = 0
82
+ f_res = fast.multiply_indices(i, j, dim=dim, i_eps_flag=1, j_eps_flag=1)
83
+ h_res = holo.multiply((1, i, 1), (1, j, 1), dim=dim)
84
+
85
+ assert f_res == (0, 0, 0), f"Fast nilpotency failed for i={i}, j={j}"
86
+ assert h_res == (0, 0, 0), f"Holo nilpotency failed for i={i}, j={j}"
87
+
88
+ @pytest.mark.parametrize("split", [False, True])
89
+ @pytest.mark.parametrize("dim", [1, 2, 3])
90
+ def test_dual_product_matches_parent(self, split, dim):
91
+ """
92
+ The core mathematical invariant:
93
+ (e_i * e_j) in dual == (e_i * e_j) in parent, with eps_flag = 0.
94
+ (eps * e_i) * e_j == eps * (e_i * e_j)
95
+ """
96
+ fast_dual = FastDual(split=split)
97
+ fast_parent = FastSplit() if split else FastStandard()
98
+
99
+ half = 1 << dim
100
+ for i in range(half):
101
+ for j in range(half):
102
+ # Get parent product
103
+ if split:
104
+ p_sign, p_idx = fast_parent.multiply_indices(i, j, dim=dim)
105
+ else:
106
+ p_sign, p_idx = fast_parent.multiply_indices(i, j)
107
+
108
+ # 1. Base * Base
109
+ d_res = fast_dual.multiply_indices(i, j, dim=dim, i_eps_flag=0, j_eps_flag=0)
110
+ assert d_res == (p_sign, p_idx, 0)
111
+
112
+ # 2. Eps * Base
113
+ d_eps_base = fast_dual.multiply_indices(i, j, dim=dim, i_eps_flag=1, j_eps_flag=0)
114
+ assert d_eps_base == (p_sign, p_idx, 1)
115
+
116
+ # 3. Base * Eps
117
+ d_base_eps = fast_dual.multiply_indices(i, j, dim=dim, i_eps_flag=0, j_eps_flag=1)
118
+ assert d_base_eps == (p_sign, p_idx, 1)
119
+
120
+
121
+ class TestCrossValidation:
122
+ """Ensures Fast O(1) and Holographic O(n) agree under the new contract."""
123
+
124
+ @pytest.mark.parametrize("split", [False, True])
125
+ def test_fast_vs_holographic_exhaustive(self, split):
126
+ fast = FastDual(split=split)
127
+ holo = DualHolographic(split=split)
128
+ dim = 3
129
+ half = 1 << dim
130
+
131
+ for i in range(half):
132
+ for j in range(half):
133
+ for i_eps in (0, 1):
134
+ for j_eps in (0, 1):
135
+ f_res = fast.multiply_indices(i, j, dim=dim, i_eps_flag=i_eps, j_eps_flag=j_eps)
136
+ h_res = holo.multiply((1, i, i_eps), (1, j, j_eps), dim=dim)
137
+
138
+ # Holographic multiply returns (s1*s2*base_sign, idx, eps)
139
+ # Since s1=1, s2=1, it should exactly match fast.
140
+ assert f_res == h_res, (
141
+ f"Mismatch at i={i}, j={j}, i_eps={i_eps}, j_eps={j_eps}. "
142
+ f"Fast: {f_res}, Holo: {h_res}"
143
+ )
@@ -1,188 +0,0 @@
1
- from ..validation import Validation
2
- from .fast_standard import FastStandard
3
- from .fast_split import FastSplit
4
-
5
-
6
- class FastDual:
7
- """
8
- Dual Cayley-Dickson O(1) multiplier.
9
-
10
- Input index convention:
11
- Total dual dimension is 2^(dim + 1).
12
- Bit `dim` marks the epsilon component.
13
-
14
- lower half: base elements
15
- upper half: epsilon * base elements
16
-
17
- Output:
18
- (sign, local_index, eps_flag)
19
-
20
- The output index is the local base index, so it can be formatted
21
- directly by CDFormat.
22
-
23
- Zero products are normalized to:
24
- (0, 0, 0)
25
- """
26
-
27
- def __init__(self, split: bool = False):
28
- self._split_mode = bool(split)
29
- self._standard = FastStandard()
30
- self._split = FastSplit() if self._split_mode else None
31
-
32
- # ==================================================================
33
- # Index helpers
34
- # ==================================================================
35
-
36
- @staticmethod
37
- def local_to_global(index: int, eps: int, dim: int) -> int:
38
- """
39
- Convert local dual representation to global index.
40
-
41
- local:
42
- index in [0, 2^dim - 1]
43
- eps = 0 or 1
44
-
45
- global:
46
- index in [0, 2^(dim+1) - 1]
47
- """
48
- dim = Validation.dimension(dim)
49
- index = int(index)
50
- eps = int(eps)
51
-
52
- half = 1 << dim
53
-
54
- if index < 0 or index >= half:
55
- raise ValueError(f"local index must be in [0, {half - 1}], got {index}")
56
-
57
- if eps:
58
- return index + half
59
-
60
- return index
61
-
62
- @staticmethod
63
- def global_to_local(global_index: int, dim: int) -> tuple:
64
- """
65
- Convert global dual index to:
66
- (local_index, eps_flag)
67
- """
68
- dim = Validation.dimension(dim)
69
- global_index = int(global_index)
70
-
71
- half = 1 << dim
72
- total = half << 1
73
-
74
- if global_index < 0 or global_index >= total:
75
- raise ValueError(f"global index must be in [0, {total - 1}], got {global_index}")
76
-
77
- return (global_index & (half - 1), 1 if global_index >= half else 0)
78
-
79
- # ==================================================================
80
- # Tuple input helper
81
- # ==================================================================
82
-
83
- def _extract_global(self, t: tuple, dim: int) -> tuple:
84
- """
85
- Accepts:
86
- (sign, global_index)
87
- (sign, local_index, eps_flag)
88
-
89
- Returns:
90
- (sign, global_index)
91
- """
92
- Validation.basis_tuple(t, allow_zero=True, allow_eps=True)
93
-
94
- sign = int(t[0])
95
- idx = int(t[1])
96
-
97
- if sign == 0:
98
- return (0, 0)
99
-
100
- half = 1 << Validation.dimension(dim)
101
-
102
- if len(t) >= 3:
103
- eps = int(t[2])
104
-
105
- # If the tuple carries an epsilon flag and the index is still
106
- # local, promote it to the global upper half.
107
- if eps == 1 and idx < half:
108
- idx += half
109
-
110
- return (sign, idx)
111
-
112
- # ==================================================================
113
- # Public API
114
- # ==================================================================
115
-
116
- def multiply(self, t1: tuple, t2: tuple, dim: int) -> tuple:
117
- """
118
- Multiply two dual basis element tuples.
119
-
120
- Accepted inputs:
121
- (sign, global_index)
122
- (sign, local_index, eps_flag)
123
-
124
- Returns:
125
- (final_sign, local_index, eps_flag)
126
- """
127
- dim = Validation.dimension(dim)
128
- Validation.basis_tuple(t1, allow_zero=True, allow_eps=True)
129
- Validation.basis_tuple(t2, allow_zero=True, allow_eps=True)
130
-
131
-
132
-
133
- s1, i = int(t1[0]), int(t1[1])
134
- s2, j = int(t2[0]), int(t2[1])
135
- i_eps_flag = int(t1[2]) if len(t1) == 3 else 0
136
- j_eps_flag = int(t2[2]) if len(t2) == 3 else 0
137
-
138
- if s1 == 0 or s2 == 0:
139
- return (0, 0, 0)
140
-
141
- sign, idx, eps = self.multiply_indices(i, j,dim,i_eps_flag,j_eps_flag)
142
-
143
- return (s1 * s2 * sign, idx, eps)
144
-
145
- def multiply_indices(self, i: int, j: int,dim:int, i_eps_flag=0 ,j_eps_flag=0) -> tuple:
146
- """
147
- Core dual O(1) multiplication using global indices.
148
-
149
- Returns:
150
- (sign, local_index, eps_flag)
151
- """
152
- i = int(i)
153
- j = int(j)
154
- dim = Validation.dimension(dim)
155
-
156
- half = 1 << dim
157
- total = half << 1
158
-
159
- if i < 0 or i >= total:
160
- raise ValueError(f"index must be in [0, {total - 1}] for dual dim={dim}, got {i}")
161
-
162
- if j < 0 or j >= total:
163
- raise ValueError(f"index must be in [0, {total - 1}] for dual dim={dim}, got {j}")
164
-
165
- i_eps = i >= half or i_eps_flag
166
- j_eps = j >= half or j_eps_flag
167
-
168
- i_loc = i & (half - 1)
169
- j_loc = j & (half - 1)
170
-
171
- # --------------------------------------------------------------
172
- # Epsilon nilpotency:
173
- # (epsilon e_i)(epsilon e_j) = 0
174
- # --------------------------------------------------------------
175
- if i_eps and j_eps:
176
- return (0, 0, 0)
177
-
178
- # --------------------------------------------------------------
179
- # Base multiplication
180
- # --------------------------------------------------------------
181
- if self._split_mode:
182
- base_sign, local_idx = self._split.multiply_indices(i_loc, j_loc, dim)
183
- else:
184
- base_sign, local_idx = self._standard.multiply_indices(i_loc, j_loc)
185
-
186
- eps_flag = 1 if (i_eps or j_eps) else 0
187
-
188
- return (base_sign, local_idx, eps_flag)
@@ -1,90 +0,0 @@
1
- from ..validation import Validation
2
- from .standard import StandardHolographic
3
- from .split import SplitHolographic
4
-
5
-
6
- class DualHolographic:
7
- """
8
- Dual Cayley-Dickson holographic multiplier.
9
-
10
- Input index convention:
11
- The total dual dimension is 2^(dim + 1).
12
- Bit `dim` marks the epsilon component.
13
-
14
- lower half: 0 ... 2^dim - 1
15
- upper half: epsilon times lower half
16
-
17
- Output:
18
- (sign, local_index, eps_flag)
19
-
20
- Nilpotency:
21
- (epsilon e_i) * (epsilon e_j) = 0
22
- returned as the canonical zero (0, 0, 0), matching FastDual
23
- and DualTableBuilder
24
- """
25
-
26
- def __init__(self, split: bool = False):
27
- self._split_mode = bool(split)
28
- self._standard = StandardHolographic()
29
- self._split = SplitHolographic() if self._split_mode else None
30
-
31
- def multiply(self, t1: tuple, t2: tuple, dim: int) -> tuple:
32
- """
33
- Multiply two dual basis elements.
34
-
35
- t1, t2 may be:
36
- (sign, global_index)
37
- (sign, global_index, eps_flag)
38
-
39
- The epsilon component is determined by bit `dim` of global_index.
40
-
41
- Returns:
42
- (final_sign, local_index, eps_flag)
43
- """
44
- Validation.basis_tuple(t1, allow_zero=True, allow_eps=True)
45
- Validation.basis_tuple(t2, allow_zero=True, allow_eps=True)
46
-
47
- dim = Validation.dimension(dim)
48
-
49
- s1, i = int(t1[0]), int(t1[1])
50
- s2, j = int(t2[0]), int(t2[1])
51
- i_eps_flag = int(t1[2]) if len(t1) == 3 else 0
52
- j_eps_flag = int(t2[2]) if len(t2) == 3 else 0
53
- # Zero propagates.
54
- if s1 == 0 or s2 == 0:
55
- return (0, 0, 0)
56
-
57
- total_size = 1 << (dim + 1)
58
-
59
- if i < 0 or i >= total_size:
60
- raise ValueError(f"index must be in [0, {total_size - 1}] for dual dim={dim}, got {i}")
61
-
62
- if j < 0 or j >= total_size:
63
- raise ValueError(f"index must be in [0, {total_size - 1}] for dual dim={dim}, got {j}")
64
-
65
- half = 1 << dim
66
-
67
- i_eps = i >= half or i_eps_flag
68
- j_eps = j >= half or j_eps_flag
69
-
70
- i_loc = i & (half - 1)
71
- j_loc = j & (half - 1)
72
-
73
- # --------------------------------------------------------------
74
- # Epsilon nilpotency:
75
- # (epsilon e_i) * (epsilon e_j) = 0
76
- # --------------------------------------------------------------
77
- if i_eps and j_eps:
78
- return (0, 0, 0)
79
-
80
- # --------------------------------------------------------------
81
- # Base multiplication.
82
- # --------------------------------------------------------------
83
- if self._split_mode:
84
- base_sign, local_idx = self._split.multiply_indices(i_loc, j_loc, dim)
85
- else:
86
- base_sign, local_idx = self._standard.multiply_indices(i_loc, j_loc)
87
-
88
- eps_flag = 1 if (i_eps or j_eps) else 0
89
-
90
- return (s1 * s2 * base_sign, local_idx, eps_flag)
@@ -1,93 +0,0 @@
1
- """Regression tests for dual-engine tuple normalization and facade zero handling.
2
-
3
- History:
4
- - 0.4.0: DualHolographic ignored the eps flag while FastDual promoted it
5
- (engines diverged on identical 3-tuple input).
6
- - 0.4.0 hotfix attempt: DualHolographic read t[2] unconditionally, crashing
7
- with IndexError on documented 2-tuple input and breaking the facade's
8
- engine="holographic" dual path (which normalizes to 2-tuples).
9
- - 0.4.1: both fixed; facade validates before zero-propagation.
10
- """
11
-
12
- import pytest
13
-
14
- # Adjust these imports to whatever hypercomplex/__init__.py exports.
15
- from hypercomplex_engine import multiply, FastDual, DualHolographic
16
- from hypercomplex_engine.core.validation import Validation
17
-
18
-
19
-
20
- # ---------- tuple normalization: engines must agree on identical input ----------
21
-
22
- def _all_global_pairs(dim):
23
- half = 1 << dim
24
- for i in range(half << 1):
25
- for j in range(half << 1):
26
- yield (1, i, 1 if i >= half else 0), (1, j, 1 if j >= half else 0)
27
-
28
-
29
- @pytest.mark.parametrize("dim", [0, 1, 2, 3])
30
- def test_engines_agree_global_3tuples(dim):
31
- fast, holo = FastDual(), DualHolographic()
32
- for a, b in _all_global_pairs(dim):
33
- assert fast.multiply(a, b, dim) == holo.multiply(a, b, dim)
34
-
35
-
36
- @pytest.mark.parametrize("dim", [1, 2, 3])
37
- def test_engines_agree_on_2tuples(dim):
38
- """2-tuples are documented input; must not raise (the 0.4.0 regression)."""
39
- fast, holo = FastDual(), DualHolographic()
40
- for a, b in _all_global_pairs(dim):
41
- a2, b2 = a[:2], b[:2] # strip the eps flag
42
- assert fast.multiply(a2, b2, dim) == holo.multiply(a2, b2, dim)
43
-
44
-
45
- @pytest.mark.parametrize("dim", [1, 2, 3])
46
- def test_local_3tuple_matches_promoted_global(dim):
47
- """(sign, local_index, eps=1) must equal (sign, local_index + half)."""
48
- fast, holo = FastDual(), DualHolographic()
49
- half = 1 << dim
50
- for loc in range(half):
51
- for j in range(half << 1):
52
- for engine in (fast, holo):
53
- assert engine.multiply((1, loc, 1), (1, j), dim) == \
54
- engine.multiply((1, loc + half), (1, j), dim)
55
-
56
-
57
- # ---------- facade routes, including the path that crashed ----------
58
-
59
- @pytest.mark.parametrize("engine", ["fast", "holographic"])
60
- def test_facade_dual_both_engines(engine):
61
- assert multiply("dual", (1, 3), (1, 5), dim=3, engine=engine) == \
62
- multiply("dual", (1, 3), (1, 5), dim=3, engine="fast")
63
-
64
-
65
- def test_facade_dual_3tuple_promotion():
66
- half = 1 << 3
67
- for engine in ("fast", "holographic"):
68
- assert multiply("dual", (1, 2, 1), (1, 1), dim=3, engine=engine) == \
69
- multiply("dual", (1, 2 + half), (1, 1), dim=3, engine=engine)
70
-
71
-
72
- # ---------- zero handling: validated, shape-correct, convention documented ----------
73
-
74
- def test_facade_zero_shapes():
75
- assert multiply("dual", (0, 2), (1, 3), dim=2) == (0, 0, 0)
76
- assert multiply("dual_split", (1, 2), (0, 3), dim=2) == (0, 0, 0)
77
- with pytest.raises((TypeError, ValueError)):
78
- assert multiply("standard", (0, 2), (1, 3), dim=2) == (0, 0)
79
- with pytest.raises((TypeError, ValueError)): # formal zero
80
- assert multiply("split", (0, 2), (1, 3), dim=2) == (0, 0)
81
-
82
-
83
- def test_facade_malformed_raises_validation_error():
84
- with pytest.raises((TypeError, ValueError)):
85
- multiply("dual", 5, (1, 1), dim=2) # not a tuple
86
- with pytest.raises((TypeError, ValueError)):
87
- multiply("standard", (1, 2, 3, 4), (1, 1)) # wrong arity
88
-
89
- # ---------- nilpotency still intact ----------
90
-
91
- @pytest.mark.parametrize("engine", ["fast", "holographic"])
92
- def test_nilpotency(engine):
93
- assert multiply("dual", (1, 1), (1, 1), dim=0, engine=engine) == (0, 0, 0)