Mercurial > octave
comparison liboctave/numeric/aepbalance.cc @ 31607:aac27ad79be6 stable
maint: Re-indent code after switch to using namespace macros.
* build-env.h, build-env.in.cc, Cell.h, __betainc__.cc, __eigs__.cc,
__ftp__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __magick_read__.cc,
__pchip_deriv__.cc, amd.cc, base-text-renderer.cc, base-text-renderer.h,
besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.h, call-stack.cc,
call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, dasrt.cc, data.cc,
debug.cc, defaults.cc, defaults.h, det.cc, display.cc, display.h, dlmread.cc,
dynamic-ld.cc, dynamic-ld.h, ellipj.cc, environment.cc, environment.h,
error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h,
event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc,
file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h,
gcd.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h,
graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, gsvd.cc, gtk-manager.cc,
gtk-manager.h, help.cc, help.h, hook-fcn.cc, hook-fcn.h, input.cc, input.h,
interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h,
inv.cc, jsondecode.cc, jsonencode.cc, latex-text-renderer.cc,
latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h,
lookup.cc, ls-hdf5.cc, ls-mat4.cc, ls-mat5.cc, lsode.cc, lu.cc, mappers.cc,
matrix_type.cc, max.cc, mex.cc, mexproto.h, mxarray.h, mxtypes.in.h,
oct-errno.in.cc, oct-hdf5-types.cc, oct-hist.cc, oct-hist.h, oct-map.cc,
oct-map.h, oct-opengl.h, oct-prcstrm.h, oct-process.cc, oct-process.h,
oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.h,
octave-default-image.h, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc,
pow2.cc, pr-output.cc, psi.cc, qr.cc, quadcc.cc, rand.cc, regexp.cc,
settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xpow.cc,
sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfns.cc, svd.cc,
syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h,
symtab.cc, symtab.h, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h,
text-renderer.cc, text-renderer.h, time.cc, toplev.cc, typecast.cc,
url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h,
variables.cc, variables.h, xdiv.cc, __delaunayn__.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audioread.cc, convhulln.cc,
gzip.cc, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc,
cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h,
cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h,
cdef-utils.cc, cdef-utils.h, ov-base-diag.cc, ov-base-int.cc, ov-base-mat.cc,
ov-base-mat.h, ov-base-scalar.cc, ov-base.cc, ov-base.h, ov-bool-mat.cc,
ov-bool-mat.h, ov-bool-sparse.cc, ov-bool.cc, ov-builtin.h, ov-cell.cc,
ov-ch-mat.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h,
ov-complex.cc, ov-cx-diag.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.cc,
ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-float.cc,
ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc, ov-flt-re-diag.cc,
ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-intx.h, ov-java.cc, ov-lazy-idx.cc,
ov-legacy-range.cc, ov-magic-int.cc, ov-mex-fcn.cc, ov-mex-fcn.h,
ov-null-mat.cc, ov-perm.cc, ov-range.cc, ov-re-diag.cc, ov-re-mat.cc,
ov-re-mat.h, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc, ov-struct.cc,
ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.h,
octave.cc, octave.h, op-b-sbm.cc, op-bm-sbm.cc, op-cs-scm.cc, op-fm-fcm.cc,
op-fs-fcm.cc, op-s-scm.cc, op-scm-cs.cc, op-scm-s.cc, op-sm-cs.cc, ops.h,
anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h,
comment-list.cc, comment-list.h, filepos.h, lex.h, oct-lvalue.cc, oct-lvalue.h,
parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h,
pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h,
pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc,
pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc,
pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h,
pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h,
pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h,
pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h,
pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h,
pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h,
pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h,
pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h,
idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h,
aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h,
gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc,
lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h,
oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc,
oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h,
randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h,
sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc,
sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h,
file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h,
lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h,
oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc,
oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h,
action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h,
cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h,
lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h,
lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc,
oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc,
oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc,
oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc,
pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc,
url-transfer.h:
Re-indent code after switch to using namespace macros.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Dec 2022 18:02:15 -0800 |
parents | e88a07dec498 |
children | 597f3ee61a48 |
comparison
equal
deleted
inserted
replaced
31605:e88a07dec498 | 31607:aac27ad79be6 |
---|---|
37 #include "lo-error.h" | 37 #include "lo-error.h" |
38 #include "lo-lapack-proto.h" | 38 #include "lo-lapack-proto.h" |
39 | 39 |
40 OCTAVE_BEGIN_NAMESPACE(octave) | 40 OCTAVE_BEGIN_NAMESPACE(octave) |
41 | 41 |
42 static inline char | 42 static inline char |
43 get_job (bool noperm, bool noscal) | 43 get_job (bool noperm, bool noscal) |
44 { | 44 { |
45 return noperm ? (noscal ? 'N' : 'S') : (noscal ? 'P' : 'B'); | 45 return noperm ? (noscal ? 'N' : 'S') : (noscal ? 'P' : 'B'); |
46 } | 46 } |
47 | 47 |
48 OCTAVE_BEGIN_NAMESPACE(math) | 48 OCTAVE_BEGIN_NAMESPACE(math) |
49 | 49 |
50 template <> | 50 template <> |
51 OCTAVE_API | 51 OCTAVE_API |
52 aepbalance<Matrix>::aepbalance (const Matrix& a, bool noperm, bool noscal) | 52 aepbalance<Matrix>::aepbalance (const Matrix& a, bool noperm, bool noscal) |
53 : m_balanced_mat (a), m_scale (), m_ilo (), m_ihi (), | 53 : m_balanced_mat (a), m_scale (), m_ilo (), m_ihi (), |
54 m_job (get_job (noperm, noscal)) | 54 m_job (get_job (noperm, noscal)) |
55 { | 55 { |
56 F77_INT n = to_f77_int (a.cols ()); | 56 F77_INT n = to_f77_int (a.cols ()); |
57 | 57 |
58 if (a.rows () != n) | 58 if (a.rows () != n) |
59 (*current_liboctave_error_handler) | 59 (*current_liboctave_error_handler) |
60 ("aepbalance: requires square matrix"); | 60 ("aepbalance: requires square matrix"); |
61 | 61 |
62 m_scale = ColumnVector (n); | 62 m_scale = ColumnVector (n); |
63 | 63 |
64 F77_INT info, t_ilo, t_ihi; | 64 F77_INT info, t_ilo, t_ihi; |
65 | 65 |
66 F77_XFCN (dgebal, DGEBAL, (F77_CONST_CHAR_ARG2 (&m_job, 1), n, | 66 F77_XFCN (dgebal, DGEBAL, (F77_CONST_CHAR_ARG2 (&m_job, 1), n, |
67 m_balanced_mat.fortran_vec (), n, | 67 m_balanced_mat.fortran_vec (), n, |
68 t_ilo, t_ihi, m_scale.fortran_vec (), info | 68 t_ilo, t_ihi, m_scale.fortran_vec (), info |
69 F77_CHAR_ARG_LEN (1))); | 69 F77_CHAR_ARG_LEN (1))); |
70 | 70 |
71 m_ilo = t_ilo; | 71 m_ilo = t_ilo; |
72 m_ihi = t_ihi; | 72 m_ihi = t_ihi; |
73 } | 73 } |
74 | 74 |
75 template <> | 75 template <> |
76 OCTAVE_API Matrix | 76 OCTAVE_API Matrix |
77 aepbalance<Matrix>::balancing_matrix (void) const | 77 aepbalance<Matrix>::balancing_matrix (void) const |
78 { | 78 { |
79 F77_INT n = to_f77_int (m_balanced_mat.rows ()); | 79 F77_INT n = to_f77_int (m_balanced_mat.rows ()); |
80 | 80 |
81 Matrix balancing_mat (n, n, 0.0); | 81 Matrix balancing_mat (n, n, 0.0); |
82 for (F77_INT i = 0; i < n; i++) | 82 for (F77_INT i = 0; i < n; i++) |
83 balancing_mat.elem (i, i) = 1.0; | 83 balancing_mat.elem (i, i) = 1.0; |
84 | 84 |
85 F77_INT info; | 85 F77_INT info; |
86 F77_INT t_ilo = to_f77_int (m_ilo); | 86 F77_INT t_ilo = to_f77_int (m_ilo); |
87 F77_INT t_ihi = to_f77_int (m_ihi); | 87 F77_INT t_ihi = to_f77_int (m_ihi); |
88 | 88 |
89 char side = 'R'; | 89 char side = 'R'; |
90 | 90 |
91 F77_XFCN (dgebak, DGEBAK, (F77_CONST_CHAR_ARG2 (&m_job, 1), | 91 F77_XFCN (dgebak, DGEBAK, (F77_CONST_CHAR_ARG2 (&m_job, 1), |
92 F77_CONST_CHAR_ARG2 (&side, 1), | 92 F77_CONST_CHAR_ARG2 (&side, 1), |
93 n, t_ilo, t_ihi, m_scale.data (), n, | 93 n, t_ilo, t_ihi, m_scale.data (), n, |
94 balancing_mat.fortran_vec (), n, info | 94 balancing_mat.fortran_vec (), n, info |
95 F77_CHAR_ARG_LEN (1) | 95 F77_CHAR_ARG_LEN (1) |
96 F77_CHAR_ARG_LEN (1))); | 96 F77_CHAR_ARG_LEN (1))); |
97 | 97 |
98 return balancing_mat; | 98 return balancing_mat; |
99 } | 99 } |
100 | 100 |
101 template <> | 101 template <> |
102 OCTAVE_API | 102 OCTAVE_API |
103 aepbalance<FloatMatrix>::aepbalance (const FloatMatrix& a, bool noperm, | 103 aepbalance<FloatMatrix>::aepbalance (const FloatMatrix& a, bool noperm, |
104 bool noscal) | 104 bool noscal) |
105 : m_balanced_mat (a), m_scale (), m_ilo (), m_ihi (), | 105 : m_balanced_mat (a), m_scale (), m_ilo (), m_ihi (), |
106 m_job (get_job (noperm, noscal)) | 106 m_job (get_job (noperm, noscal)) |
107 { | 107 { |
108 F77_INT n = to_f77_int (a.cols ()); | 108 F77_INT n = to_f77_int (a.cols ()); |
109 | 109 |
110 if (a.rows () != n) | 110 if (a.rows () != n) |
111 (*current_liboctave_error_handler) | 111 (*current_liboctave_error_handler) |
112 ("aepbalance: requires square matrix"); | 112 ("aepbalance: requires square matrix"); |
113 | 113 |
114 m_scale = FloatColumnVector (n); | 114 m_scale = FloatColumnVector (n); |
115 | 115 |
116 F77_INT info, t_ilo, t_ihi; | 116 F77_INT info, t_ilo, t_ihi; |
117 | 117 |
118 F77_XFCN (sgebal, SGEBAL, (F77_CONST_CHAR_ARG2 (&m_job, 1), n, | 118 F77_XFCN (sgebal, SGEBAL, (F77_CONST_CHAR_ARG2 (&m_job, 1), n, |
119 m_balanced_mat.fortran_vec (), n, t_ilo, | 119 m_balanced_mat.fortran_vec (), n, t_ilo, |
120 t_ihi, m_scale.fortran_vec (), info | 120 t_ihi, m_scale.fortran_vec (), info |
121 F77_CHAR_ARG_LEN (1))); | 121 F77_CHAR_ARG_LEN (1))); |
122 | 122 |
123 m_ilo = t_ilo; | 123 m_ilo = t_ilo; |
124 m_ihi = t_ihi; | 124 m_ihi = t_ihi; |
125 } | 125 } |
126 | 126 |
127 template <> | 127 template <> |
128 OCTAVE_API FloatMatrix | 128 OCTAVE_API FloatMatrix |
129 aepbalance<FloatMatrix>::balancing_matrix (void) const | 129 aepbalance<FloatMatrix>::balancing_matrix (void) const |
130 { | 130 { |
131 F77_INT n = to_f77_int (m_balanced_mat.rows ()); | 131 F77_INT n = to_f77_int (m_balanced_mat.rows ()); |
132 | 132 |
133 FloatMatrix balancing_mat (n, n, 0.0); | 133 FloatMatrix balancing_mat (n, n, 0.0); |
134 for (F77_INT i = 0; i < n; i++) | 134 for (F77_INT i = 0; i < n; i++) |
135 balancing_mat.elem (i, i) = 1.0; | 135 balancing_mat.elem (i, i) = 1.0; |
136 | 136 |
137 F77_INT info; | 137 F77_INT info; |
138 F77_INT t_ilo = to_f77_int (m_ilo); | 138 F77_INT t_ilo = to_f77_int (m_ilo); |
139 F77_INT t_ihi = to_f77_int (m_ihi); | 139 F77_INT t_ihi = to_f77_int (m_ihi); |
140 | 140 |
141 char side = 'R'; | 141 char side = 'R'; |
142 | 142 |
143 F77_XFCN (sgebak, SGEBAK, (F77_CONST_CHAR_ARG2 (&m_job, 1), | 143 F77_XFCN (sgebak, SGEBAK, (F77_CONST_CHAR_ARG2 (&m_job, 1), |
144 F77_CONST_CHAR_ARG2 (&side, 1), | 144 F77_CONST_CHAR_ARG2 (&side, 1), |
145 n, t_ilo, t_ihi, m_scale.data (), n, | 145 n, t_ilo, t_ihi, m_scale.data (), n, |
146 balancing_mat.fortran_vec (), n, info | 146 balancing_mat.fortran_vec (), n, info |
147 F77_CHAR_ARG_LEN (1) | 147 F77_CHAR_ARG_LEN (1) |
148 F77_CHAR_ARG_LEN (1))); | 148 F77_CHAR_ARG_LEN (1))); |
149 | 149 |
150 return balancing_mat; | 150 return balancing_mat; |
151 } | 151 } |
152 | 152 |
153 template <> | 153 template <> |
154 OCTAVE_API | 154 OCTAVE_API |
155 aepbalance<ComplexMatrix>::aepbalance (const ComplexMatrix& a, bool noperm, | 155 aepbalance<ComplexMatrix>::aepbalance (const ComplexMatrix& a, bool noperm, |
156 bool noscal) | 156 bool noscal) |
157 : m_balanced_mat (a), m_scale (), m_ilo (), m_ihi (), | 157 : m_balanced_mat (a), m_scale (), m_ilo (), m_ihi (), |
158 m_job (get_job (noperm, noscal)) | 158 m_job (get_job (noperm, noscal)) |
159 { | 159 { |
160 F77_INT n = to_f77_int (a.cols ()); | 160 F77_INT n = to_f77_int (a.cols ()); |
161 | 161 |
162 if (a.rows () != n) | 162 if (a.rows () != n) |
163 (*current_liboctave_error_handler) | 163 (*current_liboctave_error_handler) |
164 ("aepbalance: requires square matrix"); | 164 ("aepbalance: requires square matrix"); |
165 | 165 |
166 m_scale = ColumnVector (n); | 166 m_scale = ColumnVector (n); |
167 | 167 |
168 F77_INT info, t_ilo, t_ihi; | 168 F77_INT info, t_ilo, t_ihi; |
169 | 169 |
170 F77_XFCN (zgebal, ZGEBAL, | 170 F77_XFCN (zgebal, ZGEBAL, |
171 (F77_CONST_CHAR_ARG2 (&m_job, 1), n, | 171 (F77_CONST_CHAR_ARG2 (&m_job, 1), n, |
172 F77_DBLE_CMPLX_ARG (m_balanced_mat.fortran_vec ()), | 172 F77_DBLE_CMPLX_ARG (m_balanced_mat.fortran_vec ()), |
173 n, t_ilo, t_ihi, m_scale.fortran_vec (), info | 173 n, t_ilo, t_ihi, m_scale.fortran_vec (), info |
174 F77_CHAR_ARG_LEN (1))); | 174 F77_CHAR_ARG_LEN (1))); |
175 | 175 |
176 m_ilo = t_ilo; | 176 m_ilo = t_ilo; |
177 m_ihi = t_ihi; | 177 m_ihi = t_ihi; |
178 } | 178 } |
179 | 179 |
180 template <> | 180 template <> |
181 OCTAVE_API ComplexMatrix | 181 OCTAVE_API ComplexMatrix |
182 aepbalance<ComplexMatrix>::balancing_matrix (void) const | 182 aepbalance<ComplexMatrix>::balancing_matrix (void) const |
183 { | 183 { |
184 F77_INT n = to_f77_int (m_balanced_mat.rows ()); | 184 F77_INT n = to_f77_int (m_balanced_mat.rows ()); |
185 | 185 |
186 ComplexMatrix balancing_mat (n, n, 0.0); | 186 ComplexMatrix balancing_mat (n, n, 0.0); |
187 for (F77_INT i = 0; i < n; i++) | 187 for (F77_INT i = 0; i < n; i++) |
188 balancing_mat.elem (i, i) = 1.0; | 188 balancing_mat.elem (i, i) = 1.0; |
189 | 189 |
190 F77_INT info; | 190 F77_INT info; |
191 F77_INT t_ilo = to_f77_int (m_ilo); | 191 F77_INT t_ilo = to_f77_int (m_ilo); |
192 F77_INT t_ihi = to_f77_int (m_ihi); | 192 F77_INT t_ihi = to_f77_int (m_ihi); |
193 | 193 |
194 char side = 'R'; | 194 char side = 'R'; |
195 | 195 |
196 F77_XFCN (zgebak, ZGEBAK, | 196 F77_XFCN (zgebak, ZGEBAK, |
197 (F77_CONST_CHAR_ARG2 (&m_job, 1), | 197 (F77_CONST_CHAR_ARG2 (&m_job, 1), |
198 F77_CONST_CHAR_ARG2 (&side, 1), | 198 F77_CONST_CHAR_ARG2 (&side, 1), |
199 n, t_ilo, t_ihi, m_scale.data (), n, | 199 n, t_ilo, t_ihi, m_scale.data (), n, |
200 F77_DBLE_CMPLX_ARG (balancing_mat.fortran_vec ()), | 200 F77_DBLE_CMPLX_ARG (balancing_mat.fortran_vec ()), |
201 n, info | 201 n, info |
202 F77_CHAR_ARG_LEN (1) | 202 F77_CHAR_ARG_LEN (1) |
203 F77_CHAR_ARG_LEN (1))); | 203 F77_CHAR_ARG_LEN (1))); |
204 | 204 |
205 return balancing_mat; | 205 return balancing_mat; |
206 } | 206 } |
207 | 207 |
208 template <> | 208 template <> |
209 OCTAVE_API | 209 OCTAVE_API |
210 aepbalance<FloatComplexMatrix>::aepbalance (const FloatComplexMatrix& a, | 210 aepbalance<FloatComplexMatrix>::aepbalance (const FloatComplexMatrix& a, |
211 bool noperm, bool noscal) | 211 bool noperm, bool noscal) |
212 : m_balanced_mat (a), m_scale (), m_ilo (), m_ihi (), | 212 : m_balanced_mat (a), m_scale (), m_ilo (), m_ihi (), |
213 m_job (get_job (noperm, noscal)) | 213 m_job (get_job (noperm, noscal)) |
214 { | 214 { |
215 F77_INT n = to_f77_int (a.cols ()); | 215 F77_INT n = to_f77_int (a.cols ()); |
216 | 216 |
217 if (a.rows () != n) | 217 if (a.rows () != n) |
218 (*current_liboctave_error_handler) | 218 (*current_liboctave_error_handler) |
219 ("aepbalance: requires square matrix"); | 219 ("aepbalance: requires square matrix"); |
220 | 220 |
221 m_scale = FloatColumnVector (n); | 221 m_scale = FloatColumnVector (n); |
222 | 222 |
223 F77_INT info, t_ilo, t_ihi; | 223 F77_INT info, t_ilo, t_ihi; |
224 | 224 |
225 F77_XFCN (cgebal, CGEBAL, (F77_CONST_CHAR_ARG2 (&m_job, 1), n, | 225 F77_XFCN (cgebal, CGEBAL, (F77_CONST_CHAR_ARG2 (&m_job, 1), n, |
226 F77_CMPLX_ARG (m_balanced_mat.fortran_vec ()), | 226 F77_CMPLX_ARG (m_balanced_mat.fortran_vec ()), |
227 n, t_ilo, t_ihi, m_scale.fortran_vec (), info | 227 n, t_ilo, t_ihi, m_scale.fortran_vec (), info |
228 F77_CHAR_ARG_LEN (1))); | 228 F77_CHAR_ARG_LEN (1))); |
229 | 229 |
230 m_ilo = t_ilo; | 230 m_ilo = t_ilo; |
231 m_ihi = t_ihi; | 231 m_ihi = t_ihi; |
232 } | 232 } |
233 | 233 |
234 template <> | 234 template <> |
235 OCTAVE_API FloatComplexMatrix | 235 OCTAVE_API FloatComplexMatrix |
236 aepbalance<FloatComplexMatrix>::balancing_matrix (void) const | 236 aepbalance<FloatComplexMatrix>::balancing_matrix (void) const |
237 { | 237 { |
238 F77_INT n = to_f77_int (m_balanced_mat.rows ()); | 238 F77_INT n = to_f77_int (m_balanced_mat.rows ()); |
239 | 239 |
240 FloatComplexMatrix balancing_mat (n, n, 0.0); | 240 FloatComplexMatrix balancing_mat (n, n, 0.0); |
241 for (F77_INT i = 0; i < n; i++) | 241 for (F77_INT i = 0; i < n; i++) |
242 balancing_mat.elem (i, i) = 1.0; | 242 balancing_mat.elem (i, i) = 1.0; |
243 | 243 |
244 F77_INT info; | 244 F77_INT info; |
245 F77_INT t_ilo = to_f77_int (m_ilo); | 245 F77_INT t_ilo = to_f77_int (m_ilo); |
246 F77_INT t_ihi = to_f77_int (m_ihi); | 246 F77_INT t_ihi = to_f77_int (m_ihi); |
247 | 247 |
248 char side = 'R'; | 248 char side = 'R'; |
249 | 249 |
250 F77_XFCN (cgebak, CGEBAK, (F77_CONST_CHAR_ARG2 (&m_job, 1), | 250 F77_XFCN (cgebak, CGEBAK, (F77_CONST_CHAR_ARG2 (&m_job, 1), |
251 F77_CONST_CHAR_ARG2 (&side, 1), | 251 F77_CONST_CHAR_ARG2 (&side, 1), |
252 n, t_ilo, t_ihi, m_scale.data (), n, | 252 n, t_ilo, t_ihi, m_scale.data (), n, |
253 F77_CMPLX_ARG (balancing_mat.fortran_vec ()), | 253 F77_CMPLX_ARG (balancing_mat.fortran_vec ()), |
254 n, info | 254 n, info |
255 F77_CHAR_ARG_LEN (1) | 255 F77_CHAR_ARG_LEN (1) |
256 F77_CHAR_ARG_LEN (1))); | 256 F77_CHAR_ARG_LEN (1))); |
257 | 257 |
258 return balancing_mat; | 258 return balancing_mat; |
259 } | 259 } |
260 | 260 |
261 // Instantiations we need. | 261 // Instantiations we need. |
262 | 262 |
263 template class aepbalance<Matrix>; | 263 template class aepbalance<Matrix>; |
264 | 264 |
265 template class aepbalance<FloatMatrix>; | 265 template class aepbalance<FloatMatrix>; |
266 | 266 |
267 template class aepbalance<ComplexMatrix>; | 267 template class aepbalance<ComplexMatrix>; |
268 | 268 |
269 template class aepbalance<FloatComplexMatrix>; | 269 template class aepbalance<FloatComplexMatrix>; |
270 | 270 |
271 OCTAVE_END_NAMESPACE(math) | 271 OCTAVE_END_NAMESPACE(math) |
272 OCTAVE_END_NAMESPACE(octave) | 272 OCTAVE_END_NAMESPACE(octave) |