annotate liboctave/numeric/lu.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: 30092
diff changeset
3 // Copyright (C) 1996-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 ////////////////////////////////////////////////////////////////////////
1991
413f6a81868f [project @ 1996-03-03 00:40:53 by jwe]
jwe
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: 21271
diff changeset
27 # include "config.h"
1991
413f6a81868f [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents:
diff changeset
28 #endif
413f6a81868f [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents:
diff changeset
29
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
30 #include <algorithm>
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
31
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
32 #include "CColVector.h"
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
33 #include "CMatrix.h"
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
34 #include "PermMatrix.h"
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
35 #include "dColVector.h"
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
36 #include "dMatrix.h"
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
37 #include "fCColVector.h"
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
38 #include "fCMatrix.h"
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
39 #include "fColVector.h"
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
40 #include "fMatrix.h"
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
41 #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
42 #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
43 #include "lo-qrupdate-proto.h"
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
44 #include "lu.h"
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
45 #include "oct-locbuf.h"
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
46
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
47 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
48
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
49 OCTAVE_BEGIN_NAMESPACE(math)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
50
24811
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
51 // FIXME: PermMatrix::col_perm_vec returns Array<octave_idx_type>
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
52 // but m_ipvt is an Array<octave_f77_int_type>. This could cause
24811
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
53 // trouble for large arrays if octave_f77_int_type is 32-bits but
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
54 // octave_idx_type is 64. Since this constructor is called from
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
55 // Fluupdate, it could be given values that are out of range. We
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
56 // should ensure that the values are within range here.
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
57
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
58 template <typename T>
24811
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
59 lu<T>::lu (const T& l, const T& u, const PermMatrix& p)
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
60 : m_a_fact (u), m_L (l), m_ipvt (p.transpose ().col_perm_vec ())
1991
413f6a81868f [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents:
diff changeset
61 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
62 if (l.columns () != u.rows ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
63 (*current_liboctave_error_handler) ("lu: dimension mismatch");
1991
413f6a81868f [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents:
diff changeset
64 }
413f6a81868f [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents:
diff changeset
65
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
66 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
67 bool
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
68 lu<T>::packed (void) const
1991
413f6a81868f [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents:
diff changeset
69 {
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
70 return m_L.dims () == dim_vector ();
1991
413f6a81868f [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents:
diff changeset
71 }
413f6a81868f [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents:
diff changeset
72
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
73 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
74 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
75 lu<T>::unpack (void)
13217
08ba694723f5 fix warnings for unused but set variables
John W. Eaton <jwe@octave.org>
parents: 11590
diff changeset
76 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
77 if (packed ())
13217
08ba694723f5 fix warnings for unused but set variables
John W. Eaton <jwe@octave.org>
parents: 11590
diff changeset
78 {
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
79 m_L = L ();
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
80 m_a_fact = U (); // FIXME: sub-optimal
24811
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
81
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
82 // FIXME: getp returns Array<octave_idx_type> but m_ipvt is
24811
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
83 // Array<octave_f77_int_type>. However, getp produces its
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
84 // result from a valid m_ipvt array so validation should not be
24811
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
85 // necessary. OTOH, it might be better to have a version of
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
86 // getp that doesn't cause us to convert from
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
87 // Array<octave_f77_int_type> to Array<octave_idx_type> and
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
88 // back again.
a8df0552cc42 * lu.cc: Note possible issues with ipvt vector.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
89
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
90 m_ipvt = getp ();
13217
08ba694723f5 fix warnings for unused but set variables
John W. Eaton <jwe@octave.org>
parents: 11590
diff changeset
91 }
08ba694723f5 fix warnings for unused but set variables
John W. Eaton <jwe@octave.org>
parents: 11590
diff changeset
92 }
9715
9f27172fbd1e auto-set MatrixType from certain functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9697
diff changeset
93
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
94 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
95 T
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
96 lu<T>::L (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
97 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
98 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
99 {
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
100 octave_idx_type a_nr = m_a_fact.rows ();
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
101 octave_idx_type a_nc = m_a_fact.columns ();
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
102 octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc);
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 T l (a_nr, mn, ELT_T (0.0));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
105
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
106 for (octave_idx_type i = 0; i < a_nr; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
107 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
108 if (i < a_nc)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
109 l.xelem (i, i) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
110
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
111 for (octave_idx_type j = 0; j < (i < a_nc ? i : a_nc); j++)
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
112 l.xelem (i, j) = m_a_fact.xelem (i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
113 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
114
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
115 return l;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
116 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
117 else
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
118 return m_L;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
119 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
120
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
121 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
122 T
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
123 lu<T>::U (void) const
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 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
126 {
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
127 octave_idx_type a_nr = m_a_fact.rows ();
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
128 octave_idx_type a_nc = m_a_fact.columns ();
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
129 octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
130
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
131 T u (mn, a_nc, ELT_T (0.0));
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 for (octave_idx_type i = 0; i < mn; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
134 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
135 for (octave_idx_type j = i; j < a_nc; j++)
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
136 u.xelem (i, j) = m_a_fact.xelem (i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
137 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
138
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
139 return u;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
140 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
141 else
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
142 return m_a_fact;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
143 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
144
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
145 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
146 T
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
147 lu<T>::Y (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
148 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
149 if (! packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
150 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
151 ("lu: Y () not implemented for unpacked form");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
152
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
153 return m_a_fact;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
154 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
155
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
156 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
157 Array<octave_idx_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
158 lu<T>::getp (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
159 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
160 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
161 {
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
162 octave_idx_type a_nr = m_a_fact.rows ();
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
163
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
164 Array<octave_idx_type> pvt (dim_vector (a_nr, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
165
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
166 for (octave_idx_type i = 0; i < a_nr; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
167 pvt.xelem (i) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
168
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
169 for (octave_idx_type i = 0; i < m_ipvt.numel (); i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
170 {
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
171 octave_idx_type k = m_ipvt.xelem (i);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
172
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
173 if (k != i)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
174 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
175 octave_idx_type tmp = pvt.xelem (k);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
176 pvt.xelem (k) = pvt.xelem (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
177 pvt.xelem (i) = tmp;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
178 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
179 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
180
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
181 return pvt;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
182 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
183 else
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
184 return m_ipvt;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
185 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
186
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 PermMatrix
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
189 lu<T>::P (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
190 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
191 return PermMatrix (getp (), false);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
192 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
193
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
194 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
195 ColumnVector
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
196 lu<T>::P_vec (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
197 {
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
198 octave_idx_type a_nr = m_a_fact.rows ();
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
199
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
200 ColumnVector p (a_nr);
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 Array<octave_idx_type> pvt = getp ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
203
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
204 for (octave_idx_type i = 0; i < a_nr; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
205 p.xelem (i) = static_cast<double> (pvt.xelem (i) + 1);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
206
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
207 return p;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
208 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
209
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
210 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
211 bool
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
212 lu<T>::regular (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
213 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
214 bool retval = true;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
215
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
216 octave_idx_type k = std::min (m_a_fact.rows (), m_a_fact.columns ());
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
217
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
218 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
219 {
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
220 if (m_a_fact(i, i) == ELT_T ())
22329
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 retval = false;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
223 break;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
224 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
225 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
226
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
227 return retval;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
228 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
229
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
230 #if ! defined (HAVE_QRUPDATE_LUU)
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
231
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
232 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
233 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
234 lu<T>::update (const VT&, const VT&)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
235 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
236 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
237 ("luupdate: support for qrupdate with LU updates "
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
238 "was unavailable or disabled when liboctave was built");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
239 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
240
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
241 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
242 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
243 lu<T>::update (const T&, const T&)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
244 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
245 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
246 ("luupdate: support for qrupdate with LU updates "
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
247 "was unavailable or disabled when liboctave was built");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
248 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
249
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
250 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
251 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
252 lu<T>::update_piv (const VT&, const VT&)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
253 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
254 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
255 ("luupdate: support for qrupdate with LU updates "
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
256 "was unavailable or disabled when liboctave was built");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
257 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
258
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
259 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
260 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
261 lu<T>::update_piv (const T&, const T&)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
262 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
263 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
264 ("luupdate: support for qrupdate with LU updates "
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
265 "was unavailable or disabled when liboctave was built");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
266 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
267
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
268 #endif
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
269
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
270 // Specializations.
21271
7e67c7f82fc1 better use of templates for lu factorization 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 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
273 OCTAVE_API
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
274 lu<Matrix>::lu (const Matrix& a)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
275 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
276 F77_INT a_nr = to_f77_int (a.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
277 F77_INT a_nc = to_f77_int (a.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
278 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
279
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
280 m_ipvt.resize (dim_vector (mn, 1));
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
281 F77_INT *pipvt = m_ipvt.fortran_vec ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
282
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
283 m_a_fact = a;
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
284 double *tmp_data = m_a_fact.fortran_vec ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
285
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
286 F77_INT info = 0;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
287
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
288 F77_XFCN (dgetrf, DGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info));
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
289
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
290 for (F77_INT i = 0; i < mn; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
291 pipvt[i] -= 1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
292 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
293
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
294 #if defined (HAVE_QRUPDATE_LUU)
21271
7e67c7f82fc1 better use of templates for lu factorization 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 <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
297 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
298 lu<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
299 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
300 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
301 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
302
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
303 Matrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
304 Matrix& r = m_a_fact;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
305
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
306 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
307 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
308 F77_INT k = to_f77_int (l.columns ());
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
309
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
310 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: 23475
diff changeset
311 F77_INT v_nel = to_f77_int (v.numel ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
312
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
313 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
314 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
315
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
316 ColumnVector utmp = u;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
317 ColumnVector vtmp = v;
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
318 F77_XFCN (dlu1up, DLU1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
319 k, utmp.fortran_vec (), vtmp.fortran_vec ()));
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
320 }
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
321
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
322 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
323 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
324 lu<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
325 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
326 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
327 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
328
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
329 Matrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
330 Matrix& r = m_a_fact;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
331
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
332 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
333 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
334 F77_INT k = to_f77_int (l.columns ());
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
335
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
336 F77_INT u_nr = to_f77_int (u.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
337 F77_INT u_nc = to_f77_int (u.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
338
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
339 F77_INT v_nr = to_f77_int (v.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
340 F77_INT v_nc = to_f77_int (v.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
341
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
342 if (u_nr != m || v_nr != n || u_nc != v_nc)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
343 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
344
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
345 for (volatile F77_INT i = 0; i < u_nc; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
346 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
347 ColumnVector utmp = u.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
348 ColumnVector vtmp = v.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
349 F77_XFCN (dlu1up, DLU1UP, (m, n, l.fortran_vec (),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
350 m, r.fortran_vec (), k,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
351 utmp.fortran_vec (), vtmp.fortran_vec ()));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
352 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
353 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
354
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
355 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
356 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
357 lu<Matrix>::update_piv (const ColumnVector& u, const ColumnVector& v)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
358 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
359 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
360 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
361
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
362 Matrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
363 Matrix& r = m_a_fact;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
364
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
365 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
366 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
367 F77_INT k = to_f77_int (l.columns ());
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
368
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
369 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: 23475
diff changeset
370 F77_INT v_nel = to_f77_int (v.numel ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
371
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
372 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
373 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
374
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
375 ColumnVector utmp = u;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
376 ColumnVector vtmp = v;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
377 OCTAVE_LOCAL_BUFFER (double, w, m);
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
378 for (F77_INT i = 0; i < m; i++) m_ipvt(i) += 1; // increment
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
379 F77_XFCN (dlup1up, DLUP1UP, (m, n, l.fortran_vec (),
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
380 m, r.fortran_vec (), k,
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
381 m_ipvt.fortran_vec (),
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
382 utmp.data (), vtmp.data (), w));
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
383 for (F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1; // decrement
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
384 }
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
385
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
386 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
387 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
388 lu<Matrix>::update_piv (const Matrix& u, const Matrix& v)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
389 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
390 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
391 unpack ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
392
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
393 Matrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
394 Matrix& r = m_a_fact;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
395
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
396 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
397 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
398 F77_INT k = to_f77_int (l.columns ());
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
399
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
400 F77_INT u_nr = to_f77_int (u.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
401 F77_INT u_nc = to_f77_int (u.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
402
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
403 F77_INT v_nr = to_f77_int (v.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
404 F77_INT v_nc = to_f77_int (v.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
405
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
406 if (u_nr != m || v_nr != n || u_nc != v_nc)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
407 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
408
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
409 OCTAVE_LOCAL_BUFFER (double, w, m);
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
410 for (F77_INT i = 0; i < m; i++) m_ipvt(i) += 1; // increment
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
411 for (volatile F77_INT i = 0; i < u_nc; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
412 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
413 ColumnVector utmp = u.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
414 ColumnVector vtmp = v.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
415 F77_XFCN (dlup1up, DLUP1UP, (m, n, l.fortran_vec (),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
416 m, r.fortran_vec (), k,
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
417 m_ipvt.fortran_vec (),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
418 utmp.data (), vtmp.data (), w));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
419 }
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
420 for (F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1; // decrement
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
421 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
422
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
423 #endif
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
424
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
425 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
426 OCTAVE_API
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
427 lu<FloatMatrix>::lu (const FloatMatrix& a)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
428 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
429 F77_INT a_nr = to_f77_int (a.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
430 F77_INT a_nc = to_f77_int (a.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
431 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
432
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
433 m_ipvt.resize (dim_vector (mn, 1));
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
434 F77_INT *pipvt = m_ipvt.fortran_vec ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
435
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
436 m_a_fact = a;
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
437 float *tmp_data = m_a_fact.fortran_vec ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
438
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
439 F77_INT info = 0;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
440
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
441 F77_XFCN (sgetrf, SGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info));
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
442
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
443 for (F77_INT i = 0; i < mn; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
444 pipvt[i] -= 1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
445 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
446
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
447 #if defined (HAVE_QRUPDATE_LUU)
21271
7e67c7f82fc1 better use of templates for lu factorization 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 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
450 OCTAVE_API void
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
451 lu<FloatMatrix>::update (const FloatColumnVector& u,
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
452 const FloatColumnVector& v)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
453 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
454 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
455 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
456
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
457 FloatMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
458 FloatMatrix& r = m_a_fact;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
459
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
460 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
461 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
462 F77_INT k = to_f77_int (l.columns ());
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
463
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
464 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: 23475
diff changeset
465 F77_INT v_nel = to_f77_int (v.numel ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
466
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
467 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
468 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
469
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
470 FloatColumnVector utmp = u;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
471 FloatColumnVector vtmp = v;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
472 F77_XFCN (slu1up, SLU1UP, (m, n, l.fortran_vec (),
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
473 m, r.fortran_vec (), k,
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
474 utmp.fortran_vec (), vtmp.fortran_vec ()));
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
475 }
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
476
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
477 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
478 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
479 lu<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
480 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
481 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
482 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
483
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
484 FloatMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
485 FloatMatrix& r = m_a_fact;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
486
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
487 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
488 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
489 F77_INT k = to_f77_int (l.columns ());
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
490
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
491 F77_INT u_nr = to_f77_int (u.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
492 F77_INT u_nc = to_f77_int (u.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
493
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
494 F77_INT v_nr = to_f77_int (v.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
495 F77_INT v_nc = to_f77_int (v.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
496
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
497 if (u_nr != m || v_nr != n || u_nc != v_nc)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
498 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
499
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
500 for (volatile F77_INT i = 0; i < u_nc; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
501 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
502 FloatColumnVector utmp = u.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
503 FloatColumnVector vtmp = v.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
504 F77_XFCN (slu1up, SLU1UP, (m, n, l.fortran_vec (),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
505 m, r.fortran_vec (), k,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
506 utmp.fortran_vec (), vtmp.fortran_vec ()));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
507 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
508 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
509
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
510 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
511 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
512 lu<FloatMatrix>::update_piv (const FloatColumnVector& u,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
513 const FloatColumnVector& v)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
514 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
515 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
516 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
517
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
518 FloatMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
519 FloatMatrix& r = m_a_fact;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
520
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
521 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
522 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
523 F77_INT k = to_f77_int (l.columns ());
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
524
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
525 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: 23475
diff changeset
526 F77_INT v_nel = to_f77_int (v.numel ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
527
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
528 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
529 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
530
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
531 FloatColumnVector utmp = u;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
532 FloatColumnVector vtmp = v;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
533 OCTAVE_LOCAL_BUFFER (float, w, m);
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
534 for (F77_INT i = 0; i < m; i++) m_ipvt(i) += 1; // increment
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
535 F77_XFCN (slup1up, SLUP1UP, (m, n, l.fortran_vec (),
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
536 m, r.fortran_vec (), k,
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
537 m_ipvt.fortran_vec (),
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
538 utmp.data (), vtmp.data (), w));
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
539 for (F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1; // decrement
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
540 }
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
541
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
542 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
543 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
544 lu<FloatMatrix>::update_piv (const FloatMatrix& u, const FloatMatrix& v)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
545 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
546 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
547 unpack ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
548
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
549 FloatMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
550 FloatMatrix& r = m_a_fact;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
551
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
552 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
553 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
554 F77_INT k = to_f77_int (l.columns ());
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
555
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
556 F77_INT u_nr = to_f77_int (u.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
557 F77_INT u_nc = to_f77_int (u.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
558
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
559 F77_INT v_nr = to_f77_int (v.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
560 F77_INT v_nc = to_f77_int (v.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
561
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
562 if (u_nr != m || v_nr != n || u_nc != v_nc)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
563 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
564
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
565 OCTAVE_LOCAL_BUFFER (float, w, m);
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
566 for (F77_INT i = 0; i < m; i++) m_ipvt(i) += 1; // increment
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
567 for (volatile F77_INT i = 0; i < u_nc; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
568 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
569 FloatColumnVector utmp = u.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
570 FloatColumnVector vtmp = v.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
571 F77_XFCN (slup1up, SLUP1UP, (m, n, l.fortran_vec (),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
572 m, r.fortran_vec (), k,
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
573 m_ipvt.fortran_vec (),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
574 utmp.data (), vtmp.data (), w));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
575 }
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
576 for (F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1; // decrement
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
577 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
578
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
579 #endif
7e67c7f82fc1 better use of templates for lu factorization 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 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
582 OCTAVE_API
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
583 lu<ComplexMatrix>::lu (const ComplexMatrix& a)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
584 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
585 F77_INT a_nr = to_f77_int (a.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
586 F77_INT a_nc = to_f77_int (a.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
587 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
588
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
589 m_ipvt.resize (dim_vector (mn, 1));
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
590 F77_INT *pipvt = m_ipvt.fortran_vec ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
591
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
592 m_a_fact = a;
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
593 Complex *tmp_data = m_a_fact.fortran_vec ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
594
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
595 F77_INT info = 0;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
596
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
597 F77_XFCN (zgetrf, ZGETRF, (a_nr, a_nc, F77_DBLE_CMPLX_ARG (tmp_data),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
598 a_nr, pipvt, info));
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
599
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
600 for (F77_INT i = 0; i < mn; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
601 pipvt[i] -= 1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
602 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
603
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
604 #if defined (HAVE_QRUPDATE_LUU)
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
605
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
606 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
607 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
608 lu<ComplexMatrix>::update (const ComplexColumnVector& u,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
609 const ComplexColumnVector& v)
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 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
612 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
613
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
614 ComplexMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
615 ComplexMatrix& r = m_a_fact;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
616
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
617 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
618 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
619 F77_INT k = to_f77_int (l.columns ());
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
620
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
621 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: 23475
diff changeset
622 F77_INT v_nel = to_f77_int (v.numel ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
623
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
624 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
625 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
626
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
627 ComplexColumnVector utmp = u;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
628 ComplexColumnVector vtmp = v;
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
629 F77_XFCN (zlu1up, ZLU1UP, (m, n, F77_DBLE_CMPLX_ARG (l.fortran_vec ()), m,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
630 F77_DBLE_CMPLX_ARG (r.fortran_vec ()), k,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
631 F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
632 F77_DBLE_CMPLX_ARG (vtmp.fortran_vec ())));
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
633 }
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
634
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
635 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
636 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
637 lu<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
638 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
639 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
640 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
641
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
642 ComplexMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
643 ComplexMatrix& r = m_a_fact;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
644
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
645 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
646 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
647 F77_INT k = to_f77_int (l.columns ());
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
648
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
649 F77_INT u_nr = to_f77_int (u.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
650 F77_INT u_nc = to_f77_int (u.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
651
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
652 F77_INT v_nr = to_f77_int (v.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
653 F77_INT v_nc = to_f77_int (v.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
654
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
655 if (u_nr != m || v_nr != n || u_nc != v_nc)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
656 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
657
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
658 for (volatile F77_INT i = 0; i < u_nc; i++)
22329
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 ComplexColumnVector utmp = u.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
661 ComplexColumnVector vtmp = v.column (i);
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
662 F77_XFCN (zlu1up, ZLU1UP, (m, n,
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
663 F77_DBLE_CMPLX_ARG (l.fortran_vec ()),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
664 m, F77_DBLE_CMPLX_ARG (r.fortran_vec ()),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
665 k,
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
666 F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
667 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
668 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
669 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
670
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
671 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
672 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
673 lu<ComplexMatrix>::update_piv (const ComplexColumnVector& u,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
674 const ComplexColumnVector& v)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
675 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
676 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
677 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
678
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
679 ComplexMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
680 ComplexMatrix& r = m_a_fact;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
681
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
682 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
683 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
684 F77_INT k = to_f77_int (l.columns ());
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
685
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
686 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: 23475
diff changeset
687 F77_INT v_nel = to_f77_int (v.numel ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
688
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
689 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
690 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
691
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
692 ComplexColumnVector utmp = u;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
693 ComplexColumnVector vtmp = v;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
694 OCTAVE_LOCAL_BUFFER (Complex, w, m);
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
695 for (F77_INT i = 0; i < m; i++) m_ipvt(i) += 1; // increment
22135
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
696 F77_XFCN (zlup1up, ZLUP1UP, (m, n, F77_DBLE_CMPLX_ARG (l.fortran_vec ()),
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
697 m, F77_DBLE_CMPLX_ARG (r.fortran_vec ()), k,
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
698 m_ipvt.fortran_vec (),
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
699 F77_CONST_DBLE_CMPLX_ARG (utmp.data ()),
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
700 F77_CONST_DBLE_CMPLX_ARG (vtmp.data ()),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
701 F77_DBLE_CMPLX_ARG (w)));
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
702 for (F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1; // decrement
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
703 }
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 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
706 OCTAVE_API void
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
707 lu<ComplexMatrix>::update_piv (const ComplexMatrix& u,
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
708 const ComplexMatrix& v)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
709 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
710 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
711 unpack ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
712
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
713 ComplexMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
714 ComplexMatrix& r = m_a_fact;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
715
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
716 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
717 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
718 F77_INT k = to_f77_int (l.columns ());
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
719
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
720 F77_INT u_nr = to_f77_int (u.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
721 F77_INT u_nc = to_f77_int (u.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
722
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
723 F77_INT v_nr = to_f77_int (v.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
724 F77_INT v_nc = to_f77_int (v.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
725
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
726 if (u_nr != m || v_nr != n || u_nc != v_nc)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
727 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
728
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
729 OCTAVE_LOCAL_BUFFER (Complex, w, m);
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
730 for (F77_INT i = 0; i < m; i++) m_ipvt(i) += 1; // increment
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
731 for (volatile F77_INT i = 0; i < u_nc; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
732 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
733 ComplexColumnVector utmp = u.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
734 ComplexColumnVector vtmp = v.column (i);
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
735 F77_XFCN (zlup1up, ZLUP1UP, (m, n,
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
736 F77_DBLE_CMPLX_ARG (l.fortran_vec ()),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
737 m,
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
738 F77_DBLE_CMPLX_ARG (r.fortran_vec ()),
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
739 k, m_ipvt.fortran_vec (),
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
740 F77_CONST_DBLE_CMPLX_ARG (utmp.data ()),
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
741 F77_CONST_DBLE_CMPLX_ARG (vtmp.data ()),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
742 F77_DBLE_CMPLX_ARG (w)));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
743 }
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
744 for (F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1; // decrement
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
745 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
746
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
747 #endif
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
748
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
749 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
750 OCTAVE_API
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
751 lu<FloatComplexMatrix>::lu (const FloatComplexMatrix& a)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
752 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
753 F77_INT a_nr = to_f77_int (a.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
754 F77_INT a_nc = to_f77_int (a.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
755 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
756
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
757 m_ipvt.resize (dim_vector (mn, 1));
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
758 F77_INT *pipvt = m_ipvt.fortran_vec ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
759
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
760 m_a_fact = a;
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
761 FloatComplex *tmp_data = m_a_fact.fortran_vec ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
762
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
763 F77_INT info = 0;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
764
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
765 F77_XFCN (cgetrf, CGETRF, (a_nr, a_nc, F77_CMPLX_ARG (tmp_data), a_nr,
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
766 pipvt, info));
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
767
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
768 for (F77_INT i = 0; i < mn; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
769 pipvt[i] -= 1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
770 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
771
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
772 #if defined (HAVE_QRUPDATE_LUU)
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
773
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
774 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
775 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
776 lu<FloatComplexMatrix>::update (const FloatComplexColumnVector& u,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
777 const FloatComplexColumnVector& v)
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 (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
780 unpack ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
781
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
782 FloatComplexMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
783 FloatComplexMatrix& r = m_a_fact;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
784
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
785 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
786 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
787 F77_INT k = to_f77_int (l.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
788
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
789 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: 23475
diff changeset
790 F77_INT v_nel = to_f77_int (v.numel ());
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
791
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
792 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
793 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
794
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
795 FloatComplexColumnVector utmp = u;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
796 FloatComplexColumnVector vtmp = v;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
797 F77_XFCN (clu1up, CLU1UP, (m, n, F77_CMPLX_ARG (l.fortran_vec ()), m,
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
798 F77_CMPLX_ARG (r.fortran_vec ()), k,
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
799 F77_CMPLX_ARG (utmp.fortran_vec ()),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
800 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
801 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
802
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
803 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
804 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
805 lu<FloatComplexMatrix>::update (const FloatComplexMatrix& u,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
806 const FloatComplexMatrix& v)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
807 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
808 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
809 unpack ();
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
810
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
811 FloatComplexMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
812 FloatComplexMatrix& r = m_a_fact;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
813
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
814 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
815 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
816 F77_INT k = to_f77_int (l.columns ());
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
817
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
818 F77_INT u_nr = to_f77_int (u.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
819 F77_INT u_nc = to_f77_int (u.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
820
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
821 F77_INT v_nr = to_f77_int (v.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
822 F77_INT v_nc = to_f77_int (v.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
823
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
824 if (u_nr != m || v_nr != n || u_nc != v_nc)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
825 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
826
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
827 for (volatile F77_INT i = 0; i < u_nc; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
828 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
829 FloatComplexColumnVector utmp = u.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
830 FloatComplexColumnVector vtmp = v.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
831 F77_XFCN (clu1up, CLU1UP, (m, n, F77_CMPLX_ARG (l.fortran_vec ()),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
832 m, F77_CMPLX_ARG (r.fortran_vec ()), k,
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
833 F77_CMPLX_ARG (utmp.fortran_vec ()),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
834 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
835 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
836 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
837
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
838 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
839 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
840 lu<FloatComplexMatrix>::update_piv (const FloatComplexColumnVector& u,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
841 const FloatComplexColumnVector& v)
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
842 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
843 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
844 unpack ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
845
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
846 FloatComplexMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
847 FloatComplexMatrix& r = m_a_fact;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
848
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
849 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
850 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
851 F77_INT k = to_f77_int (l.columns ());
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
852
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
853 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: 23475
diff changeset
854 F77_INT v_nel = to_f77_int (v.numel ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
855
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
856 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
857 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
858
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
859 FloatComplexColumnVector utmp = u;
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
860 FloatComplexColumnVector vtmp = v;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
861 OCTAVE_LOCAL_BUFFER (FloatComplex, w, m);
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
862 for (F77_INT i = 0; i < m; i++) m_ipvt(i) += 1; // increment
22135
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
863 F77_XFCN (clup1up, CLUP1UP, (m, n, F77_CMPLX_ARG (l.fortran_vec ()),
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
864 m, F77_CMPLX_ARG (r.fortran_vec ()), k,
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
865 m_ipvt.fortran_vec (),
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
866 F77_CONST_CMPLX_ARG (utmp.data ()),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
867 F77_CONST_CMPLX_ARG (vtmp.data ()),
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
868 F77_CMPLX_ARG (w)));
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
869 for (F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1; // decrement
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
870 }
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
871
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
872 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
873 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
874 lu<FloatComplexMatrix>::update_piv (const FloatComplexMatrix& u,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
875 const FloatComplexMatrix& v)
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 if (packed ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
878 unpack ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
879
30092
51040836259d maint: rename "m_l" to "m_L" for clarity in class lu.
Rik <rik@octave.org>
parents: 30076
diff changeset
880 FloatComplexMatrix& l = m_L;
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
881 FloatComplexMatrix& r = m_a_fact;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
882
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
883 F77_INT m = to_f77_int (l.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
884 F77_INT n = to_f77_int (r.columns ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
885 F77_INT k = to_f77_int (l.columns ());
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
886
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
887 F77_INT u_nr = to_f77_int (u.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
888 F77_INT u_nc = to_f77_int (u.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
889
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
890 F77_INT v_nr = to_f77_int (v.rows ());
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
891 F77_INT v_nc = to_f77_int (v.columns ());
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
892
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
893 if (u_nr != m || v_nr != n || u_nc != v_nc)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
894 (*current_liboctave_error_handler) ("luupdate: dimensions mismatch");
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 OCTAVE_LOCAL_BUFFER (FloatComplex, w, m);
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
897 for (F77_INT i = 0; i < m; i++) m_ipvt(i) += 1; // increment
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
898 for (volatile F77_INT i = 0; i < u_nc; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
899 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
900 FloatComplexColumnVector utmp = u.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
901 FloatComplexColumnVector vtmp = v.column (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
902 F77_XFCN (clup1up, CLUP1UP, (m, n, F77_CMPLX_ARG (l.fortran_vec ()),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
903 m, F77_CMPLX_ARG (r.fortran_vec ()), k,
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
904 m_ipvt.fortran_vec (),
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
905 F77_CONST_CMPLX_ARG (utmp.data ()),
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
906 F77_CONST_CMPLX_ARG (vtmp.data ()),
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
907 F77_CMPLX_ARG (w)));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
908 }
30058
f2062fb507bc maint: use "m_" prefix for member variables in class lu.
Rik <rik@octave.org>
parents: 29359
diff changeset
909 for (F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1; // decrement
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
910 }
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
911
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
912 #endif
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
913
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
914 // Instantiations we need.
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
915
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
916 template class lu<Matrix>;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
917
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
918 template class lu<FloatMatrix>;
21271
7e67c7f82fc1 better use of templates for lu factorization classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
919
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
920 template class lu<ComplexMatrix>;
21271
7e67c7f82fc1 better use of templates for lu factorization 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 template class lu<FloatComplexMatrix>;
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
923
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
924 OCTAVE_END_NAMESPACE(math)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
925 OCTAVE_END_NAMESPACE(octave)