Home > tt2 > @qtt_tucker > matrix.m

matrix

PURPOSE ^

Converts a vector to a matrix in the QTT-Tucker format

SYNOPSIS ^

function [qt]=matrix(qt, sz1, sz2)

DESCRIPTION ^

Converts a vector to a matrix in the QTT-Tucker format
   [QT]=MATRIX(QT, SZ1, SZ2) Makes factors of QTT-Tucker to be TT-matrices
   SZ1 and SZ2 are cell arrays with N, M dimensions for each factor
   If they are absent, the square matrices are assumed
 


 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 [qt]=matrix(qt, sz1, sz2)
0002 %Converts a vector to a matrix in the QTT-Tucker format
0003 %   [QT]=MATRIX(QT, SZ1, SZ2) Makes factors of QTT-Tucker to be TT-matrices
0004 %   SZ1 and SZ2 are cell arrays with N, M dimensions for each factor
0005 %   If they are absent, the square matrices are assumed
0006 %
0007 %
0008 %
0009 % TT-Toolbox 2.2, 2009-2012
0010 %
0011 %This is TT Toolbox, written by Ivan Oseledets et al.
0012 %Institute of Numerical Mathematics, Moscow, Russia
0013 %webpage: http://spring.inm.ras.ru/osel
0014 %
0015 %For all questions, bugs and suggestions please mail
0016 %ivan.oseledets@gmail.com
0017 %---------------------------
0018 
0019 if (nargin<3)
0020     sz1 = [];
0021     sz2 = [];
0022 end;
0023 
0024 d = qt.dphys;
0025 for i=1:d
0026     if (~isempty(sz1))||(~isempty(sz2))
0027         qt.tuck{i} = tt_matrix(qt.tuck{i}, sz1{i}, sz2{i});
0028     else
0029         cursz = qt.tuck{i}.n;
0030         cursz = sqrt(cursz);
0031         qt.tuck{i} = tt_matrix(qt.tuck{i}, cursz, cursz);
0032     end;
0033 end;
0034 
0035 end

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