1% Compute a preconditioner using a modified incomplete Cholesky decomposition.
2%
3% [M1,M2] = divand_pc_michol(iB,H,R,icholparam)
4%
5% Compute preconditioner matrices M1 and M2 based on
6% the inverse background error covariance iB, observation operator
7% H and observation R covariance R. icholparam is a structure will parameters
8% for ichol. The default value is struct('michol','on'). A modified incomplete
9% Cholesky factorization of the matrix iP = iB + H'*(R\H) is computed per
10% default.
11% M2 is the transpose of M1 for this preconditioner.
12%
13% The function ichol is necessary.
14%
15% See also:
16% ichol, divand_pc_sqrtiB
17
18function [M1,M2] = divand_pc_michol(iB,H,R,icholparam)
19
20if nargin == 3
21  icholparam = struct('michol','on');
22end
23
24iP = iB + H'*(R\H);
25
26if which('ichol')
27  M1 = ichol(iP,icholparam);
28else
29    warning('divand-noichol','ichol is not available')
30    M1 = [];
31end
32
33M2 = M1';
34
35% LocalWords:  preconditioner Cholesky diavnd pc michol iB icholparam ichol struct iP divand sqrtiB
36
37% Copyright (C) 2014 Alexander Barth <a.barth@ulg.ac.be>
38%
39% This program is free software; you can redistribute it and/or modify it under
40% the terms of the GNU General Public License as published by the Free Software
41% Foundation; either version 2 of the License, or (at your option) any later
42% version.
43%
44% This program is distributed in the hope that it will be useful, but WITHOUT
45% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
46% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
47% details.
48%
49% You should have received a copy of the GNU General Public License along with
50% this program; if not, see <http://www.gnu.org/licenses/>.
51