RANDTENSOR3 - Randomly generates a 3-way low-rank tensor Syntax function X=randtensor3(sz, dims) Reference "On the extension of trace norm to tensors" Ryota Tomioka, Kohei Hayashi, and Hisashi Kashima arXiv:1010.0789 http://arxiv.org/abs/1010.0789 Copyright(c) 2010 Ryota Tomioka This software is distributed under the MIT license. See license.txt
0001 % RANDTENSOR3 - Randomly generates a 3-way low-rank tensor 0002 % 0003 % Syntax 0004 % function X=randtensor3(sz, dims) 0005 % 0006 % Reference 0007 % "On the extension of trace norm to tensors" 0008 % Ryota Tomioka, Kohei Hayashi, and Hisashi Kashima 0009 % arXiv:1010.0789 0010 % http://arxiv.org/abs/1010.0789 0011 % 0012 % Copyright(c) 2010 Ryota Tomioka 0013 % This software is distributed under the MIT license. See license.txt 0014 0015 0016 function X=randtensor3(sz, dims) 0017 0018 nd=length(sz); 0019 0020 C=randn(dims); 0021 0022 U=cell(1,nd); 0023 for jj=1:nd 0024 [U{jj},R]=qr(randn(sz(jj),dims(jj)),0); 0025 end 0026 0027 X=kolda3(C,U{:});