rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
lincomb_sequence3.m
1 function res = lincomb_sequence3(seq,sigma1,sigma2,sigma3)
2 %function res = lincomb_sequence3(seq,sigma1,sigma2,sigma3)
3 %
4 % function performing a linear combination of the elements in the
5 % 3d cell array seq with coefficients in sigma1, sigma2, sigma3 result is a
6 % vector/matrix the same size as the entries of seq.
7 % size of seq is length(sigma1) x length(sigma2) x length(sigma3)
8 % if some sigma = 0, the component is not touched, i.e. the component
9 % may also be an empty matrix.
10 
11 % Bernard Haasdonk 15.5.2007
12 
13  Q1 = length(sigma1);
14  Q2 = length(sigma2);
15  Q3 = length(sigma3);
16  res = zeros(size(seq{1,1,1}));
17  for q1=1:Q1
18  if sigma1(q1)~=0
19  for q2=1:Q2
20  if sigma2(q2)~=0
21  for q3=1:Q3
22  if sigma3(q3)~=0
23  res = res + sigma1(q1)*sigma2(q2)*sigma3(q3)* seq{q1,q2,q3};
24  end;
25  end;
26  end;
27  end;
28  end;
29  end;