Tensor of all zeros [TT]=TT_ZEROS(N,D), computes the d-dimensional TT-tensor of all zeros with mode size equal to N [TT]=TT_ZEROS(N), computes the TT-tensor of all zeros with mode size given in the vector N 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 ---------------------------
0001 function [tt] = tt_zeros(n,varargin) 0002 %Tensor of all zeros 0003 % [TT]=TT_ZEROS(N,D), computes the d-dimensional TT-tensor of all zeros 0004 % with mode size equal to N 0005 % 0006 % [TT]=TT_ZEROS(N), computes the TT-tensor of all zeros with mode size 0007 % given in the vector N 0008 % 0009 % 0010 % 0011 % 0012 % TT-Toolbox 2.2, 2009-2012 0013 % 0014 %This is TT Toolbox, written by Ivan Oseledets et al. 0015 %Institute of Numerical Mathematics, Moscow, Russia 0016 %webpage: http://spring.inm.ras.ru/osel 0017 % 0018 %For all questions, bugs and suggestions please mail 0019 %ivan.oseledets@gmail.com 0020 %--------------------------- 0021 if (numel(n) == 1) 0022 d=varargin{1}; 0023 n=n*ones(1,d); 0024 else 0025 d=numel(n); 0026 end 0027 tt=cell(d,1); 0028 tt{1}=zeros(n(1),1); 0029 tt{d}=zeros(n(d),1); 0030 for i=2:d-1 0031 tt{i}=zeros(n(i),1,1); 0032 end 0033 tt=tt_tensor(tt); %Bydlocode 0034 return 0035 end