Factorize a function on the continuous using quantics grid#

struct Quantics#

This class represents a quantics grid. A quantics grid is an uniform grid with $2^R$ points in [a,b): $x_i=a+i\Delta$, where $\Delta = (b -a)/2^R $ and $i=0,1,…,2^R-1 $. The function $f$ is mapped to a tensor with $R$ legs in the following way. The binary digits $\sigma_i\}$ of $i$ are used as indices of the tensor $F$ defined by: $ F(\sigma_i\})=f(x_i) $

Public Members

double b = 1#

the start and end of the interval for all the variables

int nBit = 10#

number of bit for each variable

int dim = 1#

dimension of the hypercube

bool fused = false#

whether to combine the bits of the same “scale”

template<class T>
class QTensorCI : public xfac::TensorCI2<T>#

This class is a TensorCI2 built form a function f(x1,x2,…,xn) where the binary digits of the each xi are used to buid a tensor of length n*nBit Apart from the TensorCI2 including its tensor train, the main output is the quantics tensor train: a cheap representation of the function that can be saved/loaded to file

Public Functions

inline QTensorCI(function<T(vector<double>)> f_, grid::Quantics grid_, TensorCI2Param par = {})#

constructs a rank-1 QTensorCI from a function f:(u1,u2,…,un)->T and the given quantics grid

inline QTensorCI(function<T(double)> f_, grid::Quantics grid_, TensorCI2Param par = {})#

constructs a rank-1 QTensorCI from a function f:(u1)->T and the given quantics grid. Specialization for the 1d case.

inline QTensorTrain<T> get_qtt() const#

returns the underline quantics tensor train

inline void addPivotPoints(vector<vector<double>> const &xpivots)#

add the pivots to all bonds of the tci. Each point is translated to the corresponding tensor index

inline void addPivotValues(vector<double> const &xpivots)#

add the pivots to all bonds of the tci. Each point is translated to the corresponding tensor index. Specialization for the 1d case.

template<class T>
struct QTensorTrain#

store a quantics tensor train, ie a tensor train and a quantics grid. This struct is able to save/load a multidimensional function R^n -> T

Public Functions

inline T eval(vector<double> const &xs) const#

evaluate the qtt at a given point in R^n

inline T integral() const#

compute the integral in the hypercube [a,b]^n where [a,b] are the bounds of the grid