rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
lincomb_sequence2.m
1 function res = lincomb_sequence2(seq,sigma1,sigma2)
2 %function res = lincomb_sequence2(seq,sigma1,sigma2)
3 %
4 % function performing a linear combination of the elements in the
5 % 2d cell array seq with coefficients in sigma1 and sigma2 result is a
6 % vector/matrix the same size as the entries of seq.
7 % size of seq is length(sigma1) x length(sigma2)
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  res = zeros(size(seq{1,1}));
16  for q1=1:Q1
17  if sigma1(q1)~=0
18  for q2=1:Q2
19  if sigma2(q2)~=0
20  res = res + sigma1(q1)*sigma2(q2)*seq{q1,q2};
21  end;
22  end;
23  end;
24  end;