hypercomplex-engine 0.0.4__py3-none-any.whl → 0.4.0__py3-none-any.whl

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.
@@ -31,8 +31,8 @@ class FastSplit:
31
31
  t2 = (sign2, index2)
32
32
 
33
33
  dim:
34
- Algebra exponent.
35
- If None, it is inferred from the indices.
34
+ Algebra exponent (required; the result depends on it,
35
+ e.g. e2*e2 is +1 at dim=2 but -1 at dim>=3).
36
36
 
37
37
  Returns:
38
38
  (final_sign, index1 XOR index2)
hypercomplex/facade.py CHANGED
@@ -89,7 +89,6 @@ def _normalize_engine(engine: str) -> str:
89
89
  aliases = {
90
90
  "fast": "fast",
91
91
  "constant": "fast",
92
- "fast": "fast",
93
92
  "bitwise": "fast",
94
93
  "o1":"fast",
95
94
 
@@ -254,12 +253,18 @@ def multiply(
254
253
  "holographic" O(n) descent, useful for verification
255
254
 
256
255
  dim:
257
- Required for dual and dual_split.
258
- Optional for split.
256
+ Required for split, dual and dual_split.
257
+ Not used for standard.
259
258
  """
260
259
  kind = _normalize_kind(kind)
261
260
  engine = _normalize_engine(engine)
262
261
 
262
+ # dim is part of the algebra's identity for split/dual kinds (e.g. e2*e2 is
263
+ # +e0 in split dim=2 but -e0 for every larger split algebra), so it is
264
+ # required, never inferred. Validate before anything else.
265
+ if kind in ("split", "dual", "dual_split") and dim is None:
266
+ raise ValueError(f"dim is required for {kind} multiplication")
267
+
263
268
  # Zero propagation
264
269
  if int(a[0]) == 0 or int(b[0]) == 0:
265
270
  if kind in ("dual", "dual_split"):
@@ -268,9 +273,6 @@ def multiply(
268
273
 
269
274
  # Dual inputs may be local 3-tuples: (sign, local_index, eps)
270
275
  if kind in ("dual", "dual_split"):
271
- if dim is None:
272
- raise ValueError("dim is required for dual multiplication")
273
-
274
276
  a = _as_dual_global(a, dim)
275
277
  b = _as_dual_global(b, dim)
276
278
 
@@ -298,8 +300,6 @@ def multiply(
298
300
  return _standard_holo.multiply(a, b)
299
301
 
300
302
  if kind == "split":
301
- if dim is None:
302
- dim = max(int(a[1]), int(b[1])).bit_length()
303
303
  return _split_holo.multiply(a, b, dim)
304
304
 
305
305
  if kind == "dual":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hypercomplex-engine
3
- Version: 0.0.4
3
+ Version: 0.4.0
4
4
  Summary: Fast O(1)/O(n) multiplication engine 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: MIT License
@@ -490,7 +490,7 @@ print(result)
490
490
  |---|---|
491
491
  | `"integer"` | `+e5` |
492
492
  | `"graded"` | `+o13` |
493
- | `"latex"` | `+e_{13}` |
493
+ | `"latex"` | `+e_{5}` |
494
494
  | `"latex_integer"` | `+e_{5}` |
495
495
  | `"latex_graded"` | `+o_{13}` |
496
496
 
@@ -1,5 +1,5 @@
1
1
  hypercomplex/__init__.py,sha256=DM_jeWSzhDkdz8KboGrVQVqVaj6xkr8k22C_uNRRxr8,1010
2
- hypercomplex/facade.py,sha256=HpGZ2roT-VIEfI0NcApVBB0rO0Odrc-vh_rsatFkSnw,9041
2
+ hypercomplex/facade.py,sha256=qneXgwLehlvec4f18jFQ_VnsTYmSiUoyswLqlE0nOes,9195
3
3
  hypercomplex/core/__init__.py,sha256=7cD5SJFbAewuVMIvKnQ6tb7JwcmpGQktSvGbN5n8dIM,668
4
4
  hypercomplex/core/basis_element.py,sha256=TnPb1xLICv0TK0AfTW_I8_8T2TavktKTq4MEPLWnyU8,1402
5
5
  hypercomplex/core/basis_notation.py,sha256=K17IUXEio7KmY3pvpFdDFI2MsLs11-E5Z5Cp10CS84Y,4887
@@ -7,7 +7,7 @@ hypercomplex/core/validation.py,sha256=_W23VmbWZh0OB7pIG4Pbm--N75Vdomh3hbHCRVXTT
7
7
  hypercomplex/core/fast/__init__.py,sha256=6KsWo1dhNlT69jT_Bi8-khOrNFX9cDs98987TGTXo4w,173
8
8
  hypercomplex/core/fast/bit_utils.py,sha256=aqBjPX2srWym6AjxZqTzt998-in_-5VAxNUiQXUFAVw,385
9
9
  hypercomplex/core/fast/fast_dual.py,sha256=8y7U5pV2JIhMYtsiuLAaei977VUPo6DVx48kGH6DPoE,5223
10
- hypercomplex/core/fast/fast_split.py,sha256=l7UHhXmuv7Rj4zMfDEwKr6OTB70FBusDnYhdkf61-zY,2998
10
+ hypercomplex/core/fast/fast_split.py,sha256=Wdr9pd9zXA_mFzlMxVv8LpPwDZJFP-XPVa0uQIEs3jA,3037
11
11
  hypercomplex/core/fast/fast_standard.py,sha256=S4ujHlp0Q_Z07jFKbpmFzrqYvf-zZTrIGm_LLwTwQUE,3306
12
12
  hypercomplex/core/holographic/__init__.py,sha256=TGMyPs6dyeaQ9I--rFooBOrKzkex73IbwzQtL7Q0i04,200
13
13
  hypercomplex/core/holographic/dual.py,sha256=6ntw2Uwz6hI18ogHrsC3e2XmZrkTb2qQy8hbMWqoV4E,2761
@@ -21,8 +21,8 @@ hypercomplex/core/table_builder/standard.py,sha256=3kyg4TLCG_LKhC8lT95hZBFmOee0W
21
21
  hypercomplex/printer/__init__.py,sha256=6EZOUBYb9TDgfqrFpnIfPS1bbPFZ0dMX6RCPDZepL6M,129
22
22
  hypercomplex/printer/cd_format.py,sha256=X_cotGumJlRMuJO5cbsnI8FA9Py12TGYftPlUdx-9xg,5731
23
23
  hypercomplex/printer/cd_table_printer.py,sha256=uQlSmiTYiJkLZ4wC0ezXm7RSCYlldva0YCF2reNfKq4,4882
24
- hypercomplex_engine-0.0.4.dist-info/licenses/LICENSE,sha256=guj-B90dY9uDtG1POm34JUQQ0HU3YE47dq8RmVY4znI,1066
25
- hypercomplex_engine-0.0.4.dist-info/METADATA,sha256=YMXATQV5XTfimwwtKwZRpwTvbhV1ujByABAxRE2rHyE,19939
26
- hypercomplex_engine-0.0.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
27
- hypercomplex_engine-0.0.4.dist-info/top_level.txt,sha256=WTtGtCnGtWsHvFBLdcsO6VRbm4wa1kU3yV-HrypIdwE,13
28
- hypercomplex_engine-0.0.4.dist-info/RECORD,,
24
+ hypercomplex_engine-0.4.0.dist-info/licenses/LICENSE,sha256=guj-B90dY9uDtG1POm34JUQQ0HU3YE47dq8RmVY4znI,1066
25
+ hypercomplex_engine-0.4.0.dist-info/METADATA,sha256=D1LIPbrrZ5azxrhQVngsB3Rhx0W6MCLzzMpkqosMx5A,19938
26
+ hypercomplex_engine-0.4.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
27
+ hypercomplex_engine-0.4.0.dist-info/top_level.txt,sha256=WTtGtCnGtWsHvFBLdcsO6VRbm4wa1kU3yV-HrypIdwE,13
28
+ hypercomplex_engine-0.4.0.dist-info/RECORD,,