comparison liboctave/floatCHOL.h @ 7789:82be108cc558

First attempt at single precision tyeps * * * corrections to qrupdate single precision routines * * * prefer demotion to single over promotion to double * * * Add single precision support to log2 function * * * Trivial PROJECT file update * * * Cache optimized hermitian/transpose methods * * * Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author David Bateman <dbateman@free.fr>
date Sun, 27 Apr 2008 22:34:17 +0200
parents
children d66c9b6e506a
comparison
equal deleted inserted replaced
7788:45f5faba05a2 7789:82be108cc558
1 /*
2
3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2006,
4 2007 John W. Eaton
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 // updating/downdating by Jaroslav Hajek 2008
25
26 #if !defined (octave_FloatCHOL_h)
27 #define octave_FloatCHOL_h 1
28
29 #include <iostream>
30
31 #include "fMatrix.h"
32
33 class
34 OCTAVE_API
35 FloatCHOL
36 {
37 public:
38
39 FloatCHOL (void) : chol_mat () { }
40
41 FloatCHOL (const FloatMatrix& a, bool calc_cond = false) { init (a, calc_cond); }
42
43 FloatCHOL (const FloatMatrix& a, octave_idx_type& info, bool calc_cond = false)
44 { info = init (a, calc_cond); }
45
46 FloatCHOL (const FloatCHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { }
47
48 FloatCHOL& operator = (const FloatCHOL& a)
49 {
50 if (this != &a)
51 {
52 chol_mat = a.chol_mat;
53 xrcond = a.xrcond;
54 }
55 return *this;
56 }
57
58 FloatMatrix chol_matrix (void) const { return chol_mat; }
59
60 float rcond (void) const { return xrcond; }
61
62 // Compute the inverse of a matrix using the Cholesky factorization.
63 FloatMatrix inverse (void) const;
64
65 void set (const FloatMatrix& R);
66
67 void update (const FloatMatrix& u);
68
69 octave_idx_type downdate (const FloatMatrix& u);
70
71 octave_idx_type insert_sym (const FloatMatrix& u, octave_idx_type j);
72
73 void delete_sym (octave_idx_type j);
74
75 void shift_sym (octave_idx_type i, octave_idx_type j);
76
77 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatCHOL& a);
78
79 private:
80
81 FloatMatrix chol_mat;
82
83 float xrcond;
84
85 octave_idx_type init (const FloatMatrix& a, bool calc_cond);
86 };
87
88 FloatMatrix OCTAVE_API chol2inv (const FloatMatrix& r);
89
90 #endif
91
92 /*
93 ;;; Local Variables: ***
94 ;;; mode: C++ ***
95 ;;; End: ***
96 */