Home > tt2 > exp > tt_xtr.m

tt_xtr

PURPOSE ^

The X_s coordinate in the transposed QTT permutation of indices

SYNOPSIS ^

function [x]=tt_xtr(L,K,s)

DESCRIPTION ^

The X_s coordinate in the transposed QTT permutation of indices
   [X]=TT_XTR(L,K,S)Computes QTT-representation of the vector X_s in the
   transposed permutation with 2^L points in each mode 
   and K variables. Ranks are still 2 here.


 TT-Toolbox 2.2, 2009-2012

This is TT Toolbox, written by Ivan Oseledets et al.
Institute of Numerical Mathematics, Moscow, Russia
webpage: http://spring.inm.ras.ru/osel

For all questions, bugs and suggestions please mail
ivan.oseledets@gmail.com
---------------------------

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [x]=tt_xtr(L,K,s)
0002 %The X_s coordinate in the transposed QTT permutation of indices
0003 %   [X]=TT_XTR(L,K,S)Computes QTT-representation of the vector X_s in the
0004 %   transposed permutation with 2^L points in each mode
0005 %   and K variables. Ranks are still 2 here.
0006 %
0007 %
0008 % TT-Toolbox 2.2, 2009-2012
0009 %
0010 %This is TT Toolbox, written by Ivan Oseledets et al.
0011 %Institute of Numerical Mathematics, Moscow, Russia
0012 %webpage: http://spring.inm.ras.ru/osel
0013 %
0014 %For all questions, bugs and suggestions please mail
0015 %ivan.oseledets@gmail.com
0016 %---------------------------
0017 
0018 d=L*K;
0019 r=2*ones(d+1,1);
0020 r(1)=1;
0021 r(d+1)=1;
0022 n=2*ones(d,1);
0023 ps=cumsum([1;n.*r(1:d).*r(2:d+1)]);
0024 %cr=ones(ps(d+1)-1);
0025 x0=zeros(1,2,2);
0026 x0(:,1,:)=[0,1];
0027 x0(:,2,:)=[0,1];
0028 cr(ps(1):ps(2)-1)=x0(:);
0029 x0=zeros(2,2,1);
0030 x0(:,1,:)=[1;0];
0031 x0(:,2,:)=[1;0];
0032 cr(ps(d):ps(d+1)-1)=x0(:);
0033 for i=2:d-1
0034    x0=zeros(2,2,2);
0035    x0(:,1,:)=eye(2);
0036    x0(:,2,:)=eye(2);
0037    cr(ps(i):ps(i+1)-1)=x0(:);
0038 end
0039 x=tt_tensor;
0040 
0041 %Now distribute them in right places: the cores in the
0042 %transposed permutation are with numbers K*(i-1)+s, i=1,...,L
0043 
0044 for i=1:L
0045    curI=K*(i-1)+s;
0046    if ( curI ~= 1 && curI ~= d )
0047       x0=zeros(2,2,2);
0048       x0(:,1,:)=[1,0;0,1];
0049       x0(:,2,:)=[1,0;2^(i-1),1];
0050    elseif ( curI == 1 )
0051       x0=zeros(1,2,2);
0052       x0(:,1,:)=[0,1];
0053       x0(:,2,:)=[2^(i-1),1];
0054    else
0055       x0=zeros(2,2,1);
0056       x0(:,1,:)=[1;0];
0057       x0(:,2,:)=[1;2^(i-1)]; 
0058    end
0059    cr(ps(curI):ps(curI+1)-1)=x0(:);
0060 end
0061 
0062 
0063 
0064 x.d=d;
0065 x.n=n;
0066 x.ps=ps;
0067 x.core=cr;
0068 x.r=r;
0069 end

Generated on Wed 08-Feb-2012 18:20:24 by m2html © 2005