You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cp_norm returns an imaginary norm for complex CP weights #655
cp_norm and CPTensor.norm() disagree with the Frobenius norm of the represented tensor when CP weights are complex. The factor Gram matrices already conjugate one factor, but the weight outer product multiplies weights without conjugation. A purely imaginary weight can therefore produce a purely imaginary norm.
All three results should equal sqrt(125), approximately 11.180339887498949. Multiplying a tensor by a unit complex phase preserves its norm.
Actual result
On main a4f895404d8159bc1127e5304df8453f6c6a091e with the NumPy backend, the two CP norm calls return 11.180339887498949j, while the dense tensor norm returns 11.180339887498949.
The complex-factor support introduced by @aarmey in #423 conjugates the factor Gram matrices; the remaining difference is in the complex weights. Conjugating the second weight axis fixes this public example and mixed complex-weight cases.
Versions
Windows 11, Python 3.12.14, NumPy 2.3.5, SciPy 1.16.3, TensorLy 0.10.0 from main a4f895404d8159bc1127e5304df8453f6c6a091e. The new input cases also pass with PyTorch 2.8.0+cpu after the fix.
Activity