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
floatCHOL.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_floatCHOL_h)
25 #define octave_floatCHOL_h 1
26 
27 #include <iosfwd>
28 
29 #include "fMatrix.h"
30 #include "fColVector.h"
31 
32 class
33 OCTAVE_API
35 {
36 public:
37 
38  FloatCHOL (void) : chol_mat (), xrcond (0) { }
39 
40  FloatCHOL (const FloatMatrix& a, bool calc_cond = false)
41  : chol_mat (), xrcond (0)
42  {
43  init (a, calc_cond);
44  }
45 
47  bool calc_cond = false)
48  : chol_mat (), xrcond (0)
49  {
50  info = init (a, calc_cond);
51  }
52 
53  FloatCHOL (const FloatCHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { }
54 
56  {
57  if (this != &a)
58  {
59  chol_mat = a.chol_mat;
60  xrcond = a.xrcond;
61  }
62  return *this;
63  }
64 
65  FloatMatrix chol_matrix (void) const { return chol_mat; }
66 
67  float rcond (void) const { return xrcond; }
68 
69  // Compute the inverse of a matrix using the Cholesky factorization.
70  FloatMatrix inverse (void) const;
71 
72  void set (const FloatMatrix& R);
73 
74  void update (const FloatColumnVector& u);
75 
77 
78  octave_idx_type insert_sym (const FloatColumnVector& u, octave_idx_type j);
79 
80  void delete_sym (octave_idx_type j);
81 
82  void shift_sym (octave_idx_type i, octave_idx_type j);
83 
84  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
85  const FloatCHOL& a);
86 
87 private:
88 
90 
91  float xrcond;
92 
93  octave_idx_type init (const FloatMatrix& a, bool calc_cond);
94 };
95 
96 FloatMatrix OCTAVE_API chol2inv (const FloatMatrix& r);
97 
98 #endif