Visitar URL original
Respect conjugate transpose in complex vector mode products by DiadkoShmek · Pull Request #696 · tensorly/tensorly · GitHub
Skip to content

Respect conjugate transpose in complex vector mode products - #696

Open
DiadkoShmek wants to merge 1 commit into
tensorly:mainfrom
DiadkoShmek:lezo-complex-vector-transpose-20261104
Open

DiadkoShmek wants to merge 1 commit into
tensorly:mainfrom
DiadkoShmek:lezo-complex-vector-transpose-20261104

Conversation

@DiadkoShmek

Copy link
Copy Markdown
Contributor

For complex vectors, mode_dot(..., transpose=True) ignores conjugation in both tensor-algebra implementations. The core multi_mode_dot already conjugates vectors, while its einsum implementation does not. Consequently, a single mode product and its one-factor multi-mode equivalent disagree.

For X=[[1+2j,3-1j],[-2+1j,4+3j]] and v=[1+1j,2-1j], the Hermitian mode-0 contraction is [-2+1j,7+6j]; both single-mode implementations currently return [-4+7j,15+4j].

Apply the existing Hermitian transpose convention to vector branches using the wrapped backend conj. Update the relevant parameter documentation and add one compact parameterized regression covering both vector modes, transpose values and complex64/128. Default bilinear calls and real-vector values retain their semantics.

Validation on exact main cdde62f:

  • Exact-base final regressions: 4 failures and 4 controls for each tenalg implementation.
  • Entire tenalg test directory: 367 passed in each NumPy/PyTorch × core/einsum configuration, with 16 existing SVD warnings per run. The final formatted regression also passes all four configurations.
  • Separate scalar-loop complex contractions and independent review cover mixed matrix/vector products and real/imaginary finite-difference gradients. Black and diff checks pass.

CPU NumPy/PyTorch were tested; other backend and GPU matrices were not run. Repeated/negative modes and reordered skip behavior are outside this change. Implementation, testing and description were AI-assisted.

@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.82%. Comparing base (8f0a273) to head (ab2c1c4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #696      +/-   ##
==========================================
+ Coverage   92.81%   92.82%   +0.01%     
==========================================
  Files         133      133              
  Lines        8863     8879      +16     
==========================================
+ Hits         8226     8242      +16     
  Misses        637      637              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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