Solvers and algorithms

Linear, eigenvalue, and nonlinear solvers, time integrators, and cross interpolation.

Linear and eigenvalue solvers

TensorTrainNumerics.ALS — Type
ALS(; kwargs...)

Alternating Linear Scheme (Holtz, Rohwedder & Schneider 2012). Each micro-step optimizes a single core with all other cores fixed. One sweep optimizes the cores left to right and then right to left.

Pass to linear_solve to solve A x = b, or to eigen_solve to find the smallest eigenpair by minimizing the Rayleigh quotient. Setting a field that the chosen problem does not read throws an ArgumentError.

Keyword arguments

  • max_sweeps=1: number of sweeps; ALS has no convergence test and runs all of them. For eigen_solve, a vector gives the sweeps of each rank stage.
  • max_bond=nothing (eigen_solve only): largest bond dimension of each stage, an integer or a vector with one entry per stage; nothing keeps the largest rank of the initial guess. When a stage's max_bond exceeds the current largest rank, the ranks are raised with increase_ranks; a smaller value is an error because ALS cannot lower ranks. In linear_solve the ranks of the initial guess are kept.
  • noise=0.0 (eigen_solve only): noise amplitude for the new rank directions of each stage, a number or a per-stage vector.
  • local_solver=:auto: :direct, :iterative, or :auto (direct up to local_threshold unknowns, iterative above).
  • local_threshold=nothing: nothing means never iterative under :auto.
  • local_maxiter::Int=200, local_tol=1e-8: limits of the local iterative solver.
  • return_info::Bool=false (linear_solve only): return (x, (; residual)), where residual is ‖A x − b‖ / ‖b‖, instead of x.
  • verbosity::Int=1: 2 logs one line per sweep.
  • show_progress::Bool=true: display a progress bar over the sweeps.

eigen_solve returns (E, x), where E is the history of eigenvalue estimates (one entry per micro-step) and x is the eigenvector approximation.

source
TensorTrainNumerics.MALS — Type
MALS(; kwargs...)

Modified Alternating Linear Scheme (Holtz, Rohwedder & Schneider 2012). Each micro-step optimizes two neighboring cores jointly and splits them with a truncated SVD, so the TT ranks adapt during the solve. One sweep moves left to right and then right to left.

Pass to linear_solve or eigen_solve. Setting a field that the chosen problem does not read throws an ArgumentError.

Keyword arguments

  • max_sweeps=1: number of sweeps; MALS has no convergence test and runs all of them. For eigen_solve, a vector gives the sweeps of each rank stage.
  • max_bond=nothing: largest bond dimension, an integer or (for eigen_solve) a per-stage vector; nothing means round(Int, √prod(dims)).
  • trunc_tol=1e-6: relative truncation tolerance of the two-core SVDs, with the rule of tt_round!.
  • local_solver=:auto, local_threshold=nothing (256 unknowns), local_maxiter=200, local_tol=1e-6 (eigen_solve only): local eigensolver settings; see ALS. linear_solve solves local systems with a dense direct solve.
  • return_info::Bool=false (linear_solve only): return (x, (; residual)), where residual is ‖A x − b‖ / ‖b‖, instead of x.
  • verbosity::Int=1: 2 logs one line per sweep.
  • show_progress::Bool=true: display a progress bar over the sweeps.

eigen_solve returns (E, x, r_hist): the eigenvalue history (one entry per micro-step), the eigenvector approximation, and the largest bond dimension after each micro-step.

source
TensorTrainNumerics.AMEn — Type
AMEn(; kwargs...)

Alternating minimal energy method (Dolgov & Savostyanov 2014). Each micro-step optimizes a single core, as ALS does, and then enlarges the basis of that core with an approximation of the residual. The approximation is a second tensor train of rank kickrank. A truncated SVD after each local solve removes directions that are not needed, so the TT ranks adapt during the solve without the two-core local problems of MALS and DMRG.

Pass to linear_solve to solve A x = b, or to eigen_solve to find the smallest eigenpair of a Hermitian A (the eigenvalue variant follows Kressner, Steinlechner & Uschmajew 2014).

Convergence of the linear solver is proven for Hermitian positive definite A. For other operators the local systems are the Galerkin projections of A itself, with no symmetrization; this works for many non-symmetric problems but is not covered by the proof.

One sweep orthogonalizes the cores from right to left and then solves from left to right. The solve stops when the largest relative residual of the local problems in a sweep is at most tol; one further sweep without enrichment then removes the directions added last.

The stopping test measures the residual within the current TT basis. The enrichment brings the part of the residual outside that basis into the test, so with kickrank = 0, or when max_bond limits the ranks, the test can be met while ‖A x − b‖ / ‖b‖ is still above tol; return_info = true reports that residual.

Keyword arguments

  • tol=1e-6: target relative residual of the local problems. It is the stopping threshold and the threshold of the rank truncation.
  • max_sweeps::Int=20: largest number of sweeps.
  • max_bond=nothing: largest bond dimension; nothing means no limit.
  • kickrank::Int=4: rank of the residual approximation, which is the number of directions added to a bond per micro-step. 0 disables enrichment.
  • local_solver=:auto, local_threshold=nothing (256 unknowns), local_maxiter=200: local solver settings; see ALS. The iterative solver is GMRES for linear_solve and Lanczos for eigen_solve.
  • local_tol=nothing: relative tolerance of the iterative local solver; nothing means tol / 2.
  • return_info::Bool=false (linear_solve only): return (x, (; residual, converged, sweeps)) instead of x, where residual is ‖A x − b‖ / ‖b‖, converged tells whether the stopping test was met, and sweeps is the number of sweeps run.
  • verbosity::Int=1: 0 silences the warning issued when max_sweeps is reached without meeting tol; 2 logs one line per sweep.
  • show_progress::Bool=true: display a progress bar over the sweeps.

eigen_solve returns (E, x, r_hist): the eigenvalue history (one entry per micro-step), the eigenvector approximation, and the largest bond dimension after each micro-step. Its residual is ‖A x − λ x‖ of the local problems for unit-norm x, relative to the largest ‖A x‖ met during the solve.

source
TensorTrainNumerics.DMRG — Type
DMRG(; kwargs...)

DMRG-style alternating scheme (White 1992; Oseledets & Dolgov 2012) that optimizes nsites neighboring cores jointly at each micro-step. With nsites ≥ 2 the ranks adapt through truncated SVDs. One sweep moves left to right and then right to left; a final micro-step on the first cores follows the last sweep.

Pass to linear_solve or eigen_solve. Both read the same fields, except that eigen_solve rejects return_info = true.

Keyword arguments

  • nsites::Int=2: number of cores optimized per micro-step.
  • max_sweeps=1: number of sweeps, or a vector with the sweeps of each rank stage; DMRG has no convergence test and runs all of them.
  • max_bond=nothing: largest bond dimension, an integer or a per-stage vector; nothing means isqrt(prod(dims)).
  • trunc_tol=1e-12: relative truncation tolerance of the SVDs, with the rule of tt_round! (used when nsites ≥ 2).
  • local_solver=:iterative, local_threshold=nothing (256 unknowns), local_maxiter=200, local_tol=1e-6: local solver settings; see ALS.
  • return_info::Bool=false: for linear_solve, return (x, (; residual)), where residual is ‖A x − b‖ / ‖b‖, instead of x.
  • verbosity::Int=1: 2 logs one line per sweep, 3 also the rank and discarded weight at every core move.
  • show_progress::Bool=true: display a progress bar over the sweeps.

eigen_solve returns (E, x, r_hist): the eigenvalue history (one entry per micro-step), the eigenvector approximation, and the largest bond dimension after each micro-step.

source
TensorTrainNumerics.Krylov — Type
Krylov(; kwargs...)

Solve A x = b with a KrylovKit.jl Krylov method whose vectors are TTVectors. Pass to linear_solve; not supported by eigen_solve.

With max_bond > 0, every operator application is followed by tt_compress! to bond dimension max_bond, and the result is compressed the same way. With max_bond = 0 no truncation is applied, so ranks grow with every iteration.

Keyword arguments

  • max_bond::Int=0: bond dimension cap applied after each operator application.
  • krylov_solver::Symbol=:auto: :gmres, :bicgstab, :cg, or :auto. :auto selects :cg when isposdef and (issymmetric or ishermitian) are set, otherwise :bicgstab when max_bond > 0 and :gmres when it is not.
  • krylovdim::Int=8: Krylov subspace dimension (GMRES restart length).
  • maxiter::Int=20: maximum number of iterations (restarts for GMRES; CG uses krylovdim * maxiter iterations).
  • rtol::Float64=1e-8, atol::Float64=1e-12: the stopping tolerance is max(atol, rtol * norm(b)) unless tol is given.
  • tol=nothing: absolute stopping tolerance, overriding rtol and atol.
  • orth: orthogonalization method passed to KrylovKit's GMRES.
  • issymmetric, ishermitian, isposdef: properties of A used by :auto.
  • verbosity::Int=1: KrylovKit verbosity level. At the default level KrylovKit warns when the solve stops without reaching the tolerance; 0 silences it.
  • return_info::Bool=false: return (x, info) instead of x, where info = (; converged, residual, numiter) holds whether the tolerance was reached, the relative residual ‖A x − b‖ / ‖b‖ reported by KrylovKit (for the rank-truncated vectors when max_bond > 0), and the number of iterations.
  • show_progress::Bool=true: display a progress bar.
source
TensorTrainNumerics.als_gen_eigsolve — Function
als_gen_eigsolve(A, S, tt_start; sweep_schedule, max_bond, tol, local_solver, local_threshold)

Find the smallest generalized eigenpair Ax = λ S x using the ALS algorithm.

Arguments

  • A::TTOperator{T}: the operator on the left-hand side.
  • S::TTOperator{T}: the positive-definite metric operator on the right-hand side.
  • tt_start::TTVector{T}: initial guess for the eigenvector.

Keyword arguments

  • sweep_schedule::Vector{Int}=[2]: sweep count at which each rank stage ends.
  • max_bond::Vector{Int}: maximum bond dimension at each stage.
  • tol::Float64=1e-10: tolerance for the local generalized eigensolver.
  • local_solver::Symbol=:auto: solver for the local eigenproblems: :direct, :iterative, or :auto (direct up to local_threshold unknowns).
  • local_threshold::Int=2500: local problem size above which :auto solves iteratively.

Returns

(E, tt_opt) where E is the eigenvalue history and tt_opt is the approximate eigenvector, or nothing if the schedule is exhausted without a final return.

source

Nonlinear solver

TensorTrainNumerics.nonlinear_solve — Function
nonlinear_solve(A, u0; alg = PenaltyALS(), g = 0.0)
nonlinear_solve(A, u0, alg::PenaltyALS; g = 0.0)

Ground state of the discrete Gross–Pitaevskii functional P(u) = ⟨u|A|u⟩ + (g/2)Σ_m u_m⁴ + η(⟨u|u⟩−1)² in TT/QTT format (arXiv:1802.07259). A is the (already discretized) linear operator and g the discrete interaction coefficient (g_physical · 2^L in the QTT convention). Real TT only. Returns the discretely normalized minimizer, or (u, info) when alg.return_info.

source
nonlinear_solve(A_builder, u0, alg::MGR; g_builder, target_sites)

MGR ground-state solve from the coarse grid nsites(u0) up to target_sites QTT sites. A_builder(d)::TTOperator returns the discrete linear operator on d sites and g_builder(d)::Real the discrete interaction coefficient (e.g. g · 2^d). Returns u, or (u, info) with info = (; energy, level_sites, level_energies).

source
TensorTrainNumerics.PenaltyALS — Type
PenaltyALS(; local_solver=:newton, local_steps=4, penalty_schedule=[1e2,1e4,1e6,1e8],
             tol=1e-6, max_sweeps=100, return_info=false, verbosity=1, show_progress=true)

Fixed-grid nonlinear penalty solver (arXiv:1802.07259): alternating site-local minimization of P(u) = ⟨u|A|u⟩ + (g/2)Σu⁴ + η(⟨u|u⟩−1)² under continuation in the penalty weight η, which takes the values of penalty_schedule in turn. local_solver is :newton (damped Newton, the paper's default), :cg (Polak–Ribière+), or :sd; local_steps line-search steps are used per site for :cg/:sd. Each stage sweeps until the relative penalty change is below tol or max_sweeps sweeps are done. verbosity ≥ 2 logs one line per sweep; show_progress displays a progress bar.

source
TensorTrainNumerics.MGR — Type
MGR(; inner = PenaltyALS(), max_bond = 8, return_info = false, verbosity = 1, show_progress = true)

Multigrid-renormalization driver (arXiv:1802.07259): solve on the coarse grid of u0, then repeatedly prolong to one more QTT site (qtto_linear_prolongation), truncate to max_bond (keeping numerically zero singular values as bond-growth room), normalize, and re-solve with inner, up to the target grid. verbosity ≥ 2 logs one line per grid level; show_progress displays a progress bar over the levels.

source
TensorTrainNumerics.gpe_energy — Function
gpe_energy(A, u; g = 0.0)

Discrete Gross–Pitaevskii energy readout E = ⟨u|A|u⟩/s + g·Σ_m u_m⁴/s², s = ⟨u|u⟩ (full g, matching the paper's Table-1 convention; the minimized functional carries g/2).

source

Time evolution

TensorTrainNumerics.time_evolve — Function
time_evolve(A, u₀, steps, alg::TimeEvolutionAlgorithm) -> TTVector
time_evolve(A, u₀, steps, alg; guess=u₀)

Evolve u₀ under the generator A with the time stepper alg: an Euler, ImplicitEuler, CrankNicolson, RK4, or TDVP object.

steps holds the step sizes, not time points. Euler, ImplicitEuler, CrankNicolson, and RK4 integrate du/dt = A u; for TDVP the generator is -iA unless imaginary_time = true.

For ImplicitEuler and CrankNicolson, guess is the initial guess of the first linear solve; later steps start from the previous solution.

If alg was built with return_info = true, the result is (u, info).

source
TensorTrainNumerics.RK4 — Type
RK4(; max_bond, normalize=false, return_info=false, show_progress=true)

Classical fourth-order Runge–Kutta time stepping with every stage compressed to bond dimension max_bond; see rk4_method.

source
TensorTrainNumerics.TDVP — Type
TDVP(; nsites=1, kwargs...)

Time-dependent variational principle with one-site (nsites = 1, fixed ranks) or two-site (nsites = 2, adaptive ranks) updates; see tdvp and tdvp2 for the schemes.

Keyword arguments

  • nsites::Int=1: 1 or 2.
  • max_bond::Int=typemax(Int), trunc_tol::Real=0.0: rank truncation of the two-site updates. Setting either with nsites = 1 throws an ArgumentError.
  • normalize, substeps, carry_env, imaginary_time, return_info, verbosity, show_progress: as in tdvp.
  • Remaining keyword arguments are passed to KrylovKit.exponentiate.
source
TensorTrainNumerics.euler_method — Function
euler_method(A, u₀, steps; normalize=false, return_info=false, show_progress=true)

Explicit Euler time stepping u ← u + h·A·u in TT format.

With return_info = true returns (u, (; error)), where error is the relative defect of the last step, ‖u_{n+1} − (I + hA)·u_n‖ / ‖u_{n+1}‖, which measures the error introduced by orthogonalization (and normalization when normalize = true) in that step.

source
TensorTrainNumerics.implicit_euler_method — Function
implicit_euler_method(A, u₀, guess, steps; alg=MALS(), normalize=false, max_bond=0, return_info=false, show_progress=true, kwargs...)

Implicit Euler time stepping: solve (I − h·A)·u_{n+1} = u_n at every step with the TT linear solver alg (a LinearSolverAlgorithm). Remaining keyword arguments replace fields of alg for these solves (for example max_sweeps = 2). max_bond > 0 compresses every step to that bond dimension and, for Krylov, also caps its operator applications. With return_info = true returns (u, (; error)), where error is the relative residual of the last step's linear system.

source
TensorTrainNumerics.crank_nicolson_method — Function
crank_nicolson_method(A, u₀, guess, steps; alg=MALS(), normalize=false, max_bond=0, return_info=false, show_progress=true, kwargs...)

Crank–Nicolson time stepping: solve (I − h/2·A)·u_{n+1} = (I + h/2·A)·u_n at every step with the TT linear solver alg (a LinearSolverAlgorithm). Remaining keyword arguments replace fields of alg for these solves (for example max_sweeps = 2). max_bond > 0 compresses every step to that bond dimension and, for Krylov, also caps its operator applications. With return_info = true returns (u, (; error)), where error is the relative residual of the last step's linear system.

source
TensorTrainNumerics.rk4_method — Function
rk4_method(A, u₀, steps; max_bond, normalize=false, return_info=false, show_progress=true)

Classical fourth-order Runge–Kutta time stepping in TT format, compressing every stage and the iterate to bond dimension max_bond.

With return_info = true returns (u, (; error)), where error is the relative defect of the last step, ‖u_{n+1} − (u_n + Δu_n)‖ / ‖u_{n+1}‖, which measures the error introduced by rank truncation (and normalization when normalize = true) in that step.

source
TensorTrainNumerics.tdvp — Function
tdvp(H, u₀, steps; kwargs...) -> TTVector
tdvp(H, u₀, steps; return_info=true, kwargs...) -> (TTVector, info)

Evolve u₀ with the one-site time-dependent variational principle (Haegeman et al. 2016), using a symmetric (second-order) projector splitting. The TT ranks stay equal to those of orthogonalize(u₀); use tdvp2 for adaptive ranks.

The generator is applied as follows:

  • real time (default): du/dt = -i H u, so each step computes approximately exp(-i h H) u. Real H and u₀ are promoted to complex.
  • imaginary_time = true: du/dt = H u, so each step computes approximately exp(h H) u and the element type is kept. To relax toward the ground state of a Hamiltonian K, pass H = -K together with normalize = true.

steps is a vector of step sizes h, not of time points. Every entry of steps evolves the state by h, split into substeps substeps of h / substeps each; more substeps reduce the splitting error of a step.

Keyword arguments

  • normalize::Bool=false: rescale the state to unit norm after every step.
  • substeps::Int=1: number of substeps each step is split into (see above).
  • carry_env::Bool=true: reuse environments between the substeps of one step.
  • return_info::Bool=false: return (ψ, (; error)), where error is the relative residual of the last step's finite-difference derivative, ‖(u_{n+1} − u_n)/h − G u_{n+1}‖ / ‖u_{n+1}‖, and G is H or -iH.
  • verbosity::Int=1: 3 logs the local energy at every site update.
  • show_progress::Bool=true: display a progress bar over the time steps.
  • Remaining keyword arguments are passed to KrylovKit.exponentiate (for example ishermitian=false, tol, or krylovdim).
source
TensorTrainNumerics.tdvp2 — Function
tdvp2(H, u₀, steps; kwargs...) -> TTVector
tdvp2(H, u₀, steps; return_info=true, kwargs...) -> (TTVector, info)

Evolve u₀ with the two-site time-dependent variational principle (Haegeman et al. 2016). Each two-site update is split by a truncated SVD, so the TT ranks adapt, up to max_bond.

The generator is applied as follows:

  • real time (default): du/dt = -i H u, so each step computes approximately exp(-i h H) u. Real H and u₀ are promoted to complex.
  • imaginary_time = true: du/dt = H u, so each step computes approximately exp(h H) u and the element type is kept. To relax toward the ground state of a Hamiltonian K, pass H = -K together with normalize = true.

steps is a vector of step sizes h, not of time points. Every entry of steps evolves the state by h, split into substeps substeps of h / substeps each; more substeps reduce the splitting error of a step.

Keyword arguments

  • max_bond::Int=typemax(Int): maximum bond dimension after each two-site update.
  • trunc_tol::Real=0.0: relative truncation tolerance of the two-site SVDs, with the rule of tt_round!.
  • normalize::Bool=false: rescale the state to unit norm after every step.
  • substeps::Int=1: number of substeps each step is split into (see above).
  • carry_env::Bool=true: reuse environments between the substeps of one step.
  • return_info::Bool=false: return (ψ, (; error)), where error is the relative residual of the last step's finite-difference derivative, ‖(u_{n+1} − u_n)/h − G u_{n+1}‖ / ‖u_{n+1}‖, and G is H or -iH.
  • verbosity::Int=1: 3 logs the local energy at every two-site update.
  • show_progress::Bool=true: display a progress bar over the time steps.
  • Remaining keyword arguments are passed to KrylovKit.exponentiate.
source

Cross interpolation

TensorTrainNumerics.tt_cross — Function
tt_cross(f, domain, alg::CrossAlgorithm=MaxVol(); ranks=2, val_size=1000) -> TTVector
tt_cross(f, domain; alg=MaxVol(), kwargs...)
tt_cross(f, dims; alg=MaxVol(), kwargs...)

Build a TTVector approximation of the function f on a tensor-product grid by cross interpolation, evaluating f only at selected points.

domain is a vector of grid-point vectors, one per dimension. With integer dims (a tuple or vector), the grid is 1.0:dims[k] in every dimension.

f is called with a batch of points: an n × d matrix whose rows are points, and it must return n values (any array that vec flattens to length n). The element type of the result is inferred from one evaluation of f.

alg is one of MaxVol, DMRGCross, or Greedy.

Keyword arguments

  • ranks::Union{Int,Vector{Int}}=2: initial interior ranks (MaxVol and DMRGCross only; Greedy always starts at rank 1).
  • val_size::Int=1000: number of random grid points used to measure the relative error ‖f − f̃‖ / ‖f‖ that is compared with alg.tol.

If the tolerance is not reached within alg.max_sweeps iterations, the last approximation is returned, and a warning is logged when alg.verbosity ≥ 1.

Example

f(X) = vec(exp.(-sum(X .^ 2, dims = 2)))
domain = [collect(range(-1.0, 1.0, length = 8)) for _ in 1:4]
tt = tt_cross(f, domain, MaxVol(verbosity = 0, tol = 1e-8); ranks = 2)
source
TensorTrainNumerics.tt_integrate — Function
tt_integrate(f, lower::Vector, upper::Vector; alg=MaxVol(), nquad=20, kwargs...)
tt_integrate(f, d::Int; lower=0.0, upper=1.0, kwargs...)

Approximate the integral of f over the box [lower[1], upper[1]] × ⋯ with a tensor-product Gauss–Legendre rule of nquad nodes per dimension. f is approximated on the quadrature grid by tt_cross with algorithm alg (remaining keyword arguments are passed to tt_cross), and the TT is then contracted with the quadrature weights. f uses the batched calling convention of tt_cross. The second form integrates over the cube [lower, upper]^d.

The values of f must have the element type of lower and upper; complex integrands with real bounds raise a MethodError.

source
TensorTrainNumerics.MaxVol — Type
MaxVol(; max_sweeps=50, tol=1e-10, max_bond=500, kickrank=5, verbosity=1, show_progress=true, pivot=MaxVolPivot())

TT-cross interpolation by alternating maximum-volume pivot selection (Oseledets & Tyrtyshnikov 2010). Starting from the ranks given to tt_cross, each iteration sweeps over the cores, selects interpolation pivots with the maxvol algorithm, and then increases every rank by kickrank (capped at max_bond) until the validation error drops below tol.

Keyword arguments

  • max_sweeps::Int=50: maximum number of iterations; each iteration is one left-to-right pass.
  • tol::Real=1e-10: target relative error on the validation set (see tt_cross).
  • max_bond::Int=500: maximum TT rank.
  • verbosity::Int=1: 1 warns when tol is not reached, 2 logs the validation error after every iteration.
  • show_progress::Bool=true: display a progress bar over the iterations.
  • kickrank::Union{Nothing,Int}=5: rank increase after each iteration; nothing keeps the ranks fixed.
  • pivot::MaxVolPivot: maxvol settings (tol=1.05, maxiter=100).
source
TensorTrainNumerics.DMRGCross — Type
DMRGCross(; max_sweeps=50, tol=1e-10, max_bond=500, kickrank=5, verbosity=1, show_progress=true, pivot=MaxVolPivot())

Two-site (DMRG-style) TT-cross interpolation (Savostyanov & Oseledets 2011). Each micro-step samples a two-core superblock, splits it with an SVD truncated with the rule of tt_round! at trunc_tol = tol and rank max_bond, and selects new pivots with the maxvol algorithm, so the ranks adapt to the function.

Keyword arguments

  • max_sweeps::Int=50: maximum number of iterations; each iteration is a left-to-right and a right-to-left pass.
  • tol::Real=1e-10: target relative error on the validation set (see tt_cross).
  • max_bond::Int=500: maximum TT rank.
  • verbosity::Int=1: 1 warns when tol is not reached, 2 logs the validation error after every pass.
  • show_progress::Bool=true: display a progress bar over the iterations.
  • kickrank::Union{Nothing,Int}=5: extra rank directions added at every split to explore beyond the truncated rank; nothing disables this.
  • pivot::MaxVolPivot: maxvol settings (tol=1.05, maxiter=100).
source
TensorTrainNumerics.Greedy — Type
Greedy(; max_sweeps=50, tol=1e-10, max_bond=500, verbosity=1, show_progress=true, nsamples=1000, pivot=RandomPivot())

Greedy rank-adaptive TT-cross interpolation (Savostyanov 2014). All ranks start at 1. At every bond, each sweep searches a random sample of candidate entries for the largest interpolation error and adds that entry as a new pivot, raising the rank by one, while the error relative to the largest sampled |f| exceeds tol and the rank is below max_bond.

Keyword arguments

  • max_sweeps::Int=50: maximum number of iterations; each iteration is one sweep over the bonds.
  • tol::Real=1e-10: target relative error on the validation set (see tt_cross).
  • max_bond::Int=500: maximum TT rank.
  • verbosity::Int=1: 1 warns when tol is not reached, 2 logs the validation error after every iteration.
  • show_progress::Bool=true: display a progress bar over the iterations.
  • nsamples::Int=1000: number of random candidate entries examined per bond.
  • pivot::RandomPivot: sampling settings; set RandomPivot(seed=…) for reproducible pivots. The smaller of nsamples and pivot.nsamples is used.
source