Skip to content

Fix QUBO DMRG LAPACK stability#34

Open
bernalde wants to merge 1 commit into
mainfrom
fix/issue-1-lapack-qubo
Open

Fix QUBO DMRG LAPACK stability#34
bernalde wants to merge 1 commit into
mainfrom
fix/issue-1-lapack-qubo

Conversation

@bernalde
Copy link
Copy Markdown
Member

Summary

  • Increase the default DMRG mindim to 2 for both the direct solver and JuMP optimizer path, so the VRP QUBO regression no longer needs a caller-provided workaround.
  • Add an exact one-variable solve path before calling ITensor DMRG, since ITensor DMRG does not support one-site systems.
  • Update tests to cover the default VRP path and single-variable QUBOs.

Tests run

  • JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using TenSolver; E, psi = minimize(reshape([-2.0], 1, 1); verbosity=0); @assert E ≈ -2.0; @assert TenSolver.sample(psi) == [1]; @assert [1] in psi; @assert !([0] in psi); println("single-variable minimize passed")'
    • Result: passed (single-variable minimize passed).
  • JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using Test, LinearAlgebra, TenSolver; include("test/cases/vrp.jl")'
    • Result: passed (Vehicle Routing Problem (VRP) | 2 passed).
  • JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using Pkg; Pkg.test("TenSolver")'
    • Result: passed (Testing TenSolver tests passed).

Notes

  • I used a temporary Julia 1.10 environment because the local checkout contains ignored Manifest.toml files resolved for Julia 1.12.6; resolving in /tmp/tensolver-test-env matches the repository's documented CI-style package test path without modifying repository files.
  • No separate lint, type-check, or formatting command is documented in the repository or CI config.

Closes #1

Copy link
Copy Markdown
Member Author

@bernalde bernalde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found. The PR addresses issue #1 by making the QUBO DMRG path use a stable default minimum bond dimension and by handling one-site QUBOs without calling ITensor DMRG, which does not support that case.

Tests reviewed:

  • JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using TenSolver; cases = Any[(reshape([-2.0], 1, 1), -2.0, [1]), (reshape([2.0], 1, 1), 0.0, [0]), (reshape([0.0], 1, 1), 0.0, nothing)]; for (Q, expected, sample_expected) in cases; E, psi = minimize(Q; verbosity=0); @Assert E ≈ expected; if sample_expected !== nothing; @Assert TenSolver.sample(psi) == sample_expected; else; @Assert [0] in psi && [1] in psi; end; end; println("one-site Float64 cases passed")'
  • JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using Test, LinearAlgebra, TenSolver; include("test/cases/vrp.jl")'
  • JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using Pkg; Pkg.test("TenSolver")'
  • JULIA_DEPOT_PATH=/tmp/tensolver-julia-depot-110 julia +1.10 --project=/tmp/tensolver-test-env -e 'using TenSolver; Q = reshape([-2], 1, 1); E, psi = minimize(Q; verbosity=0); @Assert E == -2; @Assert TenSolver.sample(psi) == [1]; println("one-site Int case passed")'

CI reviewed with gh pr checks --watch --fail-fast: all checks passed across Julia 1, lts, and pre on Ubuntu, macOS, and Windows, plus docs.

@bernalde bernalde requested a review from iagoleal May 15, 2026 20:42
@iagoleal
Copy link
Copy Markdown
Collaborator

That error was unrelated to the mindim (in the sense that it could both improve or worsen the situation). In general, modifying the Krylov solver's tolerance helped with the LAPACK error, but I could never reproduce it outside of Anvil.

It is (most probably) dependent on this issue being fixed:

Jutho/KrylovKit.jl#57

The exact one-variable solve path is good to have! But I'd prefer it to be a separate method for better organization.

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.

LAPACKException on some QUBO examples

2 participants