annotate liboctave/numeric/chol.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: 30394
diff changeset
3 // Copyright (C) 1994-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 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: 21285
diff changeset
27 # include "config.h"
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
28 #endif
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 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 "Array.h"
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
31 #include "CColVector.h"
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
32 #include "CMatrix.h"
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
33 #include "chol.h"
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
34 #include "dColVector.h"
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
35 #include "dMatrix.h"
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
36 #include "fCColVector.h"
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
37 #include "fCMatrix.h"
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
38 #include "fColVector.h"
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
39 #include "fMatrix.h"
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
40 #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
41 #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
42 #include "lo-qrupdate-proto.h"
8377
25bc2d31e1bf improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents: 7725
diff changeset
43 #include "oct-locbuf.h"
9862
c0aeedd8fb86 improve chol Matlab compatibility
Jaroslav Hajek <highegg@gmail.com>
parents: 8562
diff changeset
44 #include "oct-norm.h"
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
45
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
46 #if ! defined (HAVE_QRUPDATE)
21285
d3b265a83adc make building without qrupdate work again
John W. Eaton <jwe@octave.org>
parents: 21270
diff changeset
47 # include "qr.h"
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
48 #endif
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
49
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
50 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
51
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
52 static Matrix
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
53 chol2inv_internal (const Matrix& r, bool is_upper = true)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
54 {
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
55 Matrix retval;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
56
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
57 octave_idx_type r_nr = r.rows ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
58 octave_idx_type r_nc = r.cols ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
59
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
60 if (r_nr != r_nc)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
61 (*current_liboctave_error_handler) ("chol2inv requires square matrix");
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
62
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27101
diff changeset
63 F77_INT n = to_f77_int (r_nc);
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
64 F77_INT info;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
65
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
66 Matrix tmp = r;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
67 double *v = tmp.fortran_vec ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
68
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
69 if (is_upper)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
70 F77_XFCN (dpotri, DPOTRI, (F77_CONST_CHAR_ARG2 ("U", 1), n,
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
71 v, n, info
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
72 F77_CHAR_ARG_LEN (1)));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
73 else
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
74 F77_XFCN (dpotri, DPOTRI, (F77_CONST_CHAR_ARG2 ("L", 1), n,
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
75 v, n, info
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
76 F77_CHAR_ARG_LEN (1)));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
77
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
78 // FIXME: Should we check info exit value and possibly report an error?
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
79
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
80 // If someone thinks of a more graceful way of doing this
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
81 // (or faster for that matter :-)), please let me know!
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
82
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
83 if (n > 1)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
84 {
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
85 if (is_upper)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
86 for (octave_idx_type j = 0; j < r_nc; j++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
87 for (octave_idx_type i = j+1; i < r_nr; i++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
88 tmp.xelem (i, j) = tmp.xelem (j, i);
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
89 else
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
90 for (octave_idx_type j = 0; j < r_nc; j++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
91 for (octave_idx_type i = j+1; i < r_nr; i++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
92 tmp.xelem (j, i) = tmp.xelem (i, j);
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
93 }
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
94
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
95 retval = tmp;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
96
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
97 return retval;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
98 }
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
99
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
100 static FloatMatrix
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
101 chol2inv_internal (const FloatMatrix& r, bool is_upper = true)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
102 {
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
103 FloatMatrix retval;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
104
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
105 octave_idx_type r_nr = r.rows ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
106 octave_idx_type r_nc = r.cols ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
107
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
108 if (r_nr != r_nc)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
109 (*current_liboctave_error_handler) ("chol2inv requires square matrix");
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
110
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27101
diff changeset
111 F77_INT n = to_f77_int (r_nc);
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
112 F77_INT info;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
113
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
114 FloatMatrix tmp = r;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
115 float *v = tmp.fortran_vec ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
116
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
117 if (is_upper)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
118 F77_XFCN (spotri, SPOTRI, (F77_CONST_CHAR_ARG2 ("U", 1), n,
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
119 v, n, info
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
120 F77_CHAR_ARG_LEN (1)));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
121 else
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
122 F77_XFCN (spotri, SPOTRI, (F77_CONST_CHAR_ARG2 ("L", 1), n,
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
123 v, n, info
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
124 F77_CHAR_ARG_LEN (1)));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
125
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
126 // FIXME: Should we check info exit value and possibly report an error?
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
127
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
128 // If someone thinks of a more graceful way of doing this (or
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
129 // faster for that matter :-)), please let me know!
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
130
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
131 if (n > 1)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
132 {
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
133 if (is_upper)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
134 for (octave_idx_type j = 0; j < r_nc; j++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
135 for (octave_idx_type i = j+1; i < r_nr; i++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
136 tmp.xelem (i, j) = tmp.xelem (j, i);
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
137 else
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
138 for (octave_idx_type j = 0; j < r_nc; j++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
139 for (octave_idx_type i = j+1; i < r_nr; i++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
140 tmp.xelem (j, i) = tmp.xelem (i, j);
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
141 }
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
142
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
143 retval = tmp;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
144
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
145 return retval;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
146 }
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
147
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
148 static ComplexMatrix
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
149 chol2inv_internal (const ComplexMatrix& r, bool is_upper = true)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
150 {
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
151 ComplexMatrix retval;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
152
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
153 octave_idx_type r_nr = r.rows ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
154 octave_idx_type r_nc = r.cols ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
155
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
156 if (r_nr != r_nc)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
157 (*current_liboctave_error_handler) ("chol2inv requires square matrix");
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
158
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27101
diff changeset
159 F77_INT n = to_f77_int (r_nc);
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
160 F77_INT info;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
161
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
162 ComplexMatrix tmp = r;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
163
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
164 if (is_upper)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
165 F77_XFCN (zpotri, ZPOTRI, (F77_CONST_CHAR_ARG2 ("U", 1), n,
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
166 F77_DBLE_CMPLX_ARG (tmp.fortran_vec ()), n, info
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
167 F77_CHAR_ARG_LEN (1)));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
168 else
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
169 F77_XFCN (zpotri, ZPOTRI, (F77_CONST_CHAR_ARG2 ("L", 1), n,
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
170 F77_DBLE_CMPLX_ARG (tmp.fortran_vec ()), n, info
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
171 F77_CHAR_ARG_LEN (1)));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
172
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
173 // If someone thinks of a more graceful way of doing this (or
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
174 // faster for that matter :-)), please let me know!
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
175
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
176 if (n > 1)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
177 {
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
178 if (is_upper)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
179 for (octave_idx_type j = 0; j < r_nc; j++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
180 for (octave_idx_type i = j+1; i < r_nr; i++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
181 tmp.xelem (i, j) = std::conj (tmp.xelem (j, i));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
182 else
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
183 for (octave_idx_type j = 0; j < r_nc; j++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
184 for (octave_idx_type i = j+1; i < r_nr; i++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
185 tmp.xelem (j, i) = std::conj (tmp.xelem (i, j));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
186 }
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
187
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
188 retval = tmp;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
189
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
190 return retval;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
191 }
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
192
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
193 static FloatComplexMatrix
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
194 chol2inv_internal (const FloatComplexMatrix& r, bool is_upper = true)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
195 {
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
196 FloatComplexMatrix retval;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
197
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
198 octave_idx_type r_nr = r.rows ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
199 octave_idx_type r_nc = r.cols ();
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
200
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
201 if (r_nr != r_nc)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
202 (*current_liboctave_error_handler) ("chol2inv requires square matrix");
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
203
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27101
diff changeset
204 F77_INT n = to_f77_int (r_nc);
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
205 F77_INT info;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
206
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
207 FloatComplexMatrix tmp = r;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
208
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
209 if (is_upper)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
210 F77_XFCN (cpotri, CPOTRI, (F77_CONST_CHAR_ARG2 ("U", 1), n,
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
211 F77_CMPLX_ARG (tmp.fortran_vec ()), n, info
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
212 F77_CHAR_ARG_LEN (1)));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
213 else
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
214 F77_XFCN (cpotri, CPOTRI, (F77_CONST_CHAR_ARG2 ("L", 1), n,
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
215 F77_CMPLX_ARG (tmp.fortran_vec ()), n, info
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
216 F77_CHAR_ARG_LEN (1)));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
217
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
218 // If someone thinks of a more graceful way of doing this (or
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
219 // faster for that matter :-)), please let me know!
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
220
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
221 if (n > 1)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
222 {
30035
9fa1d8dd3a23 maint: Reverse "m_" conversions of function parameters in cset e156fce82e00.
Rik <rik@octave.org>
parents: 30032
diff changeset
223 if (is_upper)
27101
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
224 for (octave_idx_type j = 0; j < r_nc; j++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
225 for (octave_idx_type i = j+1; i < r_nr; i++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
226 tmp.xelem (i, j) = std::conj (tmp.xelem (j, i));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
227 else
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
228 for (octave_idx_type j = 0; j < r_nc; j++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
229 for (octave_idx_type i = j+1; i < r_nr; i++)
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
230 tmp.xelem (j, i) = std::conj (tmp.xelem (i, j));
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
231 }
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
232
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
233 retval = tmp;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
234
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
235 return retval;
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
236 }
097774bed4ed move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26385
diff changeset
237
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
238 OCTAVE_BEGIN_NAMESPACE(math)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
239
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
240 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
241 T
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
242 chol2inv (const T& r)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
243 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
244 return chol2inv_internal (r);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
245 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
246
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
247 // Compute the inverse of a matrix using the Cholesky factorization.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
248 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
249 T
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
250 chol<T>::inverse (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
251 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
252 return chol2inv_internal (m_chol_mat, m_is_upper);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
253 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
254
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
255 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
256 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
257 chol<T>::set (const T& R)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
258 {
23593
a8361bc2361a maint: Deprecate is_square and replace with issquare.
Rik <rik@octave.org>
parents: 23475
diff changeset
259 if (! R.issquare ())
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
260 (*current_liboctave_error_handler) ("chol: requires square matrix");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
261
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
262 m_chol_mat = R;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
263 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
264
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
265 #if ! defined (HAVE_QRUPDATE)
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
266
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
267 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
268 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
269 chol<T>::update (const VT& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
270 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
271 warn_qrupdate_once ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
272
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
273 octave_idx_type n = m_chol_mat.rows ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
274
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
275 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
276 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
277
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
278 init (m_chol_mat.hermitian () * m_chol_mat + T (u) * T (u).hermitian (),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
279 true, false);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
280 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
281
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
282 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
283 bool
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
284 singular (const T& a)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
285 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
286 static typename T::element_type zero (0);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
287 for (octave_idx_type i = 0; i < a.rows (); i++)
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30035
diff changeset
288 if (a(i, i) == zero) return true;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
289 return false;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
290 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
291
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
292 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
293 octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
294 chol<T>::downdate (const VT& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
295 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
296 warn_qrupdate_once ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
297
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
298 octave_idx_type info = -1;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
299
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
300 octave_idx_type n = m_chol_mat.rows ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
301
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
302 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
303 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
304
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
305 if (singular (m_chol_mat))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
306 info = 2;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
307 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
308 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
309 info = init (m_chol_mat.hermitian () * m_chol_mat
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
310 - T (u) * T (u).hermitian (), true, false);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
311 if (info) info = 1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
312 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
313
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
314 return info;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
315 }
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
316
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
317 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
318 octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
319 chol<T>::insert_sym (const VT& u, octave_idx_type j)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
320 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
321 static typename T::element_type zero (0);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
322
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
323 warn_qrupdate_once ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
324
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
325 octave_idx_type info = -1;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
326
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
327 octave_idx_type n = m_chol_mat.rows ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
328
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
329 if (u.numel () != n + 1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
330 (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
331 if (j < 0 || j > n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
332 (*current_liboctave_error_handler) ("cholinsert: index out of range");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
333
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
334 if (singular (m_chol_mat))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
335 info = 2;
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23696
diff changeset
336 else if (std::imag (u(j)) != zero)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
337 info = 3;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
338 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
339 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
340 T a = m_chol_mat.hermitian () * m_chol_mat;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
341 T a1 (n+1, n+1);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
342 for (octave_idx_type k = 0; k < n+1; k++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
343 for (octave_idx_type l = 0; l < n+1; l++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
344 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
345 if (l == j)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
346 a1(k, l) = u(k);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
347 else if (k == j)
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
348 a1(k, l) = math::conj (u(l));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
349 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
350 a1(k, l) = a(k < j ? k : k-1, l < j ? l : l-1);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
351 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
352 info = init (a1, true, false);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
353 if (info) info = 1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
354 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
355
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
356 return info;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
357 }
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
358
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
359 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
360 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
361 chol<T>::delete_sym (octave_idx_type j)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
362 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
363 warn_qrupdate_once ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
364
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
365 octave_idx_type n = m_chol_mat.rows ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
366
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
367 if (j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
368 (*current_liboctave_error_handler) ("choldelete: index out of range");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
369
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
370 T a = m_chol_mat.hermitian () * m_chol_mat;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
371 a.delete_elements (1, idx_vector (j));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
372 a.delete_elements (0, idx_vector (j));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
373 init (a, true, false);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
374 }
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
375
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
376 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
377 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
378 chol<T>::shift_sym (octave_idx_type i, octave_idx_type j)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
379 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
380 warn_qrupdate_once ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
381
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
382 octave_idx_type n = m_chol_mat.rows ();
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
383
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
384 if (i < 0 || i > n-1 || j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
385 (*current_liboctave_error_handler) ("cholshift: index out of range");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
386
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
387 T a = m_chol_mat.hermitian () * m_chol_mat;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
388 Array<octave_idx_type> p (dim_vector (n, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
389 for (octave_idx_type k = 0; k < n; k++) p(k) = k;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
390 if (i < j)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
391 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
392 for (octave_idx_type k = i; k < j; k++) p(k) = k+1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
393 p(j) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
394 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
395 else if (j < i)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
396 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
397 p(j) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
398 for (octave_idx_type k = j+1; k < i+1; k++) p(k) = k-1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
399 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
400
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
401 init (a.index (idx_vector (p), idx_vector (p)), true, false);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
402 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
403
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
404 #endif
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
405
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
406 // Specializations.
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
407
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
408 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
409 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
410 chol<Matrix>::init (const Matrix& a, bool upper, bool calc_cond)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
411 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
412 octave_idx_type a_nr = a.rows ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
413 octave_idx_type a_nc = a.cols ();
1944
8cb4d3008c76 [project @ 1996-02-14 00:45:04 by jwe]
jwe
parents: 1882
diff changeset
414
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
415 if (a_nr != a_nc)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
416 (*current_liboctave_error_handler) ("chol: requires square matrix");
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
417
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
418 F77_INT n = to_f77_int (a_nc);
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
419 F77_INT info;
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
420
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
421 m_is_upper = upper;
20462
5ce959c55cc0 Propagate 'lower' in chol(a, 'lower') to underlying library function.
PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
parents: 20232
diff changeset
422
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
423 m_chol_mat.clear (n, n);
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
424 if (m_is_upper)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
425 for (octave_idx_type j = 0; j < n; j++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
426 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
427 for (octave_idx_type i = 0; i <= j; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
428 m_chol_mat.xelem (i, j) = a(i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
429 for (octave_idx_type i = j+1; i < n; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
430 m_chol_mat.xelem (i, j) = 0.0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
431 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
432 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
433 for (octave_idx_type j = 0; j < n; j++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
434 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
435 for (octave_idx_type i = 0; i < j; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
436 m_chol_mat.xelem (i, j) = 0.0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
437 for (octave_idx_type i = j; i < n; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
438 m_chol_mat.xelem (i, j) = a(i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
439 }
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
440 double *h = m_chol_mat.fortran_vec ();
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
441
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
442 // Calculate the norm of the matrix, for later use.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
443 double anorm = 0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
444 if (calc_cond)
29874
92662b17ef7e move liboctave xnorm functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
445 anorm = octave::xnorm (a, 1);
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
446
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
447 if (m_is_upper)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
448 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, info
20628
48fedd8fbff7 maint: Apply Octave coding style to Cholesky classes
Mike Miller <mtmiller@octave.org>
parents: 20531
diff changeset
449 F77_CHAR_ARG_LEN (1)));
20462
5ce959c55cc0 Propagate 'lower' in chol(a, 'lower') to underlying library function.
PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
parents: 20232
diff changeset
450 else
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
451 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1), n, h, n, info
20628
48fedd8fbff7 maint: Apply Octave coding style to Cholesky classes
Mike Miller <mtmiller@octave.org>
parents: 20531
diff changeset
452 F77_CHAR_ARG_LEN (1)));
7482
29980c6b8604 don't check f77_exception_encountered
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
453
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
454 m_rcond = 0.0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
455 if (info > 0)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
456 m_chol_mat.resize (info - 1, info - 1);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
457 else if (calc_cond)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
458 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
459 F77_INT dpocon_info = 0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
460
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
461 // Now calculate the condition number for non-singular matrix.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
462 Array<double> z (dim_vector (3*n, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
463 double *pz = z.fortran_vec ();
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
464 OCTAVE_LOCAL_BUFFER (F77_INT, iz, n);
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
465 if (m_is_upper)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
466 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
467 n, anorm, m_rcond, pz, iz, dpocon_info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
468 F77_CHAR_ARG_LEN (1)));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
469 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
470 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 ("L", 1), n, h,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
471 n, anorm, m_rcond, pz, iz, dpocon_info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
472 F77_CHAR_ARG_LEN (1)));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
473
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
474 if (dpocon_info != 0)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
475 info = -1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
476 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
477
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
478 return info;
7482
29980c6b8604 don't check f77_exception_encountered
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
479 }
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
480
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
481 #if defined (HAVE_QRUPDATE)
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
482
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
483 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
484 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
485 chol<Matrix>::update (const ColumnVector& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
486 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
487 F77_INT n = to_f77_int (m_chol_mat.rows ());
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
488
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
489 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
490 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
491
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
492 ColumnVector utmp = u;
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
493
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
494 OCTAVE_LOCAL_BUFFER (double, w, n);
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
495
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
496 F77_XFCN (dch1up, DCH1UP, (n, m_chol_mat.fortran_vec (), n,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
497 utmp.fortran_vec (), w));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
498 }
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
499
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
500 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
501 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
502 chol<Matrix>::downdate (const ColumnVector& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
503 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
504 F77_INT info = -1;
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
505
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
506 F77_INT n = to_f77_int (m_chol_mat.rows ());
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
507
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
508 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
509 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
510
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
511 ColumnVector utmp = u;
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
512
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
513 OCTAVE_LOCAL_BUFFER (double, w, n);
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
514
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
515 F77_XFCN (dch1dn, DCH1DN, (n, m_chol_mat.fortran_vec (), n,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
516 utmp.fortran_vec (), w, info));
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
517
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
518 return info;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
519 }
7554
40574114c514 implement Cholesky factorization updating
Jaroslav Hajek <highegg@gmail.com>
parents: 7482
diff changeset
520
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
521 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
522 OCTAVE_API octave_idx_type
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
523 chol<Matrix>::insert_sym (const ColumnVector& u, octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
524 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
525 F77_INT info = -1;
7700
efccca5f2ad7 more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7559
diff changeset
526
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
527 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
528 F77_INT j = to_f77_int (j_arg);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
529
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
530 if (u.numel () != n + 1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
531 (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
532 if (j < 0 || j > n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
533 (*current_liboctave_error_handler) ("cholinsert: index out of range");
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
534
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
535 ColumnVector utmp = u;
8547
d66c9b6e506a imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8377
diff changeset
536
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
537 OCTAVE_LOCAL_BUFFER (double, w, n);
7700
efccca5f2ad7 more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7559
diff changeset
538
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
539 m_chol_mat.resize (n+1, n+1);
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
540 F77_INT ldcm = to_f77_int (m_chol_mat.rows ());
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
541
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
542 F77_XFCN (dchinx, DCHINX, (n, m_chol_mat.fortran_vec (), ldcm,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
543 j + 1, utmp.fortran_vec (), w, info));
7700
efccca5f2ad7 more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7559
diff changeset
544
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
545 return info;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
546 }
7700
efccca5f2ad7 more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7559
diff changeset
547
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
548 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
549 OCTAVE_API void
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
550 chol<Matrix>::delete_sym (octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
551 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
552 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
553 F77_INT j = to_f77_int (j_arg);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
554
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
555 if (j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
556 (*current_liboctave_error_handler) ("choldelete: index out of range");
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
557
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
558 OCTAVE_LOCAL_BUFFER (double, w, n);
7700
efccca5f2ad7 more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7559
diff changeset
559
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
560 F77_XFCN (dchdex, DCHDEX, (n, m_chol_mat.fortran_vec (), n, j + 1, w));
7700
efccca5f2ad7 more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7559
diff changeset
561
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
562 m_chol_mat.resize (n-1, n-1);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
563 }
7700
efccca5f2ad7 more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7559
diff changeset
564
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
565 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
566 OCTAVE_API void
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
567 chol<Matrix>::shift_sym (octave_idx_type i_arg, octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
568 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
569 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
570 F77_INT i = to_f77_int (i_arg);
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
571 F77_INT j = to_f77_int (j_arg);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
572
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
573 if (i < 0 || i > n-1 || j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
574 (*current_liboctave_error_handler) ("cholshift: index out of range");
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
575
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
576 OCTAVE_LOCAL_BUFFER (double, w, 2*n);
8547
d66c9b6e506a imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8377
diff changeset
577
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
578 F77_XFCN (dchshx, DCHSHX, (n, m_chol_mat.fortran_vec (), n,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
579 i + 1, j + 1, w));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
580 }
7700
efccca5f2ad7 more QR & Cholesky updating functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7559
diff changeset
581
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
582 #endif
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
583
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
584 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
585 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
586 chol<FloatMatrix>::init (const FloatMatrix& a, bool upper, bool calc_cond)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
587 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
588 octave_idx_type a_nr = a.rows ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
589 octave_idx_type a_nc = a.cols ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
590
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
591 if (a_nr != a_nc)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
592 (*current_liboctave_error_handler) ("chol: requires square matrix");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
593
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
594 F77_INT n = to_f77_int (a_nc);
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
595 F77_INT info;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
596
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
597 m_is_upper = upper;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
598
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
599 m_chol_mat.clear (n, n);
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
600 if (m_is_upper)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
601 for (octave_idx_type j = 0; j < n; j++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
602 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
603 for (octave_idx_type i = 0; i <= j; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
604 m_chol_mat.xelem (i, j) = a(i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
605 for (octave_idx_type i = j+1; i < n; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
606 m_chol_mat.xelem (i, j) = 0.0f;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
607 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
608 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
609 for (octave_idx_type j = 0; j < n; j++)
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 for (octave_idx_type i = 0; i < j; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
612 m_chol_mat.xelem (i, j) = 0.0f;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
613 for (octave_idx_type i = j; i < n; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
614 m_chol_mat.xelem (i, j) = a(i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
615 }
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
616 float *h = m_chol_mat.fortran_vec ();
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
617
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
618 // Calculate the norm of the matrix, for later use.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
619 float anorm = 0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
620 if (calc_cond)
29874
92662b17ef7e move liboctave xnorm functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
621 anorm = octave::xnorm (a, 1);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
622
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
623 if (m_is_upper)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
624 F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, info
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
625 F77_CHAR_ARG_LEN (1)));
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
626 else
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
627 F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1), n, h, n, info
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
628 F77_CHAR_ARG_LEN (1)));
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
629
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
630 m_rcond = 0.0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
631 if (info > 0)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
632 m_chol_mat.resize (info - 1, info - 1);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
633 else if (calc_cond)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
634 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
635 F77_INT spocon_info = 0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
636
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
637 // Now calculate the condition number for non-singular matrix.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
638 Array<float> z (dim_vector (3*n, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
639 float *pz = z.fortran_vec ();
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
640 OCTAVE_LOCAL_BUFFER (F77_INT, iz, n);
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
641 if (m_is_upper)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
642 F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
643 n, anorm, m_rcond, pz, iz, spocon_info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
644 F77_CHAR_ARG_LEN (1)));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
645 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
646 F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 ("L", 1), n, h,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
647 n, anorm, m_rcond, pz, iz, spocon_info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
648 F77_CHAR_ARG_LEN (1)));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
649
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
650 if (spocon_info != 0)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
651 info = -1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
652 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
653
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
654 return info;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
655 }
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
656
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
657 #if defined (HAVE_QRUPDATE)
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
658
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
659 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
660 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
661 chol<FloatMatrix>::update (const FloatColumnVector& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
662 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
663 F77_INT n = to_f77_int (m_chol_mat.rows ());
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
664
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
665 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
666 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
667
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
668 FloatColumnVector utmp = u;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
669
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
670 OCTAVE_LOCAL_BUFFER (float, w, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
671
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
672 F77_XFCN (sch1up, SCH1UP, (n, m_chol_mat.fortran_vec (), n,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
673 utmp.fortran_vec (), w));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
674 }
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
675
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
676 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
677 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
678 chol<FloatMatrix>::downdate (const FloatColumnVector& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
679 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
680 F77_INT info = -1;
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
681
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
682 F77_INT n = to_f77_int (m_chol_mat.rows ());
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
683
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
684 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
685 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
686
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
687 FloatColumnVector utmp = u;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
688
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
689 OCTAVE_LOCAL_BUFFER (float, w, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
690
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
691 F77_XFCN (sch1dn, SCH1DN, (n, m_chol_mat.fortran_vec (), n,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
692 utmp.fortran_vec (), w, info));
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
693
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
694 return info;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
695 }
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
696
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
697 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
698 OCTAVE_API octave_idx_type
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
699 chol<FloatMatrix>::insert_sym (const FloatColumnVector& u,
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
700 octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
701 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
702 F77_INT info = -1;
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
703
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
704 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
705 F77_INT j = to_f77_int (j_arg);
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
706
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
707 if (u.numel () != n + 1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
708 (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
709 if (j < 0 || j > n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
710 (*current_liboctave_error_handler) ("cholinsert: index out of range");
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
711
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
712 FloatColumnVector utmp = u;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
713
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
714 OCTAVE_LOCAL_BUFFER (float, w, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
715
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
716 m_chol_mat.resize (n+1, n+1);
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
717 F77_INT ldcm = to_f77_int (m_chol_mat.rows ());
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
718
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
719 F77_XFCN (schinx, SCHINX, (n, m_chol_mat.fortran_vec (), ldcm,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
720 j + 1, utmp.fortran_vec (), w, info));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
721
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
722 return info;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
723 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
724
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
725 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
726 OCTAVE_API void
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
727 chol<FloatMatrix>::delete_sym (octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
728 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
729 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
730 F77_INT j = to_f77_int (j_arg);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
731
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
732 if (j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
733 (*current_liboctave_error_handler) ("choldelete: index out of range");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
734
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
735 OCTAVE_LOCAL_BUFFER (float, w, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
736
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
737 F77_XFCN (schdex, SCHDEX, (n, m_chol_mat.fortran_vec (), n,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
738 j + 1, w));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
739
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
740 m_chol_mat.resize (n-1, n-1);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
741 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
742
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
743 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
744 OCTAVE_API void
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
745 chol<FloatMatrix>::shift_sym (octave_idx_type i_arg, octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
746 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
747 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
748 F77_INT i = to_f77_int (i_arg);
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
749 F77_INT j = to_f77_int (j_arg);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
750
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
751 if (i < 0 || i > n-1 || j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
752 (*current_liboctave_error_handler) ("cholshift: index out of range");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
753
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
754 OCTAVE_LOCAL_BUFFER (float, w, 2*n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
755
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
756 F77_XFCN (schshx, SCHSHX, (n, m_chol_mat.fortran_vec (), n,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
757 i + 1, j + 1, w));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
758 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
759
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
760 #endif
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
761
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
762 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
763 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
764 chol<ComplexMatrix>::init (const ComplexMatrix& a, bool upper, bool calc_cond)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
765 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
766 octave_idx_type a_nr = a.rows ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
767 octave_idx_type a_nc = a.cols ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
768
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
769 if (a_nr != a_nc)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
770 (*current_liboctave_error_handler) ("chol: requires square matrix");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
771
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
772 F77_INT n = to_f77_int (a_nc);
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
773 F77_INT info;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
774
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
775 m_is_upper = upper;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
776
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
777 m_chol_mat.clear (n, n);
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
778 if (m_is_upper)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
779 for (octave_idx_type j = 0; j < n; j++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
780 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
781 for (octave_idx_type i = 0; i <= j; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
782 m_chol_mat.xelem (i, j) = a(i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
783 for (octave_idx_type i = j+1; i < n; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
784 m_chol_mat.xelem (i, j) = 0.0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
785 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
786 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
787 for (octave_idx_type j = 0; j < n; j++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
788 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
789 for (octave_idx_type i = 0; i < j; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
790 m_chol_mat.xelem (i, j) = 0.0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
791 for (octave_idx_type i = j; i < n; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
792 m_chol_mat.xelem (i, j) = a(i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
793 }
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
794 Complex *h = m_chol_mat.fortran_vec ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
795
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
796 // Calculate the norm of the matrix, for later use.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
797 double anorm = 0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
798 if (calc_cond)
29874
92662b17ef7e move liboctave xnorm functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
799 anorm = octave::xnorm (a, 1);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
800
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
801 if (m_is_upper)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
802 F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
803 F77_DBLE_CMPLX_ARG (h), n, info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
804 F77_CHAR_ARG_LEN (1)));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
805 else
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
806 F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1), n,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
807 F77_DBLE_CMPLX_ARG (h), n, info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
808 F77_CHAR_ARG_LEN (1)));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
809
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
810 m_rcond = 0.0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
811 if (info > 0)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
812 m_chol_mat.resize (info - 1, info - 1);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
813 else if (calc_cond)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
814 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
815 F77_INT zpocon_info = 0;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
816
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
817 // Now calculate the condition number for non-singular matrix.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
818 Array<Complex> z (dim_vector (2*n, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
819 Complex *pz = z.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
820 Array<double> rz (dim_vector (n, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
821 double *prz = rz.fortran_vec ();
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
822 F77_XFCN (zpocon, ZPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
823 F77_DBLE_CMPLX_ARG (h), n, anorm, m_rcond,
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
824 F77_DBLE_CMPLX_ARG (pz), prz, zpocon_info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
825 F77_CHAR_ARG_LEN (1)));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
826
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
827 if (zpocon_info != 0)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
828 info = -1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
829 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
830
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
831 return info;
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
832 }
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
833
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
834 #if defined (HAVE_QRUPDATE)
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
835
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
836 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
837 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
838 chol<ComplexMatrix>::update (const ComplexColumnVector& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
839 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
840 F77_INT n = to_f77_int (m_chol_mat.rows ());
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
841
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
842 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
843 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
844
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
845 ComplexColumnVector utmp = u;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
846
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
847 OCTAVE_LOCAL_BUFFER (double, rw, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
848
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
849 F77_XFCN (zch1up, ZCH1UP, (n,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
850 F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
851 n,
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
852 F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()),
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
853 rw));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
854 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
855
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
856 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
857 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
858 chol<ComplexMatrix>::downdate (const ComplexColumnVector& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
859 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
860 F77_INT info = -1;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
861
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
862 F77_INT n = to_f77_int (m_chol_mat.rows ());
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
863
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
864 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
865 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
866
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
867 ComplexColumnVector utmp = u;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
868
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
869 OCTAVE_LOCAL_BUFFER (double, rw, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
870
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
871 F77_XFCN (zch1dn, ZCH1DN, (n,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
872 F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
873 n,
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
874 F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()),
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
875 rw, info));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
876
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
877 return info;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
878 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
879
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
880 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
881 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
882 chol<ComplexMatrix>::insert_sym (const ComplexColumnVector& u,
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
883 octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
884 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
885 F77_INT info = -1;
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
886
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
887 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
888 F77_INT j = to_f77_int (j_arg);
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
889
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
890 if (u.numel () != n + 1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
891 (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
892 if (j < 0 || j > n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
893 (*current_liboctave_error_handler) ("cholinsert: index out of range");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
894
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
895 ComplexColumnVector utmp = u;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
896
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
897 OCTAVE_LOCAL_BUFFER (double, rw, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
898
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
899 m_chol_mat.resize (n+1, n+1);
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
900 F77_INT ldcm = to_f77_int (m_chol_mat.rows ());
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
901
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
902 F77_XFCN (zchinx, ZCHINX, (n,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
903 F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22969
023026207910 * chol.cc: Fix thinko in previous change.
John W. Eaton <jwe@octave.org>
parents: 22942
diff changeset
904 ldcm, j + 1,
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
905 F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()),
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
906 rw, info));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
907
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
908 return info;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
909 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
910
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
911 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
912 OCTAVE_API void
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
913 chol<ComplexMatrix>::delete_sym (octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
914 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
915 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
916 F77_INT j = to_f77_int (j_arg);
21269
3c8a3d35661a better use of templates for Cholesky factorization
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 if (j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
919 (*current_liboctave_error_handler) ("choldelete: index out of range");
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
920
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
921 OCTAVE_LOCAL_BUFFER (double, rw, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
922
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
923 F77_XFCN (zchdex, ZCHDEX, (n,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
924 F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
925 n, j + 1, rw));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
926
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
927 m_chol_mat.resize (n-1, n-1);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
928 }
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
929
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
930 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
931 OCTAVE_API void
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
932 chol<ComplexMatrix>::shift_sym (octave_idx_type i_arg,
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
933 octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
934 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
935 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
936 F77_INT i = to_f77_int (i_arg);
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
937 F77_INT j = to_f77_int (j_arg);
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
938
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
939 if (i < 0 || i > n-1 || j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
940 (*current_liboctave_error_handler) ("cholshift: index out of range");
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20629
diff changeset
941
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
942 OCTAVE_LOCAL_BUFFER (Complex, w, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
943 OCTAVE_LOCAL_BUFFER (double, rw, n);
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
944
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
945 F77_XFCN (zchshx, ZCHSHX, (n,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
946 F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
947 n, i + 1, j + 1,
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
948 F77_DBLE_CMPLX_ARG (w), rw));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
949 }
8562
a6edd5c23cb5 use replacement methods if qrupdate is not available
Jaroslav Hajek <highegg@gmail.com>
parents: 8547
diff changeset
950
8547
d66c9b6e506a imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8377
diff changeset
951 #endif
d66c9b6e506a imported patch qrupdate.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8377
diff changeset
952
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
953 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
954 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
955 chol<FloatComplexMatrix>::init (const FloatComplexMatrix& a, bool upper,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
956 bool calc_cond)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
957 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
958 octave_idx_type a_nr = a.rows ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
959 octave_idx_type a_nc = a.cols ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
960
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
961 if (a_nr != a_nc)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
962 (*current_liboctave_error_handler) ("chol: requires square matrix");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
963
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
964 F77_INT n = to_f77_int (a_nc);
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
965 F77_INT info;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
966
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
967 m_is_upper = upper;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
968
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
969 m_chol_mat.clear (n, n);
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
970 if (m_is_upper)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
971 for (octave_idx_type j = 0; j < n; j++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
972 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
973 for (octave_idx_type i = 0; i <= j; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
974 m_chol_mat.xelem (i, j) = a(i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
975 for (octave_idx_type i = j+1; i < n; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
976 m_chol_mat.xelem (i, j) = 0.0f;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
977 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
978 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
979 for (octave_idx_type j = 0; j < n; j++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
980 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
981 for (octave_idx_type i = 0; i < j; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
982 m_chol_mat.xelem (i, j) = 0.0f;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
983 for (octave_idx_type i = j; i < n; i++)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
984 m_chol_mat.xelem (i, j) = a(i, j);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
985 }
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
986 FloatComplex *h = m_chol_mat.fortran_vec ();
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
987
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
988 // Calculate the norm of the matrix, for later use.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
989 float anorm = 0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
990 if (calc_cond)
29874
92662b17ef7e move liboctave xnorm functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
991 anorm = octave::xnorm (a, 1);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
992
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
993 if (m_is_upper)
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
994 F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1),
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
995 n, F77_CMPLX_ARG (h), n, info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
996 F77_CHAR_ARG_LEN (1)));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
997 else
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
998 F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1),
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
999 n, F77_CMPLX_ARG (h), n, info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1000 F77_CHAR_ARG_LEN (1)));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1001
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1002 m_rcond = 0.0;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1003 if (info > 0)
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1004 m_chol_mat.resize (info - 1, info - 1);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1005 else if (calc_cond)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1006 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1007 F77_INT cpocon_info = 0;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1008
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1009 // Now calculate the condition number for non-singular matrix.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1010 Array<FloatComplex> z (dim_vector (2*n, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1011 FloatComplex *pz = z.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1012 Array<float> rz (dim_vector (n, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1013 float *prz = rz.fortran_vec ();
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1014 F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n,
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1015 F77_CMPLX_ARG (h), n, anorm, m_rcond,
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1016 F77_CMPLX_ARG (pz), prz, cpocon_info
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1017 F77_CHAR_ARG_LEN (1)));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1018
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1019 if (cpocon_info != 0)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1020 info = -1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1021 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1022
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1023 return info;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1024 }
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1025
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
1026 #if defined (HAVE_QRUPDATE)
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1027
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1028 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
1029 OCTAVE_API void
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1030 chol<FloatComplexMatrix>::update (const FloatComplexColumnVector& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1031 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1032 F77_INT n = to_f77_int (m_chol_mat.rows ());
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1033
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1034 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1035 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1036
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1037 FloatComplexColumnVector utmp = u;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1038
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1039 OCTAVE_LOCAL_BUFFER (float, rw, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1040
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1041 F77_XFCN (cch1up, CCH1UP, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1042 n, F77_CMPLX_ARG (utmp.fortran_vec ()), rw));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1043 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1044
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1045 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
1046 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1047 chol<FloatComplexMatrix>::downdate (const FloatComplexColumnVector& u)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1048 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1049 F77_INT info = -1;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1050
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1051 F77_INT n = to_f77_int (m_chol_mat.rows ());
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1052
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1053 if (u.numel () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1054 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1055
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1056 FloatComplexColumnVector utmp = u;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1057
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1058 OCTAVE_LOCAL_BUFFER (float, rw, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1059
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1060 F77_XFCN (cch1dn, CCH1DN, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1061 n, F77_CMPLX_ARG (utmp.fortran_vec ()),
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1062 rw, info));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1063
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1064 return info;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1065 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1066
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1067 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
1068 OCTAVE_API octave_idx_type
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1069 chol<FloatComplexMatrix>::insert_sym (const FloatComplexColumnVector& u,
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1070 octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1071 {
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1072 F77_INT info = -1;
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
1073 F77_INT j = to_f77_int (j_arg);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1074
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1075 F77_INT n = to_f77_int (m_chol_mat.rows ());
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1076
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1077 if (u.numel () != n + 1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1078 (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1079 if (j < 0 || j > n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1080 (*current_liboctave_error_handler) ("cholinsert: index out of range");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1081
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1082 FloatComplexColumnVector utmp = u;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1083
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1084 OCTAVE_LOCAL_BUFFER (float, rw, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1085
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1086 m_chol_mat.resize (n+1, n+1);
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1087 F77_INT ldcm = to_f77_int (m_chol_mat.rows ());
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1088
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1089 F77_XFCN (cchinx, CCHINX, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22969
023026207910 * chol.cc: Fix thinko in previous change.
John W. Eaton <jwe@octave.org>
parents: 22942
diff changeset
1090 ldcm, j + 1,
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1091 F77_CMPLX_ARG (utmp.fortran_vec ()),
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1092 rw, info));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1093
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1094 return info;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1095 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1096
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1097 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
1098 OCTAVE_API void
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1099 chol<FloatComplexMatrix>::delete_sym (octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1100 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1101 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
1102 F77_INT j = to_f77_int (j_arg);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1103
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1104 if (j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1105 (*current_liboctave_error_handler) ("choldelete: index out of range");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1106
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1107 OCTAVE_LOCAL_BUFFER (float, rw, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1108
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1109 F77_XFCN (cchdex, CCHDEX, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1110 n, j + 1, rw));
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1111
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1112 m_chol_mat.resize (n-1, n-1);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1113 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1114
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1115 template <>
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
1116 OCTAVE_API void
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1117 chol<FloatComplexMatrix>::shift_sym (octave_idx_type i_arg,
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1118 octave_idx_type j_arg)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1119 {
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1120 F77_INT n = to_f77_int (m_chol_mat.rows ());
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
1121 F77_INT i = to_f77_int (i_arg);
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
1122 F77_INT j = to_f77_int (j_arg);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1123
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1124 if (i < 0 || i > n-1 || j < 0 || j > n-1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1125 (*current_liboctave_error_handler) ("cholshift: index out of range");
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1126
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1127 OCTAVE_LOCAL_BUFFER (FloatComplex, w, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1128 OCTAVE_LOCAL_BUFFER (float, rw, n);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1129
30032
e156fce82e00 maint: use "m_" prefix for member variables for chol class.
Rik <rik@octave.org>
parents: 29874
diff changeset
1130 F77_XFCN (cchshx, CCHSHX, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()),
22942
7627ebcf194d use F77_INT instead of octave_idx_type for liboctave chol classes
John W. Eaton <jwe@octave.org>
parents: 22927
diff changeset
1131 n, i + 1, j + 1, F77_CMPLX_ARG (w), rw));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1132 }
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1133
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1134 #endif
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1135
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1136 // Instantiations we need.
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1137
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1138 template class chol<Matrix>;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1139
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1140 template class chol<FloatMatrix>;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1141
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1142 template class chol<ComplexMatrix>;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1143
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1144 template class chol<FloatComplexMatrix>;
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1145
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
1146 template OCTAVE_API Matrix
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1147 chol2inv<Matrix> (const Matrix& r);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1148
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
1149 template OCTAVE_API ComplexMatrix
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1150 chol2inv<ComplexMatrix> (const ComplexMatrix& r);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1151
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
1152 template OCTAVE_API FloatMatrix
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1153 chol2inv<FloatMatrix> (const FloatMatrix& r);
21269
3c8a3d35661a better use of templates for Cholesky factorization
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
1154
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
1155 template OCTAVE_API FloatComplexMatrix
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1156 chol2inv<FloatComplexMatrix> (const FloatComplexMatrix& r);
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
1157
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
1158 OCTAVE_END_NAMESPACE(math)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
1159 OCTAVE_END_NAMESPACE(octave)