Mercurial > hg > octave-nkf
annotate liboctave/numeric/CmplxAEPBAL.cc @ 20439:5dfaaaae784f
Deprecate Array::capacity() and Sparse::capacity() for numel() and nzmax().
* liboctave/array/Array.h (Array::capacity): deprecate for ::numel().
* liboctave/array/Sparse.h (Sparse::capacity): deprecate for ::nzmax().
Also move comments into doxygen docs.
* libinterp/corefcn/daspk.cc, libinterp/corefcn/dasrt.cc,
libinterp/corefcn/dassl.cc, libinterp/corefcn/jit-typeinfo.h,
libinterp/corefcn/quad.cc, libinterp/corefcn/variables.cc,
libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.h,
libinterp/octave-value/ov.h, liboctave/array/Sparse.cc,
liboctave/numeric/DASPK.cc, liboctave/numeric/DASRT.cc,
liboctave/numeric/DASSL.cc, liboctave/numeric/LSODE.cc,
liboctave/numeric/Quad.cc, liboctave/numeric/base-de.h,
liboctave/numeric/base-min.h, liboctave/numeric/oct-rand.cc: replace use
of capacity by numel() or nzmax() as appropriate.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sun, 24 May 2015 04:47:20 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
457 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
3 Copyright (C) 1994-2015 John W. Eaton |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
4 Copyright (C) 2008 Jaroslav Hajek |
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 | |
1730 | 28 #include <string> |
29 | |
457 | 30 #include "CmplxAEPBAL.h" |
31 #include "dMatrix.h" | |
1847 | 32 #include "f77-fcn.h" |
457 | 33 |
34 extern "C" | |
35 { | |
4552 | 36 F77_RET_T |
11518 | 37 F77_FUNC (zgebal, ZGEBAL) (F77_CONST_CHAR_ARG_DECL, |
38 const octave_idx_type&, Complex*, | |
39 const octave_idx_type&, octave_idx_type&, | |
40 octave_idx_type&, double*, octave_idx_type& | |
41 F77_CHAR_ARG_LEN_DECL); | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
42 |
4552 | 43 F77_RET_T |
11518 | 44 F77_FUNC (zgebak, ZGEBAK) (F77_CONST_CHAR_ARG_DECL, |
45 F77_CONST_CHAR_ARG_DECL, | |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
46 const octave_idx_type&, const octave_idx_type&, |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
47 const octave_idx_type&, const double*, |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
48 const octave_idx_type&, Complex*, |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
49 const octave_idx_type&, octave_idx_type& |
11518 | 50 F77_CHAR_ARG_LEN_DECL |
51 F77_CHAR_ARG_LEN_DECL); | |
457 | 52 } |
53 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
54 ComplexAEPBALANCE::ComplexAEPBALANCE (const ComplexMatrix& a, |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
55 bool noperm, bool noscal) |
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
56 : base_aepbal<ComplexMatrix, ColumnVector> () |
457 | 57 { |
5275 | 58 octave_idx_type n = a.cols (); |
457 | 59 |
1933 | 60 if (a.rows () != n) |
1730 | 61 { |
62 (*current_liboctave_error_handler) ("AEPBALANCE requires square matrix"); | |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
63 return; |
1730 | 64 } |
65 | |
5275 | 66 octave_idx_type info; |
457 | 67 |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
68 scale = ColumnVector (n); |
1933 | 69 double *pscale = scale.fortran_vec (); |
457 | 70 |
71 balanced_mat = a; | |
1933 | 72 Complex *p_balanced_mat = balanced_mat.fortran_vec (); |
1730 | 73 |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
74 job = noperm ? (noscal ? 'N' : 'S') : (noscal ? 'P' : 'B'); |
457 | 75 |
4552 | 76 F77_XFCN (zgebal, ZGEBAL, (F77_CONST_CHAR_ARG2 (&job, 1), |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
77 n, p_balanced_mat, n, ilo, ihi, |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
78 pscale, info |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
79 F77_CHAR_ARG_LEN (1))); |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
80 } |
457 | 81 |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
82 ComplexMatrix |
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
83 ComplexAEPBALANCE::balancing_matrix (void) const |
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
84 { |
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
85 octave_idx_type n = balanced_mat.rows (); |
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
86 ComplexMatrix balancing_mat (n, n, 0.0); |
7482
29980c6b8604
don't check f77_exception_encountered
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
87 for (octave_idx_type i = 0; i < n; i++) |
29980c6b8604
don't check f77_exception_encountered
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
88 balancing_mat.elem (i, i) = 1.0; |
457 | 89 |
7482
29980c6b8604
don't check f77_exception_encountered
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
90 Complex *p_balancing_mat = balancing_mat.fortran_vec (); |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
91 const double *pscale = scale.fortran_vec (); |
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
92 |
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
93 octave_idx_type info; |
1933 | 94 |
7482
29980c6b8604
don't check f77_exception_encountered
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
95 char side = 'R'; |
457 | 96 |
7482
29980c6b8604
don't check f77_exception_encountered
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
97 F77_XFCN (zgebak, ZGEBAK, (F77_CONST_CHAR_ARG2 (&job, 1), |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
98 F77_CONST_CHAR_ARG2 (&side, 1), |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
99 n, ilo, ihi, pscale, n, |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
100 p_balancing_mat, n, info |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
101 F77_CHAR_ARG_LEN (1) |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
102 F77_CHAR_ARG_LEN (1))); |
457 | 103 |
8386
a5e080076778
make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7482
diff
changeset
|
104 return balancing_mat; |
457 | 105 } |