C=A.^B [C]=POWER(A,B) Computes A.^B for a QTT-Tucker A and natural B. 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 [c] = power(a,b,varargin) 0002 %C=A.^B 0003 % [C]=POWER(A,B) Computes A.^B for a QTT-Tucker A and natural B. 0004 % 0005 % 0006 % TT-Toolbox 2.2, 2009-2012 0007 % 0008 %This is TT Toolbox, written by Ivan Oseledets et al. 0009 %Institute of Numerical Mathematics, Moscow, Russia 0010 %webpage: http://spring.inm.ras.ru/osel 0011 % 0012 %For all questions, bugs and suggestions please mail 0013 %ivan.oseledets@gmail.com 0014 %--------------------------- 0015 if isa(a,'qtt_tucker') && numel(b) == 1 0016 c=a; 0017 b=b-1; 0018 while(b>0) 0019 c=c.*a; 0020 b=b-1; 0021 end 0022 0023 else 0024 error('Incorrect usage for TT-power'); 0025 end