Mercurial > octave
comparison libinterp/corefcn/balance.cc @ 21268:f08ae27289e4
better use of templates for balance classes
* aepbalance.h, aepbalance.cc: New files generated from base-aepbal.h,
CmplxAEPBAL.cc, CmplxAEPBAL.h, dbleAEPBAL.cc, dbleAEPBAL.h,
fCmplxAEPBAL.cc, fCmplxAEPBAL.h, floatAEPBAL.cc, and floatAEPBAL.h and
making them templates.
* gepbalance.h, gepbalance.cc: New files generate from CmplxGEPBAL.cc,
CmplxGEPBAL.h, dbleGEPBAL.cc, dbleGEPBAL.h, fCmplxGEPBAL.cc,
fCmplxGEPBAL.h, floatGEPBAL.cc, and floatGEPBAL.h and making them
templates.
* liboctave/numeric/module.mk: Update.
* balance.cc, CMatrix.h, dMatrix.h, fCMatrix.h, fMatrix.h, mx-defs.h,
mx-ext.h: Use new classes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 16 Feb 2016 00:32:29 -0500 |
parents | fcac5dbbf9ed |
children | 40de9f8f23a6 |
comparison
equal
deleted
inserted
replaced
21267:f5b8c3aca5f8 | 21268:f08ae27289e4 |
---|---|
27 # include <config.h> | 27 # include <config.h> |
28 #endif | 28 #endif |
29 | 29 |
30 #include <string> | 30 #include <string> |
31 | 31 |
32 #include "CmplxAEPBAL.h" | 32 #include "CMatrix.h" |
33 #include "fCmplxAEPBAL.h" | 33 #include "aepbalance.h" |
34 #include "dbleAEPBAL.h" | 34 #include "dMatrix.h" |
35 #include "floatAEPBAL.h" | 35 #include "fCMatrix.h" |
36 #include "CmplxGEPBAL.h" | 36 #include "fMatrix.h" |
37 #include "fCmplxGEPBAL.h" | 37 #include "gepbalance.h" |
38 #include "dbleGEPBAL.h" | |
39 #include "floatGEPBAL.h" | |
40 #include "quit.h" | 38 #include "quit.h" |
41 | 39 |
42 #include "defun.h" | 40 #include "defun.h" |
43 #include "error.h" | 41 #include "error.h" |
44 #include "f77-fcn.h" | 42 #include "f77-fcn.h" |
150 // balance the AEP | 148 // balance the AEP |
151 if (isfloat) | 149 if (isfloat) |
152 { | 150 { |
153 if (complex_case) | 151 if (complex_case) |
154 { | 152 { |
155 FloatComplexAEPBALANCE result (fcaa, noperm, noscal); | 153 aepbalance<FloatComplexMatrix> result (fcaa, noperm, noscal); |
156 | 154 |
157 if (nargout == 0 || nargout == 1) | 155 if (nargout == 0 || nargout == 1) |
158 retval = ovl (result.balanced_matrix ()); | 156 retval = ovl (result.balanced_matrix ()); |
159 else if (nargout == 2) | 157 else if (nargout == 2) |
160 retval = ovl (result.balancing_matrix (), | 158 retval = ovl (result.balancing_matrix (), |
164 result.permuting_vector (), | 162 result.permuting_vector (), |
165 result.balanced_matrix ()); | 163 result.balanced_matrix ()); |
166 } | 164 } |
167 else | 165 else |
168 { | 166 { |
169 FloatAEPBALANCE result (faa, noperm, noscal); | 167 aepbalance<FloatMatrix> result (faa, noperm, noscal); |
170 | 168 |
171 if (nargout == 0 || nargout == 1) | 169 if (nargout == 0 || nargout == 1) |
172 retval = ovl (result.balanced_matrix ()); | 170 retval = ovl (result.balanced_matrix ()); |
173 else if (nargout == 2) | 171 else if (nargout == 2) |
174 retval = ovl (result.balancing_matrix (), | 172 retval = ovl (result.balancing_matrix (), |
181 } | 179 } |
182 else | 180 else |
183 { | 181 { |
184 if (complex_case) | 182 if (complex_case) |
185 { | 183 { |
186 ComplexAEPBALANCE result (caa, noperm, noscal); | 184 aepbalance<ComplexMatrix> result (caa, noperm, noscal); |
187 | 185 |
188 if (nargout == 0 || nargout == 1) | 186 if (nargout == 0 || nargout == 1) |
189 retval = ovl (result.balanced_matrix ()); | 187 retval = ovl (result.balanced_matrix ()); |
190 else if (nargout == 2) | 188 else if (nargout == 2) |
191 retval = ovl (result.balancing_matrix (), | 189 retval = ovl (result.balancing_matrix (), |
195 result.permuting_vector (), | 193 result.permuting_vector (), |
196 result.balanced_matrix ()); | 194 result.balanced_matrix ()); |
197 } | 195 } |
198 else | 196 else |
199 { | 197 { |
200 AEPBALANCE result (aa, noperm, noscal); | 198 aepbalance<Matrix> result (aa, noperm, noscal); |
201 | 199 |
202 if (nargout == 0 || nargout == 1) | 200 if (nargout == 0 || nargout == 1) |
203 retval = ovl (result.balanced_matrix ()); | 201 retval = ovl (result.balanced_matrix ()); |
204 else if (nargout == 2) | 202 else if (nargout == 2) |
205 retval = ovl (result.balancing_matrix (), | 203 retval = ovl (result.balancing_matrix (), |
249 // balance the GEP | 247 // balance the GEP |
250 if (isfloat) | 248 if (isfloat) |
251 { | 249 { |
252 if (complex_case) | 250 if (complex_case) |
253 { | 251 { |
254 FloatComplexGEPBALANCE result (fcaa, fcbb, bal_job); | 252 gepbalance<FloatComplexMatrix> result (fcaa, fcbb, bal_job); |
255 | 253 |
256 switch (nargout) | 254 switch (nargout) |
257 { | 255 { |
258 case 4: | 256 case 4: |
259 retval(3) = result.balanced_matrix2 (); | 257 retval(3) = result.balanced_matrix2 (); |
274 break; | 272 break; |
275 } | 273 } |
276 } | 274 } |
277 else | 275 else |
278 { | 276 { |
279 FloatGEPBALANCE result (faa, fbb, bal_job); | 277 gepbalance<FloatMatrix> result (faa, fbb, bal_job); |
280 | 278 |
281 switch (nargout) | 279 switch (nargout) |
282 { | 280 { |
283 case 4: | 281 case 4: |
284 retval(3) = result.balanced_matrix2 (); | 282 retval(3) = result.balanced_matrix2 (); |
302 } | 300 } |
303 else | 301 else |
304 { | 302 { |
305 if (complex_case) | 303 if (complex_case) |
306 { | 304 { |
307 ComplexGEPBALANCE result (caa, cbb, bal_job); | 305 gepbalance<ComplexMatrix> result (caa, cbb, bal_job); |
308 | 306 |
309 switch (nargout) | 307 switch (nargout) |
310 { | 308 { |
311 case 4: | 309 case 4: |
312 retval(3) = result.balanced_matrix2 (); | 310 retval(3) = result.balanced_matrix2 (); |
327 break; | 325 break; |
328 } | 326 } |
329 } | 327 } |
330 else | 328 else |
331 { | 329 { |
332 GEPBALANCE result (aa, bb, bal_job); | 330 gepbalance<Matrix> result (aa, bb, bal_job); |
333 | 331 |
334 switch (nargout) | 332 switch (nargout) |
335 { | 333 { |
336 case 4: | 334 case 4: |
337 retval(3) = result.balanced_matrix2 (); | 335 retval(3) = result.balanced_matrix2 (); |