rbmatlab 0.10.01
general/basic/lincomb_sequence3.m
00001 function res = lincomb_sequence3(seq,sigma1,sigma2,sigma3)
00002 %function res = lincomb_sequence3(seq,sigma1,sigma2,sigma3)
00003 %
00004 % function performing a linear combination of the elements in the
00005 % 3d cell array seq with coefficients in sigma1, sigma2, sigma3 result is a
00006 % vector/matrix the same size as the entries of seq.
00007 % size of seq is length(sigma1) x length(sigma2) x length(sigma3)
00008 % if some sigma = 0, the component is not touched, i.e. the component
00009 % may also be an empty matrix. 
00010 
00011 % Bernard Haasdonk 15.5.2007
00012 
00013   Q1 = length(sigma1);
00014   Q2 = length(sigma2);
00015   Q3 = length(sigma3);
00016   res = zeros(size(seq{1,1,1}));
00017   for q1=1:Q1
00018     if sigma1(q1)~=0 
00019       for q2=1:Q2
00020         if sigma2(q2)~=0 
00021           for q3=1:Q3
00022             if sigma3(q3)~=0      
00023               res = res + sigma1(q1)*sigma2(q2)*sigma3(q3)* seq{q1,q2,q3};
00024             end;
00025           end;
00026         end;
00027       end; 
00028     end;
00029   end;
 All Classes Namespaces Files Functions Variables