diff --git a/docs/src/changelog.md b/docs/src/changelog.md index f66e30fc8..2f6c277c8 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -52,7 +52,7 @@ When releasing a new version, move the "Unreleased" changes to a new version sec ### Changed - A unified interface for Trotter-based time evolution algorithms. The old `su_iter`, `simpleupdate` functions should be replaced by `timestep`, `time_evolve` respectively -- Default fixed-point gradient algorithm changed to `:eigsolver` +- Default fixed-point gradient algorithm changed to `:EigSolver` - BoundaryMPS methods now have their own custom transfer functions, avoiding a double conjugation and twist issues for fermions - `physicalspace` and related functions now correctly handle periodic indexing for infinite networks - Updated compatibility with TensorKit v0.15 diff --git a/docs/src/examples/bose_hubbard/index.md b/docs/src/examples/bose_hubbard/index.md index b5a3e13c6..a8c4a115d 100644 --- a/docs/src/examples/bose_hubbard/index.md +++ b/docs/src/examples/bose_hubbard/index.md @@ -99,9 +99,9 @@ optimization framework in the usual way to find the ground state. So, we first s algorithms and their tolerances: ````julia -boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace)) -gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :linsolver, iterscheme = :fixed) -optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 150, ls_maxiter = 2, ls_maxfg = 2); +boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation)) +gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :LinSolver, iterscheme = :fixed) +optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, maxiter = 150, ls_maxiter = 2, ls_maxfg = 2); ```` !!! note @@ -110,7 +110,7 @@ optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 150, ls_maxiter = 2, ls the `boundary_alg`, `gradient_alg` and `optimizer_alg` settings. There rarely is a general-purpose set of settings which will always work, so instead one has to adjust the simulation settings for each specific application. For example, it might help to - switch between the CTMRG flavors `alg=:simultaneous` and `alg=:sequential` to + switch between the CTMRG flavors `alg=:SimultaneousCTMRG` and `alg=:SequentialCTMRG` to improve convergence. Of course the tolerances of the algorithms and their subalgorithms also have to be compatible. For more details on the available options, see the [`fixedpoint`](@ref) docstring. diff --git a/docs/src/examples/bose_hubbard/main.ipynb b/docs/src/examples/bose_hubbard/main.ipynb index ceb2057e8..932af0a28 100644 --- a/docs/src/examples/bose_hubbard/main.ipynb +++ b/docs/src/examples/bose_hubbard/main.ipynb @@ -156,9 +156,9 @@ "metadata": {}, "outputs": [], "source": [ - "boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace))\n", - "gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :linsolver, iterscheme = :fixed)\n", - "optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 150, ls_maxiter = 2, ls_maxfg = 2);" + "boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation))\n", + "gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :LinSolver, iterscheme = :fixed)\n", + "optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, maxiter = 150, ls_maxiter = 2, ls_maxfg = 2);" ] }, { @@ -171,7 +171,7 @@ " the `boundary_alg`, `gradient_alg` and `optimizer_alg` settings. There rarely is a\n", " general-purpose set of settings which will always work, so instead one has to adjust\n", " the simulation settings for each specific application. For example, it might help to\n", - " switch between the CTMRG flavors `alg=:simultaneous` and `alg=:sequential` to\n", + " switch between the CTMRG flavors `alg=:SimultaneousCTMRG` and `alg=:SequentialCTMRG` to\n", " improve convergence. Of course the tolerances of the algorithms and their subalgorithms\n", " also have to be compatible. For more details on the available options, see the\n", " [`fixedpoint`](@ref) docstring.\n", diff --git a/docs/src/examples/c4v_ctmrg/index.md b/docs/src/examples/c4v_ctmrg/index.md index 954f7af9c..69f149fca 100644 --- a/docs/src/examples/c4v_ctmrg/index.md +++ b/docs/src/examples/c4v_ctmrg/index.md @@ -87,10 +87,10 @@ env_random_c4v = initialize_random_c4v_env(peps₀, ComplexSpace(χ)); ```` Then contracting the PEPS using $C_{4v}$ CTMRG is as easy as just calling [`leading_boundary`](@ref) -but passing the initial PEPS and environment as well as the `alg = :c4v` keyword argument: +but passing the initial PEPS and environment as well as the `alg = :C4vCTMRG` keyword argument: ````julia -env₀, = leading_boundary(env_random_c4v, peps₀; alg = :c4v, tol = 1.0e-10); +env₀, = leading_boundary(env_random_c4v, peps₀; alg = :C4vCTMRG, tol = 1.0e-10); ```` ```` @@ -103,13 +103,13 @@ env₀, = leading_boundary(env_random_c4v, peps₀; alg = :c4v, tol = 1.0e-10); We now take `peps₀` and `env₀` as a starting point for a gradient-based energy minimization where we contract using $C_{4v}$ CTMRG such that the energy gradient will also -exhibit $C_{4v}$ symmetry. For that, we call `fixedpoint` and specify `alg = :c4v` +exhibit $C_{4v}$ symmetry. For that, we call `fixedpoint` and specify `alg = :C4vCTMRG` as the boundary contraction algorithm: ````julia H = real(heisenberg_XYZ_c4v(InfiniteSquare())) # make Hamiltonian real-valued peps, env, E, = fixedpoint( - H, peps₀, env₀; optimizer_alg = (; tol = 1.0e-4), boundary_alg = (; alg = :c4v), + H, peps₀, env₀; optimizer_alg = (; tol = 1.0e-4), boundary_alg = (; alg = :C4vCTMRG), ); ```` @@ -184,13 +184,13 @@ and optimization times, and also has vastly improved GPU performance. Notably, i that QR-CTMRG converges to the same fixed point as regular $C_{4v}$ CTMRG. In PEPSKit terms, using QR-CTMRG just amounts to switching out the projector algorithm that is -used by the [`C4vCTMRG`](@ref) algorithm to `projector_alg = :c4v_qr` (as opposed to `:c4v_eigh`). +used by the [`C4vCTMRG`](@ref) algorithm to `projector_alg = :C4vQRProjector` (as opposed to `:C4vEighProjector`). QR-CTMRG tends to need significantly more iterations to converge while still being much faster, hence we need to increase `maxiter`: ````julia env_qr₀, = leading_boundary( - env_random_c4v, peps; alg = :c4v, projector_alg = :c4v_qr, maxiter = 500, + env_random_c4v, peps; alg = :C4vCTMRG, projector_alg = :C4vQRProjector, maxiter = 500, ); ```` @@ -201,7 +201,7 @@ env_qr₀, = leading_boundary( ```` -To optimize using QR-CTMRG we proceed analogously by specifiying `projector_alg = :c4v_qr` and +To optimize using QR-CTMRG we proceed analogously by specifiying `projector_alg = :C4vQRProjector` and increasing the `maxiter` when setting the boundary algorithm parameters. We make sure to supply the `env_qr₀` initial environment because it does not use `DiagonalTensorMap`s as its corner type (only regular `eigh`-based $C_{4v}$ CTMRG produces diagonal corners): @@ -210,8 +210,8 @@ type (only regular `eigh`-based $C_{4v}$ CTMRG produces diagonal corners): peps_qr, env_qr, E_qr, = fixedpoint( H, peps₀, env_qr₀; optimizer_alg = (; tol = 1.0e-4), - boundary_alg = (; alg = :c4v, projector_alg = :c4v_qr, maxiter = 500), - gradient_alg = (; alg = :linsolver) + boundary_alg = (; alg = :C4vCTMRG, projector_alg = :C4vQRProjector, maxiter = 500), + gradient_alg = (; alg = :LinSolver) ); @show (E_qr - E_ref) / E_ref; ```` diff --git a/docs/src/examples/c4v_ctmrg/main.ipynb b/docs/src/examples/c4v_ctmrg/main.ipynb index 73a9cbb5e..536ae7e97 100644 --- a/docs/src/examples/c4v_ctmrg/main.ipynb +++ b/docs/src/examples/c4v_ctmrg/main.ipynb @@ -132,7 +132,7 @@ "cell_type": "markdown", "source": [ "Then contracting the PEPS using $C_{4v}$ CTMRG is as easy as just calling `leading_boundary`\n", - "but passing the initial PEPS and environment as well as the `alg = :c4v` keyword argument:" + "but passing the initial PEPS and environment as well as the `alg = :C4vCTMRG` keyword argument:" ], "metadata": {} }, @@ -140,7 +140,7 @@ "outputs": [], "cell_type": "code", "source": [ - "env₀, = leading_boundary(env_random_c4v, peps₀; alg = :c4v, tol = 1.0e-10);" + "env₀, = leading_boundary(env_random_c4v, peps₀; alg = :C4vCTMRG, tol = 1.0e-10);" ], "metadata": {}, "execution_count": null @@ -152,7 +152,7 @@ "\n", "We now take `peps₀` and `env₀` as a starting point for a gradient-based energy\n", "minimization where we contract using $C_{4v}$ CTMRG such that the energy gradient will also\n", - "exhibit $C_{4v}$ symmetry. For that, we call `fixedpoint` and specify `alg = :c4v`\n", + "exhibit $C_{4v}$ symmetry. For that, we call `fixedpoint` and specify `alg = :C4vCTMRG`\n", "as the boundary contraction algorithm:" ], "metadata": {} @@ -163,7 +163,7 @@ "source": [ "H = real(heisenberg_XYZ_c4v(InfiniteSquare())) # make Hamiltonian real-valued\n", "peps, env, E, = fixedpoint(\n", - " H, peps₀, env₀; optimizer_alg = (; tol = 1.0e-4), boundary_alg = (; alg = :c4v),\n", + " H, peps₀, env₀; optimizer_alg = (; tol = 1.0e-4), boundary_alg = (; alg = :C4vCTMRG),\n", ");" ], "metadata": {}, @@ -226,7 +226,7 @@ "that QR-CTMRG converges to the same fixed point as regular $C_{4v}$ CTMRG.\n", "\n", "In PEPSKit terms, using QR-CTMRG just amounts to switching out the projector algorithm that is\n", - "used by the `C4vCTMRG` algorithm to `projector_alg = :c4v_qr` (as opposed to `:c4v_eigh`).\n", + "used by the `C4vCTMRG` algorithm to `projector_alg = :C4vQRProjector` (as opposed to `:C4vEighProjector`).\n", "QR-CTMRG tends to need significantly more iterations to converge while still being much faster,\n", "hence we need to increase `maxiter`:" ], @@ -237,7 +237,7 @@ "cell_type": "code", "source": [ "env_qr₀, = leading_boundary(\n", - " env_random_c4v, peps; alg = :c4v, projector_alg = :c4v_qr, maxiter = 500,\n", + " env_random_c4v, peps; alg = :C4vCTMRG, projector_alg = :C4vQRProjector, maxiter = 500,\n", ");" ], "metadata": {}, @@ -246,7 +246,7 @@ { "cell_type": "markdown", "source": [ - "To optimize using QR-CTMRG we proceed analogously by specifiying `projector_alg = :c4v_qr` and\n", + "To optimize using QR-CTMRG we proceed analogously by specifiying `projector_alg = :C4vQRProjector` and\n", "increasing the `maxiter` when setting the boundary algorithm parameters. We make sure to supply\n", "the `env_qr₀` initial environment because it does not use `DiagonalTensorMap`s as its corner\n", "type (only regular `eigh`-based $C_{4v}$ CTMRG produces diagonal corners):" @@ -260,8 +260,8 @@ "peps_qr, env_qr, E_qr, = fixedpoint(\n", " H, peps₀, env_qr₀;\n", " optimizer_alg = (; tol = 1.0e-4),\n", - " boundary_alg = (; alg = :c4v, projector_alg = :c4v_qr, maxiter = 500),\n", - " gradient_alg = (; alg = :linsolver)\n", + " boundary_alg = (; alg = :C4vCTMRG, projector_alg = :C4vQRProjector, maxiter = 500),\n", + " gradient_alg = (; alg = :LinSolver)\n", ");\n", "@show (E_qr - E_ref) / E_ref;" ], diff --git a/docs/src/examples/fermi_hubbard/index.md b/docs/src/examples/fermi_hubbard/index.md index 71c284fe5..d0d4b4576 100644 --- a/docs/src/examples/fermi_hubbard/index.md +++ b/docs/src/examples/fermi_hubbard/index.md @@ -81,13 +81,13 @@ Again, the procedure of ground state optimization is very similar to before. Fir define all algorithmic parameters: ````julia -boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace)) -gradient_alg = (; tol = 1.0e-6, alg = :eigsolver, maxiter = 10, iterscheme = :fixed) -optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 80, ls_maxiter = 3, ls_maxfg = 3) +boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation)) +gradient_alg = (; tol = 1.0e-6, alg = :EigSolver, maxiter = 10, iterscheme = :fixed) +optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, maxiter = 80, ls_maxiter = 3, ls_maxfg = 3) ```` ```` -(tol = 0.0001, alg = :lbfgs, maxiter = 80, ls_maxiter = 3, ls_maxfg = 3) +(tol = 0.0001, alg = :LBFGS, maxiter = 80, ls_maxiter = 3, ls_maxfg = 3) ```` Second, we initialize a PEPS state and environment (which we converge) constructed from diff --git a/docs/src/examples/fermi_hubbard/main.ipynb b/docs/src/examples/fermi_hubbard/main.ipynb index 260320382..ed8273401 100644 --- a/docs/src/examples/fermi_hubbard/main.ipynb +++ b/docs/src/examples/fermi_hubbard/main.ipynb @@ -129,9 +129,9 @@ "metadata": {}, "outputs": [], "source": [ - "boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace))\n", - "gradient_alg = (; tol = 1.0e-6, alg = :eigsolver, maxiter = 10, iterscheme = :fixed)\n", - "optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 80, ls_maxiter = 3, ls_maxfg = 3)" + "boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation))\n", + "gradient_alg = (; tol = 1.0e-6, alg = :EigSolver, maxiter = 10, iterscheme = :fixed)\n", + "optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, maxiter = 80, ls_maxiter = 3, ls_maxfg = 3)" ] }, { diff --git a/docs/src/examples/heisenberg/index.md b/docs/src/examples/heisenberg/index.md index bcc11aee1..089742f7e 100644 --- a/docs/src/examples/heisenberg/index.md +++ b/docs/src/examples/heisenberg/index.md @@ -74,7 +74,7 @@ arguments. To see a description of all arguments, see the docstring of specific tolerance and during the CTMRG run keep all index dimensions fixed: ````julia -boundary_alg = (; tol = 1.0e-10, trunc = (; alg = :fixedspace)); +boundary_alg = (; tol = 1.0e-10, trunc = (; alg = :FixedSpaceTruncation)); ```` Let us also configure the optimizer algorithm. We are going to optimize the PEPS using the @@ -83,7 +83,7 @@ the convergence tolerance (for the gradient norm) as well as the maximal number and the BFGS memory size (which is used to approximate the Hessian): ````julia -optimizer_alg = (; alg = :lbfgs, tol = 1.0e-4, maxiter = 100, lbfgs_memory = 16); +optimizer_alg = (; alg = :LBFGS, tol = 1.0e-4, maxiter = 100, lbfgs_memory = 16); ```` Additionally, during optimization, we want to reuse the previous CTMRG environment to diff --git a/docs/src/examples/heisenberg/main.ipynb b/docs/src/examples/heisenberg/main.ipynb index 54fb6f083..309932184 100644 --- a/docs/src/examples/heisenberg/main.ipynb +++ b/docs/src/examples/heisenberg/main.ipynb @@ -120,7 +120,7 @@ "outputs": [], "cell_type": "code", "source": [ - "boundary_alg = (; tol = 1.0e-10, trunc = (; alg = :fixedspace));" + "boundary_alg = (; tol = 1.0e-10, trunc = (; alg = :FixedSpaceTruncation));" ], "metadata": {}, "execution_count": null @@ -139,7 +139,7 @@ "outputs": [], "cell_type": "code", "source": [ - "optimizer_alg = (; alg = :lbfgs, tol = 1.0e-4, maxiter = 100, lbfgs_memory = 16);" + "optimizer_alg = (; alg = :LBFGS, tol = 1.0e-4, maxiter = 100, lbfgs_memory = 16);" ], "metadata": {}, "execution_count": null diff --git a/docs/src/examples/heisenberg_su/index.md b/docs/src/examples/heisenberg_su/index.md index 1225f06c4..4dd700f22 100644 --- a/docs/src/examples/heisenberg_su/index.md +++ b/docs/src/examples/heisenberg_su/index.md @@ -142,8 +142,8 @@ trunc_env = truncerror(; atol = 1.0e-10) & truncrank(χenv) env, = leading_boundary( env₀, peps; - alg = :sequential, - projector_alg = :fullinfinite, + alg = :SequentialCTMRG, + projector_alg = :FullInfiniteProjector, tol = 1.0e-10, trunc = trunc_env, ); diff --git a/docs/src/examples/heisenberg_su/main.ipynb b/docs/src/examples/heisenberg_su/main.ipynb index f762d6db9..55721abe4 100644 --- a/docs/src/examples/heisenberg_su/main.ipynb +++ b/docs/src/examples/heisenberg_su/main.ipynb @@ -152,8 +152,8 @@ "env, = leading_boundary(\n", " env₀,\n", " peps;\n", - " alg = :sequential,\n", - " projector_alg = :fullinfinite,\n", + " alg = :SequentialCTMRG,\n", + " projector_alg = :FullInfiniteProjector,\n", " tol = 1.0e-10,\n", " trunc = trunc_env,\n", ");" diff --git a/docs/src/examples/hubbard_su/index.md b/docs/src/examples/hubbard_su/index.md index 32a590e4d..9157a46d7 100644 --- a/docs/src/examples/hubbard_su/index.md +++ b/docs/src/examples/hubbard_su/index.md @@ -133,7 +133,7 @@ normalize!.(peps.A, Inf) env = CTMRGEnv(wts) for χ in [χenv₀, χenv] global env, = leading_boundary( - env, peps; alg = :sequential, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ) + env, peps; alg = :SequentialCTMRG, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ) ) end ```` diff --git a/docs/src/examples/hubbard_su/main.ipynb b/docs/src/examples/hubbard_su/main.ipynb index 428ccd5e1..9e66747f5 100644 --- a/docs/src/examples/hubbard_su/main.ipynb +++ b/docs/src/examples/hubbard_su/main.ipynb @@ -143,7 +143,7 @@ "env = CTMRGEnv(wts)\n", "for χ in [χenv₀, χenv]\n", " global env, = leading_boundary(\n", - " env, peps; alg = :sequential, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ)\n", + " env, peps; alg = :SequentialCTMRG, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ)\n", " )\n", "end" ], diff --git a/docs/src/examples/j1j2_su/index.md b/docs/src/examples/j1j2_su/index.md index 5edd3051e..5f450fc18 100644 --- a/docs/src/examples/j1j2_su/index.md +++ b/docs/src/examples/j1j2_su/index.md @@ -314,7 +314,7 @@ normalize!.(peps.A, Inf) ## normalize each PEPS tensor by largest element trunc_env = truncerror(; atol = 1.0e-10) & truncrank(χenv) Espace = Vect[U1Irrep](0 => χenv ÷ 2, 1 // 2 => χenv ÷ 4, -1 // 2 => χenv ÷ 4) env₀ = CTMRGEnv(rand, Float64, peps, Espace) -env, = leading_boundary(env₀, peps; tol = 1.0e-10, alg = :sequential, trunc = trunc_env); +env, = leading_boundary(env₀, peps; tol = 1.0e-10, alg = :SequentialCTMRG, trunc = trunc_env); E = expectation_value(peps, H, env) / (Nr * Nc) ```` diff --git a/docs/src/examples/j1j2_su/main.ipynb b/docs/src/examples/j1j2_su/main.ipynb index 67086a16f..b90d577d1 100644 --- a/docs/src/examples/j1j2_su/main.ipynb +++ b/docs/src/examples/j1j2_su/main.ipynb @@ -144,7 +144,7 @@ "trunc_env = truncerror(; atol = 1.0e-10) & truncrank(χenv)\n", "Espace = Vect[U1Irrep](0 => χenv ÷ 2, 1 // 2 => χenv ÷ 4, -1 // 2 => χenv ÷ 4)\n", "env₀ = CTMRGEnv(rand, Float64, peps, Espace)\n", - "env, = leading_boundary(env₀, peps; tol = 1.0e-10, alg = :sequential, trunc = trunc_env);\n", + "env, = leading_boundary(env₀, peps; tol = 1.0e-10, alg = :SequentialCTMRG, trunc = trunc_env);\n", "E = expectation_value(peps, H, env) / (Nr * Nc)" ] }, diff --git a/docs/src/examples/xxz/index.md b/docs/src/examples/xxz/index.md index bc2f10dc0..18d7c9178 100644 --- a/docs/src/examples/xxz/index.md +++ b/docs/src/examples/xxz/index.md @@ -84,9 +84,9 @@ From this point onwards it's business as usual: Create an initial PEPS and envir (using the symmetric spaces), specify the algorithmic parameters and optimize: ````julia -boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace)) -gradient_alg = (; tol = 1.0e-6, alg = :eigsolver, maxiter = 10, iterscheme = :fixed) -optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 85, ls_maxiter = 3, ls_maxfg = 3) +boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation)) +gradient_alg = (; tol = 1.0e-6, alg = :EigSolver, maxiter = 10, iterscheme = :fixed) +optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, maxiter = 85, ls_maxiter = 3, ls_maxfg = 3) peps₀ = InfinitePEPS(randn, ComplexF64, physical_spaces, virtual_spaces) env₀, = leading_boundary(CTMRGEnv(peps₀, V_env), peps₀; boundary_alg...); diff --git a/docs/src/examples/xxz/main.ipynb b/docs/src/examples/xxz/main.ipynb index 319cc86e2..d16f13ec6 100644 --- a/docs/src/examples/xxz/main.ipynb +++ b/docs/src/examples/xxz/main.ipynb @@ -130,9 +130,9 @@ "metadata": {}, "outputs": [], "source": [ - "boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace))\n", - "gradient_alg = (; tol = 1.0e-6, alg = :eigsolver, maxiter = 10, iterscheme = :fixed)\n", - "optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 85, ls_maxiter = 3, ls_maxfg = 3)\n", + "boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation))\n", + "gradient_alg = (; tol = 1.0e-6, alg = :EigSolver, maxiter = 10, iterscheme = :fixed)\n", + "optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, maxiter = 85, ls_maxiter = 3, ls_maxfg = 3)\n", "\n", "peps₀ = InfinitePEPS(randn, ComplexF64, physical_spaces, virtual_spaces)\n", "env₀, = leading_boundary(CTMRGEnv(peps₀, V_env), peps₀; boundary_alg...);" diff --git a/docs/src/man/multithreading.md b/docs/src/man/multithreading.md index 4258daa11..ff4defed4 100644 --- a/docs/src/man/multithreading.md +++ b/docs/src/man/multithreading.md @@ -15,6 +15,6 @@ set_scheduler! By default, the OhMyThreads machinery will be used to parallelize certain parts of the code, if Julia started with multiple threads. Cases where PEPSKit can leverage parallel threads are: -- CTMRG steps using the `:simultaneous` scheme, where we parallelize over all unit cell coordinates and spatial directions +- CTMRG steps using the `:SimultaneousCTMRG` scheme, where we parallelize over all unit cell coordinates and spatial directions - The reverse pass of these parallelized CTMRG steps - Evaluating expectation values of observables, where we parallelize over the terms contained in the [`LocalOperator`](@ref PEPSKit.LocalOperator) diff --git a/docs/src/man/precompilation.md b/docs/src/man/precompilation.md index b1977ec64..b464fabe7 100644 --- a/docs/src/man/precompilation.md +++ b/docs/src/man/precompilation.md @@ -58,8 +58,8 @@ using PrecompileTools # Algorithmic settings ctmrg_algs = [ - SimultaneousCTMRG(; maxiter, projector_alg=:halfinfinite, verbosity), - SequentialCTMRG(; maxiter, projector_alg=:halfinfinite, verbosity), + SimultaneousCTMRG(; maxiter, projector_alg=:HalfInfiniteProjector, verbosity), + SequentialCTMRG(; maxiter, projector_alg=:HalfInfiniteProjector, verbosity), ] gradient_algs = [ LinSolver(; solver_alg=BiCGStab(; tol=gradtol)), diff --git a/examples/bose_hubbard/main.jl b/examples/bose_hubbard/main.jl index 4d1dd420e..b72ca0ad2 100644 --- a/examples/bose_hubbard/main.jl +++ b/examples/bose_hubbard/main.jl @@ -87,9 +87,9 @@ optimization framework in the usual way to find the ground state. So, we first s algorithms and their tolerances: """ -boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace)) -gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :linsolver) -optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 150, ls_maxiter = 2, ls_maxfg = 2); +boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation)) +gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :LinSolver) +optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, maxiter = 150, ls_maxiter = 2, ls_maxfg = 2); md""" !!! note @@ -98,7 +98,7 @@ md""" the `boundary_alg`, `gradient_alg` and `optimizer_alg` settings. There rarely is a general-purpose set of settings which will always work, so instead one has to adjust the simulation settings for each specific application. For example, it might help to - switch between the CTMRG flavors `alg=:simultaneous` and `alg=:sequential` to + switch between the CTMRG flavors `alg=:SimultaneousCTMRG` and `alg=:SequentialCTMRG` to improve convergence. Of course the tolerances of the algorithms and their subalgorithms also have to be compatible. For more details on the available options, see the [`fixedpoint`](@ref) docstring. diff --git a/examples/c4v_ctmrg/main.jl b/examples/c4v_ctmrg/main.jl index 57c1f5322..7f1e0cdec 100644 --- a/examples/c4v_ctmrg/main.jl +++ b/examples/c4v_ctmrg/main.jl @@ -80,23 +80,23 @@ env_random_c4v = initialize_random_c4v_env(peps₀, ComplexSpace(χ)); md""" Then contracting the PEPS using $C_{4v}$ CTMRG is as easy as just calling [`leading_boundary`](@ref) -but passing the initial PEPS and environment as well as the `alg = :c4v` keyword argument: +but passing the initial PEPS and environment as well as the `alg = :C4vCTMRG` keyword argument: """ -env₀, = leading_boundary(env_random_c4v, peps₀; alg = :c4v, tol = 1.0e-10); +env₀, = leading_boundary(env_random_c4v, peps₀; alg = :C4vCTMRG, tol = 1.0e-10); md""" ## C₄ᵥ-symmetric optimization We now take `peps₀` and `env₀` as a starting point for a gradient-based energy minimization where we contract using $C_{4v}$ CTMRG such that the energy gradient will also -exhibit $C_{4v}$ symmetry. For that, we call `fixedpoint` and specify `alg = :c4v` +exhibit $C_{4v}$ symmetry. For that, we call `fixedpoint` and specify `alg = :C4vCTMRG` as the boundary contraction algorithm: """ H = real(heisenberg_XYZ_c4v(InfiniteSquare())) # make Hamiltonian real-valued peps, env, E, = fixedpoint( - H, peps₀, env₀; optimizer_alg = (; tol = 1.0e-4), boundary_alg = (; alg = :c4v), + H, peps₀, env₀; optimizer_alg = (; tol = 1.0e-4), boundary_alg = (; alg = :C4vCTMRG), ); md""" @@ -134,17 +134,17 @@ and optimization times, and also has vastly improved GPU performance. Notably, i that QR-CTMRG converges to the same fixed point as regular $C_{4v}$ CTMRG. In PEPSKit terms, using QR-CTMRG just amounts to switching out the projector algorithm that is -used by the [`C4vCTMRG`](@ref) algorithm to `projector_alg = :c4v_qr` (as opposed to `:c4v_eigh`). +used by the [`C4vCTMRG`](@ref) algorithm to `projector_alg = :C4vQRProjector` (as opposed to `:C4vEighProjector`). QR-CTMRG tends to need significantly more iterations to converge while still being much faster, hence we need to increase `maxiter`: """ env_qr₀, = leading_boundary( - env_random_c4v, peps; alg = :c4v, projector_alg = :c4v_qr, maxiter = 500, + env_random_c4v, peps; alg = :C4vCTMRG, projector_alg = :C4vQRProjector, maxiter = 500, ); md""" -To optimize using QR-CTMRG we proceed analogously by specifiying `projector_alg = :c4v_qr` and +To optimize using QR-CTMRG we proceed analogously by specifiying `projector_alg = :C4vQRProjector` and increasing the `maxiter` when setting the boundary algorithm parameters. We make sure to supply the `env_qr₀` initial environment because it does not use `DiagonalTensorMap`s as its corner type (only regular `eigh`-based $C_{4v}$ CTMRG produces diagonal corners): @@ -153,7 +153,7 @@ type (only regular `eigh`-based $C_{4v}$ CTMRG produces diagonal corners): peps_qr, env_qr, E_qr, = fixedpoint( H, peps₀, env_qr₀; optimizer_alg = (; tol = 1.0e-4), - boundary_alg = (; alg = :c4v, projector_alg = :c4v_qr, maxiter = 500), - gradient_alg = (; alg = :linsolver) + boundary_alg = (; alg = :C4vCTMRG, projector_alg = :C4vQRProjector, maxiter = 500), + gradient_alg = (; alg = :LinSolver) ); @show (E_qr - E_ref) / E_ref; diff --git a/examples/fermi_hubbard/main.jl b/examples/fermi_hubbard/main.jl index 0517bc7c3..f9373fc2a 100644 --- a/examples/fermi_hubbard/main.jl +++ b/examples/fermi_hubbard/main.jl @@ -70,9 +70,9 @@ Again, the procedure of ground state optimization is very similar to before. Fir define all algorithmic parameters: """ -boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace)) -gradient_alg = (; tol = 1.0e-6, alg = :eigsolver, maxiter = 10, iterscheme = :fixed) -optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 80, ls_maxiter = 3, ls_maxfg = 3) +boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation)) +gradient_alg = (; tol = 1.0e-6, alg = :EigSolver, maxiter = 10, iterscheme = :fixed) +optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, maxiter = 80, ls_maxiter = 3, ls_maxfg = 3) md""" Second, we initialize a PEPS state and environment (which we converge) constructed from diff --git a/examples/heisenberg/main.jl b/examples/heisenberg/main.jl index 3f0139126..5f571d4ec 100644 --- a/examples/heisenberg/main.jl +++ b/examples/heisenberg/main.jl @@ -63,7 +63,7 @@ arguments. To see a description of all arguments, see the docstring of specific tolerance and during the CTMRG run keep all index dimensions fixed: """ -boundary_alg = (; tol = 1.0e-10, trunc = (; alg = :fixedspace)); +boundary_alg = (; tol = 1.0e-10, trunc = (; alg = :FixedSpaceTruncation)); md""" Let us also configure the optimizer algorithm. We are going to optimize the PEPS using the @@ -72,7 +72,7 @@ the convergence tolerance (for the gradient norm) as well as the maximal number and the BFGS memory size (which is used to approximate the Hessian): """ -optimizer_alg = (; alg = :lbfgs, tol = 1.0e-4, maxiter = 100, lbfgs_memory = 16); +optimizer_alg = (; alg = :LBFGS, tol = 1.0e-4, maxiter = 100, lbfgs_memory = 16); md""" Additionally, during optimization, we want to reuse the previous CTMRG environment to diff --git a/examples/heisenberg_su/main.jl b/examples/heisenberg_su/main.jl index bdc6f2e08..00d0eb100 100644 --- a/examples/heisenberg_su/main.jl +++ b/examples/heisenberg_su/main.jl @@ -94,8 +94,8 @@ trunc_env = truncerror(; atol = 1.0e-10) & truncrank(χenv) env, = leading_boundary( env₀, peps; - alg = :sequential, - projector_alg = :fullinfinite, + alg = :SequentialCTMRG, + projector_alg = :FullInfiniteProjector, tol = 1.0e-10, trunc = trunc_env, ); diff --git a/examples/hubbard_su/main.jl b/examples/hubbard_su/main.jl index 2bb0f411c..71b72aad8 100644 --- a/examples/hubbard_su/main.jl +++ b/examples/hubbard_su/main.jl @@ -86,7 +86,7 @@ normalize!.(peps.A, Inf) env = CTMRGEnv(wts) for χ in [χenv₀, χenv] global env, = leading_boundary( - env, peps; alg = :sequential, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ) + env, peps; alg = :SequentialCTMRG, tol = 1.0e-8, maxiter = 50, trunc = truncrank(χ) ) end diff --git a/examples/j1j2_su/main.jl b/examples/j1j2_su/main.jl index acb201084..dbcda4b4a 100644 --- a/examples/j1j2_su/main.jl +++ b/examples/j1j2_su/main.jl @@ -85,7 +85,7 @@ normalize!.(peps.A, Inf) ## normalize each PEPS tensor by largest element trunc_env = truncerror(; atol = 1.0e-10) & truncrank(χenv) Espace = Vect[U1Irrep](0 => χenv ÷ 2, 1 // 2 => χenv ÷ 4, -1 // 2 => χenv ÷ 4) env₀ = CTMRGEnv(rand, Float64, peps, Espace) -env, = leading_boundary(env₀, peps; tol = 1.0e-10, alg = :sequential, trunc = trunc_env); +env, = leading_boundary(env₀, peps; tol = 1.0e-10, alg = :SequentialCTMRG, trunc = trunc_env); E = expectation_value(peps, H, env) / (Nr * Nc) md""" diff --git a/examples/xxz/main.jl b/examples/xxz/main.jl index 234b0479f..b2cf35814 100644 --- a/examples/xxz/main.jl +++ b/examples/xxz/main.jl @@ -71,9 +71,9 @@ From this point onwards it's business as usual: Create an initial PEPS and envir (using the symmetric spaces), specify the algorithmic parameters and optimize: """ -boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, trunc = (; alg = :fixedspace)) -gradient_alg = (; tol = 1.0e-6, alg = :eigsolver, maxiter = 10, iterscheme = :fixed) -optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, maxiter = 85, ls_maxiter = 3, ls_maxfg = 3) +boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation)) +gradient_alg = (; tol = 1.0e-6, alg = :EigSolver, maxiter = 10, iterscheme = :fixed) +optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, maxiter = 85, ls_maxiter = 3, ls_maxfg = 3) peps₀ = InfinitePEPS(randn, ComplexF64, physical_spaces, virtual_spaces) env₀, = leading_boundary(CTMRGEnv(peps₀, V_env), peps₀; boundary_alg...); diff --git a/src/Defaults.jl b/src/Defaults.jl index c7db81158..6cd0ca652 100644 --- a/src/Defaults.jl +++ b/src/Defaults.jl @@ -9,19 +9,20 @@ Module containing default algorithm parameter values and arguments. * `ctmrg_maxiter=$(Defaults.ctmrg_maxiter)` : Maximal number of CTMRG iterations per run. * `ctmrg_miniter=$(Defaults.ctmrg_miniter)` : Minimal number of CTMRG carried out. * `ctmrg_alg=:$(Defaults.ctmrg_alg)` : Default CTMRG algorithm variant. - - `:simultaneous` : Simultaneous expansion and renormalization of all sides. - - `:sequential` : Sequential application of left moves and rotations. + - `:SimultaneousCTMRG` : Simultaneous expansion and renormalization of all sides. + - `:SequentialCTMRG` : Sequential application of left moves and rotations. * `ctmrg_verbosity=$(Defaults.ctmrg_verbosity)` : CTMRG output information verbosity ## SVD forward & reverse * `trunc=:$(Defaults.trunc)` : Truncation scheme for SVDs and other decompositions. - - `:fixedspace` : Keep virtual spaces fixed during projection + - `:FixedSpaceTruncation` : Keep virtual spaces fixed during projection - `:notrunc` : No singular values are truncated and the performed SVDs are exact - `:truncerror` : Additionally supply error threshold `η`; truncate to the maximal virtual dimension of `η` - `:truncrank` : Additionally supply truncation dimension `η`; truncate such that the 2-norm of the truncated values is smaller than `η` - `:truncspace` : Additionally supply truncation space `η`; truncate according to the supplied vector space - `:trunctol` : Additionally supply singular value cutoff `η`; truncate such that every retained singular value is larger than `η` + * `rrule_degeneracy_atol=$(Defaults.rrule_degeneracy_atol)` : Broadening amplitude which smoothens the divergent term in the retained contributions of an SVD or eigh pullback, in case of (pseudo) degenerate singular values @@ -33,7 +34,7 @@ Module containing default algorithm parameter values and arguments. - `:Jacobi` : MatrixAlgebraKit's [`Jacobi`](@extref MatrixAlgebraKit.Jacobi) - `:SVDViaPolar` : MatrixAlgebraKit's [`SVDViaPolar`](@extref MatrixAlgebraKit.SVDViaPolar) - `:SafeDivideAndConquer` : MatrixAlgebraKit's [`SafeDivideAndConquer`](@extref MatrixAlgebraKit.SafeDivideAndConquer) - - `:iterative` : Iterative Krylov-based SVD only computing the specifed number of + - `:GKL` : Iterative Krylov-based SVD only computing the specifed number of singular values and vectors, see [`IterSVD`](@ref PEPSKit.IterSVD) for details. * `svd_rrule_tol=$(Defaults.svd_rrule_tol)` : Accuracy of SVD reverse-rule. * `svd_rrule_min_krylovdim=$(Defaults.svd_rrule_min_krylovdim)` : Minimal Krylov dimension of the reverse-rule algorithm (if it is a Krylov algorithm). @@ -41,9 +42,9 @@ Module containing default algorithm parameter values and arguments. * `svd_rrule_alg=:$(Defaults.svd_rrule_alg)` : Reverse-rule algorithm for the SVD gradient. - `:full` : MatrixAlgebraKit's [`svd_pullback!`](@extref MatrixAlgebraKit.svd_pullback!) that requires access to the full spectrum - `:trunc` : MatrixAlgebraKit's [`svd_trunc_pullback!`](@extref MatrixAlgebraKit.svd_trunc_pullback!) solving a Sylvester equation on the truncated subspace - - `:gmres` : GMRES iterative linear solver, see [`KrylovKit.GMRES`](@extref) - - `:bicgstab` : BiCGStab iterative linear solver, see [`KrylovKit.BiCGStab`](@extref) - - `:arnoldi` : Arnoldi Krylov algorithm, see the [`KrylovKit.Arnoldi`](@extref) + - `:GMRES` : GMRES iterative linear solver, see [`KrylovKit.GMRES`](@extref) + - `:BiCGStab` : BiCGStab iterative linear solver, see [`KrylovKit.BiCGStab`](@extref) + - `:Arnoldi` : Arnoldi Krylov algorithm, see the [`KrylovKit.Arnoldi`](@extref) ## `eigh` forward & reverse @@ -64,12 +65,12 @@ Module containing default algorithm parameter values and arguments. ## Projectors * `projector_alg=:$(Defaults.projector_alg)` : Default variant of the CTMRG projector algorithm. - - `:halfinfinite` : Projection via SVDs of half-infinite (two enlarged corners) CTMRG environments. - - `:fullinfinite` : Projection via SVDs of full-infinite (all four enlarged corners) CTMRG environments. + - `:HalfInfiniteProjector` : Projection via SVDs of half-infinite (two enlarged corners) CTMRG environments. + - `:FullInfiniteProjector` : Projection via SVDs of full-infinite (all four enlarged corners) CTMRG environments. * `projector_verbosity=$(Defaults.projector_verbosity)` : Projector output information verbosity. * `projector_alg_c4v=:$(Defaults.projector_alg_c4v)` : Default variant of the C4v CTMRG projector algorithm. - - `:c4v_eigh` : Projection via truncated Eigh of an enlarged corner. - - `:c4v_qr` : Projection via QR decomposition of a column-enlarged corner. + - `:C4vEighProjector` : Projection via truncated Eigh of an enlarged corner. + - `:C4vQRProjector` : Projection via QR decomposition of a column-enlarged corner. ## Fixed-point gradient @@ -77,10 +78,10 @@ Module containing default algorithm parameter values and arguments. * `gradient_maxiter=$(Defaults.gradient_maxiter)` : Maximal number of iterations for computing the CTMRG fixed-point gradient. * `gradient_verbosity=$(Defaults.gradient_verbosity)` : Gradient output information verbosity. * `gradient_linsolver=:$(Defaults.gradient_linsolver)` : Default linear solver for the `LinSolver` gradient algorithm. - - `:gmres` : GMRES iterative linear solver, see [`KrylovKit.GMRES`](@extref) for details - - `:bicgstab` : BiCGStab iterative linear solver, see [`KrylovKit.BiCGStab`](@extref) for details + - `:GMRES` : GMRES iterative linear solver, see [`KrylovKit.GMRES`](@extref) for details + - `:BiCGStab` : BiCGStab iterative linear solver, see [`KrylovKit.BiCGStab`](@extref) for details * `gradient_eigsolver=:$(Defaults.gradient_eigsolver)` : Default eigensolver for the `EigSolver` gradient algorithm. - - `:arnoldi` : Arnoldi Krylov algorithm, see [`KrylovKit.Arnoldi`](@extref) for details + - `:Arnoldi` : Arnoldi Krylov algorithm, see [`KrylovKit.Arnoldi`](@extref) for details * `gradient_eigsolver_eager=$(Defaults.gradient_eigsolver_eager)` : Enables `EigSolver` algorithm to finish before the full Krylov dimension is reached. * `gradient_iterscheme=:$(Defaults.gradient_iterscheme)` : Scheme for differentiating one CTMRG iteration. - `:fixed` : the differentiated CTMRG iteration uses a pre-computed SVD with a fixed set of gauges @@ -93,9 +94,9 @@ Module containing default algorithm parameter values and arguments. * `optimizer_maxiter=$(Defaults.optimizer_maxiter)` : Maximal number of optimization steps. * `optimizer_verbosity=$(Defaults.optimizer_verbosity)` : Optimizer output information verbosity. * `optimizer_alg=:$(Defaults.optimizer_alg)` : Default `OptimKit.OptimizerAlgorithm` for PEPS optimization. - - `:gradientdescent` : Gradient descent algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) - - `:conjugategradient` : Conjugate gradient algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) - - `:lbfgs` : L-BFGS algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) + - `:GradientDescent` : Gradient descent algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) + - `:ConjugateGradient` : Conjugate gradient algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) + - `:LBFGS` : L-BFGS algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) * `ls_maxiter=$(Defaults.ls_maxiter)` : Maximum number of iterations for the line search in each step of the optimization. * `ls_maxfg=$(Defaults.ls_maxfg)` : Maximum number of function evaluations for the line search in each step of the optimization. * `lbfgs_memory=$(Defaults.lbfgs_memory)` : Size of limited memory representation of BFGS Hessian matrix. @@ -114,18 +115,18 @@ using OhMyThreads const ctmrg_tol = 1.0e-8 const ctmrg_maxiter = 100 const ctmrg_miniter = 4 -const ctmrg_alg = :simultaneous # ∈ {:simultaneous, :sequential} +const ctmrg_alg = :SimultaneousCTMRG # ∈ {:SimultaneousCTMRG, :SequentialCTMRG} const ctmrg_verbosity = 2 const sparse = false # TODO: implement sparse CTMRG # SVD forward & reverse -const trunc = :fixedspace # ∈ {:fixedspace, :notrunc, :truncerror, :truncspace, :trunctol} +const trunc = :FixedSpaceTruncation # ∈ {:FixedSpaceTruncation, :notrunc, :truncerror, :truncspace, :trunctol} const rrule_degeneracy_atol = 1.0e-13 -const svd_fwd_alg = :DefaultAlgorithm # ∈ {:, :iterative} +const svd_fwd_alg = :DefaultAlgorithm # ∈ {:, :GKL} const svd_rrule_tol = ctmrg_tol const svd_rrule_min_krylovdim = 48 const svd_rrule_verbosity = -1 -const svd_rrule_alg = :full # ∈ {:full, :trunc, :gmres, :bicgstab, :arnoldi} +const svd_rrule_alg = :full # ∈ {:full, :trunc, :GMRES, :BiCGStab, :Arnoldi} const krylovdim_factor = 1.4 # eigh forward & reverse @@ -140,26 +141,26 @@ const qr_rrule_alg = :qr const qr_rrule_verbosity = 0 # Projectors -const projector_alg = :halfinfinite # ∈ {:halfinfinite, :fullinfinite} +const projector_alg = :HalfInfiniteProjector # ∈ {:HalfInfiniteProjector, :FullInfiniteProjector} const projector_verbosity = 0 -const projector_alg_c4v = :c4v_eigh # ∈ {:c4v_eigh, :c4v_qr} +const projector_alg_c4v = :C4vEighProjector # ∈ {:C4vEighProjector, :C4vQRProjector} # Fixed-point gradient const gradient_tol = 1.0e-6 const gradient_maxiter = 30 const gradient_verbosity = -1 -const gradient_linsolver = :bicgstab # ∈ {:gmres, :bicgstab} -const gradient_eigsolver = :arnoldi +const gradient_linsolver = :BiCGStab # ∈ {:GMRES, :BiCGStab} +const gradient_eigsolver = :Arnoldi const gradient_eigsolver_eager = true const gradient_iterscheme = :fixed -const gradient_alg = :eigsolver # ∈ {:geomsum, :manualiter, :linsolver, :eigsolver} +const gradient_alg = :EigSolver # ∈ {:GeomSum, :ManualIter, :LinSolver, :EigSolver} # Optimization const reuse_env = true const optimizer_tol = 1.0e-4 const optimizer_maxiter = 100 const optimizer_verbosity = 3 -const optimizer_alg = :lbfgs # ∈ {:gradientdescent, :conjugategradient, :lbfgs} +const optimizer_alg = :LBFGS # ∈ {:GradientDescent, :ConjugateGradient, :LBFGS} const ls_maxiter = 10 const ls_maxfg = 20 const lbfgs_memory = 20 diff --git a/src/algorithms/ctmrg/c4v.jl b/src/algorithms/ctmrg/c4v.jl index 777bd4b27..3cd201d89 100644 --- a/src/algorithms/ctmrg/c4v.jl +++ b/src/algorithms/ctmrg/c4v.jl @@ -32,9 +32,9 @@ struct C4vCTMRG{P <: ProjectorAlgorithm} <: CTMRGAlgorithm projector_alg::P end function C4vCTMRG(; kwargs...) - return CTMRGAlgorithm(; alg = :c4v, kwargs...) + return CTMRGAlgorithm(; alg = :C4vCTMRG, kwargs...) end -CTMRG_SYMBOLS[:c4v] = C4vCTMRG +CTMRG_SYMBOLS[:C4vCTMRG] = C4vCTMRG """ $(TYPEDEF) @@ -53,7 +53,7 @@ Construct the C₄ᵥ `eigh`-based projector algorithm based on the following ke * `decomposition_alg::Union{<:EighAdjoint,NamedTuple}=EighAdjoint()` : `eigh` algorithm including the reverse rule. See [`EighAdjoint`](@ref). * `trunc::Union{TruncationStrategy,NamedTuple}=(; alg::Symbol=:$(Defaults.trunc))` : Truncation strategy for the projector computation, which controls the resulting virtual spaces. Here, `alg` can be one of the following: - - `:fixedspace` : Keep virtual spaces fixed during projection + - `:FixedSpaceTruncation` : Keep virtual spaces fixed during projection - `:notrunc` : No singular values are truncated and the performed SVDs are exact - `:truncerror` : Additionally supply error threshold `η`; truncate to the maximal virtual dimension of `η` - `:truncrank` : Additionally supply truncation dimension `η`; truncate such that the 2-norm of the truncated values is smaller than `η` @@ -69,9 +69,9 @@ struct C4vEighProjector{S <: EighAdjoint, T} <: ProjectorAlgorithm verbosity::Int end function C4vEighProjector(; kwargs...) - return ProjectorAlgorithm(; alg = :c4v_eigh, kwargs...) + return ProjectorAlgorithm(; alg = :C4vEighProjector, kwargs...) end -PROJECTOR_SYMBOLS[:c4v_eigh] = C4vEighProjector +PROJECTOR_SYMBOLS[:C4vEighProjector] = C4vEighProjector """ $(TYPEDEF) @@ -95,9 +95,9 @@ struct C4vQRProjector{S} <: ProjectorAlgorithm decomposition_alg::S end function C4vQRProjector(; kwargs...) - return ProjectorAlgorithm(; alg = :c4v_qr, kwargs...) + return ProjectorAlgorithm(; alg = :C4vQRProjector, kwargs...) end -PROJECTOR_SYMBOLS[:c4v_qr] = C4vQRProjector +PROJECTOR_SYMBOLS[:C4vQRProjector] = C4vQRProjector decomposition_algorithm(alg::C4vQRProjector) = alg.decomposition_alg diff --git a/src/algorithms/ctmrg/ctmrg.jl b/src/algorithms/ctmrg/ctmrg.jl index fb6155143..57e7a901d 100644 --- a/src/algorithms/ctmrg/ctmrg.jl +++ b/src/algorithms/ctmrg/ctmrg.jl @@ -28,7 +28,7 @@ function CTMRGAlgorithm(; alg_type = CTMRG_SYMBOLS[alg] # parse CTMRG projector algorithm - if alg == :c4v && projector_alg == Defaults.projector_alg + if alg == :C4vCTMRG && projector_alg == Defaults.projector_alg projector_alg = Defaults.projector_alg_c4v end # check for full decomposition algorithm specification, otherwise interpret as forward alg @@ -71,24 +71,24 @@ supplied via the keyword arguments or directly as an [`CTMRGAlgorithm`](@ref) st 3. Iteration info 4. Debug info * `alg::Symbol=:$(Defaults.ctmrg_alg)` : Variant of the CTMRG algorithm. See also [`CTMRGAlgorithm`](@ref). - - `:simultaneous` : Simultaneous expansion and renormalization of all sides. - - `:sequential` : Sequential application of left moves and rotations. - - `:c4v` : CTMRG assuming C₄ᵥ-symmetric PEPS and environment. + - `:SimultaneousCTMRG` : Simultaneous expansion and renormalization of all sides. + - `:SequentialCTMRG` : Sequential application of left moves and rotations. + - `:C4vCTMRG` : CTMRG assuming C₄ᵥ-symmetric PEPS and environment. ### Projector algorithm * `trunc::Union{TruncationStrategy,NamedTuple}=(; alg::Symbol=:$(Defaults.trunc))` : Truncation strategy for the projector computation, which controls the resulting virtual spaces. Here, `alg` can be one of the following: - - `:fixedspace` : Keep virtual spaces fixed during projection + - `:FixedSpaceTruncation` : Keep virtual spaces fixed during projection - `:notrunc` : No singular values are truncated and the performed SVDs are exact - `:truncerror` : Additionally supply error threshold `η`; truncate to the maximal virtual dimension of `η` - `:truncrank` : Additionally supply truncation dimension `η`; truncate such that the 2-norm of the truncated values is smaller than `η` - `:truncspace` : Additionally supply truncation space `η`; truncate according to the supplied vector space - `:trunctol` : Additionally supply singular value cutoff `η`; truncate such that every retained singular value is larger than `η` * `projector_alg::Symbol=:$(Defaults.projector_alg)` : Variant of the projector algorithm. See also [`ProjectorAlgorithm`](@ref). - - `:halfinfinite` : Projection via SVDs of half-infinite (two enlarged corners) CTMRG environments. - - `:fullinfinite` : Projection via SVDs of full-infinite (all four enlarged corners) CTMRG environments. - - `:c4v_eigh` : Projection via `eigh` of the Hermitian enlarged corner, works only for [`C4vCTMRG`](@ref). - - `:c4v_qr` : Projection via QR decomposition of the lower-rank column-enlarged corner, works only for [`C4vCTMRG`](@ref). + - `:HalfInfiniteProjector` : Projection via SVDs of half-infinite (two enlarged corners) CTMRG environments. + - `:FullInfiniteProjector` : Projection via SVDs of full-infinite (all four enlarged corners) CTMRG environments. + - `:C4vEighProjector` : Projection via `eigh` of the Hermitian enlarged corner, works only for [`C4vCTMRG`](@ref). + - `:C4vQRProjector` : Projection via QR decomposition of the lower-rank column-enlarged corner, works only for [`C4vCTMRG`](@ref). * `decomposition_alg::Union{NamedTuple,<:SVDAdjoint,<:EighAdjoint,<:QRAdjoint}` : Tensor decomposition algorithm used for computing projectors. When specified as a `NamedTuple`, the settings are passed a the forward algorithm to the appropriate decomposition diff --git a/src/algorithms/ctmrg/projectors.jl b/src/algorithms/ctmrg/projectors.jl index b49b542d4..bd81041b1 100644 --- a/src/algorithms/ctmrg/projectors.jl +++ b/src/algorithms/ctmrg/projectors.jl @@ -25,16 +25,16 @@ function ProjectorAlgorithm(; # parse SVD forward & rrule algorithm - decomposition_algorithm = if alg in [:halfinfinite, :fullinfinite] + decomposition_algorithm = if alg in [:HalfInfiniteProjector, :FullInfiniteProjector] _alg_or_nt(SVDAdjoint, decomposition_alg) - elseif alg in [:c4v_eigh] + elseif alg in [:C4vEighProjector] _alg_or_nt(EighAdjoint, decomposition_alg) - elseif alg in [:c4v_qr] + elseif alg in [:C4vQRProjector] _alg_or_nt(QRAdjoint, decomposition_alg) end # TODO: how do we solve this in a proper way? # qr-ctmrg does not need truncation or degeneracy checks - if alg in [:c4v_qr] + if alg in [:C4vQRProjector] return alg_type(decomposition_algorithm) end @@ -108,7 +108,7 @@ Construct the half-infinite projector algorithm based on the following keyword a * `decomposition_alg::Union{<:SVDAdjoint,NamedTuple}=SVDAdjoint()` : SVD algorithm including the reverse rule. See [`SVDAdjoint`](@ref). * `trunc::Union{TruncationStrategy,NamedTuple}=(; alg::Symbol=:$(Defaults.trunc))` : Truncation strategy for the projector computation, which controls the resulting virtual spaces. Here, `alg` can be one of the following: - - `:fixedspace` : Keep virtual spaces fixed during projection + - `:FixedSpaceTruncation` : Keep virtual spaces fixed during projection - `:notrunc` : No singular values are truncated and the performed SVDs are exact - `:truncerror` : Additionally supply error threshold `η`; truncate to the maximal virtual dimension of `η` - `:truncrank` : Additionally supply truncation dimension `η`; truncate such that the 2-norm of the truncated values is smaller than `η` @@ -124,10 +124,10 @@ struct HalfInfiniteProjector{S <: SVDAdjoint, T} <: ProjectorAlgorithm verbosity::Int end function HalfInfiniteProjector(; kwargs...) - return ProjectorAlgorithm(; alg = :halfinfinite, kwargs...) + return ProjectorAlgorithm(; alg = :HalfInfiniteProjector, kwargs...) end -PROJECTOR_SYMBOLS[:halfinfinite] = HalfInfiniteProjector +PROJECTOR_SYMBOLS[:HalfInfiniteProjector] = HalfInfiniteProjector """ $(TYPEDEF) @@ -146,7 +146,7 @@ Construct the full-infinite projector algorithm based on the following keyword a * `decomposition_alg::Union{<:SVDAdjoint,NamedTuple}=SVDAdjoint()` : SVD algorithm including the reverse rule. See [`SVDAdjoint`](@ref). * `trunc::Union{TruncationStrategy,NamedTuple}=(; alg::Symbol=:$(Defaults.trunc))` : Truncation scheme for the projector computation, which controls the resulting virtual spaces. Here, `alg` can be one of the following: - - `:fixedspace` : Keep virtual spaces fixed during projection + - `:FixedSpaceTruncation` : Keep virtual spaces fixed during projection - `:notrunc` : No singular values are truncated and the performed SVDs are exact - `:truncerror` : Additionally supply error threshold `η`; truncate to the maximal virtual dimension of `η` - `:truncrank` : Additionally supply truncation dimension `η`; truncate such that the 2-norm of the truncated values is smaller than `η` @@ -162,10 +162,10 @@ struct FullInfiniteProjector{S <: SVDAdjoint, T} <: ProjectorAlgorithm verbosity::Int end function FullInfiniteProjector(; kwargs...) - return ProjectorAlgorithm(; alg = :fullinfinite, kwargs...) + return ProjectorAlgorithm(; alg = :FullInfiniteProjector, kwargs...) end -PROJECTOR_SYMBOLS[:fullinfinite] = FullInfiniteProjector +PROJECTOR_SYMBOLS[:FullInfiniteProjector] = FullInfiniteProjector """ compute_projector(enlarged_corners, alg::ProjectorAlgorithm) diff --git a/src/algorithms/ctmrg/sequential.jl b/src/algorithms/ctmrg/sequential.jl index 775164c7f..d68c41640 100644 --- a/src/algorithms/ctmrg/sequential.jl +++ b/src/algorithms/ctmrg/sequential.jl @@ -32,10 +32,10 @@ struct SequentialCTMRG{P <: ProjectorAlgorithm} <: CTMRGAlgorithm projector_alg::P end function SequentialCTMRG(; kwargs...) - return CTMRGAlgorithm(; alg = :sequential, kwargs...) + return CTMRGAlgorithm(; alg = :SequentialCTMRG, kwargs...) end -CTMRG_SYMBOLS[:sequential] = SequentialCTMRG +CTMRG_SYMBOLS[:SequentialCTMRG] = SequentialCTMRG """ ctmrg_leftmove(col::Int, network, env::CTMRGEnv, alg::SequentialCTMRG) @@ -74,8 +74,8 @@ end sequential_projectors(col::Int, network, env::CTMRGEnv, alg::ProjectorAlgorithm) sequential_projectors(coordinate::NTuple{3,Int}, network::InfiniteSquareNetwork, env::CTMRGEnv, alg::ProjectorAlgorithm) -Compute CTMRG projectors in the `:sequential` scheme either for an entire column `col` or -for a specific `coordinate` (where `dir=WEST` is already implied in the `:sequential` scheme). +Compute CTMRG projectors in the `:SequentialCTMRG` scheme either for an entire column `col` or +for a specific `coordinate` (where `dir=WEST` is already implied in the `:SequentialCTMRG` scheme). """ function sequential_projectors(col::Int, network, env::CTMRGEnv, alg::ProjectorAlgorithm) coordinates = eachcoordinate(env)[:, col] diff --git a/src/algorithms/ctmrg/simultaneous.jl b/src/algorithms/ctmrg/simultaneous.jl index cab9e6dc3..ecaf52c7b 100644 --- a/src/algorithms/ctmrg/simultaneous.jl +++ b/src/algorithms/ctmrg/simultaneous.jl @@ -31,10 +31,10 @@ struct SimultaneousCTMRG{P <: ProjectorAlgorithm} <: CTMRGAlgorithm projector_alg::P end function SimultaneousCTMRG(; kwargs...) - return CTMRGAlgorithm(; alg = :simultaneous, kwargs...) + return CTMRGAlgorithm(; alg = :SimultaneousCTMRG, kwargs...) end -CTMRG_SYMBOLS[:simultaneous] = SimultaneousCTMRG +CTMRG_SYMBOLS[:SimultaneousCTMRG] = SimultaneousCTMRG function ctmrg_iteration(network, env::CTMRGEnv, alg::SimultaneousCTMRG) coordinates = eachcoordinate(network, 1:4) @@ -72,7 +72,7 @@ end simultaneous_projectors(enlarged_corners::Array{E,3}, env::CTMRGEnv, alg::ProjectorAlgorithm) simultaneous_projectors(coordinate, enlarged_corners::Array{E,3}, alg::ProjectorAlgorithm) -Compute CTMRG projectors in the `:simultaneous` scheme either for all provided +Compute CTMRG projectors in the `:SimultaneousCTMRG` scheme either for all provided enlarged corners or on a specific `coordinate`. """ function simultaneous_projectors( diff --git a/src/algorithms/optimization/fixed_point_differentiation.jl b/src/algorithms/optimization/fixed_point_differentiation.jl index 70fe8fdc9..9b28a0f96 100644 --- a/src/algorithms/optimization/fixed_point_differentiation.jl +++ b/src/algorithms/optimization/fixed_point_differentiation.jl @@ -2,10 +2,10 @@ abstract type GradMode{F} end const GRADIENT_MODE_SYMBOLS = IdDict{Symbol, Type{<:GradMode}}() const LINSOLVER_SOLVER_SYMBOLS = IdDict{Symbol, Type{<:KrylovKit.LinearSolver}}( - :gmres => GMRES, :bicgstab => BiCGStab + :GMRES => GMRES, :BiCGStab => BiCGStab ) const EIGSOLVER_SOLVER_SYMBOLS = IdDict{Symbol, Type{<:KrylovKit.KrylovAlgorithm}}( - :arnoldi => Arnoldi + :Arnoldi => Arnoldi ) """ @@ -96,9 +96,9 @@ struct GeomSum{F} <: GradMode{F} maxiter::Int verbosity::Int end -GeomSum(; kwargs...) = GradMode(; alg = :geomsum, kwargs...) +GeomSum(; kwargs...) = GradMode(; alg = :GeomSum, kwargs...) -GRADIENT_MODE_SYMBOLS[:geomsum] = GeomSum +GRADIENT_MODE_SYMBOLS[:GeomSum] = GeomSum """ $(TYPEDEF) @@ -129,9 +129,9 @@ struct ManualIter{F} <: GradMode{F} maxiter::Int verbosity::Int end -ManualIter(; kwargs...) = GradMode(; alg = :manualiter, kwargs...) +ManualIter(; kwargs...) = GradMode(; alg = :ManualIter, kwargs...) -GRADIENT_MODE_SYMBOLS[:manualiter] = ManualIter +GRADIENT_MODE_SYMBOLS[:ManualIter] = ManualIter """ $(TYPEDEF) @@ -155,15 +155,15 @@ Construct the `LinSolver` algorithm struct based on the following keyword argume * `iterscheme::Symbol=:$(Defaults.gradient_iterscheme)` : Style of CTMRG iteration which is being differentiated, which can be: - `:fixed` : the differentiated CTMRG iteration uses a pre-computed SVD with a fixed set of gauges * `solver_alg::Union{KrylovKit.LinearSolver,NamedTuple}=(; alg::Symbol=:$(Defaults.gradient_linsolver)` : Linear solver algorithm which, if supplied directly as a `KrylovKit.LinearSolver` overrides the above specified `tol`, `maxiter` and `verbosity`. Alternatively, it can be supplied via a `NamedTuple` where `alg` can be one of the following: - - `:gmres` : GMRES iterative linear solver, see [`KrylovKit.GMRES`](@extref) for details - - `:bicgstab` : BiCGStab iterative linear solver, see [`KrylovKit.BiCGStab`](@extref) for details + - `:GMRES` : GMRES iterative linear solver, see [`KrylovKit.GMRES`](@extref) for details + - `:BiCGStab` : BiCGStab iterative linear solver, see [`KrylovKit.BiCGStab`](@extref) for details """ struct LinSolver{F} <: GradMode{F} solver_alg::KrylovKit.LinearSolver end -LinSolver(; kwargs...) = GradMode(; alg = :linsolver, kwargs...) +LinSolver(; kwargs...) = GradMode(; alg = :LinSolver, kwargs...) -GRADIENT_MODE_SYMBOLS[:linsolver] = LinSolver +GRADIENT_MODE_SYMBOLS[:LinSolver] = LinSolver """ $(TYPEDEF) @@ -187,14 +187,14 @@ Construct the `EigSolver` algorithm struct based on the following keyword argume * `iterscheme::Symbol=:$(Defaults.gradient_iterscheme)` : Style of CTMRG iteration which is being differentiated, which can be: - `:fixed` : the differentiated CTMRG iteration uses a pre-computed SVD with a fixed set of gauges * `solver_alg::Union{KrylovKit.KrylovAlgorithm,NamedTuple}=(; alg=:$(Defaults.gradient_eigsolver)` : Eigen solver algorithm which, if supplied directly as a `KrylovKit.KrylovAlgorithm` overrides the above specified `tol`, `maxiter` and `verbosity`. Alternatively, it can be supplied via a `NamedTuple` where `alg` can be one of the following: - - `:arnoldi` : Arnoldi Krylov algorithm, see [`KrylovKit.Arnoldi`](@extref) for details + - `:Arnoldi` : Arnoldi Krylov algorithm, see [`KrylovKit.Arnoldi`](@extref) for details """ struct EigSolver{F} <: GradMode{F} solver_alg::KrylovKit.KrylovAlgorithm end -EigSolver(; kwargs...) = GradMode(; alg = :eigsolver, kwargs...) +EigSolver(; kwargs...) = GradMode(; alg = :EigSolver, kwargs...) -GRADIENT_MODE_SYMBOLS[:eigsolver] = EigSolver +GRADIENT_MODE_SYMBOLS[:EigSolver] = EigSolver """ _check_algorithm_combination(boundary_alg, gradient_alg_or_symmetrization) @@ -372,7 +372,7 @@ function fpgrad(∂F∂x, ∂f∂x, ∂f∂A, x₀, alg::EigSolver) backup_ls_alg = _alg_or_nt( GradMode, (; - alg = :linsolver, + alg = :LinSolver, tol = alg.solver_alg.tol, maxiter = alg.solver_alg.maxiter * alg.solver_alg.krylovdim, verbosity = alg.solver_alg.verbosity, diff --git a/src/algorithms/optimization/peps_optimization.jl b/src/algorithms/optimization/peps_optimization.jl index acca99c57..511ce8261 100644 --- a/src/algorithms/optimization/peps_optimization.jl +++ b/src/algorithms/optimization/peps_optimization.jl @@ -51,9 +51,9 @@ function PEPSOptimize(; end const OPTIMIZATION_SYMBOLS = IdDict{Symbol, Type{<:OptimKit.OptimizationAlgorithm}}( - :gradientdescent => GradientDescent, - :conjugategradient => ConjugateGradient, - :lbfgs => LBFGS, + :GradientDescent => GradientDescent, + :ConjugateGradient => ConjugateGradient, + :LBFGS => LBFGS, ) # Should be OptimizationAlgorithm but piracy @@ -129,10 +129,10 @@ keyword arguments are: * `tol::Real=1e-2tol` : Convergence tolerance for the fixed-point gradient iteration. * `maxiter::Int=$(Defaults.gradient_maxiter)` : Maximal number of gradient problem iterations. * `alg::Symbol=:$(Defaults.gradient_alg)` : Gradient algorithm variant, can be one of the following: - - `:geomsum` : Compute gradient directly from the geometric sum, see [`GeomSum`](@ref) - - `:manualiter` : Iterate gradient geometric sum manually, see [`ManualIter`](@ref) - - `:linsolver` : Solve fixed-point gradient linear problem using iterative solver, see [`LinSolver`](@ref) - - `:eigsolver` : Determine gradient via eigenvalue formulation of its Sylvester equation, see [`EigSolver`](@ref) + - `:GeomSum` : Compute gradient directly from the geometric sum, see [`GeomSum`](@ref) + - `:ManualIter` : Iterate gradient geometric sum manually, see [`ManualIter`](@ref) + - `:LinSolver` : Solve fixed-point gradient linear problem using iterative solver, see [`LinSolver`](@ref) + - `:EigSolver` : Determine gradient via eigenvalue formulation of its Sylvester equation, see [`EigSolver`](@ref) * `verbosity::Int` : Gradient output verbosity, ≤0 by default to disable too verbose printing. Should only be >0 for debug purposes. * `iterscheme::Symbol=:$(Defaults.gradient_iterscheme)` : CTMRG iteration scheme determining mode of differentiation. This can be: - `:fixed` : the differentiated CTMRG iteration uses a pre-computed SVD with a fixed set of gauges @@ -145,9 +145,9 @@ using either a `NamedTuple` of keyword arguments or a `OptimKit.OptimizationAlgo keyword arguments are: * `alg::Symbol=:$(Defaults.optimizer_alg)` : Optimizer algorithm, can be one of the following: - - `:gradientdescent` : Gradient descent algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) - - `:conjugategradient` : Conjugate gradient algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) - - `:lbfgs` : L-BFGS algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) + - `:GradientDescent` : Gradient descent algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) + - `:ConjugateGradient` : Conjugate gradient algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) + - `:LBFGS` : L-BFGS algorithm, see the [OptimKit README](https://github.com/Jutho/OptimKit.jl) * `tol::Real=tol` : Gradient norm tolerance of the optimizer. * `maxiter::Int=$(Defaults.optimizer_maxiter)` : Maximal number of optimization steps. * `verbosity::Int=$(Defaults.optimizer_verbosity)` : Optimizer output verbosity. diff --git a/src/algorithms/select_algorithm.jl b/src/algorithms/select_algorithm.jl index 93333b1bd..ff3f8eea9 100644 --- a/src/algorithms/select_algorithm.jl +++ b/src/algorithms/select_algorithm.jl @@ -34,9 +34,9 @@ function select_algorithm( # C4vCTMRG-specific defaults if boundary_alg isa C4vCTMRG - # use :linsolver GradMode since :eigsolver tends to have hiccups + # use :LinSolver GradMode since :EigSolver tends to have hiccups if gradient_alg isa NamedTuple - haskey(gradient_alg, :alg) || (gradient_alg = merge((; alg = :linsolver), gradient_alg)) + haskey(gradient_alg, :alg) || (gradient_alg = merge((; alg = :LinSolver), gradient_alg)) end # symmetrize state and gradient if isnothing(symmetrization) diff --git a/src/algorithms/truncation/truncationschemes.jl b/src/algorithms/truncation/truncationschemes.jl index cdddbf41d..315ca62ab 100644 --- a/src/algorithms/truncation/truncationschemes.jl +++ b/src/algorithms/truncation/truncationschemes.jl @@ -43,8 +43,8 @@ const TRUNCATION_STRATEGY_SYMBOLS = IdDict{Symbol, Type{<:TruncationStrategy}}( :truncrank => MatrixAlgebraKit.TruncationByOrder, :trunctol => MatrixAlgebraKit.TruncationByValue, :truncspace => TruncationSpace, - :fixedspace => FixedSpaceTruncation, - :sitedependent => SiteDependentTruncation, + :FixedSpaceTruncation => FixedSpaceTruncation, + :SiteDependentTruncation => SiteDependentTruncation, ) # Should be TruncationStrategy but rename to avoid type piracy diff --git a/src/utility/svd.jl b/src/utility/svd.jl index a7887091e..f07b3d796 100644 --- a/src/utility/svd.jl +++ b/src/utility/svd.jl @@ -77,16 +77,16 @@ Construct a `SVDAdjoint` algorithm struct based on the following keyword argumen - `:SafeDivideAndConquer` : MatrixAlgebraKit's [`SafeDivideAndConquer`](@extref MatrixAlgebraKit.SafeDivideAndConquer) - "Sparse" SVD algorithms which directly compute a truncated SVD without access to the full decomposition. Available algorithms are: - - `:iterative` : Iterative Krylov-based SVD only computing the specifed number of + - `:GKL` : Iterative Krylov-based SVD only computing the specifed number of singular values and vectors, see [`IterSVD`](@ref) * `rrule_alg::Union{Algorithm,NamedTuple}=(; alg::Symbol=:$(Defaults.svd_rrule_alg))`: Reverse-rule algorithm for differentiating the SVD. Can be supplied by an `Algorithm` instance directly or as a `NamedTuple` where `alg` is one of the following: - `:full` : MatrixAlgebraKit's [`svd_pullback!`](@extref MatrixAlgebraKit.svd_pullback!) that requires access to the full spectrum - `:trunc` : MatrixAlgebraKit's [`svd_trunc_pullback!`](@extref MatrixAlgebraKit.svd_trunc_pullback!) solving a Sylvester equation on the truncated subspace - - `:gmres` : GMRES iterative linear solver, see [`KrylovKit.GMRES`](@extref) - - `:bicgstab` : BiCGStab iterative linear solver, see [`KrylovKit.BiCGStab`](@extref) - - `:arnoldi` : Arnoldi Krylov algorithm, see the [`KrylovKit.Arnoldi`](@extref KrylovKit.Arnoldi) + - `:GMRES` : GMRES iterative linear solver, see [`KrylovKit.GMRES`](@extref) + - `:BiCGStab` : BiCGStab iterative linear solver, see [`KrylovKit.BiCGStab`](@extref) + - `:Arnoldi` : Arnoldi Krylov algorithm, see the [`KrylovKit.Arnoldi`](@extref KrylovKit.Arnoldi) !!! note Manually specifying a `rrule_alg` is considered expert-mode usage, and should only be done when full control over the implementation is desired. @@ -105,11 +105,11 @@ const SVD_FWD_SYMBOLS = IdDict{Symbol, Any}( :Jacobi => Jacobi, :SVDViaPolar => SVDViaPolar, :SafeDivideAndConquer => SafeDivideAndConquer, - :iterative => (; tol = 1.0e-14, krylovdim = 25, kwargs...) -> IterSVD(; alg = GKL(; tol, krylovdim), kwargs...), + :GKL => (; tol = 1.0e-14, krylovdim = 25, kwargs...) -> IterSVD(; alg = GKL(; tol, krylovdim), kwargs...), ) const SVD_RRULE_SYMBOLS = IdDict{Symbol, Type{<:Any}}( :full => FullSVDPullback, :trunc => TruncSVDPullback, - :gmres => GMRES, :bicgstab => BiCGStab, :arnoldi => Arnoldi + :GMRES => GMRES, :BiCGStab => BiCGStab, :Arnoldi => Arnoldi ) _default_svd_rrule_alg(::MatrixAlgebraKit.Algorithm) = :full diff --git a/test/ctmrg/fixed_iterscheme.jl b/test/ctmrg/fixed_iterscheme.jl index 62c4251e4..98172b6cc 100644 --- a/test/ctmrg/fixed_iterscheme.jl +++ b/test/ctmrg/fixed_iterscheme.jl @@ -19,8 +19,8 @@ using PEPSKit.Defaults: ctmrg_tol # initialize parameters D = 2 χ = 16 -svd_algs = [(; alg = :DivideAndConquer), (; alg = :iterative)] -projector_algs_asymm = [:halfinfinite] #, :fullinfinite] +svd_algs = [(; alg = :DivideAndConquer), (; alg = :GKL)] +projector_algs_asymm = [:HalfInfiniteProjector] #, :FullInfiniteProjector] unitcells = [(1, 1), (3, 4)] atol = 1.0e-5 @@ -59,9 +59,9 @@ end # test same thing for C4v CTMRG c4v_algs = [ - (:c4v_qr, (; alg = :Householder)), - (:c4v_eigh, (; alg = :QRIteration)), - (:c4v_eigh, (; alg = :Lanczos)), + (:C4vQRProjector, (; alg = :Householder)), + (:C4vEighProjector, (; alg = :QRIteration)), + (:C4vEighProjector, (; alg = :Lanczos)), ] @testset "$(decomposition_alg.alg) and $projector_alg" for (projector_alg, decomposition_alg) in c4v_algs @@ -69,7 +69,7 @@ c4v_algs = [ Random.seed!(2394823842) ctm_alg = C4vCTMRG(; projector_alg, decomposition_alg, maxiter = 200, - tol = (projector_alg == :c4v_qr ? 1.0e-12 : ctmrg_tol) + tol = (projector_alg == :C4vQRProjector ? 1.0e-12 : ctmrg_tol) ) symm = RotateReflect() @@ -101,10 +101,10 @@ c4v_algs = [ @test calc_elementwise_convergence(env_conv1, env_fixed2) ≈ 0 atol = atol end -@testset "Element-wise consistency of :DivideAndConquer and :iterative" begin +@testset "Element-wise consistency of :DivideAndConquer and :GKL" begin ctm_alg_iter = SimultaneousCTMRG(; maxiter = 200, - decomposition_alg = (; alg = :iterative, krylovdim = χ + 10), + decomposition_alg = (; alg = :GKL, krylovdim = χ + 10), ) ctm_alg_full = SimultaneousCTMRG(; decomposition_alg = (; alg = :DivideAndConquer)) diff --git a/test/ctmrg/flavors.jl b/test/ctmrg/flavors.jl index 37614ab02..238a010a0 100644 --- a/test/ctmrg/flavors.jl +++ b/test/ctmrg/flavors.jl @@ -10,10 +10,10 @@ using PEPSKit: peps_normalize D = 2 χ = 16 unitcells = [(1, 1), (3, 4)] -projector_algs_asymm = [:halfinfinite, :fullinfinite] +projector_algs_asymm = [:HalfInfiniteProjector, :FullInfiniteProjector] projector_algs_c4v = [ - (:c4v_qr, :Householder), - (:c4v_eigh, :QRIteration), (:c4v_eigh, :Lanczos), + (:C4vQRProjector, :Householder), + (:C4vEighProjector, :QRIteration), (:C4vEighProjector, :Lanczos), ] Ts = [Float64, ComplexF64] @@ -23,10 +23,10 @@ Ts = [Float64, ComplexF64] Random.seed!(32350283290358) psi = InfinitePEPS(ComplexSpace(2), ComplexSpace(D); unitcell) env_sequential, = leading_boundary( - CTMRGEnv(psi, ComplexSpace(χ)), psi; alg = :sequential, projector_alg + CTMRGEnv(psi, ComplexSpace(χ)), psi; alg = :SequentialCTMRG, projector_alg ) env_simultaneous, = leading_boundary( - CTMRGEnv(psi, ComplexSpace(χ)), psi; alg = :simultaneous, projector_alg + CTMRGEnv(psi, ComplexSpace(χ)), psi; alg = :SimultaneousCTMRG, projector_alg ) # compare norms @@ -52,7 +52,7 @@ end # test fixedspace actually fixes space @testset "Fixedspace truncation using $alg and $projector_alg" for (alg, projector_alg) in - Iterators.product([:sequential, :simultaneous], projector_algs_asymm) + Iterators.product([:SequentialCTMRG, :SimultaneousCTMRG], projector_algs_asymm) Ds = ComplexSpace.(fill(2, 3, 3)) χs = ComplexSpace.([16 17 18; 15 20 21; 14 19 22]) psi = InfinitePEPS(Ds, Ds, Ds) @@ -80,7 +80,7 @@ end env₀ = initialize_random_c4v_env(peps, Venv) env, = leading_boundary( - env₀, peps; alg = :c4v, projector_alg, + env₀, peps; alg = :C4vCTMRG, projector_alg, decomposition_alg = (; alg = decomp_alg) ) @test env isa CTMRGEnv diff --git a/test/ctmrg/gaugefix.jl b/test/ctmrg/gaugefix.jl index fe668a4df..f259c4e22 100644 --- a/test/ctmrg/gaugefix.jl +++ b/test/ctmrg/gaugefix.jl @@ -11,8 +11,8 @@ spacetypes = [ComplexSpace, Z2Space] scalartypes = [Float64, ComplexF64] unitcells = [(1, 1), (2, 2), (3, 2)] ctmrg_algs_asymm = [SequentialCTMRG, SimultaneousCTMRG] -projector_algs_asymm = [:halfinfinite, :fullinfinite] -projector_algs_c4v = [:c4v_eigh, :c4v_qr] +projector_algs_asymm = [:HalfInfiniteProjector, :FullInfiniteProjector] +projector_algs_c4v = [:C4vEighProjector, :C4vQRProjector] gauge_algs_asymm = [ScramblingEnvGauge()] gauge_algs_c4v = [ScramblingEnvGaugeC4v()] tol = 1.0e-6 # large tol due to χ=6 @@ -25,8 +25,8 @@ function _pre_converge_env( ) where {T} Random.seed!(seed) # Seed RNG to make random environment consistent psi = InfinitePEPS(rand, T, physical_space, peps_space; unitcell) - alg == :c4v && (psi = peps_normalize(symmetrize!(psi, RotateReflect()))) - env₀ = if alg == :c4v + alg == :C4vCTMRG && (psi = peps_normalize(symmetrize!(psi, RotateReflect()))) + env₀ = if alg == :C4vCTMRG initialize_singlet_c4v_env(T, psi, env_space) else CTMRGEnv(psi, env_space) @@ -39,10 +39,10 @@ end preconv = Dict() for (S, T, unitcell) in Iterators.product(spacetypes, scalartypes, unitcells) if S == ComplexSpace - result = _pre_converge_env(T, :sequential, S(2), S(2), S(χ), unitcell) + result = _pre_converge_env(T, :SequentialCTMRG, S(2), S(2), S(χ), unitcell) elseif S == Z2Space result = _pre_converge_env( - T, :sequential, S(0 => 1, 1 => 1), S(0 => 1, 1 => 1), + T, :SequentialCTMRG, S(0 => 1, 1 => 1), S(0 => 1, 1 => 1), S(0 => χ ÷ 2, 1 => χ ÷ 2), unitcell ) end @@ -51,10 +51,10 @@ end preconv_c4v = Dict() for (S, T) in Iterators.product(spacetypes, scalartypes) if S == ComplexSpace - result = _pre_converge_env(T, :c4v, S(2), S(2), S(χ), (1, 1)) + result = _pre_converge_env(T, :C4vCTMRG, S(2), S(2), S(χ), (1, 1)) elseif S == Z2Space result = _pre_converge_env( - T, :c4v, S(0 => 1, 1 => 1), S(0 => 1, 1 => 1), S(0 => χ ÷ 2, 1 => χ ÷ 2), (1, 1) + T, :C4vCTMRG, S(0 => 1, 1 => 1), S(0 => 1, 1 => 1), S(0 => χ ÷ 2, 1 => χ ÷ 2), (1, 1) ) end push!(preconv_c4v, (S, T) => result) diff --git a/test/ctmrg/jacobian_real_linear.jl b/test/ctmrg/jacobian_real_linear.jl index 0674658bc..2c6b5450c 100644 --- a/test/ctmrg/jacobian_real_linear.jl +++ b/test/ctmrg/jacobian_real_linear.jl @@ -7,8 +7,8 @@ using PEPSKit: ctmrg_iteration, compute_gauge_fix_gauge, fix_phases, ScramblingEnvGauge algs = [ - (:fixed, SimultaneousCTMRG(; projector_alg = :halfinfinite)), - (:fixed, SimultaneousCTMRG(; projector_alg = :fullinfinite)), # TODO: why are the errors quite a bit larger for :fullinfinite? + (:fixed, SimultaneousCTMRG(; projector_alg = :HalfInfiniteProjector)), + (:fixed, SimultaneousCTMRG(; projector_alg = :FullInfiniteProjector)), # TODO: why are the errors quite a bit larger for :FullInfiniteProjector? ] Dbond, χenv = 2, 16 alg_gauge = ScramblingEnvGauge() diff --git a/test/ctmrg/partition_function.jl b/test/ctmrg/partition_function.jl index 5cb14db46..e28477218 100644 --- a/test/ctmrg/partition_function.jl +++ b/test/ctmrg/partition_function.jl @@ -15,7 +15,7 @@ using Test Z = InfinitePartitionFunction([zA zB; zC zD]) χenv = ℂ^12 env0 = CTMRGEnv(Z, χenv) - env, = leading_boundary(env0, Z; alg = :simultaneous, maxiter = 3, projector_alg = :fullinfinite) + env, = leading_boundary(env0, Z; alg = :SimultaneousCTMRG, maxiter = 3, projector_alg = :FullInfiniteProjector) @test env isa CTMRGEnv end @@ -103,9 +103,9 @@ env₀ = CTMRGEnv(Z, Venv) env₀_c4v = initialize_random_c4v_env(Z, Venv) # cover all different flavors args = [ - (:sequential, :halfinfinite), (:sequential, :fullinfinite), - (:simultaneous, :halfinfinite), (:simultaneous, :fullinfinite), - (:c4v, :c4v_eigh), (:c4v, :c4v_qr), + (:SequentialCTMRG, :HalfInfiniteProjector), (:SequentialCTMRG, :FullInfiniteProjector), + (:SimultaneousCTMRG, :HalfInfiniteProjector), (:SimultaneousCTMRG, :FullInfiniteProjector), + (:C4vCTMRG, :C4vEighProjector), (:C4vCTMRG, :C4vQRProjector), ] # Basic properties @@ -124,7 +124,7 @@ args = [ @testset "Classical Ising partition function using $alg with $projector_alg" for ( alg, projector_alg, ) in args - env₀₀ = alg == :c4v ? env₀_c4v : env₀ + env₀₀ = alg == :C4vCTMRG ? env₀_c4v : env₀ env, = leading_boundary(env₀₀, Z; alg, maxiter = 300, projector_alg) # check observables diff --git a/test/ctmrg/pepo.jl b/test/ctmrg/pepo.jl index 4bd22a60a..b1fcc6d76 100644 --- a/test/ctmrg/pepo.jl +++ b/test/ctmrg/pepo.jl @@ -55,8 +55,8 @@ O, M, E = three_dimensional_classical_ising(; beta) χenv = ℂ^12 # cover all different flavors -ctm_styles = [:sequential, :simultaneous] -projector_algs = [:halfinfinite, :fullinfinite] +ctm_styles = [:SequentialCTMRG, :SimultaneousCTMRG] +projector_algs = [:HalfInfiniteProjector, :FullInfiniteProjector] @testset "PEPO CTMRG runthroughs for unitcell=$(unitcell)" for unitcell in [(1, 1, 1), (1, 1, 2)] diff --git a/test/ctmrg/unitcell.jl b/test/ctmrg/unitcell.jl index e57c14ec8..f87548469 100644 --- a/test/ctmrg/unitcell.jl +++ b/test/ctmrg/unitcell.jl @@ -8,10 +8,10 @@ using TensorKit Random.seed!(91283219347) stype = ComplexF64 ctm_algs = [ - SequentialCTMRG(; projector_alg = :halfinfinite), - SequentialCTMRG(; projector_alg = :fullinfinite), - SimultaneousCTMRG(; projector_alg = :halfinfinite), - SimultaneousCTMRG(; projector_alg = :fullinfinite), + SequentialCTMRG(; projector_alg = :HalfInfiniteProjector), + SequentialCTMRG(; projector_alg = :FullInfiniteProjector), + SimultaneousCTMRG(; projector_alg = :HalfInfiniteProjector), + SimultaneousCTMRG(; projector_alg = :FullInfiniteProjector), ] function test_unitcell( diff --git a/test/examples/bose_hubbard.jl b/test/examples/bose_hubbard.jl index 3d7161bf6..f0cfdd3a1 100644 --- a/test/examples/bose_hubbard.jl +++ b/test/examples/bose_hubbard.jl @@ -26,9 +26,9 @@ Vpeps = U1Space(0 => 2, 1 => 1, -1 => 1) Venv = U1Space(0 => 6, 1 => 4, -1 => 4, 2 => 2, -2 => 2) # algorithms -boundary_alg = (; tol = 1.0e-8, alg = :simultaneous, verbosity = 2, trunc = (; alg = :fixedspace)) -gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :eigsolver, iterscheme = :fixed) -optimizer_alg = (; tol = 1.0e-4, alg = :lbfgs, verbosity = 3, maxiter = 25, ls_maxiter = 2, ls_maxfg = 2) +boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, verbosity = 2, trunc = (; alg = :FixedSpaceTruncation)) +gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :EigSolver, iterscheme = :fixed) +optimizer_alg = (; tol = 1.0e-4, alg = :LBFGS, verbosity = 3, maxiter = 25, ls_maxiter = 2, ls_maxfg = 2) reuse_env = true # Hamiltonian diff --git a/test/examples/heisenberg.jl b/test/examples/heisenberg.jl index 3d0fb66bc..6dbbccd7c 100644 --- a/test/examples/heisenberg.jl +++ b/test/examples/heisenberg.jl @@ -53,7 +53,7 @@ end end @testset "C4v AD optimization with scalartype T=$T and projector_alg=$projector_alg" for (T, projector_alg) in - Iterators.product([Float64, ComplexF64], [:c4v_eigh, :c4v_qr]) + Iterators.product([Float64, ComplexF64], [:C4vEighProjector, :C4vQRProjector]) # initialize symmetric states Random.seed!(123456789) symm = RotateReflect() @@ -62,13 +62,13 @@ end peps₀ = InfinitePEPS(randn, T, ComplexSpace(2), ComplexSpace(Dbond)) peps₀ = peps_normalize(symmetrize!(peps₀, symm)) e₀ = initialize_random_c4v_env(peps₀, ComplexSpace(χenv)) - env₀, = leading_boundary(e₀, peps₀; alg = :c4v, projector_alg) + env₀, = leading_boundary(e₀, peps₀; alg = :C4vCTMRG, projector_alg) # optimize energy and compute correlation lengths peps, env, E, = fixedpoint( H, peps₀, env₀; optimizer_alg = (; tol = gradtol, maxiter = 25), - boundary_alg = (; alg = :c4v, projector_alg, maxiter = 500), + boundary_alg = (; alg = :C4vCTMRG, projector_alg, maxiter = 500), ) ξ_h, ξ_v, = correlation_length(peps, env) @info "Optimized energy = $E." @@ -142,7 +142,7 @@ end ham, peps, complex(env); # make environment complex explicitly optimizer_alg = (; tol = gradtol, maxiter = 25), boundary_alg = (; maxiter = ctmrg_maxiter), - gradient_alg = (; alg = :linsolver, solver_alg = (; alg = :gmres)), + gradient_alg = (; alg = :LinSolver, solver_alg = (; alg = :GMRES)), ) # sensitivity warnings and degeneracies due to SU(2)? ξ_h, ξ_v, = correlation_length(peps_final, env_final) e_site2 = E_final / (N1 * N2) diff --git a/test/gradients/c4v_ctmrg_gradients.jl b/test/gradients/c4v_ctmrg_gradients.jl index a2fded178..06ca98513 100644 --- a/test/gradients/c4v_ctmrg_gradients.jl +++ b/test/gradients/c4v_ctmrg_gradients.jl @@ -21,20 +21,20 @@ names = ["Heisenberg"] gradtol = 1.0e-4 ctmrg_verbosity = 1 -ctmrg_algs = [[:c4v]] -projector_algs = [[:c4v_eigh, :c4v_qr]] +ctmrg_algs = [[:C4vCTMRG]] +projector_algs = [[:C4vEighProjector, :C4vQRProjector]] decomposition_rrule_algs = [[:full, :trunc, :qr]] -gradient_algs = [[nothing, :geomsum, :manualiter, :linsolver, :eigsolver]] # they all use :fixed mode by default (except for nothing) +gradient_algs = [[nothing, :GeomSum, :ManualIter, :LinSolver, :EigSolver]] # they all use :fixed mode by default (except for nothing) steps = -0.01:0.005:0.01 # record which rrule alg is compatible with which projector alg allowed_rrule_algs = Dict( - :c4v_eigh => keys(PEPSKit.EIGH_RRULE_SYMBOLS), - :c4v_qr => keys(PEPSKit.QR_RRULE_SYMBOLS), + :C4vEighProjector => keys(PEPSKit.EIGH_RRULE_SYMBOLS), + :C4vQRProjector => keys(PEPSKit.QR_RRULE_SYMBOLS), ) # be selective on which configurations to test the naive gradient for -naive_gradient_combinations = [(:c4v, :c4v_eigh, :full), (:c4v, :c4v_qr, :qr)] +naive_gradient_combinations = [(:C4vCTMRG, :C4vEighProjector, :full), (:C4vCTMRG, :C4vQRProjector, :qr)] naive_gradient_done = Set() ## Tests @@ -68,9 +68,9 @@ naive_gradient_done = Set() decomposition_rrule_alg in allowed_rrule_algs[projector_alg] || continue # construct appropriate decomposition struct to pass custom rrule alg - decomposition_alg = if projector_alg == :c4v_eigh + decomposition_alg = if projector_alg == :C4vEighProjector EighAdjoint(; rrule_alg = (; alg = decomposition_rrule_alg)) - elseif projector_alg == :c4v_qr + elseif projector_alg == :C4vQRProjector QRAdjoint(; rrule_alg = (; alg = decomposition_rrule_alg)) else error("unknown projector alg: $projector_alg") diff --git a/test/gradients/ctmrg_gradients.jl b/test/gradients/ctmrg_gradients.jl index df847aea7..0c277e144 100644 --- a/test/gradients/ctmrg_gradients.jl +++ b/test/gradients/ctmrg_gradients.jl @@ -18,20 +18,20 @@ names = ["Heisenberg", "p-wave superconductor"] gradtol = 1.0e-4 ctmrg_verbosity = 0 -ctmrg_algs = [[:sequential, :simultaneous], [:sequential, :simultaneous]] -projector_algs = [[:halfinfinite, :fullinfinite], [:halfinfinite, :fullinfinite]] -svd_rrule_algs = [[:full, :trunc, :arnoldi], [:full, :arnoldi]] +ctmrg_algs = [[:SequentialCTMRG, :SimultaneousCTMRG], [:SequentialCTMRG, :SimultaneousCTMRG]] +projector_algs = [[:HalfInfiniteProjector, :FullInfiniteProjector], [:HalfInfiniteProjector, :FullInfiniteProjector]] +svd_rrule_algs = [[:full, :trunc, :Arnoldi], [:full, :Arnoldi]] gradient_algs = [ - [nothing, :geomsum, :manualiter, :linsolver, :eigsolver], - [:geomsum, :manualiter, :linsolver, :eigsolver], + [nothing, :GeomSum, :ManualIter, :LinSolver, :EigSolver], + [:GeomSum, :ManualIter, :LinSolver, :EigSolver], ] steps = -0.01:0.005:0.01 # don't check naive AD gradients for all algorithm combinations, since it's slow naive_gradient_combinations = [ - (:simultaneous, :halfinfinite, :full), - (:simultaneous, :fullinfinite, :full), - (:sequential, :halfinfinite, :full), + (:SimultaneousCTMRG, :HalfInfiniteProjector, :full), + (:SimultaneousCTMRG, :FullInfiniteProjector, :full), + (:SequentialCTMRG, :HalfInfiniteProjector, :full), ] naive_gradient_done = Set() @@ -39,7 +39,7 @@ naive_gradient_done = Set() function _check_disallowed_combination( ctmrg_alg, projector_alg, decomposition_rrule_alg, gradient_alg ) - ctmrg_alg == :sequential && !isnothing(gradient_alg) && return true + ctmrg_alg == :SequentialCTMRG && !isnothing(gradient_alg) && return true return false end @@ -130,7 +130,7 @@ end Random.seed!(1234) boundary_alg = PEPSKit.CTMRGAlgorithm(; tol = 1.0e-10) - gradient_alg = PEPSKit.GradMode(; alg = :linsolver, tol = 5.0e-8) + gradient_alg = PEPSKit.GradMode(; alg = :LinSolver, tol = 5.0e-8) function fg((peps, env)) E, g = Zygote.withgradient(peps) do ψ diff --git a/test/timeevol/cluster_projectors.jl b/test/timeevol/cluster_projectors.jl index 6e48ec6b4..f95b9043c 100644 --- a/test/timeevol/cluster_projectors.jl +++ b/test/timeevol/cluster_projectors.jl @@ -246,7 +246,7 @@ end normalize!.(peps.A, Inf) env = CTMRGEnv(wts) for trunc in truncs_env - env, = leading_boundary(env, peps; alg = :sequential, tol = ctmrg_tol, trunc) + env, = leading_boundary(env, peps; alg = :SequentialCTMRG, tol = ctmrg_tol, trunc) end e_site = cost_function(peps, env, ham) / (Nr * Nc) @info "Energy (force_mpo = $(force_mpo)): $e_site" diff --git a/test/timeevol/j1j2_finiteT.jl b/test/timeevol/j1j2_finiteT.jl index 63576e6a1..51009cbe1 100644 --- a/test/timeevol/j1j2_finiteT.jl +++ b/test/timeevol/j1j2_finiteT.jl @@ -12,7 +12,7 @@ bm = [-0.1235, -0.213] function converge_env(state, χ::Int) trunc1 = truncrank(χ) & truncerror(; atol = 1.0e-12) env0 = CTMRGEnv(ones, Float64, state, Vect[SU2Irrep](0 => 1)) - env, = leading_boundary(env0, state; alg = :sequential, trunc = trunc1, tol = 1.0e-10) + env, = leading_boundary(env0, state; alg = :SequentialCTMRG, trunc = trunc1, tol = 1.0e-10) return env end diff --git a/test/timeevol/tf_ising_finiteT.jl b/test/timeevol/tf_ising_finiteT.jl index 6164460f1..62cc7edc7 100644 --- a/test/timeevol/tf_ising_finiteT.jl +++ b/test/timeevol/tf_ising_finiteT.jl @@ -12,9 +12,9 @@ bm_2β = [0.5297, 0.8265] function converge_env(state, χ::Int) trunc1 = truncrank(4) & truncerror(; atol = 1.0e-12) env0 = CTMRGEnv(rand, Float64, state, ℂ^2) - env, = leading_boundary(env0, state; alg = :sequential, trunc = trunc1, tol = 1.0e-10) + env, = leading_boundary(env0, state; alg = :SequentialCTMRG, trunc = trunc1, tol = 1.0e-10) trunc2 = truncrank(χ) & truncerror(; atol = 1.0e-12) - env, = leading_boundary(env, state; alg = :sequential, trunc = trunc2, tol = 1.0e-10) + env, = leading_boundary(env, state; alg = :SequentialCTMRG, trunc = trunc2, tol = 1.0e-10) return env end diff --git a/test/utility/svd_wrapper.jl b/test/utility/svd_wrapper.jl index 95c0208df..b1667810b 100644 --- a/test/utility/svd_wrapper.jl +++ b/test/utility/svd_wrapper.jl @@ -26,7 +26,7 @@ R = randn(space(r)) full_alg = SVDAdjoint(; rrule_alg = (; alg = :full, degeneracy_atol = 1.0e-13)) trunc_alg = SVDAdjoint(; rrule_alg = (; alg = :trunc, degeneracy_atol = 1.0e-13)) -iter_alg = SVDAdjoint(; fwd_alg = (; alg = :iterative)) +iter_alg = SVDAdjoint(; fwd_alg = (; alg = :GKL)) @testset "Non-truncated SVD" begin l_full, g_full = withgradient(A -> lossfun(A, full_alg, R), r)