Skip to content

tensor4all/AlternatingCrossInterpolation.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlternatingCrossInterpolation

Dev Build Status Aqua

This package implements the alternating cross interpolation method for efficient elementwise operations on tensor trains, as presented in arXiv:2604.00037.

Installation

This package is not yet registered in the General julia registry. The easiest way to install it is to type the following in a julia REPL:

import Pkg; Pkg.add(url="https://github.com/tensor4all/AlternatingCrossInterpolation.jl.git")

Usage

This package contains a single exported function, elementwise(), with two positional arguments: An operator to be applied to the tensor trains, and a vector containing tensor trains as TensorCrossInterpolation.TensorTrain objects. There are multiple keyword arguments, the most important of which is truncationparameters.

For example, to multiply two tensor trains tt1 and tt2 with a maximum bond dimension of 100, and a tolerance of \tau = 10^{-8}:

truncationparameters = ACI.TruncationParameters(100, 1e-8)
ttprod, ranks, errors = ACI.elementwise(*, [tt1, tt2]; truncationparameters=truncationparameters)

The return values are

  • ttprod, the resulting tensor train, and
  • ranks and errors, the rank and error estimate in each iteration of the algorithm.

Example

This example obtains TTs representing two Gaussians, and multiplies them with a maximum bond dimension of 15.

makegaussian(μ, σ) = x -> exp(-0.5 * ((x - μ) / σ)^2)
g1 = makegaussian(0.4, 0.15)
g2 = makegaussian(-0.4, 0.15)
grid = QG.DiscretizedGrid(R, -0.5, 0.5)
ttg1, = TCI.crossinterpolate2(Float64, q -> g1(QG.quantics_to_origcoord(grid, q)), QG.localdimensions(grid); tolerance=1e-24, maxbonddim=χ)
ttg2, = TCI.crossinterpolate2(Float64, q -> g2(QG.quantics_to_origcoord(grid, q)), QG.localdimensions(grid); tolerance=1e-24, maxbonddim=χ)
truncationparameters = ACI.TruncationParameters(15, 1e-24, false)
ttprod, = ACI.elementwise(*, TCI.tensortrain.([ttg1, ttg2]); truncationparameters)

More examples can be found in the repository https://github.com/rittermarc/aci-paper.

About

Alternating Cross Interpolation for elementwise operations on tensor trains.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages