1% Add a constraint to the cost function.
2%
3% s = divand_addc(s,constrain)
4%
5% Include in the structure s the specified constrain.
6%
7% Input:
8%   s: structure created by divand_background
9%   constrain: The parameter constrain has the following fields: R (a covariance
10%     matrix), H (extraction operator) and yo (specified value for the
11%     constrain).
12%
13% Output:
14%   s: structure to be used by divand_factorize
15
16function s = divand_addc(s,constrain)
17
18if isfield(s,'R')
19  s.R = append(s.R,constrain.R);
20  s.H = append(s.H,constrain.H);
21  s.yo = cat(1,s.yo,constrain.yo);
22else
23   s.H = CatBlockMat(1,constrain.H);
24   s.R = DiagBlockMat(constrain.R);
25   s.yo = constrain.yo;
26end
27
28% Copyright (C) 2014 Alexander Barth <a.barth@ulg.ac.be>
29%
30% This program is free software; you can redistribute it and/or modify it under
31% the terms of the GNU General Public License as published by the Free Software
32% Foundation; either version 2 of the License, or (at your option) any later
33% version.
34%
35% This program is distributed in the hope that it will be useful, but WITHOUT
36% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
37% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
38% details.
39%
40% You should have received a copy of the GNU General Public License along with
41% this program; if not, see <http://www.gnu.org/licenses/>.
42