Mercurial > hg > octave-lyh
annotate liboctave/floatQR.h @ 8597:c86718093c1b
improve & fix QR classes
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 27 Jan 2009 12:40:06 +0100 |
parents | a6edd5c23cb5 |
children | d865363208d6 |
rev | line source |
---|---|
7792
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2006, |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 2007 John W. Eaton |
8547
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
5 Copyright (C) 2008, 2009 Jaroslav Hajek |
7792
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 This file is part of Octave. |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 Octave is free software; you can redistribute it and/or modify it |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 under the terms of the GNU General Public License as published by the |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 Free Software Foundation; either version 3 of the License, or (at your |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 option) any later version. |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 Octave is distributed in the hope that it will be useful, but WITHOUT |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 for more details. |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 along with Octave; see the file COPYING. If not, see |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 <http://www.gnu.org/licenses/>. |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 */ |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 #if !defined (octave_FloatQR_h) |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #define octave_FloatQR_h 1 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #include <iostream> |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include "fMatrix.h" |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include "fColVector.h" |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include "fRowVector.h" |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include "dbleQR.h" |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 class |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 OCTAVE_API |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 FloatQR |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 { |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 public: |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 FloatQR (void) : q (), r () { } |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 FloatQR (const FloatMatrix&, QR::type = QR::std); |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 FloatQR (const FloatMatrix& q, const FloatMatrix& r); |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 FloatQR (const FloatQR& a) : q (a.q), r (a.r) { } |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 FloatQR& operator = (const FloatQR& a) |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 { |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 if (this != &a) |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 { |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 q = a.q; |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 r = a.r; |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 } |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 return *this; |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 } |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 ~FloatQR (void) { } |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 void init (const FloatMatrix&, QR::type); |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 FloatMatrix Q (void) const { return q; } |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 FloatMatrix R (void) const { return r; } |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 |
8562
a6edd5c23cb5
use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents:
8547
diff
changeset
|
67 QR::type get_type (void) const; |
8547
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
68 |
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
69 void update (const FloatColumnVector& u, const FloatColumnVector& v); |
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
70 |
7792
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 void update (const FloatMatrix& u, const FloatMatrix& v); |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 |
8547
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
73 void insert_col (const FloatColumnVector& u, octave_idx_type j); |
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
74 |
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
75 void insert_col (const FloatMatrix& u, const Array<octave_idx_type>& j); |
7792
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
76 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 void delete_col (octave_idx_type j); |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
78 |
8547
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
79 void delete_col (const Array<octave_idx_type>& j); |
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
80 |
d66c9b6e506a
imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
7792
diff
changeset
|
81 void insert_row (const FloatRowVector& u, octave_idx_type j); |
7792
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 void delete_row (octave_idx_type j); |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 void shift_cols (octave_idx_type i, octave_idx_type j); |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
86 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
87 friend std::ostream& operator << (std::ostream&, const FloatQR&); |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
88 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 protected: |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
90 |
8597
c86718093c1b
improve & fix QR classes
Jaroslav Hajek <highegg@gmail.com>
parents:
8562
diff
changeset
|
91 void form (octave_idx_type n, FloatMatrix& afact, |
c86718093c1b
improve & fix QR classes
Jaroslav Hajek <highegg@gmail.com>
parents:
8562
diff
changeset
|
92 float *tau, QR::type qr_type); |
c86718093c1b
improve & fix QR classes
Jaroslav Hajek <highegg@gmail.com>
parents:
8562
diff
changeset
|
93 |
7792
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
94 FloatMatrix q; |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
95 FloatMatrix r; |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
96 }; |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
98 #endif |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
99 |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
100 /* |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
101 ;;; Local Variables: *** |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
102 ;;; mode: C++ *** |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
103 ;;; End: *** |
39c1026191e9
add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
104 */ |