Mercurial > hg > octave-nkf
annotate liboctave/numeric/CmplxLU.cc @ 20056:059a05bc398c
Replace 'Octave:broadcast' warning with 'Octave:matlab-incompatible'.
* liboctave/numeric/bsxfun.h: replace the 'Octave:broadcasting' with the more
common 'Octave:matlab-compatible' warning which is off by default.
* plot/appearance/annotation.m, image/cubehelix.m: remove turning off the
warning since now it is done by default.
* miscellaneous/warning_ids.m: remove entry about Octave:broadcast
* NEWS: make note of this change.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sat, 21 Feb 2015 16:38:53 +0000 |
parents | 4197fc428c7d |
children | a9574e3c6e9e |
rev | line source |
---|---|
457 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18084
diff
changeset
|
3 Copyright (C) 1994-2015 John W. Eaton |
9708 | 4 Copyright (C) 2009 VZLU Prague, a.s. |
457 | 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
457 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
457 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
1192 | 25 #include <config.h> |
457 | 26 #endif |
27 | |
28 #include "CmplxLU.h" | |
1847 | 29 #include "f77-fcn.h" |
457 | 30 #include "lo-error.h" |
9708 | 31 #include "oct-locbuf.h" |
32 #include "CColVector.h" | |
457 | 33 |
1992 | 34 // Instantiate the base LU class for the types we need. |
35 | |
15374
b5f28cc401b9
Use double quotes, not angle brackets, for '#include "base-lu.cc"'.
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
36 #include "base-lu.h" |
b5f28cc401b9
Use double quotes, not angle brackets, for '#include "base-lu.cc"'.
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
37 #include "base-lu.cc" |
1992 | 38 |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
39 template class base_lu <ComplexMatrix>; |
1992 | 40 |
41 // Define the constructor for this particular derivation. | |
42 | |
457 | 43 extern "C" |
44 { | |
4552 | 45 F77_RET_T |
11518 | 46 F77_FUNC (zgetrf, ZGETRF) (const octave_idx_type&, const octave_idx_type&, |
47 Complex*, const octave_idx_type&, | |
48 octave_idx_type*, octave_idx_type&); | |
9708 | 49 |
50 #ifdef HAVE_QRUPDATE_LUU | |
51 F77_RET_T | |
52 F77_FUNC (zlu1up, ZLU1UP) (const octave_idx_type&, const octave_idx_type&, | |
53 Complex *, const octave_idx_type&, | |
54 Complex *, const octave_idx_type&, | |
55 Complex *, Complex *); | |
56 | |
57 F77_RET_T | |
58 F77_FUNC (zlup1up, ZLUP1UP) (const octave_idx_type&, const octave_idx_type&, | |
59 Complex *, const octave_idx_type&, | |
60 Complex *, const octave_idx_type&, | |
61 octave_idx_type *, const Complex *, | |
62 const Complex *, Complex *); | |
63 #endif | |
457 | 64 } |
65 | |
66 ComplexLU::ComplexLU (const ComplexMatrix& a) | |
67 { | |
5275 | 68 octave_idx_type a_nr = a.rows (); |
69 octave_idx_type a_nc = a.cols (); | |
70 octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); | |
1919 | 71 |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
72 ipvt.resize (dim_vector (mn, 1)); |
5275 | 73 octave_idx_type *pipvt = ipvt.fortran_vec (); |
1919 | 74 |
1992 | 75 a_fact = a; |
76 Complex *tmp_data = a_fact.fortran_vec (); | |
1919 | 77 |
5275 | 78 octave_idx_type info = 0; |
457 | 79 |
4329 | 80 F77_XFCN (zgetrf, ZGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info)); |
457 | 81 |
9694
50db3c5175b5
allow unpacked form of LU
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
82 for (octave_idx_type i = 0; i < mn; i++) |
50db3c5175b5
allow unpacked form of LU
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
83 pipvt[i] -= 1; |
457 | 84 } |
85 | |
9708 | 86 #ifdef HAVE_QRUPDATE_LUU |
87 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
88 void ComplexLU::update (const ComplexColumnVector& u, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
89 const ComplexColumnVector& v) |
9708 | 90 { |
91 if (packed ()) | |
92 unpack (); | |
93 | |
94 ComplexMatrix& l = l_fact; | |
95 ComplexMatrix& r = a_fact; | |
96 | |
97 octave_idx_type m = l.rows (); | |
98 octave_idx_type n = r.columns (); | |
99 octave_idx_type k = l.columns (); | |
100 | |
101 if (u.length () == m && v.length () == n) | |
102 { | |
18084
8e056300994b
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
103 ComplexColumnVector utmp = u; |
8e056300994b
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
104 ComplexColumnVector vtmp = v; |
9708 | 105 F77_XFCN (zlu1up, ZLU1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, |
106 utmp.fortran_vec (), vtmp.fortran_vec ())); | |
107 } | |
108 else | |
109 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch"); | |
110 } | |
111 | |
112 void ComplexLU::update (const ComplexMatrix& u, const ComplexMatrix& v) | |
113 { | |
114 if (packed ()) | |
115 unpack (); | |
116 | |
117 ComplexMatrix& l = l_fact; | |
118 ComplexMatrix& r = a_fact; | |
119 | |
120 octave_idx_type m = l.rows (); | |
121 octave_idx_type n = r.columns (); | |
122 octave_idx_type k = l.columns (); | |
123 | |
124 if (u.rows () == m && v.rows () == n && u.cols () == v.cols ()) | |
125 { | |
126 for (volatile octave_idx_type i = 0; i < u.cols (); i++) | |
127 { | |
18084
8e056300994b
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
128 ComplexColumnVector utmp = u.column (i); |
8e056300994b
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
129 ComplexColumnVector vtmp = v.column (i); |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
130 F77_XFCN (zlu1up, ZLU1UP, (m, n, l.fortran_vec (), |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
131 m, r.fortran_vec (), k, |
9708 | 132 utmp.fortran_vec (), vtmp.fortran_vec ())); |
133 } | |
134 } | |
135 else | |
136 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch"); | |
137 } | |
138 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
139 void ComplexLU::update_piv (const ComplexColumnVector& u, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
140 const ComplexColumnVector& v) |
9708 | 141 { |
142 if (packed ()) | |
143 unpack (); | |
144 | |
145 ComplexMatrix& l = l_fact; | |
146 ComplexMatrix& r = a_fact; | |
147 | |
148 octave_idx_type m = l.rows (); | |
149 octave_idx_type n = r.columns (); | |
150 octave_idx_type k = l.columns (); | |
151 | |
152 if (u.length () == m && v.length () == n) | |
153 { | |
18084
8e056300994b
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
154 ComplexColumnVector utmp = u; |
8e056300994b
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
155 ComplexColumnVector vtmp = v; |
9708 | 156 OCTAVE_LOCAL_BUFFER (Complex, w, m); |
157 for (octave_idx_type i = 0; i < m; i++) ipvt(i) += 1; // increment | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
158 F77_XFCN (zlup1up, ZLUP1UP, (m, n, l.fortran_vec (), |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
159 m, r.fortran_vec (), k, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
160 ipvt.fortran_vec (), |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
161 utmp.data (), vtmp.data (), w)); |
9708 | 162 for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement |
163 } | |
164 else | |
165 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch"); | |
166 } | |
167 | |
168 void ComplexLU::update_piv (const ComplexMatrix& u, const ComplexMatrix& v) | |
169 { | |
170 if (packed ()) | |
171 unpack (); | |
172 | |
173 ComplexMatrix& l = l_fact; | |
174 ComplexMatrix& r = a_fact; | |
175 | |
176 octave_idx_type m = l.rows (); | |
177 octave_idx_type n = r.columns (); | |
178 octave_idx_type k = l.columns (); | |
179 | |
180 if (u.rows () == m && v.rows () == n && u.cols () == v.cols ()) | |
181 { | |
182 OCTAVE_LOCAL_BUFFER (Complex, w, m); | |
183 for (octave_idx_type i = 0; i < m; i++) ipvt(i) += 1; // increment | |
184 for (volatile octave_idx_type i = 0; i < u.cols (); i++) | |
185 { | |
18084
8e056300994b
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
186 ComplexColumnVector utmp = u.column (i); |
8e056300994b
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
187 ComplexColumnVector vtmp = v.column (i); |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
188 F77_XFCN (zlup1up, ZLUP1UP, (m, n, l.fortran_vec (), |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
189 m, r.fortran_vec (), k, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
190 ipvt.fortran_vec (), |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
191 utmp.data (), vtmp.data (), w)); |
9708 | 192 } |
193 for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement | |
194 } | |
195 else | |
196 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch"); | |
197 } | |
198 | |
199 #else | |
200 | |
201 void ComplexLU::update (const ComplexColumnVector&, const ComplexColumnVector&) | |
202 { | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
203 (*current_liboctave_error_handler) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
204 ("luupdate: not available in this version"); |
9708 | 205 } |
206 | |
207 void ComplexLU::update (const ComplexMatrix&, const ComplexMatrix&) | |
208 { | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
209 (*current_liboctave_error_handler) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
210 ("luupdate: not available in this version"); |
9708 | 211 } |
212 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
213 void ComplexLU::update_piv (const ComplexColumnVector&, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
214 const ComplexColumnVector&) |
9708 | 215 { |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
216 (*current_liboctave_error_handler) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
217 ("luupdate: not available in this version"); |
9708 | 218 } |
219 | |
220 void ComplexLU::update_piv (const ComplexMatrix&, const ComplexMatrix&) | |
221 { | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
222 (*current_liboctave_error_handler) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
223 ("luupdate: not available in this version"); |
9708 | 224 } |
225 | |
226 #endif |