Skip to content

Require square matrices in the unitary predicate - #311

Draft
PawelTroka wants to merge 1 commit into
masterfrom
codex/unitary-matrix-shape-20261030
Draft

PawelTroka wants to merge 1 commit into
masterfrom
codex/unitary-matrix-shape-20261030

Conversation

@PawelTroka

@PawelTroka PawelTroka commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Problem

isUnitary(matrix({{1,0}})) currently returns true. Its rows are orthonormal, but the rectangular map discards a coordinate and is not a unitary matrix. The same defect exists in the host and emitted TSL helper.

Change

Require equal row and column counts before applying the existing conjugate-transpose product and relative comparison. Preserve square-matrix arithmetic, the 1e-10 tolerance, input matrices, and the separate rectangular identity-pattern semantics of isIndentity / IdentityMatrix.

Update the authored and materialized reference together. This intentionally changes the previously documented rectangular-row behavior. A script that needs row orthonormality can continue to request it explicitly with isIndentity(M*HermitianTranspose(M)).

Validation

  • 44 new portable cases: 15 failed and 29 passed against unchanged master; all 44 pass after the fix.
  • Full portable Engine suite: 1,482 passed, zero failed/skipped. Rerun after recovery with SDK 10.0.403 on Linux x64.
  • Tests cover host and complete emitted source, real/complex dense/sparse matrices, rectangular row-isometries, square rotations, complex conjugation, nonunitary inputs, nonfinite values, comparison tolerance, and actual TSL expression/script execution.
  • 57 Python reference-authoring tests passed. Deterministic regeneration changes exactly one article; the other 1,219 stay identical.
  • Six additional checks cover the shipped precompiled scripting facade in Windows Core.Tests. A Windows Core.Tests cross-build passed on this exact source tree; native Windows execution remains a CI gate.
  • Independent code/compatibility review and git diff --check passed.

The uploaded tree 0b4c9131ff209eb4f53fe45792b744e49f935f65 exactly matches the tested local tree.

dotnet test Computator.NET.Engine.Tests/Computator.NET.Engine.Tests.csproj -c Release
python3 -m unittest discover -s build/reference -p 'test_*.py'

Existing work

Reviewed all 78 open issues, 14 existing open PRs, recent closed PRs, and targeted matrix/unitary searches. No existing PR repairs this predicate. This is separate from pointwise operations (#185), matrix powers (#238), and the active numerical/platform work.

Independently based on master fe1aba49b5f9538355ffaaa3d1683f69a23d2d9c. Draft for review and native CI; no merge performed.

Combined compatibility check — 2026-10-30

Also tested the final contributions in #311, #313, #314 and #315 together with the seven existing maintenance PRs (#304–#310), using the existing #312 candidate 189d28c0ec7acbf77d380f14f95ef450e7bfbd84 as the local integration base.

  • Complete combined Engine Release suite: 1,819 passed, zero failed/skipped.
  • Combined Python reference-authoring suite: 76 passed.
  • Windows-targeted Core.Tests and Desktop.Tests cross-builds: passed, zero errors, with existing warnings.
  • Deterministic reference check: passed, covering 1,251 articles and 1,351 completion items.

Eight shared paths required composition resolutions. These preserved all Euclid/ODE/polynomial aliases, completion and authoring registrations; Debye/unitary documentation; and Find/Replace/printing methods, test-source links and documentation entries. No feature behavior or numerical algorithm needed changing to combine the contributions. The independently published PRs remain based on master.

Combined local tree: 63225a973ea2883974a91ab26afcdc83d866e77b, SDK 10.0.403, Linux x64. The reference check used the authenticated master inventory plus current production reflection for changed entries through a portable UI shell. Native Windows tests, full native catalog execution and printer acceptance remain pending. The existing #312 PR was not changed by this local verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant