Mercurial > octave
annotate liboctave/numeric/qr.cc @ 31605:e88a07dec498 stable
maint: Use macros to begin/end C++ namespaces.
* oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE,
OCTAVE_END_NAMESPACE) that can be used to start/end a namespace.
* mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc,
__dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc,
__ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc,
auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h,
besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h,
call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc,
colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc,
defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc,
display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc,
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, fftn.cc, file-io.cc, filter.cc, find.cc,
ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc,
getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc,
gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc,
graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc,
help.h, hess.cc, hex2num.cc, 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, kron.cc, latex-text-renderer.cc,
latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h,
lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc,
ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h,
mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc,
oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h,
oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h,
oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h,
oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy,
ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc,
pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc,
qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h,
sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc,
sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h,
stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc,
symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h,
symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h,
text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc,
toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc,
url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc,
variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h,
__delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc,
audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh,
mk-builtins.pl, 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.cc, ov-base.h, ov-bool-mat.cc,
ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc,
ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h,
ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc,
ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h,
ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc,
op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc,
op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc,
op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc,
op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc,
op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc,
op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc,
op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc,
op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc,
op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc,
op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc,
op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc,
op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc,
op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc,
op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc,
op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.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, lex.ll, oct-lvalue.cc,
oct-lvalue.h, oct-parse.yy, 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-vm-eval.cc, 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 : Use new macros to begin/end C++ namespaces.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Dec 2022 14:23:45 -0800 |
parents | 796f54d4ddbf |
children | aac27ad79be6 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30068
diff
changeset
|
3 // Copyright (C) 1994-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
9713
7918eb15040c
refactor the QR classes onto a templated base
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21285
diff
changeset
|
27 # include "config.h" |
9713
7918eb15040c
refactor the QR classes onto a templated base
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
28 #endif |
7918eb15040c
refactor the QR classes onto a templated base
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
29 |
23475
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
30 #include <algorithm> |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
31 |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
32 #include "Array.h" |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
33 #include "CColVector.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
34 #include "CMatrix.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
35 #include "CRowVector.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
36 #include "dColVector.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
37 #include "dMatrix.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
38 #include "dRowVector.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
39 #include "fCColVector.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
40 #include "fCMatrix.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
41 #include "fCRowVector.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
42 #include "fColVector.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
43 #include "fMatrix.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
44 #include "fRowVector.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
45 #include "lo-error.h" |
22322
93b3cdd36854
move most f77 function decls to separate header files
John W. Eaton <jwe@octave.org>
parents:
22317
diff
changeset
|
46 #include "lo-lapack-proto.h" |
93b3cdd36854
move most f77 function decls to separate header files
John W. Eaton <jwe@octave.org>
parents:
22317
diff
changeset
|
47 #include "lo-qrupdate-proto.h" |
23475
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
48 #include "oct-cmplx.h" |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
49 #include "oct-locbuf.h" |
23475
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
50 #include "oct-sort.h" |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
51 #include "qr.h" |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
52 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
53 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
54 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
55 OCTAVE_BEGIN_NAMESPACE(math) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
56 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
57 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
58 qr<T>::qr (const T& q_arg, const T& r_arg) |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
59 : m_q (q_arg), m_r (r_arg) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
60 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
61 octave_idx_type q_nr = m_q.rows (); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
62 octave_idx_type q_nc = m_q.cols (); |
11505
9a308e96194e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
9715
diff
changeset
|
63 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
64 octave_idx_type r_nr = m_r.rows (); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
65 octave_idx_type r_nc = m_r.cols (); |
9713
7918eb15040c
refactor the QR classes onto a templated base
Jaroslav Hajek <highegg@gmail.com>
parents:
diff
changeset
|
66 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
67 if (! (q_nc == r_nr && (q_nr == q_nc || (q_nr > q_nc && r_nr == r_nc)))) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
68 (*current_liboctave_error_handler) ("QR dimensions mismatch"); |
13217
08ba694723f5
fix warnings for unused but set variables
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
69 } |
9715
9f27172fbd1e
auto-set MatrixType from certain functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9713
diff
changeset
|
70 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
71 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
72 typename qr<T>::type |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
73 qr<T>::get_type (void) const |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
74 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
75 type retval; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
76 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
77 if (! m_q.isempty () && m_q.issquare ()) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
78 retval = qr<T>::std; |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
79 else if (m_q.rows () > m_q.cols () && m_r.issquare ()) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
80 retval = qr<T>::economy; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
81 else |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
82 retval = qr<T>::raw; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
83 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
84 return retval; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
85 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
86 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
87 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
88 bool |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
89 qr<T>::regular (void) const |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
90 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
91 bool retval = true; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
92 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
93 octave_idx_type k = std::min (m_r.rows (), m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
94 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
95 for (octave_idx_type i = 0; i < k; i++) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
96 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
97 if (m_r(i, i) == ELT_T ()) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
98 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
99 retval = false; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
100 break; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
101 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
102 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
103 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
104 return retval; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
105 } |
9715
9f27172fbd1e
auto-set MatrixType from certain functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9713
diff
changeset
|
106 |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
107 #if ! defined (HAVE_QRUPDATE) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
108 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
109 // Replacement update methods. |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
110 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
111 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
112 warn_qrupdate_once (void) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
113 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
114 static bool warned = false; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
115 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
116 if (! warned) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
117 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
118 (*current_liboctave_warning_with_id_handler) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
119 ("Octave:missing-dependency", |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
120 "In this version of Octave, QR & Cholesky updating routines " |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
121 "simply update the matrix and recalculate factorizations. " |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
122 "To use fast algorithms, link Octave with the qrupdate library. " |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
123 "See <http://sourceforge.net/projects/qrupdate>."); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
124 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
125 warned = true; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
126 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
127 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
128 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
129 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
130 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
131 qr<T>::update (const CV_T& u, const CV_T& v) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
132 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
133 warn_qrupdate_once (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
134 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
135 octave_idx_type m = m_q.rows (); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
136 octave_idx_type n = m_r.cols (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
137 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
138 if (u.numel () != m || v.numel () != n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
139 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
140 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
141 init (m_q*m_r + T (u) * T (v).hermitian (), get_type ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
142 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
143 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
144 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
145 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
146 qr<T>::update (const T& u, const T& v) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
147 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
148 warn_qrupdate_once (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
149 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
150 octave_idx_type m = m_q.rows (); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
151 octave_idx_type n = m_r.cols (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
152 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
153 if (u.rows () != m || v.rows () != n || u.cols () != v.cols ()) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
154 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
155 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
156 init (m_q*m_r + u * v.hermitian (), get_type ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
157 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
158 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
159 template <typename T, typename CV_T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
160 static |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
161 T |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
162 insert_col (const T& a, octave_idx_type i, const CV_T& x) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
163 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
164 T retval (a.rows (), a.cols () + 1); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
165 retval.assign (idx_vector::colon, idx_vector (0, i), |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
166 a.index (idx_vector::colon, idx_vector (0, i))); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
167 retval.assign (idx_vector::colon, idx_vector (i), x); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
168 retval.assign (idx_vector::colon, idx_vector (i+1, retval.cols ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
169 a.index (idx_vector::colon, idx_vector (i, a.cols ()))); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
170 return retval; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
171 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
172 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
173 template <typename T, typename RV_T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
174 static |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
175 T |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
176 insert_row (const T& a, octave_idx_type i, const RV_T& x) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
177 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
178 T retval (a.rows () + 1, a.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
179 retval.assign (idx_vector (0, i), idx_vector::colon, |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
180 a.index (idx_vector (0, i), idx_vector::colon)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
181 retval.assign (idx_vector (i), idx_vector::colon, x); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
182 retval.assign (idx_vector (i+1, retval.rows ()), idx_vector::colon, |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
183 a.index (idx_vector (i, a.rows ()), idx_vector::colon)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
184 return retval; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
185 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
186 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
187 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
188 static |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
189 T |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
190 delete_col (const T& a, octave_idx_type i) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
191 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
192 T retval = a; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
193 retval.delete_elements (1, idx_vector (i)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
194 return retval; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
195 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
196 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
197 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
198 static |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
199 T |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
200 delete_row (const T& a, octave_idx_type i) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
201 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
202 T retval = a; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
203 retval.delete_elements (0, idx_vector (i)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
204 return retval; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
205 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
206 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
207 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
208 static |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
209 T |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
210 shift_cols (const T& a, octave_idx_type i, octave_idx_type j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
211 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
212 octave_idx_type n = a.cols (); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
213 Array<octave_idx_type> p (dim_vector (n, 1)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
214 for (octave_idx_type k = 0; k < n; k++) p(k) = k; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
215 if (i < j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
216 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
217 for (octave_idx_type k = i; k < j; k++) p(k) = k+1; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
218 p(j) = i; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
219 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
220 else if (j < i) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
221 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
222 p(j) = i; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
223 for (octave_idx_type k = j+1; k < i+1; k++) p(k) = k-1; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
224 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
225 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
226 return a.index (idx_vector::colon, idx_vector (p)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
227 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
228 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
229 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
230 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
231 qr<T>::insert_col (const CV_T& u, octave_idx_type j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
232 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
233 warn_qrupdate_once (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
234 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
235 octave_idx_type m = m_q.rows (); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
236 octave_idx_type n = m_r.cols (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
237 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
238 if (u.numel () != m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
239 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
240 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
241 if (j < 0 || j > n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
242 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
243 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
244 init (math::insert_col (m_q*m_r, j, u), get_type ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
245 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
246 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
247 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
248 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
249 qr<T>::insert_col (const T& u, const Array<octave_idx_type>& j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
250 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
251 warn_qrupdate_once (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
252 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
253 octave_idx_type m = m_q.rows (); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
254 octave_idx_type n = m_r.cols (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
255 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
256 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
257 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
258 octave_idx_type nj = js.numel (); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
259 bool dups = false; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
260 for (octave_idx_type i = 0; i < nj - 1; i++) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
261 dups = dups && js(i) == js(i+1); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
262 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
263 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
264 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
265 |
22984
45dba14ca7af
* qr.cc: Fix error in previous change. (bug #49957)
John W. Eaton <jwe@octave.org>
parents:
22958
diff
changeset
|
266 if (u.numel () != m || u.cols () != nj) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
267 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
268 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
269 if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
270 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
271 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
272 if (nj > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
273 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
274 T a = m_q*m_r; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
275 for (octave_idx_type i = 0; i < nj; i++) |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
276 a = math::insert_col (a, js(i), u.column (i)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
277 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
278 init (a, get_type ()); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
279 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
280 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
281 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
282 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
283 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
284 qr<T>::delete_col (octave_idx_type j) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
285 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
286 warn_qrupdate_once (); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
287 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
288 octave_idx_type n = m_r.cols (); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
289 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
290 if (j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
291 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
292 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
293 init (math::delete_col (m_q*m_r, j), get_type ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
294 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
295 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
296 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
297 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
298 qr<T>::delete_col (const Array<octave_idx_type>& j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
299 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
300 warn_qrupdate_once (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
301 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
302 octave_idx_type n = m_r.cols (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
303 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
304 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
305 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
306 octave_idx_type nj = js.numel (); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
307 bool dups = false; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
308 for (octave_idx_type i = 0; i < nj - 1; i++) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
309 dups = dups && js(i) == js(i+1); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
310 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
311 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
312 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
313 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
314 if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
315 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
316 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
317 if (nj > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
318 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
319 T a = m_q*m_r; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
320 for (octave_idx_type i = 0; i < nj; i++) |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
321 a = math::delete_col (a, js(i)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
322 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
323 init (a, get_type ()); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
324 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
325 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
326 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
327 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
328 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
329 qr<T>::insert_row (const RV_T& u, octave_idx_type j) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
330 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
331 warn_qrupdate_once (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
332 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
333 octave_idx_type m = m_r.rows (); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
334 octave_idx_type n = m_r.cols (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
335 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
336 if (! m_q.issquare () || u.numel () != n) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
337 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
338 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
339 if (j < 0 || j > m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
340 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
341 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
342 init (math::insert_row (m_q*m_r, j, u), get_type ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
343 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
344 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
345 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
346 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
347 qr<T>::delete_row (octave_idx_type j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
348 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
349 warn_qrupdate_once (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
350 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
351 octave_idx_type m = m_r.rows (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
352 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
353 if (! m_q.issquare ()) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
354 (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
355 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
356 if (j < 0 || j > m-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
357 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
358 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
359 init (math::delete_row (m_q*m_r, j), get_type ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
360 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
361 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
362 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
363 void |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
364 qr<T>::shift_cols (octave_idx_type i, octave_idx_type j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
365 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
366 warn_qrupdate_once (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
367 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
368 octave_idx_type n = m_r.cols (); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
369 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
370 if (i < 0 || i > n-1 || j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
371 (*current_liboctave_error_handler) ("qrshift: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
372 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
373 init (math::shift_cols (m_q*m_r, i, j), get_type ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
374 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
375 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
376 #endif |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
377 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
378 // Specializations. |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
379 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
380 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
381 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
382 qr<Matrix>::form (octave_idx_type n_arg, Matrix& afact, double *tau, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
383 type qr_type) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
384 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
385 F77_INT n = to_f77_int (n_arg); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
386 F77_INT m = to_f77_int (afact.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
387 F77_INT min_mn = std::min (m, n); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
388 F77_INT info; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
389 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
390 if (qr_type == qr<Matrix>::raw) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
391 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
392 for (F77_INT j = 0; j < min_mn; j++) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
393 { |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
394 F77_INT limit = (j < min_mn - 1 ? j : min_mn - 1); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
395 for (F77_INT i = limit + 1; i < m; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
396 afact.elem (i, j) *= tau[j]; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
397 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
398 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
399 m_r = afact; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
400 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
401 else |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
402 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
403 // Attempt to minimize copying. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
404 if (m >= n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
405 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
406 // afact will become m_q. |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
407 m_q = afact; |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
408 F77_INT k = (qr_type == qr<Matrix>::economy ? n : m); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
409 m_r = Matrix (k, n); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
410 for (F77_INT j = 0; j < n; j++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
411 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
412 F77_INT i = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
413 for (; i <= j; i++) |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
414 m_r.xelem (i, j) = afact.xelem (i, j); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
415 for (; i < k; i++) |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
416 m_r.xelem (i, j) = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
417 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
418 afact = Matrix (); // optimize memory |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
419 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
420 else |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
421 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
422 // afact will become m_r. |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
423 m_q = Matrix (m, m); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
424 for (F77_INT j = 0; j < m; j++) |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
425 for (F77_INT i = j + 1; i < m; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
426 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
427 m_q.xelem (i, j) = afact.xelem (i, j); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
428 afact.xelem (i, j) = 0; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
429 } |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
430 m_r = afact; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
431 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
432 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
433 if (m > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
434 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
435 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
436 // workspace query. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
437 double rlwork; |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
438 F77_XFCN (dorgqr, DORGQR, (m, k, min_mn, m_q.fortran_vec (), m, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
439 tau, &rlwork, -1, info)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
440 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
441 // allocate buffer and do the job. |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
442 F77_INT lwork = static_cast<F77_INT> (rlwork); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
443 lwork = std::max (lwork, static_cast<F77_INT> (1)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
444 OCTAVE_LOCAL_BUFFER (double, work, lwork); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
445 F77_XFCN (dorgqr, DORGQR, (m, k, min_mn, m_q.fortran_vec (), m, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
446 tau, work, lwork, info)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
447 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
448 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
449 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
450 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
451 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
452 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
453 qr<Matrix>::init (const Matrix& a, type qr_type) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
454 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
455 F77_INT m = to_f77_int (a.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
456 F77_INT n = to_f77_int (a.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
457 |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
458 F77_INT min_mn = (m < n ? m : n); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
459 OCTAVE_LOCAL_BUFFER (double, tau, min_mn); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
460 |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
461 F77_INT info = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
462 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
463 Matrix afact = a; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
464 if (m > n && qr_type == qr<Matrix>::std) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
465 afact.resize (m, m); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
466 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
467 if (m > 0) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
468 { |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
469 // workspace query. |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
470 double rlwork; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
471 F77_XFCN (dgeqrf, DGEQRF, (m, n, afact.fortran_vec (), m, tau, |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
472 &rlwork, -1, info)); |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
473 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
474 // allocate buffer and do the job. |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
475 F77_INT lwork = static_cast<F77_INT> (rlwork); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
476 lwork = std::max (lwork, static_cast<F77_INT> (1)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
477 OCTAVE_LOCAL_BUFFER (double, work, lwork); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
478 F77_XFCN (dgeqrf, DGEQRF, (m, n, afact.fortran_vec (), m, tau, |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
479 work, lwork, info)); |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
480 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
481 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
482 form (n, afact, tau, qr_type); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
483 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
484 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
485 #if defined (HAVE_QRUPDATE) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
486 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
487 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
488 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
489 qr<Matrix>::update (const ColumnVector& u, const ColumnVector& v) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
490 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
491 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
492 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
493 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
494 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
495 F77_INT u_nel = to_f77_int (u.numel ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
496 F77_INT v_nel = to_f77_int (v.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
497 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
498 if (u_nel != m || v_nel != n) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
499 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
500 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
501 ColumnVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
502 ColumnVector vtmp = v; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
503 OCTAVE_LOCAL_BUFFER (double, w, 2*k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
504 F77_XFCN (dqr1up, DQR1UP, (m, n, k, m_q.fortran_vec (), m, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
505 m_r.fortran_vec (), k, utmp.fortran_vec (), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
506 vtmp.fortran_vec (), w)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
507 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
508 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
509 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
510 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
511 qr<Matrix>::update (const Matrix& u, const Matrix& v) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
512 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
513 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
514 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
515 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
516 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
517 F77_INT u_rows = to_f77_int (u.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
518 F77_INT u_cols = to_f77_int (u.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
519 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
520 F77_INT v_rows = to_f77_int (v.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
521 F77_INT v_cols = to_f77_int (v.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
522 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
523 if (u_rows != m || v_rows != n || u_cols != v_cols) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
524 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
525 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
526 OCTAVE_LOCAL_BUFFER (double, w, 2*k); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
527 for (volatile F77_INT i = 0; i < u_cols; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
528 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
529 ColumnVector utmp = u.column (i); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
530 ColumnVector vtmp = v.column (i); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
531 F77_XFCN (dqr1up, DQR1UP, (m, n, k, m_q.fortran_vec (), m, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
532 m_r.fortran_vec (), k, utmp.fortran_vec (), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
533 vtmp.fortran_vec (), w)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
534 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
535 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
536 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
537 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
538 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
539 qr<Matrix>::insert_col (const ColumnVector& u, octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
540 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
541 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
542 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
543 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
544 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
545 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
546 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
547 F77_INT u_nel = to_f77_int (u.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
548 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
549 if (u_nel != m) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
550 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
551 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
552 if (j < 0 || j > n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
553 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
554 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
555 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
556 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
557 m_q.resize (m, k+1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
558 m_r.resize (k+1, n+1); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
559 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
560 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
561 m_r.resize (k, n+1); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
562 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
563 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
564 F77_INT ldr = to_f77_int (m_r.rows ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
565 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
566 ColumnVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
567 OCTAVE_LOCAL_BUFFER (double, w, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
568 F77_XFCN (dqrinc, DQRINC, (m, n, k, m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
569 m_r.fortran_vec (), ldr, j + 1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
570 utmp.data (), w)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
571 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
572 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
573 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
574 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
575 qr<Matrix>::insert_col (const Matrix& u, const Array<octave_idx_type>& j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
576 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
577 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
578 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
579 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
580 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
581 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
582 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
583 F77_INT nj = to_f77_int (js.numel ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
584 bool dups = false; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
585 for (F77_INT i = 0; i < nj - 1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
586 dups = dups && js(i) == js(i+1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
587 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
588 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
589 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
590 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
591 F77_INT u_nel = to_f77_int (u.numel ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
592 F77_INT u_cols = to_f77_int (u.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
593 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
594 if (u_nel != m || u_cols != nj) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
595 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
596 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
597 F77_INT js_beg = to_f77_int (js(0)); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
598 F77_INT js_end = to_f77_int (js(nj-1)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
599 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
600 if (nj > 0 && (js_beg < 0 || js_end > n)) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
601 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
602 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
603 if (nj > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
604 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
605 F77_INT kmax = std::min (k + nj, m); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
606 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
607 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
608 m_q.resize (m, kmax); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
609 m_r.resize (kmax, n + nj); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
610 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
611 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
612 m_r.resize (k, n + nj); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
613 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
614 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
615 F77_INT ldr = to_f77_int (m_r.rows ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
616 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
617 OCTAVE_LOCAL_BUFFER (double, w, kmax); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
618 for (volatile F77_INT i = 0; i < nj; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
619 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
620 F77_INT ii = i; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
621 ColumnVector utmp = u.column (jsi(i)); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
622 F77_INT js_elt = to_f77_int (js(ii)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
623 F77_XFCN (dqrinc, DQRINC, (m, n + ii, std::min (kmax, k + ii), |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
624 m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
625 m_r.fortran_vec (), ldr, js_elt + 1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
626 utmp.data (), w)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
627 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
628 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
629 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
630 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
631 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
632 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
633 qr<Matrix>::delete_col (octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
634 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
635 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
636 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
637 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
638 F77_INT k = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
639 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
640 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
641 if (j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
642 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
643 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
644 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
645 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
646 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
647 OCTAVE_LOCAL_BUFFER (double, w, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
648 F77_XFCN (dqrdec, DQRDEC, (m, n, k, m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
649 m_r.fortran_vec (), ldr, j + 1, w)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
650 |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
651 if (k < m) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
652 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
653 m_q.resize (m, k-1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
654 m_r.resize (k-1, n-1); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
655 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
656 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
657 m_r.resize (k, n-1); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
658 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
659 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
660 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
661 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
662 qr<Matrix>::delete_col (const Array<octave_idx_type>& j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
663 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
664 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
665 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
666 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
667 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
668 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
669 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
670 F77_INT nj = to_f77_int (js.numel ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
671 bool dups = false; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
672 for (F77_INT i = 0; i < nj - 1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
673 dups = dups && js(i) == js(i+1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
674 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
675 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
676 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
677 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
678 F77_INT js_beg = to_f77_int (js(0)); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
679 F77_INT js_end = to_f77_int (js(nj-1)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
680 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
681 if (nj > 0 && (js_beg > n-1 || js_end < 0)) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
682 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
683 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
684 if (nj > 0) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
685 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
686 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
687 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
688 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
689 OCTAVE_LOCAL_BUFFER (double, w, k); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
690 for (volatile F77_INT i = 0; i < nj; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
691 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
692 F77_INT ii = i; |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
693 F77_INT js_elt = to_f77_int (js(ii)); |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
694 F77_XFCN (dqrdec, DQRDEC, (m, n - ii, (k == m ? k : k - ii), |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
695 m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
696 m_r.fortran_vec (), ldr, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
697 js_elt + 1, w)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
698 } |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
699 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
700 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
701 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
702 m_q.resize (m, k - nj); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
703 m_r.resize (k - nj, n - nj); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
704 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
705 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
706 m_r.resize (k, n - nj); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
707 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
708 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
709 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
710 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
711 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
712 qr<Matrix>::insert_row (const RowVector& u, octave_idx_type j_arg) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
713 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
714 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
715 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
716 F77_INT m = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
717 F77_INT n = to_f77_int (m_r.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
718 F77_INT k = std::min (m, n); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
719 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
720 F77_INT u_nel = to_f77_int (u.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
721 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
722 if (! m_q.issquare () || u_nel != n) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
723 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
724 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
725 if (j < 0 || j > m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
726 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
727 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
728 m_q.resize (m + 1, m + 1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
729 m_r.resize (m + 1, n); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
730 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
731 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
732 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
733 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
734 RowVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
735 OCTAVE_LOCAL_BUFFER (double, w, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
736 F77_XFCN (dqrinr, DQRINR, (m, n, m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
737 m_r.fortran_vec (), ldr, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
738 j + 1, utmp.fortran_vec (), w)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
739 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
740 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
741 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
742 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
743 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
744 qr<Matrix>::delete_row (octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
745 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
746 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
747 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
748 F77_INT m = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
749 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
750 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
751 if (! m_q.issquare ()) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
752 (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
753 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
754 if (j < 0 || j > m-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
755 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
756 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
757 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
758 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
759 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
760 OCTAVE_LOCAL_BUFFER (double, w, 2*m); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
761 F77_XFCN (dqrder, DQRDER, (m, n, m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
762 m_r.fortran_vec (), ldr, j + 1, w)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
763 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
764 m_q.resize (m - 1, m - 1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
765 m_r.resize (m - 1, n); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
766 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
767 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
768 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
769 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
770 qr<Matrix>::shift_cols (octave_idx_type i_arg, octave_idx_type j_arg) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
771 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
772 F77_INT i = to_f77_int (i_arg); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
773 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
774 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
775 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
776 F77_INT k = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
777 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
778 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
779 if (i < 0 || i > n-1 || j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
780 (*current_liboctave_error_handler) ("qrshift: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
781 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
782 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
783 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
784 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
785 OCTAVE_LOCAL_BUFFER (double, w, 2*k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
786 F77_XFCN (dqrshc, DQRSHC, (m, n, k, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
787 m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
788 m_r.fortran_vec (), ldr, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
789 i + 1, j + 1, w)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
790 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
791 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
792 #endif |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
793 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
794 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
795 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
796 qr<FloatMatrix>::form (octave_idx_type n_arg, FloatMatrix& afact, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
797 float *tau, type qr_type) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
798 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
799 F77_INT n = to_f77_int (n_arg); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
800 F77_INT m = to_f77_int (afact.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
801 F77_INT min_mn = std::min (m, n); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
802 F77_INT info; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
803 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
804 if (qr_type == qr<FloatMatrix>::raw) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
805 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
806 for (F77_INT j = 0; j < min_mn; j++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
807 { |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
808 F77_INT limit = (j < min_mn - 1 ? j : min_mn - 1); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
809 for (F77_INT i = limit + 1; i < m; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
810 afact.elem (i, j) *= tau[j]; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
811 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
812 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
813 m_r = afact; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
814 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
815 else |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
816 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
817 // Attempt to minimize copying. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
818 if (m >= n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
819 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
820 // afact will become m_q. |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
821 m_q = afact; |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
822 F77_INT k = (qr_type == qr<FloatMatrix>::economy ? n : m); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
823 m_r = FloatMatrix (k, n); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
824 for (F77_INT j = 0; j < n; j++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
825 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
826 F77_INT i = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
827 for (; i <= j; i++) |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
828 m_r.xelem (i, j) = afact.xelem (i, j); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
829 for (; i < k; i++) |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
830 m_r.xelem (i, j) = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
831 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
832 afact = FloatMatrix (); // optimize memory |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
833 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
834 else |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
835 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
836 // afact will become m_r. |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
837 m_q = FloatMatrix (m, m); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
838 for (F77_INT j = 0; j < m; j++) |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
839 for (F77_INT i = j + 1; i < m; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
840 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
841 m_q.xelem (i, j) = afact.xelem (i, j); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
842 afact.xelem (i, j) = 0; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
843 } |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
844 m_r = afact; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
845 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
846 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
847 if (m > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
848 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
849 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
850 // workspace query. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
851 float rlwork; |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
852 F77_XFCN (sorgqr, SORGQR, (m, k, min_mn, m_q.fortran_vec (), m, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
853 tau, &rlwork, -1, info)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
854 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
855 // allocate buffer and do the job. |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
856 F77_INT lwork = static_cast<F77_INT> (rlwork); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
857 lwork = std::max (lwork, static_cast<F77_INT> (1)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
858 OCTAVE_LOCAL_BUFFER (float, work, lwork); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
859 F77_XFCN (sorgqr, SORGQR, (m, k, min_mn, m_q.fortran_vec (), m, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
860 tau, work, lwork, info)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
861 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
862 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
863 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
864 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
865 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
866 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
867 qr<FloatMatrix>::init (const FloatMatrix& a, type qr_type) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
868 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
869 F77_INT m = to_f77_int (a.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
870 F77_INT n = to_f77_int (a.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
871 |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
872 F77_INT min_mn = (m < n ? m : n); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
873 OCTAVE_LOCAL_BUFFER (float, tau, min_mn); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
874 |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
875 F77_INT info = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
876 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
877 FloatMatrix afact = a; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
878 if (m > n && qr_type == qr<FloatMatrix>::std) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
879 afact.resize (m, m); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
880 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
881 if (m > 0) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
882 { |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
883 // workspace query. |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
884 float rlwork; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
885 F77_XFCN (sgeqrf, SGEQRF, (m, n, afact.fortran_vec (), m, tau, |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
886 &rlwork, -1, info)); |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
887 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
888 // allocate buffer and do the job. |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
889 F77_INT lwork = static_cast<F77_INT> (rlwork); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
890 lwork = std::max (lwork, static_cast<F77_INT> (1)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
891 OCTAVE_LOCAL_BUFFER (float, work, lwork); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
892 F77_XFCN (sgeqrf, SGEQRF, (m, n, afact.fortran_vec (), m, tau, |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
893 work, lwork, info)); |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
894 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
895 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
896 form (n, afact, tau, qr_type); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
897 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
898 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
899 #if defined (HAVE_QRUPDATE) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
900 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
901 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
902 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
903 qr<FloatMatrix>::update (const FloatColumnVector& u, const FloatColumnVector& v) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
904 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
905 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
906 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
907 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
908 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
909 F77_INT u_nel = to_f77_int (u.numel ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
910 F77_INT v_nel = to_f77_int (v.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
911 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
912 if (u_nel != m || v_nel != n) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
913 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
914 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
915 FloatColumnVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
916 FloatColumnVector vtmp = v; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
917 OCTAVE_LOCAL_BUFFER (float, w, 2*k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
918 F77_XFCN (sqr1up, SQR1UP, (m, n, k, m_q.fortran_vec (), m, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
919 m_r.fortran_vec (), k, utmp.fortran_vec (), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
920 vtmp.fortran_vec (), w)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
921 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
922 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
923 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
924 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
925 qr<FloatMatrix>::update (const FloatMatrix& u, const FloatMatrix& v) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
926 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
927 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
928 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
929 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
930 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
931 F77_INT u_rows = to_f77_int (u.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
932 F77_INT u_cols = to_f77_int (u.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
933 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
934 F77_INT v_rows = to_f77_int (v.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
935 F77_INT v_cols = to_f77_int (v.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
936 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
937 if (u_rows != m || v_rows != n || u_cols != v_cols) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
938 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
939 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
940 OCTAVE_LOCAL_BUFFER (float, w, 2*k); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
941 for (volatile F77_INT i = 0; i < u_cols; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
942 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
943 FloatColumnVector utmp = u.column (i); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
944 FloatColumnVector vtmp = v.column (i); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
945 F77_XFCN (sqr1up, SQR1UP, (m, n, k, m_q.fortran_vec (), m, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
946 m_r.fortran_vec (), k, utmp.fortran_vec (), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
947 vtmp.fortran_vec (), w)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
948 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
949 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
950 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
951 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
952 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
953 qr<FloatMatrix>::insert_col (const FloatColumnVector& u, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
954 octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
955 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
956 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
957 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
958 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
959 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
960 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
961 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
962 F77_INT u_nel = to_f77_int (u.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
963 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
964 if (u_nel != m) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
965 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
966 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
967 if (j < 0 || j > n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
968 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
969 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
970 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
971 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
972 m_q.resize (m, k+1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
973 m_r.resize (k+1, n+1); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
974 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
975 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
976 m_r.resize (k, n+1); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
977 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
978 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
979 F77_INT ldr = to_f77_int (m_r.rows ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
980 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
981 FloatColumnVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
982 OCTAVE_LOCAL_BUFFER (float, w, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
983 F77_XFCN (sqrinc, SQRINC, (m, n, k, m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
984 m_r.fortran_vec (), ldr, j + 1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
985 utmp.data (), w)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
986 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
987 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
988 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
989 OCTAVE_API void |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
990 qr<FloatMatrix>::insert_col (const FloatMatrix& u, |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
991 const Array<octave_idx_type>& j) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
992 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
993 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
994 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
995 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
996 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
997 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
998 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
999 F77_INT nj = to_f77_int (js.numel ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1000 bool dups = false; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1001 for (F77_INT i = 0; i < nj - 1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1002 dups = dups && js(i) == js(i+1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1003 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1004 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1005 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1006 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1007 F77_INT u_nel = to_f77_int (u.numel ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1008 F77_INT u_cols = to_f77_int (u.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1009 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1010 if (u_nel != m || u_cols != nj) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1011 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1012 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1013 F77_INT js_beg = to_f77_int (js(0)); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1014 F77_INT js_end = to_f77_int (js(nj-1)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1015 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1016 if (nj > 0 && (js_beg < 0 || js_end > n)) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1017 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1018 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1019 if (nj > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1020 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1021 F77_INT kmax = std::min (k + nj, m); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1022 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1023 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1024 m_q.resize (m, kmax); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1025 m_r.resize (kmax, n + nj); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1026 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1027 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1028 m_r.resize (k, n + nj); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1029 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1030 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1031 F77_INT ldr = to_f77_int (m_r.rows ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1032 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1033 OCTAVE_LOCAL_BUFFER (float, w, kmax); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1034 for (volatile F77_INT i = 0; i < nj; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1035 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1036 F77_INT ii = i; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1037 FloatColumnVector utmp = u.column (jsi(i)); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1038 F77_INT js_elt = to_f77_int (js(ii)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1039 F77_XFCN (sqrinc, SQRINC, (m, n + ii, std::min (kmax, k + ii), |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1040 m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1041 m_r.fortran_vec (), ldr, js_elt + 1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1042 utmp.data (), w)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1043 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1044 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1045 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1046 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1047 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1048 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1049 qr<FloatMatrix>::delete_col (octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1050 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1051 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1052 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1053 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1054 F77_INT k = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1055 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1056 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1057 if (j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1058 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1059 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1060 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1061 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1062 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1063 OCTAVE_LOCAL_BUFFER (float, w, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1064 F77_XFCN (sqrdec, SQRDEC, (m, n, k, m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1065 m_r.fortran_vec (), ldr, j + 1, w)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1066 |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1067 if (k < m) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1068 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1069 m_q.resize (m, k-1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1070 m_r.resize (k-1, n-1); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1071 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1072 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1073 m_r.resize (k, n-1); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1074 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1075 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1076 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1077 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1078 qr<FloatMatrix>::delete_col (const Array<octave_idx_type>& j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1079 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1080 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1081 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1082 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1083 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1084 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1085 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1086 F77_INT nj = to_f77_int (js.numel ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1087 bool dups = false; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1088 for (F77_INT i = 0; i < nj - 1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1089 dups = dups && js(i) == js(i+1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1090 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1091 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1092 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1093 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1094 F77_INT js_beg = to_f77_int (js(0)); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1095 F77_INT js_end = to_f77_int (js(nj-1)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1096 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1097 if (nj > 0 && (js_beg > n-1 || js_end < 0)) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1098 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1099 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1100 if (nj > 0) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1101 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1102 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1103 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1104 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1105 OCTAVE_LOCAL_BUFFER (float, w, k); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1106 for (volatile F77_INT i = 0; i < nj; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1107 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1108 F77_INT ii = i; |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1109 F77_INT js_elt = to_f77_int (js(ii)); |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1110 F77_XFCN (sqrdec, SQRDEC, (m, n - ii, (k == m ? k : k - ii), |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1111 m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1112 m_r.fortran_vec (), ldr, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1113 js_elt + 1, w)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1114 } |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1115 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1116 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1117 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1118 m_q.resize (m, k - nj); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1119 m_r.resize (k - nj, n - nj); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1120 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1121 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1122 m_r.resize (k, n - nj); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1123 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1124 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1125 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1126 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1127 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1128 qr<FloatMatrix>::insert_row (const FloatRowVector& u, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1129 octave_idx_type j_arg) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1130 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1131 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1132 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1133 F77_INT m = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1134 F77_INT n = to_f77_int (m_r.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1135 F77_INT k = std::min (m, n); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1136 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1137 F77_INT u_nel = to_f77_int (u.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1138 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1139 if (! m_q.issquare () || u_nel != n) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1140 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1141 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1142 if (j < 0 || j > m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1143 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1144 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1145 m_q.resize (m + 1, m + 1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1146 m_r.resize (m + 1, n); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1147 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1148 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1149 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1150 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1151 FloatRowVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1152 OCTAVE_LOCAL_BUFFER (float, w, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1153 F77_XFCN (sqrinr, SQRINR, (m, n, m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1154 m_r.fortran_vec (), ldr, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1155 j + 1, utmp.fortran_vec (), w)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1156 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1157 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1158 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1159 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1160 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1161 qr<FloatMatrix>::delete_row (octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1162 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1163 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1164 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1165 F77_INT m = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1166 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1167 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1168 if (! m_q.issquare ()) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1169 (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1170 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1171 if (j < 0 || j > m-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1172 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1173 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1174 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1175 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1176 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1177 OCTAVE_LOCAL_BUFFER (float, w, 2*m); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1178 F77_XFCN (sqrder, SQRDER, (m, n, m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1179 m_r.fortran_vec (), ldr, j + 1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1180 w)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1181 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1182 m_q.resize (m - 1, m - 1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1183 m_r.resize (m - 1, n); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1184 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1185 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1186 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1187 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1188 qr<FloatMatrix>::shift_cols (octave_idx_type i_arg, octave_idx_type j_arg) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1189 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1190 F77_INT i = to_f77_int (i_arg); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1191 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1192 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1193 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1194 F77_INT k = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1195 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1196 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1197 if (i < 0 || i > n-1 || j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1198 (*current_liboctave_error_handler) ("qrshift: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1199 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1200 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1201 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1202 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1203 OCTAVE_LOCAL_BUFFER (float, w, 2*k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1204 F77_XFCN (sqrshc, SQRSHC, (m, n, k, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1205 m_q.fortran_vec (), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1206 m_r.fortran_vec (), ldr, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1207 i + 1, j + 1, w)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1208 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1209 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1210 #endif |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1211 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1212 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1213 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1214 qr<ComplexMatrix>::form (octave_idx_type n_arg, ComplexMatrix& afact, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1215 Complex *tau, type qr_type) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1216 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1217 F77_INT n = to_f77_int (n_arg); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1218 F77_INT m = to_f77_int (afact.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1219 F77_INT min_mn = std::min (m, n); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1220 F77_INT info; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1221 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1222 if (qr_type == qr<ComplexMatrix>::raw) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1223 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1224 for (F77_INT j = 0; j < min_mn; j++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1225 { |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1226 F77_INT limit = (j < min_mn - 1 ? j : min_mn - 1); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1227 for (F77_INT i = limit + 1; i < m; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1228 afact.elem (i, j) *= tau[j]; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1229 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1230 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1231 m_r = afact; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1232 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1233 else |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1234 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1235 // Attempt to minimize copying. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1236 if (m >= n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1237 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1238 // afact will become m_q. |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1239 m_q = afact; |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1240 F77_INT k = (qr_type == qr<ComplexMatrix>::economy ? n : m); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1241 m_r = ComplexMatrix (k, n); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1242 for (F77_INT j = 0; j < n; j++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1243 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1244 F77_INT i = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1245 for (; i <= j; i++) |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1246 m_r.xelem (i, j) = afact.xelem (i, j); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1247 for (; i < k; i++) |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1248 m_r.xelem (i, j) = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1249 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1250 afact = ComplexMatrix (); // optimize memory |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1251 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1252 else |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1253 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1254 // afact will become m_r. |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1255 m_q = ComplexMatrix (m, m); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1256 for (F77_INT j = 0; j < m; j++) |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1257 for (F77_INT i = j + 1; i < m; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1258 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1259 m_q.xelem (i, j) = afact.xelem (i, j); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1260 afact.xelem (i, j) = 0; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1261 } |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1262 m_r = afact; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1263 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1264 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1265 if (m > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1266 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1267 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1268 // workspace query. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1269 Complex clwork; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1270 F77_XFCN (zungqr, ZUNGQR, (m, k, min_mn, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1271 F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1272 m, F77_DBLE_CMPLX_ARG (tau), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1273 F77_DBLE_CMPLX_ARG (&clwork), -1, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1274 info)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1275 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1276 // allocate buffer and do the job. |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1277 F77_INT lwork = static_cast<F77_INT> (clwork.real ()); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1278 lwork = std::max (lwork, static_cast<F77_INT> (1)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1279 OCTAVE_LOCAL_BUFFER (Complex, work, lwork); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1280 F77_XFCN (zungqr, ZUNGQR, (m, k, min_mn, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1281 F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1282 m, F77_DBLE_CMPLX_ARG (tau), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1283 F77_DBLE_CMPLX_ARG (work), lwork, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1284 info)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1285 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1286 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1287 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1288 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1289 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1290 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1291 qr<ComplexMatrix>::init (const ComplexMatrix& a, type qr_type) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1292 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1293 F77_INT m = to_f77_int (a.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1294 F77_INT n = to_f77_int (a.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1295 |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1296 F77_INT min_mn = (m < n ? m : n); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1297 OCTAVE_LOCAL_BUFFER (Complex, tau, min_mn); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1298 |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1299 F77_INT info = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1300 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1301 ComplexMatrix afact = a; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1302 if (m > n && qr_type == qr<ComplexMatrix>::std) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1303 afact.resize (m, m); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1304 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1305 if (m > 0) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1306 { |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1307 // workspace query. |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1308 Complex clwork; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1309 F77_XFCN (zgeqrf, ZGEQRF, (m, n, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1310 F77_DBLE_CMPLX_ARG (afact.fortran_vec ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1311 m, F77_DBLE_CMPLX_ARG (tau), |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1312 F77_DBLE_CMPLX_ARG (&clwork), -1, info)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1313 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1314 // allocate buffer and do the job. |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1315 F77_INT lwork = static_cast<F77_INT> (clwork.real ()); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1316 lwork = std::max (lwork, static_cast<F77_INT> (1)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1317 OCTAVE_LOCAL_BUFFER (Complex, work, lwork); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1318 F77_XFCN (zgeqrf, ZGEQRF, (m, n, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1319 F77_DBLE_CMPLX_ARG (afact.fortran_vec ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1320 m, F77_DBLE_CMPLX_ARG (tau), |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1321 F77_DBLE_CMPLX_ARG (work), lwork, info)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1322 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1323 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1324 form (n, afact, tau, qr_type); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1325 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1326 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1327 #if defined (HAVE_QRUPDATE) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1328 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1329 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1330 OCTAVE_API void |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1331 qr<ComplexMatrix>::update (const ComplexColumnVector& u, |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1332 const ComplexColumnVector& v) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1333 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1334 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1335 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1336 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1337 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1338 F77_INT u_nel = to_f77_int (u.numel ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1339 F77_INT v_nel = to_f77_int (v.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1340 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1341 if (u_nel != m || v_nel != n) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1342 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1343 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1344 ComplexColumnVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1345 ComplexColumnVector vtmp = v; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1346 OCTAVE_LOCAL_BUFFER (Complex, w, k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1347 OCTAVE_LOCAL_BUFFER (double, rw, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1348 F77_XFCN (zqr1up, ZQR1UP, (m, n, k, F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1349 m, F77_DBLE_CMPLX_ARG (m_r.fortran_vec ()), k, |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1350 F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()), |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1351 F77_DBLE_CMPLX_ARG (vtmp.fortran_vec ()), |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1352 F77_DBLE_CMPLX_ARG (w), rw)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1353 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1354 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1355 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1356 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1357 qr<ComplexMatrix>::update (const ComplexMatrix& u, const ComplexMatrix& v) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1358 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1359 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1360 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1361 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1362 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1363 F77_INT u_rows = to_f77_int (u.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1364 F77_INT u_cols = to_f77_int (u.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1365 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1366 F77_INT v_rows = to_f77_int (v.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1367 F77_INT v_cols = to_f77_int (v.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1368 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1369 if (u_rows != m || v_rows != n || u_cols != v_cols) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1370 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1371 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1372 OCTAVE_LOCAL_BUFFER (Complex, w, k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1373 OCTAVE_LOCAL_BUFFER (double, rw, k); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1374 for (volatile F77_INT i = 0; i < u_cols; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1375 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1376 ComplexColumnVector utmp = u.column (i); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1377 ComplexColumnVector vtmp = v.column (i); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1378 F77_XFCN (zqr1up, ZQR1UP, (m, n, k, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1379 F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1380 m, F77_DBLE_CMPLX_ARG (m_r.fortran_vec ()), k, |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1381 F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()), |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1382 F77_DBLE_CMPLX_ARG (vtmp.fortran_vec ()), |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1383 F77_DBLE_CMPLX_ARG (w), rw)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1384 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1385 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1386 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1387 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1388 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1389 qr<ComplexMatrix>::insert_col (const ComplexColumnVector& u, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1390 octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1391 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1392 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1393 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1394 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1395 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1396 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1397 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1398 F77_INT u_nel = to_f77_int (u.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1399 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1400 if (u_nel != m) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1401 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1402 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1403 if (j < 0 || j > n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1404 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1405 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1406 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1407 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1408 m_q.resize (m, k+1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1409 m_r.resize (k+1, n+1); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1410 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1411 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1412 m_r.resize (k, n+1); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1413 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1414 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1415 F77_INT ldr = to_f77_int (m_r.rows ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1416 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1417 ComplexColumnVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1418 OCTAVE_LOCAL_BUFFER (double, rw, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1419 F77_XFCN (zqrinc, ZQRINC, (m, n, k, F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1420 ldq, F77_DBLE_CMPLX_ARG (m_r.fortran_vec ()), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1421 ldr, j + 1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1422 F77_CONST_DBLE_CMPLX_ARG (utmp.data ()), rw)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1423 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1424 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1425 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1426 OCTAVE_API void |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1427 qr<ComplexMatrix>::insert_col (const ComplexMatrix& u, |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1428 const Array<octave_idx_type>& j) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1429 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1430 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1431 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1432 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1433 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1434 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1435 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1436 F77_INT nj = to_f77_int (js.numel ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1437 bool dups = false; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1438 for (F77_INT i = 0; i < nj - 1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1439 dups = dups && js(i) == js(i+1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1440 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1441 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1442 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1443 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1444 F77_INT u_nel = to_f77_int (u.numel ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1445 F77_INT u_cols = to_f77_int (u.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1446 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1447 if (u_nel != m || u_cols != nj) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1448 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1449 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1450 F77_INT js_beg = to_f77_int (js(0)); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1451 F77_INT js_end = to_f77_int (js(nj-1)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1452 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1453 if (nj > 0 && (js_beg < 0 || js_end > n)) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1454 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1455 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1456 if (nj > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1457 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1458 F77_INT kmax = std::min (k + nj, m); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1459 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1460 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1461 m_q.resize (m, kmax); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1462 m_r.resize (kmax, n + nj); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1463 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1464 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1465 m_r.resize (k, n + nj); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1466 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1467 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1468 F77_INT ldr = to_f77_int (m_r.rows ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1469 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1470 OCTAVE_LOCAL_BUFFER (double, rw, kmax); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1471 for (volatile F77_INT i = 0; i < nj; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1472 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1473 F77_INT ii = i; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1474 ComplexColumnVector utmp = u.column (jsi(i)); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1475 F77_INT js_elt = to_f77_int (js(ii)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1476 F77_XFCN (zqrinc, ZQRINC, (m, n + ii, std::min (kmax, k + ii), |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1477 F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1478 ldq, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1479 F77_DBLE_CMPLX_ARG (m_r.fortran_vec ()), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1480 ldr, js_elt + 1, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1481 F77_CONST_DBLE_CMPLX_ARG (utmp.data ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1482 rw)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1483 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1484 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1485 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1486 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1487 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1488 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1489 qr<ComplexMatrix>::delete_col (octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1490 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1491 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1492 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1493 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1494 F77_INT k = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1495 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1496 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1497 if (j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1498 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1499 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1500 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1501 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1502 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1503 OCTAVE_LOCAL_BUFFER (double, rw, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1504 F77_XFCN (zqrdec, ZQRDEC, (m, n, k, F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1505 ldq, F77_DBLE_CMPLX_ARG (m_r.fortran_vec ()), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1506 ldr, j + 1, rw)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1507 |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1508 if (k < m) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1509 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1510 m_q.resize (m, k-1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1511 m_r.resize (k-1, n-1); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1512 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1513 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1514 m_r.resize (k, n-1); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1515 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1516 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1517 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1518 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1519 qr<ComplexMatrix>::delete_col (const Array<octave_idx_type>& j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1520 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1521 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1522 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1523 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1524 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1525 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1526 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1527 F77_INT nj = to_f77_int (js.numel ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1528 bool dups = false; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1529 for (F77_INT i = 0; i < nj - 1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1530 dups = dups && js(i) == js(i+1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1531 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1532 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1533 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1534 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1535 F77_INT js_beg = to_f77_int (js(0)); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1536 F77_INT js_end = to_f77_int (js(nj-1)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1537 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1538 if (nj > 0 && (js_beg > n-1 || js_end < 0)) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1539 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1540 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1541 if (nj > 0) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1542 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1543 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1544 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1545 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1546 OCTAVE_LOCAL_BUFFER (double, rw, k); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1547 for (volatile F77_INT i = 0; i < nj; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1548 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1549 F77_INT ii = i; |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1550 F77_INT js_elt = to_f77_int (js(ii)); |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1551 F77_XFCN (zqrdec, ZQRDEC, (m, n - ii, (k == m ? k : k - ii), |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1552 F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1553 ldq, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1554 F77_DBLE_CMPLX_ARG (m_r.fortran_vec ()), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1555 ldr, js_elt + 1, rw)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1556 } |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1557 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1558 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1559 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1560 m_q.resize (m, k - nj); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1561 m_r.resize (k - nj, n - nj); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1562 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1563 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1564 m_r.resize (k, n - nj); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1565 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1566 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1567 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1568 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1569 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1570 qr<ComplexMatrix>::insert_row (const ComplexRowVector& u, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1571 octave_idx_type j_arg) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1572 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1573 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1574 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1575 F77_INT m = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1576 F77_INT n = to_f77_int (m_r.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1577 F77_INT k = std::min (m, n); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1578 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1579 F77_INT u_nel = to_f77_int (u.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1580 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1581 if (! m_q.issquare () || u_nel != n) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1582 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1583 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1584 if (j < 0 || j > m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1585 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1586 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1587 m_q.resize (m + 1, m + 1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1588 m_r.resize (m + 1, n); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1589 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1590 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1591 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1592 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1593 ComplexRowVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1594 OCTAVE_LOCAL_BUFFER (double, rw, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1595 F77_XFCN (zqrinr, ZQRINR, (m, n, F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1596 ldq, F77_DBLE_CMPLX_ARG (m_r.fortran_vec ()), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1597 ldr, j + 1, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1598 F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()), rw)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1599 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1600 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1601 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1602 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1603 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1604 qr<ComplexMatrix>::delete_row (octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1605 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1606 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1607 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1608 F77_INT m = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1609 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1610 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1611 if (! m_q.issquare ()) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1612 (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1613 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1614 if (j < 0 || j > m-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1615 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1616 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1617 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1618 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1619 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1620 OCTAVE_LOCAL_BUFFER (Complex, w, m); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1621 OCTAVE_LOCAL_BUFFER (double, rw, m); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1622 F77_XFCN (zqrder, ZQRDER, (m, n, F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1623 ldq, F77_DBLE_CMPLX_ARG (m_r.fortran_vec ()), |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1624 ldr, j + 1, F77_DBLE_CMPLX_ARG (w), rw)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1625 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1626 m_q.resize (m - 1, m - 1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1627 m_r.resize (m - 1, n); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1628 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1629 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1630 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1631 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1632 qr<ComplexMatrix>::shift_cols (octave_idx_type i_arg, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1633 octave_idx_type j_arg) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1634 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1635 F77_INT i = to_f77_int (i_arg); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1636 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1637 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1638 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1639 F77_INT k = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1640 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1641 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1642 if (i < 0 || i > n-1 || j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1643 (*current_liboctave_error_handler) ("qrshift: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1644 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1645 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1646 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1647 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1648 OCTAVE_LOCAL_BUFFER (Complex, w, k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1649 OCTAVE_LOCAL_BUFFER (double, rw, k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1650 F77_XFCN (zqrshc, ZQRSHC, (m, n, k, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1651 F77_DBLE_CMPLX_ARG (m_q.fortran_vec ()), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1652 F77_DBLE_CMPLX_ARG (m_r.fortran_vec ()), ldr, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1653 i + 1, j + 1, F77_DBLE_CMPLX_ARG (w), rw)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1654 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1655 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1656 #endif |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1657 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1658 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1659 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1660 qr<FloatComplexMatrix>::form (octave_idx_type n_arg, FloatComplexMatrix& afact, |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1661 FloatComplex *tau, type qr_type) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1662 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1663 F77_INT n = to_f77_int (n_arg); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1664 F77_INT m = to_f77_int (afact.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1665 F77_INT min_mn = std::min (m, n); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1666 F77_INT info; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1667 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1668 if (qr_type == qr<FloatComplexMatrix>::raw) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1669 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1670 for (F77_INT j = 0; j < min_mn; j++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1671 { |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1672 F77_INT limit = (j < min_mn - 1 ? j : min_mn - 1); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1673 for (F77_INT i = limit + 1; i < m; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1674 afact.elem (i, j) *= tau[j]; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1675 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1676 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1677 m_r = afact; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1678 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1679 else |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1680 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1681 // Attempt to minimize copying. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1682 if (m >= n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1683 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1684 // afact will become m_q. |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1685 m_q = afact; |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1686 F77_INT k = (qr_type == qr<FloatComplexMatrix>::economy ? n : m); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1687 m_r = FloatComplexMatrix (k, n); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1688 for (F77_INT j = 0; j < n; j++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1689 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1690 F77_INT i = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1691 for (; i <= j; i++) |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1692 m_r.xelem (i, j) = afact.xelem (i, j); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1693 for (; i < k; i++) |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1694 m_r.xelem (i, j) = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1695 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1696 afact = FloatComplexMatrix (); // optimize memory |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1697 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1698 else |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1699 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1700 // afact will become m_r. |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1701 m_q = FloatComplexMatrix (m, m); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1702 for (F77_INT j = 0; j < m; j++) |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1703 for (F77_INT i = j + 1; i < m; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1704 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1705 m_q.xelem (i, j) = afact.xelem (i, j); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1706 afact.xelem (i, j) = 0; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1707 } |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1708 m_r = afact; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1709 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1710 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1711 if (m > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1712 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1713 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1714 // workspace query. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1715 FloatComplex clwork; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1716 F77_XFCN (cungqr, CUNGQR, (m, k, min_mn, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1717 F77_CMPLX_ARG (m_q.fortran_vec ()), m, |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1718 F77_CMPLX_ARG (tau), |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1719 F77_CMPLX_ARG (&clwork), -1, info)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1720 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1721 // allocate buffer and do the job. |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1722 F77_INT lwork = static_cast<F77_INT> (clwork.real ()); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1723 lwork = std::max (lwork, static_cast<F77_INT> (1)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1724 OCTAVE_LOCAL_BUFFER (FloatComplex, work, lwork); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1725 F77_XFCN (cungqr, CUNGQR, (m, k, min_mn, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1726 F77_CMPLX_ARG (m_q.fortran_vec ()), m, |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1727 F77_CMPLX_ARG (tau), |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1728 F77_CMPLX_ARG (work), lwork, info)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1729 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1730 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1731 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1732 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1733 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1734 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1735 qr<FloatComplexMatrix>::init (const FloatComplexMatrix& a, type qr_type) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1736 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1737 F77_INT m = to_f77_int (a.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1738 F77_INT n = to_f77_int (a.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1739 |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1740 F77_INT min_mn = (m < n ? m : n); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1741 OCTAVE_LOCAL_BUFFER (FloatComplex, tau, min_mn); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1742 |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1743 F77_INT info = 0; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1744 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1745 FloatComplexMatrix afact = a; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1746 if (m > n && qr_type == qr<FloatComplexMatrix>::std) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1747 afact.resize (m, m); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1748 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1749 if (m > 0) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1750 { |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1751 // workspace query. |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1752 FloatComplex clwork; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1753 F77_XFCN (cgeqrf, CGEQRF, (m, n, F77_CMPLX_ARG (afact.fortran_vec ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1754 m, F77_CMPLX_ARG (tau), |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1755 F77_CMPLX_ARG (&clwork), -1, info)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1756 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1757 // allocate buffer and do the job. |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1758 F77_INT lwork = static_cast<F77_INT> (clwork.real ()); |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1759 lwork = std::max (lwork, static_cast<F77_INT> (1)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1760 OCTAVE_LOCAL_BUFFER (FloatComplex, work, lwork); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1761 F77_XFCN (cgeqrf, CGEQRF, (m, n, F77_CMPLX_ARG (afact.fortran_vec ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1762 m, F77_CMPLX_ARG (tau), |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1763 F77_CMPLX_ARG (work), lwork, info)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1764 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1765 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1766 form (n, afact, tau, qr_type); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1767 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1768 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
1769 #if defined (HAVE_QRUPDATE) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1770 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1771 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1772 OCTAVE_API void |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1773 qr<FloatComplexMatrix>::update (const FloatComplexColumnVector& u, |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1774 const FloatComplexColumnVector& v) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1775 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1776 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1777 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1778 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1779 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1780 F77_INT u_nel = to_f77_int (u.numel ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1781 F77_INT v_nel = to_f77_int (v.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1782 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1783 if (u_nel != m || v_nel != n) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1784 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1785 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1786 FloatComplexColumnVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1787 FloatComplexColumnVector vtmp = v; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1788 OCTAVE_LOCAL_BUFFER (FloatComplex, w, k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1789 OCTAVE_LOCAL_BUFFER (float, rw, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1790 F77_XFCN (cqr1up, CQR1UP, (m, n, k, F77_CMPLX_ARG (m_q.fortran_vec ()), |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1791 m, F77_CMPLX_ARG (m_r.fortran_vec ()), k, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1792 F77_CMPLX_ARG (utmp.fortran_vec ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1793 F77_CMPLX_ARG (vtmp.fortran_vec ()), |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1794 F77_CMPLX_ARG (w), rw)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1795 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1796 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1797 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1798 OCTAVE_API void |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1799 qr<FloatComplexMatrix>::update (const FloatComplexMatrix& u, |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1800 const FloatComplexMatrix& v) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1801 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1802 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1803 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1804 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1805 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1806 F77_INT u_rows = to_f77_int (u.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1807 F77_INT u_cols = to_f77_int (u.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1808 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1809 F77_INT v_rows = to_f77_int (v.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1810 F77_INT v_cols = to_f77_int (v.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1811 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1812 if (u_rows != m || v_rows != n || u_cols != v_cols) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1813 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1814 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1815 OCTAVE_LOCAL_BUFFER (FloatComplex, w, k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1816 OCTAVE_LOCAL_BUFFER (float, rw, k); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1817 for (volatile F77_INT i = 0; i < u_cols; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1818 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1819 FloatComplexColumnVector utmp = u.column (i); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1820 FloatComplexColumnVector vtmp = v.column (i); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1821 F77_XFCN (cqr1up, CQR1UP, (m, n, k, F77_CMPLX_ARG (m_q.fortran_vec ()), |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1822 m, F77_CMPLX_ARG (m_r.fortran_vec ()), k, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1823 F77_CMPLX_ARG (utmp.fortran_vec ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1824 F77_CMPLX_ARG (vtmp.fortran_vec ()), |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1825 F77_CMPLX_ARG (w), rw)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1826 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1827 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1828 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1829 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1830 OCTAVE_API void |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1831 qr<FloatComplexMatrix>::insert_col (const FloatComplexColumnVector& u, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1832 octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1833 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1834 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1835 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1836 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1837 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1838 F77_INT k = to_f77_int (m_q.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1839 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1840 F77_INT u_nel = to_f77_int (u.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1841 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1842 if (u_nel != m) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1843 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1844 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1845 if (j < 0 || j > n) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1846 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1847 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1848 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1849 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1850 m_q.resize (m, k+1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1851 m_r.resize (k+1, n+1); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1852 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1853 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1854 m_r.resize (k, n+1); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1855 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1856 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1857 F77_INT ldr = to_f77_int (m_r.rows ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1858 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1859 FloatComplexColumnVector utmp = u; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1860 OCTAVE_LOCAL_BUFFER (float, rw, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1861 F77_XFCN (cqrinc, CQRINC, (m, n, k, F77_CMPLX_ARG (m_q.fortran_vec ()), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1862 F77_CMPLX_ARG (m_r.fortran_vec ()), ldr, j + 1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1863 F77_CONST_CMPLX_ARG (utmp.data ()), rw)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1864 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1865 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1866 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1867 OCTAVE_API void |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1868 qr<FloatComplexMatrix>::insert_col (const FloatComplexMatrix& u, |
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
1869 const Array<octave_idx_type>& j) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1870 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1871 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1872 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1873 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1874 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1875 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1876 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1877 F77_INT nj = to_f77_int (js.numel ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1878 bool dups = false; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1879 for (F77_INT i = 0; i < nj - 1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1880 dups = dups && js(i) == js(i+1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1881 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1882 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1883 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1884 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1885 F77_INT u_nel = to_f77_int (u.numel ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1886 F77_INT u_cols = to_f77_int (u.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1887 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1888 if (u_nel != m || u_cols != nj) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1889 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1890 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1891 F77_INT js_beg = to_f77_int (js(0)); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1892 F77_INT js_end = to_f77_int (js(nj-1)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1893 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1894 if (nj > 0 && (js_beg < 0 || js_end > n)) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1895 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1896 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1897 if (nj > 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1898 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1899 F77_INT kmax = std::min (k + nj, m); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1900 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1901 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1902 m_q.resize (m, kmax); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1903 m_r.resize (kmax, n + nj); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1904 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1905 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1906 m_r.resize (k, n + nj); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1907 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1908 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1909 F77_INT ldr = to_f77_int (m_r.rows ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1910 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1911 OCTAVE_LOCAL_BUFFER (float, rw, kmax); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1912 for (volatile F77_INT i = 0; i < nj; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1913 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1914 F77_INT ii = i; |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1915 F77_INT js_elt = to_f77_int (js(ii)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1916 F77_XFCN (cqrinc, CQRINC, (m, n + ii, std::min (kmax, k + ii), |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1917 F77_CMPLX_ARG (m_q.fortran_vec ()), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1918 F77_CMPLX_ARG (m_r.fortran_vec ()), ldr, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1919 js_elt + 1, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1920 F77_CONST_CMPLX_ARG (u.column (jsi(i)).data ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1921 rw)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1922 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1923 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1924 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1925 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1926 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1927 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1928 qr<FloatComplexMatrix>::delete_col (octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1929 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1930 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1931 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1932 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1933 F77_INT k = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1934 F77_INT n = to_f77_int (m_r.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1935 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1936 if (j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1937 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1938 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1939 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1940 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1941 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1942 OCTAVE_LOCAL_BUFFER (float, rw, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1943 F77_XFCN (cqrdec, CQRDEC, (m, n, k, F77_CMPLX_ARG (m_q.fortran_vec ()), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1944 F77_CMPLX_ARG (m_r.fortran_vec ()), ldr, j + 1, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1945 rw)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1946 |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1947 if (k < m) |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1948 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1949 m_q.resize (m, k-1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1950 m_r.resize (k-1, n-1); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1951 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1952 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1953 m_r.resize (k, n-1); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1954 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1955 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1956 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
1957 OCTAVE_API void |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1958 qr<FloatComplexMatrix>::delete_col (const Array<octave_idx_type>& j) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1959 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1960 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1961 F77_INT n = to_f77_int (m_r.cols ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1962 F77_INT k = to_f77_int (m_q.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1963 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1964 Array<octave_idx_type> jsi; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1965 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1966 F77_INT nj = to_f77_int (js.numel ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1967 bool dups = false; |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1968 for (F77_INT i = 0; i < nj - 1; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1969 dups = dups && js(i) == js(i+1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1970 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1971 if (dups) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1972 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1973 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1974 F77_INT js_beg = to_f77_int (js(0)); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1975 F77_INT js_end = to_f77_int (js(nj-1)); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1976 |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1977 if (nj > 0 && (js_beg > n-1 || js_end < 0)) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1978 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1979 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1980 if (nj > 0) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
1981 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1982 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1983 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1984 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1985 OCTAVE_LOCAL_BUFFER (float, rw, k); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1986 for (volatile F77_INT i = 0; i < nj; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1987 { |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1988 F77_INT ii = i; |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
1989 F77_INT js_elt = to_f77_int (js(ii)); |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1990 F77_XFCN (cqrdec, CQRDEC, (m, n - ii, (k == m ? k : k - ii), |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1991 F77_CMPLX_ARG (m_q.fortran_vec ()), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1992 F77_CMPLX_ARG (m_r.fortran_vec ()), ldr, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1993 js_elt + 1, rw)); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1994 } |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1995 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1996 if (k < m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
1997 { |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1998 m_q.resize (m, k - nj); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
1999 m_r.resize (k - nj, n - nj); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2000 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2001 else |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2002 m_r.resize (k, n - nj); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2003 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2004 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2005 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2006 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
2007 OCTAVE_API void |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22393
diff
changeset
|
2008 qr<FloatComplexMatrix>::insert_row (const FloatComplexRowVector& u, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2009 octave_idx_type j_arg) |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2010 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
2011 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2012 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2013 F77_INT m = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2014 F77_INT n = to_f77_int (m_r.cols ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2015 F77_INT k = std::min (m, n); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2016 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
2017 F77_INT u_nel = to_f77_int (u.numel ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2018 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2019 if (! m_q.issquare () || u_nel != n) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2020 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2021 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2022 if (j < 0 || j > m) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2023 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2024 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2025 m_q.resize (m + 1, m + 1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2026 m_r.resize (m + 1, n); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2027 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2028 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2029 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2030 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2031 FloatComplexRowVector utmp = u; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2032 OCTAVE_LOCAL_BUFFER (float, rw, k); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2033 F77_XFCN (cqrinr, CQRINR, (m, n, F77_CMPLX_ARG (m_q.fortran_vec ()), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2034 F77_CMPLX_ARG (m_r.fortran_vec ()), ldr, |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2035 j + 1, F77_CMPLX_ARG (utmp.fortran_vec ()), |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2036 rw)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2037 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2038 } |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2039 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2040 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
2041 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2042 qr<FloatComplexMatrix>::delete_row (octave_idx_type j_arg) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2043 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
2044 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2045 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2046 F77_INT m = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2047 F77_INT n = to_f77_int (m_r.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2048 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2049 if (! m_q.issquare ()) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2050 (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2051 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2052 if (j < 0 || j > m-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2053 (*current_liboctave_error_handler) ("qrdelete: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2054 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2055 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2056 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2057 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2058 OCTAVE_LOCAL_BUFFER (FloatComplex, w, m); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2059 OCTAVE_LOCAL_BUFFER (float, rw, m); |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2060 F77_XFCN (cqrder, CQRDER, (m, n, F77_CMPLX_ARG (m_q.fortran_vec ()), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2061 F77_CMPLX_ARG (m_r.fortran_vec ()), ldr, j + 1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2062 F77_CMPLX_ARG (w), rw)); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2063 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2064 m_q.resize (m - 1, m - 1); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2065 m_r.resize (m - 1, n); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2066 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2067 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2068 template <> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
2069 OCTAVE_API void |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2070 qr<FloatComplexMatrix>::shift_cols (octave_idx_type i_arg, |
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2071 octave_idx_type j_arg) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2072 { |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
2073 F77_INT i = to_f77_int (i_arg); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23593
diff
changeset
|
2074 F77_INT j = to_f77_int (j_arg); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2075 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2076 F77_INT m = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2077 F77_INT k = to_f77_int (m_r.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2078 F77_INT n = to_f77_int (m_r.cols ()); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2079 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2080 if (i < 0 || i > n-1 || j < 0 || j > n-1) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2081 (*current_liboctave_error_handler) ("qrshift: index out of range"); |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2082 |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2083 F77_INT ldq = to_f77_int (m_q.rows ()); |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2084 F77_INT ldr = to_f77_int (m_r.rows ()); |
22958
12e4534d68b1
use F77_INT instead of octave_idx_type for liboctave QR class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
2085 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2086 OCTAVE_LOCAL_BUFFER (FloatComplex, w, k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2087 OCTAVE_LOCAL_BUFFER (float, rw, k); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2088 F77_XFCN (cqrshc, CQRSHC, (m, n, k, |
30068
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2089 F77_CMPLX_ARG (m_q.fortran_vec ()), ldq, |
97378503ee0a
maint: use "m_" prefix for member variables in class qr.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
2090 F77_CMPLX_ARG (m_r.fortran_vec ()), ldr, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2091 i + 1, j + 1, F77_CMPLX_ARG (w), rw)); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2092 } |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2093 |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2094 #endif |
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2095 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2096 // Instantiations we need. |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2097 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2098 template class qr<Matrix>; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2099 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2100 template class qr<FloatMatrix>; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2101 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2102 template class qr<ComplexMatrix>; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
2103 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
2104 template class qr<FloatComplexMatrix>; |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
2105 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
2106 OCTAVE_END_NAMESPACE(math) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
2107 OCTAVE_END_NAMESPACE(octave) |