Skip to content

Canonicalizing Hamiltonians throws an exception when sites are decoupled #522

Closed

Description

@rittermarc

Description

I'm using changebonds to compress a Hamiltonian MPO. In certain cases (depends on external parameters), some sites decouple exactly. Whenever some, but not all sites decouple from each other, right_canonicalize! and/or left_canonicalize! throw the following exception.

Minimal working example (MWE)

using MPSKit, TensorKit

pspace = ℂ^2
hop = rand(ComplexF64, pspace*pspace, pspace*pspace); hop += hop'
onsite = rand(ComplexF64, pspace, pspace); onsite += onsite'

terms = [
    (1,) => onsite,
    (2, 3) => hop,
]

H = FiniteMPOHamiltonian(fill(pspace, 3), terms...)
MPSKit.right_canonicalize!(H, 2)

Error / output

LoadError: SpaceMismatch: A-block has incompatible spaces:\n(() ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ ⊞(ℂ^4))\n(() ⊗ ⊞(ℂ^2)) ← (⊞(ℂ^2) ⊗ ())
Stacktrace:
  [1] JordanMPOTensor(V::TensorMapSpace{BlockTensorKit.SumSpace{ComplexSpace}, 2, 2}, A::BlockTensorKit.SparseBlockTensorMap{TensorMap{ComplexF64, ComplexSpace, 2, 2, Vector{ComplexF64}}, ComplexF64, ComplexSpace, 2, 2, 4}, B::BlockTensorKit.SparseBlockTensorMap{TensorMap{ComplexF64, ComplexSpace, 2, 1, Vector{ComplexF64}}, ComplexF64, ComplexSpace, 2, 1, 3}, C::BlockTensorKit.SparseBlockTensorMap{TensorMap{ComplexF64, ComplexSpace, 1, 2, Vector{ComplexF64}}, ComplexF64, ComplexSpace, 1, 2, 3}, D::BlockTensorKit.SparseBlockTensorMap{TensorMap{ComplexF64, ComplexSpace, 1, 1, Vector{ComplexF64}}, ComplexF64, ComplexSpace, 1, 1, 2})
    @ MPSKit ~/ComplexTime/MPSKit.jl/src/operators/jordanmpotensor.jl:92
  [2] right_canonicalize!(H::FiniteMPOHamiltonian{JordanMPOTensor{ComplexF64, ComplexSpace, Vector{ComplexF64}}}, i::Int64; alg::MatrixAlgebraKit.Householder{@NamedTuple{blocksize::Int64, driver::MatrixAlgebraKit.DefaultDriver, pivoted::Bool, positive::Bool}})
    @ MPSKit ~/ComplexTime/MPSKit.jl/src/operators/ortho.jl:157
  [3] right_canonicalize!(H::FiniteMPOHamiltonian{JordanMPOTensor{ComplexF64, ComplexSpace, Vector{ComplexF64}}}, i::Int64)
    @ MPSKit ~/ComplexTime/MPSKit.jl/src/operators/ortho.jl:99
  [4] top-level scope
    @ ~/ComplexTime/complextime.jl/examples/siam-tdvp-mpskit/mpskit-sandbox.jl:13

Version info

Julia Version 1.12.5

  [07d1fe3e] TensorKit v0.17.1
  [bb1c41ca] MPSKit v0.13.13

Note that I'm using the current main branch of MPSKit checked out locally.

Activity

  1. added a commit that references this issue on Sep 24, 2026
    af9c564
  2. added a commit that references this issue on Sep 25, 2026
    3b0727c
  3. added a commit that references this issue on Sep 25, 2026
    1c4fb96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions