GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
dbleCHOL.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2013 John W. Eaton
4 Copyright (C) 2008-2009 Jaroslav Hajek
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if !defined (octave_dbleCHOL_h)
25 #define octave_dbleCHOL_h 1
26 
27 #include <iosfwd>
28 
29 #include "dMatrix.h"
30 #include "dColVector.h"
31 
32 class
33 OCTAVE_API
34 CHOL
35 {
36 public:
37 
38  CHOL (void) : chol_mat (), xrcond (0) { }
39 
40  CHOL (const Matrix& a, bool calc_cond = false)
41  : chol_mat (), xrcond (0)
42  {
43  init (a, calc_cond);
44  }
45 
46  CHOL (const Matrix& a, octave_idx_type& info, bool calc_cond = false)
47  : chol_mat (), xrcond (0)
48  {
49  info = init (a, calc_cond);
50  }
51 
52  CHOL (const CHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { }
53 
54  CHOL& operator = (const CHOL& a)
55  {
56  if (this != &a)
57  {
58  chol_mat = a.chol_mat;
59  xrcond = a.xrcond;
60  }
61  return *this;
62  }
63 
64  Matrix chol_matrix (void) const { return chol_mat; }
65 
66  double rcond (void) const { return xrcond; }
67 
68  // Compute the inverse of a matrix using the Cholesky factorization.
69  Matrix inverse (void) const;
70 
71  void set (const Matrix& R);
72 
73  void update (const ColumnVector& u);
74 
76 
77  octave_idx_type insert_sym (const ColumnVector& u, octave_idx_type j);
78 
79  void delete_sym (octave_idx_type j);
80 
81  void shift_sym (octave_idx_type i, octave_idx_type j);
82 
83  friend OCTAVE_API std::ostream& operator << (std::ostream& os, const CHOL& a);
84 
85 private:
86 
88 
89  double xrcond;
90 
91  octave_idx_type init (const Matrix& a, bool calc_cond);
92 };
93 
94 Matrix OCTAVE_API chol2inv (const Matrix& r);
95 
96 #endif