annotate liboctave/numeric/sparse-lu.cc @ 23696:08036a7f3660

remove octave:: namespace tag from symbols used inside octave namespace * octave-gui.cc, dynamic-ld.h, ft-text-renderer.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, input.cc, input.h, interpreter.cc, load-path.cc, load-path.h, oct-stream.cc, sighandlers.cc, symtab.cc, symtab.h, __ode15__.cc, gzip.cc, octave.cc, lex.ll, oct-parse.in.yy, parse.h, pt-arg-list.cc, pt-arg-list.h, pt-array-list.h, pt-classdef.h, pt-decl.h, pt-eval.cc, pt-eval.h, pt-exp.h, pt-fcn-handle.cc, pt-idx.cc, pt-misc.h, pt-select.h, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt.cc, aepbalance.cc, chol.cc, gepbalance.cc, gsvd.cc, hess.cc, lo-mappers.h, lo-specfun.cc, lu.cc, qr.cc, qrp.cc, schur.cc, sparse-chol.cc, sparse-lu.cc, sparse-qr.cc, svd.cc, child-list.cc, dir-ops.cc, file-ops.cc, file-stat.cc, file-stat.h, lo-sysdep.cc, oct-env.cc, oct-syscalls.cc, cmd-edit.cc, cmd-hist.cc, oct-glob.cc, oct-locbuf.cc, oct-mutex.cc, oct-mutex.h, oct-shlib.cc, oct-shlib.h, pathsearch.cc, url-transfer.cc, url-transfer.h: Remove octave:: namespace tag from symbols used inside octave namespace. * oct-conf-post.in.h (OCTAVE_USE_DEPRECATED_FUNCTIONS): Don't define.
author John W. Eaton <jwe@octave.org>
date Mon, 26 Jun 2017 09:05:37 -0400
parents d691ed308237
children 980f39c3ab90
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
1 /*
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 2016-2017 John W. Eaton
22323
bac0d6f07a3e maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents: 22317
diff changeset
4 Copyright (C) 2004-2016 David Bateman
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10314
diff changeset
5 Copyright (C) 1998-2004 Andy Adler
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
6
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
7 This file is part of Octave.
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
8
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
9 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
10 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
11 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
12 (at your option) any later version.
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
13
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
14 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
15 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
17 GNU General Public License for more details.
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
18
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
20 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
21 <http://www.gnu.org/licenses/>.
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
22
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
23 */
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
24
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21691
diff changeset
25 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21207
diff changeset
26 # include "config.h"
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
27 #endif
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
28
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
29 #include "CSparse.h"
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
30 #include "PermMatrix.h"
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
31 #include "dSparse.h"
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
32 #include "lo-error.h"
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23391
diff changeset
33 #include "lo-mappers.h"
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
34 #include "oct-locbuf.h"
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
35 #include "oct-sparse.h"
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
36 #include "oct-spparms.h"
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
37 #include "sparse-lu.h"
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
38
22317
6ca3acf5fad8 move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
39 namespace octave
6ca3acf5fad8 move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
40 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
41 namespace math
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
42 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
43 // Wrappers for SuiteSparse (formerly UMFPACK) functions that have
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
44 // different names depending on the sparse matrix data type.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
45 //
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
46 // All of these functions must be specialized to forward to the correct
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
47 // SuiteSparse functions.
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
48
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
49 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
50 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
51 umfpack_defaults (double *Control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
52
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
53 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
54 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
55 umfpack_free_numeric (void **Numeric);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
56
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
57 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
58 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
59 umfpack_free_symbolic (void **Symbolic);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
60
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
61 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
62 octave_idx_type
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
63 umfpack_get_lunz (octave_idx_type *lnz, octave_idx_type *unz,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
64 void *Numeric);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
65
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
66 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
67 octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
68 umfpack_get_numeric (octave_idx_type *Lp, octave_idx_type *Lj,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
69 T *Lx, // Or Lz_packed
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
70 octave_idx_type *Up, octave_idx_type *Ui,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
71 T *Ux, // Or Uz_packed
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
72 octave_idx_type *p, octave_idx_type *q,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
73 double *Dz_packed, octave_idx_type *do_recip,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
74 double *Rs, void *Numeric);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
75
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
76 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
77 octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
78 umfpack_numeric (const octave_idx_type *Ap, const octave_idx_type *Ai,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
79 const T *Ax, // Or Az_packed
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
80 void *Symbolic, void **Numeric,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
81 const double *Control, double *Info);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
82
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
83 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
84 octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
85 umfpack_qsymbolic (octave_idx_type n_row, octave_idx_type n_col,
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
86 const octave_idx_type *Ap, const octave_idx_type *Ai,
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
87 const T *Ax, // Or Az_packed
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
88 const octave_idx_type *Qinit, void **Symbolic,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
89 const double *Control, double *Info);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
90
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
91 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
92 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
93 umfpack_report_control (const double *Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
94
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
95 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
96 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
97 umfpack_report_info (const double *Control, const double *Info);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
98
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
99 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
100 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
101 umfpack_report_matrix (octave_idx_type n_row, octave_idx_type n_col,
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
102 const octave_idx_type *Ap,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
103 const octave_idx_type *Ai,
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
104 const T *Ax, // Or Az_packed
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
105 octave_idx_type col_form, const double *Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
106
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
107 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
108 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
109 umfpack_report_numeric (void *Numeric, const double *Control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
110
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
111 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
112 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
113 umfpack_report_perm (octave_idx_type np, const octave_idx_type *Perm,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
114 const double *Control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
115
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
116 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
117 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
118 umfpack_report_status (double *Control, octave_idx_type status);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
119
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
120 template <typename T>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
121 void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
122 umfpack_report_symbolic (void *Symbolic, const double *Control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
123
21207
945695cafd2b allow build to succeed with missing dependencies
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
124 #if defined (HAVE_UMFPACK)
945695cafd2b allow build to succeed with missing dependencies
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
125
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
126 // SparseMatrix Specialization.
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
127
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
128 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
129 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
130 umfpack_defaults<double> (double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
131 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
132 UMFPACK_DNAME (defaults) (Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
133 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
134
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
135 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
136 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
137 umfpack_free_numeric<double> (void **Numeric)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
138 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
139 UMFPACK_DNAME (free_numeric) (Numeric);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
140 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
141
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
142 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
143 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
144 umfpack_free_symbolic<double> (void **Symbolic)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
145 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
146 UMFPACK_DNAME (free_symbolic) (Symbolic);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
147 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
148
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
149 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
150 inline octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
151 umfpack_get_lunz<double>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
152 (octave_idx_type *lnz, octave_idx_type *unz, void *Numeric)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
153 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
154 suitesparse_integer ignore1, ignore2, ignore3;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
155
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
156 return UMFPACK_DNAME (get_lunz) (to_suitesparse_intptr (lnz),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
157 to_suitesparse_intptr (unz),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
158 &ignore1, &ignore2, &ignore3, Numeric);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
159 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
160
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
161 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
162 inline octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
163 umfpack_get_numeric<double>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
164 (octave_idx_type *Lp, octave_idx_type *Lj, double *Lx,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
165 octave_idx_type *Up, octave_idx_type *Ui, double *Ux,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
166 octave_idx_type *p, octave_idx_type *q, double *Dx,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
167 octave_idx_type *do_recip, double *Rs, void *Numeric)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
168 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
169 return UMFPACK_DNAME (get_numeric) (to_suitesparse_intptr (Lp),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
170 to_suitesparse_intptr (Lj),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
171 Lx, to_suitesparse_intptr (Up),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
172 to_suitesparse_intptr (Ui), Ux,
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
173 to_suitesparse_intptr (p),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
174 to_suitesparse_intptr (q), Dx,
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
175 to_suitesparse_intptr (do_recip),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
176 Rs, Numeric);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
177 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
178
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
179 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
180 inline octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
181 umfpack_numeric<double>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
182 (const octave_idx_type *Ap, const octave_idx_type *Ai,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
183 const double *Ax, void *Symbolic, void **Numeric,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
184 const double *Control, double *Info)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
185 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
186 return UMFPACK_DNAME (numeric) (to_suitesparse_intptr (Ap),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
187 to_suitesparse_intptr (Ai),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
188 Ax, Symbolic, Numeric, Control, Info);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
189 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
190
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
191 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
192 inline octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
193 umfpack_qsymbolic<double>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
194 (octave_idx_type n_row, octave_idx_type n_col, const octave_idx_type *Ap,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
195 const octave_idx_type *Ai, const double *Ax,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
196 const octave_idx_type *Qinit, void **Symbolic,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
197 const double *Control, double *Info)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
198 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
199 return UMFPACK_DNAME (qsymbolic) (n_row, n_col,
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
200 to_suitesparse_intptr (Ap),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
201 to_suitesparse_intptr (Ai), Ax,
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
202 to_suitesparse_intptr (Qinit),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
203 Symbolic, Control, Info);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
204 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
205
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
206 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
207 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
208 umfpack_report_control<double> (const double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
209 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
210 UMFPACK_DNAME (report_control) (Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
211 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
212
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
213 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
214 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
215 umfpack_report_info<double> (const double *Control, const double *Info)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
216 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
217 UMFPACK_DNAME (report_info) (Control, Info);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
218 }
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
219
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
220 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
221 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
222 umfpack_report_matrix<double>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
223 (octave_idx_type n_row, octave_idx_type n_col, const octave_idx_type *Ap,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
224 const octave_idx_type *Ai, const double *Ax, octave_idx_type col_form,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
225 const double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
226 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
227 UMFPACK_DNAME (report_matrix) (n_row, n_col,
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
228 to_suitesparse_intptr (Ap),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
229 to_suitesparse_intptr (Ai), Ax,
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
230 col_form, Control);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
231 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
232
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
233 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
234 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
235 umfpack_report_numeric<double> (void *Numeric, const double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
236 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
237 UMFPACK_DNAME (report_numeric) (Numeric, Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
238 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
239
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
240 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
241 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
242 umfpack_report_perm<double>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
243 (octave_idx_type np, const octave_idx_type *Perm, const double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
244 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
245 UMFPACK_DNAME (report_perm) (np, to_suitesparse_intptr (Perm), Control);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
246 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
247
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
248 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
249 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
250 umfpack_report_status<double> (double *Control, octave_idx_type status)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
251 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
252 UMFPACK_DNAME (report_status) (Control, status);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
253 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
254
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
255 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
256 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
257 umfpack_report_symbolic<double> (void *Symbolic, const double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
258 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
259 UMFPACK_DNAME (report_symbolic) (Symbolic, Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
260 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
261
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
262 // SparseComplexMatrix specialization.
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
263
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
264 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
265 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
266 umfpack_defaults<Complex> (double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
267 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
268 UMFPACK_ZNAME (defaults) (Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
269 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
270
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
271 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
272 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
273 umfpack_free_numeric<Complex> (void **Numeric)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
274 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
275 UMFPACK_ZNAME (free_numeric) (Numeric);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
276 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
277
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
278 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
279 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
280 umfpack_free_symbolic<Complex> (void **Symbolic)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
281 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
282 UMFPACK_ZNAME (free_symbolic) (Symbolic);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
283 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
284
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
285 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
286 inline octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
287 umfpack_get_lunz<Complex>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
288 (octave_idx_type *lnz, octave_idx_type *unz, void *Numeric)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
289 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
290 suitesparse_integer ignore1, ignore2, ignore3;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
291
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
292 return UMFPACK_ZNAME (get_lunz) (to_suitesparse_intptr (lnz),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
293 to_suitesparse_intptr (unz),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
294 &ignore1, &ignore2, &ignore3, Numeric);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
295 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
296
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
297 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
298 inline octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
299 umfpack_get_numeric<Complex>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
300 (octave_idx_type *Lp, octave_idx_type *Lj, Complex *Lz,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
301 octave_idx_type *Up, octave_idx_type *Ui, Complex *Uz,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
302 octave_idx_type *p, octave_idx_type *q, double *Dz,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
303 octave_idx_type *do_recip, double *Rs, void *Numeric)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
304 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
305 return UMFPACK_ZNAME (get_numeric) (to_suitesparse_intptr (Lp),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
306 to_suitesparse_intptr (Lj),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
307 reinterpret_cast<double *> (Lz),
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
308 0, to_suitesparse_intptr (Up),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
309 to_suitesparse_intptr (Ui),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
310 reinterpret_cast<double *> (Uz),
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
311 0, to_suitesparse_intptr (p),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
312 to_suitesparse_intptr (q),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
313 reinterpret_cast<double *> (Dz),
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
314 0, to_suitesparse_intptr (do_recip),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
315 Rs, Numeric);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
316 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
317
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
318 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
319 inline octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
320 umfpack_numeric<Complex>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
321 (const octave_idx_type *Ap, const octave_idx_type *Ai,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
322 const Complex *Az, void *Symbolic, void **Numeric,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
323 const double *Control, double *Info)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
324 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
325 return UMFPACK_ZNAME (numeric) (to_suitesparse_intptr (Ap),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
326 to_suitesparse_intptr (Ai),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
327 reinterpret_cast<const double *> (Az),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
328 0, Symbolic, Numeric, Control, Info);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
329 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
330
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
331 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
332 inline octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
333 umfpack_qsymbolic<Complex>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
334 (octave_idx_type n_row, octave_idx_type n_col,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
335 const octave_idx_type *Ap, const octave_idx_type *Ai,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
336 const Complex *Az, const octave_idx_type *Qinit,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
337 void **Symbolic, const double *Control, double *Info)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
338 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
339 return UMFPACK_ZNAME (qsymbolic) (n_row, n_col,
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
340 to_suitesparse_intptr (Ap),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
341 to_suitesparse_intptr (Ai),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
342 reinterpret_cast<const double *> (Az),
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
343 0, to_suitesparse_intptr (Qinit),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
344 Symbolic, Control, Info);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
345 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
346
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
347 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
348 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
349 umfpack_report_control<Complex> (const double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
350 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
351 UMFPACK_ZNAME (report_control) (Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
352 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
353
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
354 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
355 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
356 umfpack_report_info<Complex> (const double *Control, const double *Info)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
357 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
358 UMFPACK_ZNAME (report_info) (Control, Info);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
359 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
360
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
361 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
362 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
363 umfpack_report_matrix<Complex>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
364 (octave_idx_type n_row, octave_idx_type n_col,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
365 const octave_idx_type *Ap, const octave_idx_type *Ai,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
366 const Complex *Az, octave_idx_type col_form, const double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
367 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
368 UMFPACK_ZNAME (report_matrix) (n_row, n_col,
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
369 to_suitesparse_intptr (Ap),
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
370 to_suitesparse_intptr (Ai),
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
371 reinterpret_cast<const double *> (Az),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
372 0, col_form, Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
373 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
374
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
375 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
376 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
377 umfpack_report_numeric<Complex> (void *Numeric, const double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
378 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
379 UMFPACK_ZNAME (report_numeric) (Numeric, Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
380 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
381
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
382 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
383 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
384 umfpack_report_perm<Complex>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
385 (octave_idx_type np, const octave_idx_type *Perm, const double *Control)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
386 {
23391
209e749363a2 safe cast between SuiteSparse_long and octave_idx_type pointers (bug #50510)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
387 UMFPACK_ZNAME (report_perm) (np, to_suitesparse_intptr (Perm), Control);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
388 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
389
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
390 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
391 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
392 umfpack_report_status<Complex> (double *Control, octave_idx_type status)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
393 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
394 UMFPACK_ZNAME (report_status) (Control, status);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
395 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
396
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
397 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
398 inline void
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
399 umfpack_report_symbolic <Complex> (void *Symbolic, const double *Control)
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 UMFPACK_ZNAME (report_symbolic) (Symbolic, Control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
402 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
403
21207
945695cafd2b allow build to succeed with missing dependencies
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
404 #endif
945695cafd2b allow build to succeed with missing dependencies
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 template <typename lu_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
407 sparse_lu<lu_type>::sparse_lu (const lu_type& a, const Matrix& piv_thres,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
408 bool scale)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
409 : Lfact (), Ufact (), Rfact (), cond (0), P (), Q ()
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
410 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21691
diff changeset
411 #if defined (HAVE_UMFPACK)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
412 octave_idx_type 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 nc = a.cols ();
19269
65554f5847ac don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents: 18425
diff changeset
414
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
415 // Setup the control parameters
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
416 Matrix Control (UMFPACK_CONTROL, 1);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
417 double *control = Control.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
418 umfpack_defaults<lu_elt_type> (control);
21177
a10f60e13243 style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents: 21146
diff changeset
419
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
420 double tmp = octave_sparse_params::get_key ("spumoni");
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
421 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
422 Control (UMFPACK_PRL) = tmp;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
423
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
424 if (piv_thres.numel () == 2)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
425 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
426 tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0));
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
427 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
428 Control (UMFPACK_PIVOT_TOLERANCE) = tmp;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
429
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
430 tmp = (piv_thres (1) > 1. ? 1. : piv_thres (1));
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
431 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
432 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
433 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
434 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
435 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
436 tmp = octave_sparse_params::get_key ("piv_tol");
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
437 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
438 Control (UMFPACK_PIVOT_TOLERANCE) = tmp;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
439
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
440 tmp = octave_sparse_params::get_key ("sym_tol");
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
441 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
442 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
443 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
444
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
445 // Set whether we are allowed to modify Q or not
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
446 tmp = octave_sparse_params::get_key ("autoamd");
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
447 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
448 Control (UMFPACK_FIXQ) = tmp;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
449
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
450 // Turn-off UMFPACK scaling for LU
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
451 if (scale)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
452 Control (UMFPACK_SCALE) = UMFPACK_SCALE_SUM;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
453 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
454 Control (UMFPACK_SCALE) = UMFPACK_SCALE_NONE;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
455
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
456 umfpack_report_control<lu_elt_type> (control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
457
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
458 const octave_idx_type *Ap = a.cidx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
459 const octave_idx_type *Ai = a.ridx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
460 const lu_elt_type *Ax = a.data ();
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
461
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
462 umfpack_report_matrix<lu_elt_type> (nr, nc, Ap, Ai, Ax,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
463 static_cast<octave_idx_type> (1),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
464 control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
465
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
466 void *Symbolic;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
467 Matrix Info (1, UMFPACK_INFO);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
468 double *info = Info.fortran_vec ();
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
469 int status = umfpack_qsymbolic<lu_elt_type> (nr, nc, Ap, Ai, Ax, 0,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
470 &Symbolic, control, info);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
471
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
472 if (status < 0)
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
473 {
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
474 umfpack_report_status<lu_elt_type> (control, status);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
475 umfpack_report_info<lu_elt_type> (control, info);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
476
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
477 umfpack_free_symbolic<lu_elt_type> (&Symbolic);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
478
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
479 (*current_liboctave_error_handler)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
480 ("sparse_lu: symbolic factorization failed");
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
481 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
482 else
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
483 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
484 umfpack_report_symbolic<lu_elt_type> (Symbolic, control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
485
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
486 void *Numeric;
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
487 status = umfpack_numeric<lu_elt_type> (Ap, Ai, Ax, Symbolic,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
488 &Numeric, control, info);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
489 umfpack_free_symbolic<lu_elt_type> (&Symbolic);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
490
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
491 cond = Info (UMFPACK_RCOND);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
492
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
493 if (status < 0)
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
494 {
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
495 umfpack_report_status<lu_elt_type> (control, status);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
496 umfpack_report_info<lu_elt_type> (control, info);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
497
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
498 umfpack_free_numeric<lu_elt_type> (&Numeric);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
499
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
500 (*current_liboctave_error_handler)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
501 ("sparse_lu: numeric factorization failed");
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
502 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
503 else
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
504 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
505 umfpack_report_numeric<lu_elt_type> (Numeric, control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
506
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
507 octave_idx_type lnz, unz;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
508 status = umfpack_get_lunz<lu_elt_type> (&lnz, &unz, Numeric);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
509
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
510 if (status < 0)
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
511 {
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
512 umfpack_report_status<lu_elt_type> (control, status);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
513 umfpack_report_info<lu_elt_type> (control, info);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
514
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
515 umfpack_free_numeric<lu_elt_type> (&Numeric);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
516
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
517 (*current_liboctave_error_handler)
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
518 ("sparse_lu: extracting LU factors failed");
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
519 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
520 else
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
521 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
522 octave_idx_type n_inner = (nr < nc ? nr : nc);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
523
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
524 if (lnz < 1)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
525 Lfact = lu_type (n_inner, nr,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
526 static_cast<octave_idx_type> (1));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
527 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
528 Lfact = lu_type (n_inner, nr, lnz);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
529
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
530 octave_idx_type *Ltp = Lfact.cidx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
531 octave_idx_type *Ltj = Lfact.ridx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
532 lu_elt_type *Ltx = Lfact.data ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
533
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
534 if (unz < 1)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
535 Ufact = lu_type (n_inner, nc,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
536 static_cast<octave_idx_type> (1));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
537 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
538 Ufact = lu_type (n_inner, nc, unz);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
539
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
540 octave_idx_type *Up = Ufact.cidx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
541 octave_idx_type *Uj = Ufact.ridx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
542 lu_elt_type *Ux = Ufact.data ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
543
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
544 Rfact = SparseMatrix (nr, nr, nr);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
545 for (octave_idx_type i = 0; i < nr; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
546 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
547 Rfact.xridx (i) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
548 Rfact.xcidx (i) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
549 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
550 Rfact.xcidx (nr) = nr;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
551 double *Rx = Rfact.data ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
552
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
553 P.resize (dim_vector (nr, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
554 octave_idx_type *p = P.fortran_vec ();
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
555
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
556 Q.resize (dim_vector (nc, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
557 octave_idx_type *q = Q.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
558
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
559 octave_idx_type do_recip;
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
560 status = umfpack_get_numeric<lu_elt_type> (Ltp, Ltj, Ltx,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
561 Up, Uj, Ux,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
562 p, q, 0,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
563 &do_recip, Rx,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
564 Numeric);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
565
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
566 umfpack_free_numeric<lu_elt_type> (&Numeric);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
567
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
568 if (status < 0)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
569 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
570 umfpack_report_status<lu_elt_type> (control, status);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
571
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
572 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
573 ("sparse_lu: extracting LU factors failed");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
574 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
575 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
576 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
577 Lfact = Lfact.transpose ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
578
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
579 if (do_recip)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
580 for (octave_idx_type i = 0; i < nr; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
581 Rx[i] = 1.0 / Rx[i];
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
582
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
583 umfpack_report_matrix<lu_elt_type> (nr, n_inner,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
584 Lfact.cidx (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
585 Lfact.ridx (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
586 Lfact.data (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
587 static_cast<octave_idx_type> (1),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
588 control);
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
589 umfpack_report_matrix<lu_elt_type> (n_inner, nc,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
590 Ufact.cidx (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
591 Ufact.ridx (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
592 Ufact.data (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
593 static_cast<octave_idx_type> (1),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
594 control);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
595 umfpack_report_perm<lu_elt_type> (nr, p, control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
596 umfpack_report_perm<lu_elt_type> (nc, q, control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
597 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
598
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
599 umfpack_report_info<lu_elt_type> (control, info);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
600 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
601 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
602 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
603
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
604 #else
21177
a10f60e13243 style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents: 21146
diff changeset
605
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
606 octave_unused_parameter (a);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
607 octave_unused_parameter (piv_thres);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
608 octave_unused_parameter (scale);
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
609
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
610 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
611 ("support for UMFPACK was unavailable or disabled when liboctave was built");
21177
a10f60e13243 style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents: 21146
diff changeset
612
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
613 #endif
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
614 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
615
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
616 template <typename lu_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
617 sparse_lu<lu_type>::sparse_lu (const lu_type& a,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
618 const ColumnVector& Qinit,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
619 const Matrix& piv_thres, bool scale,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
620 bool FixedQ, double droptol,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
621 bool milu, bool udiag)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
622 : Lfact (), Ufact (), Rfact (), cond (0), P (), Q ()
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
623 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
624 #if defined (HAVE_UMFPACK)
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
625
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
626 if (milu)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
627 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
628 ("Modified incomplete LU not implemented");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
629
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
630 octave_idx_type nr = a.rows ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
631 octave_idx_type nc = a.cols ();
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
632
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
633 // Setup the control parameters
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
634 Matrix Control (UMFPACK_CONTROL, 1);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
635 double *control = Control.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
636 umfpack_defaults<lu_elt_type> (control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
637
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
638 double tmp = octave_sparse_params::get_key ("spumoni");
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
639 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
640 Control (UMFPACK_PRL) = tmp;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
641
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
642 if (piv_thres.numel () == 2)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
643 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
644 tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0));
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
645 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
646 Control (UMFPACK_PIVOT_TOLERANCE) = tmp;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
647 tmp = (piv_thres (1) > 1. ? 1. : piv_thres (1));
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
648 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
649 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
650 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
651 else
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 tmp = octave_sparse_params::get_key ("piv_tol");
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
654 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
655 Control (UMFPACK_PIVOT_TOLERANCE) = tmp;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
656
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
657 tmp = octave_sparse_params::get_key ("sym_tol");
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
658 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
659 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
660 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
661
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
662 if (droptol >= 0.)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
663 Control (UMFPACK_DROPTOL) = droptol;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
664
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
665 // Set whether we are allowed to modify Q or not
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
666 if (FixedQ)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
667 Control (UMFPACK_FIXQ) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
668 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
669 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
670 tmp = octave_sparse_params::get_key ("autoamd");
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23475
diff changeset
671 if (! math::isnan (tmp))
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
672 Control (UMFPACK_FIXQ) = tmp;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
673 }
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
674
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
675 // Turn-off UMFPACK scaling for LU
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
676 if (scale)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
677 Control (UMFPACK_SCALE) = UMFPACK_SCALE_SUM;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
678 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
679 Control (UMFPACK_SCALE) = UMFPACK_SCALE_NONE;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
680
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
681 umfpack_report_control<lu_elt_type> (control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
682
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
683 const octave_idx_type *Ap = a.cidx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
684 const octave_idx_type *Ai = a.ridx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
685 const lu_elt_type *Ax = a.data ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
686
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
687 umfpack_report_matrix<lu_elt_type> (nr, nc, Ap, Ai, Ax,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
688 static_cast<octave_idx_type> (1),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
689 control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
690
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
691 void *Symbolic;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
692 Matrix Info (1, UMFPACK_INFO);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
693 double *info = Info.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
694 int status;
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
695
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
696 // Null loop so that qinit is imediately deallocated when not needed
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
697 do
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
698 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
699 OCTAVE_LOCAL_BUFFER (octave_idx_type, qinit, nc);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
700
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
701 for (octave_idx_type i = 0; i < nc; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
702 qinit[i] = static_cast<octave_idx_type> (Qinit (i));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
703
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
704 status = umfpack_qsymbolic<lu_elt_type> (nr, nc, Ap, Ai, Ax,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
705 qinit, &Symbolic, control,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
706 info);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
707 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
708 while (0);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
709
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
710 if (status < 0)
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
711 {
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
712 umfpack_report_status<lu_elt_type> (control, status);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
713 umfpack_report_info<lu_elt_type> (control, info);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
714
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
715 umfpack_free_symbolic<lu_elt_type> (&Symbolic);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
716
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
717 (*current_liboctave_error_handler)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
718 ("sparse_lu: symbolic factorization failed");
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
719 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
720 else
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
721 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
722 umfpack_report_symbolic<lu_elt_type> (Symbolic, control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
723
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
724 void *Numeric;
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
725 status = umfpack_numeric<lu_elt_type> (Ap, Ai, Ax, Symbolic,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
726 &Numeric, control, info);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
727 umfpack_free_symbolic<lu_elt_type> (&Symbolic);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
728
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
729 cond = Info (UMFPACK_RCOND);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
730
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
731 if (status < 0)
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
732 {
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
733 umfpack_report_status<lu_elt_type> (control, status);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
734 umfpack_report_info<lu_elt_type> (control, info);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
735
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
736 umfpack_free_numeric<lu_elt_type> (&Numeric);
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
737
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
738 (*current_liboctave_error_handler)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
739 ("sparse_lu: numeric factorization failed");
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
740 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
741 else
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
742 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
743 umfpack_report_numeric<lu_elt_type> (Numeric, control);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
744
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
745 octave_idx_type lnz, unz;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
746 status = umfpack_get_lunz<lu_elt_type> (&lnz, &unz, Numeric);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
747
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
748 if (status < 0)
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
749 {
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
750 umfpack_report_status<lu_elt_type> (control, status);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
751 umfpack_report_info<lu_elt_type> (control, info);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
752
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
753 umfpack_free_numeric<lu_elt_type> (&Numeric);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
754
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
755 (*current_liboctave_error_handler)
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
756 ("sparse_lu: extracting LU factors failed");
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
757 }
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
758 else
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
759 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
760 octave_idx_type n_inner = (nr < nc ? nr : nc);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
761
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
762 if (lnz < 1)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
763 Lfact = lu_type (n_inner, nr,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
764 static_cast<octave_idx_type> (1));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
765 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
766 Lfact = lu_type (n_inner, nr, lnz);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
767
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
768 octave_idx_type *Ltp = Lfact.cidx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
769 octave_idx_type *Ltj = Lfact.ridx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
770 lu_elt_type *Ltx = Lfact.data ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
771
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
772 if (unz < 1)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
773 Ufact = lu_type (n_inner, nc,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
774 static_cast<octave_idx_type> (1));
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
775 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
776 Ufact = lu_type (n_inner, nc, unz);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
777
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
778 octave_idx_type *Up = Ufact.cidx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
779 octave_idx_type *Uj = Ufact.ridx ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
780 lu_elt_type *Ux = Ufact.data ();
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
781
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
782 Rfact = SparseMatrix (nr, nr, nr);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
783 for (octave_idx_type i = 0; i < nr; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
784 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
785 Rfact.xridx (i) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
786 Rfact.xcidx (i) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
787 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
788 Rfact.xcidx (nr) = nr;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
789 double *Rx = Rfact.data ();
21177
a10f60e13243 style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents: 21146
diff changeset
790
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
791 P.resize (dim_vector (nr, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
792 octave_idx_type *p = P.fortran_vec ();
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
793
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
794 Q.resize (dim_vector (nc, 1));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
795 octave_idx_type *q = Q.fortran_vec ();
21177
a10f60e13243 style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents: 21146
diff changeset
796
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
797 octave_idx_type do_recip;
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
798 status = umfpack_get_numeric<lu_elt_type> (Ltp, Ltj, Ltx,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
799 Up, Uj, Ux,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
800 p, q, 0,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
801 &do_recip,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
802 Rx, Numeric);
21146
ea9c05014809 revamp sparse LU factorization classes
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
803
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
804 umfpack_free_numeric<lu_elt_type> (&Numeric);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
805
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
806 if (status < 0)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
807 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
808 umfpack_report_status<lu_elt_type> (control, status);
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
809
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
810 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
811 ("sparse_lu: extracting LU factors failed");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
812 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
813 else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
814 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
815 Lfact = Lfact.transpose ();
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
816
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
817 if (do_recip)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
818 for (octave_idx_type i = 0; i < nr; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
819 Rx[i] = 1.0 / Rx[i];
21177
a10f60e13243 style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents: 21146
diff changeset
820
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
821 umfpack_report_matrix<lu_elt_type> (nr, n_inner,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
822 Lfact.cidx (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
823 Lfact.ridx (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
824 Lfact.data (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
825 static_cast<octave_idx_type> (1),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
826 control);
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
827 umfpack_report_matrix<lu_elt_type> (n_inner, nc,
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
828 Ufact.cidx (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
829 Ufact.ridx (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
830 Ufact.data (),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
831 static_cast<octave_idx_type> (1),
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22329
diff changeset
832 control);
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
833 umfpack_report_perm<lu_elt_type> (nr, p, control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
834 umfpack_report_perm<lu_elt_type> (nc, q, control);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
835 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
836
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
837 umfpack_report_info<lu_elt_type> (control, info);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
838 }
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
839 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
840 }
21177
a10f60e13243 style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents: 21146
diff changeset
841
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
842 if (udiag)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
843 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
844 ("Option udiag of incomplete LU not implemented");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
845
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
846 #else
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
847
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
848 octave_unused_parameter (a);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
849 octave_unused_parameter (Qinit);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
850 octave_unused_parameter (piv_thres);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
851 octave_unused_parameter (scale);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
852 octave_unused_parameter (FixedQ);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
853 octave_unused_parameter (droptol);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
854 octave_unused_parameter (milu);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
855 octave_unused_parameter (udiag);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
856
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
857 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
858 ("support for UMFPACK was unavailable or disabled when liboctave was built");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
859
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
860 #endif
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
861 }
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
862
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
863 template <typename lu_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
864 lu_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
865 sparse_lu<lu_type>::Y (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
866 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
867 octave_idx_type nr = Lfact.rows ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
868 octave_idx_type nz = Lfact.cols ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
869 octave_idx_type nc = Ufact.cols ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
870
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
871 lu_type Yout (nr, nc, Lfact.nnz () + Ufact.nnz () - (nr<nz?nr:nz));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
872 octave_idx_type ii = 0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
873 Yout.xcidx (0) = 0;
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
874
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
875 for (octave_idx_type j = 0; j < nc; j++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
876 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
877 for (octave_idx_type i = Ufact.cidx (j); i < Ufact.cidx (j + 1); i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
878 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
879 Yout.xridx (ii) = Ufact.ridx (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
880 Yout.xdata (ii++) = Ufact.data (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
881 }
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
882
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
883 if (j < nz)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
884 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
885 // Note the +1 skips the 1.0 on the diagonal
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
886 for (octave_idx_type i = Lfact.cidx (j) + 1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
887 i < Lfact.cidx (j +1); i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
888 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
889 Yout.xridx (ii) = Lfact.ridx (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
890 Yout.xdata (ii++) = Lfact.data (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
891 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
892 }
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
893
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
894 Yout.xcidx (j + 1) = ii;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
895 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
896
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
897 return Yout;
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
898 }
21177
a10f60e13243 style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents: 21146
diff changeset
899
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
900 template <typename lu_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
901 SparseMatrix
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
902 sparse_lu<lu_type>::Pr (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
903 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
904 octave_idx_type nr = Lfact.rows ();
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
905
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
906 SparseMatrix Pout (nr, nr, nr);
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
907
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
908 for (octave_idx_type i = 0; i < nr; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
909 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
910 Pout.cidx (i) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
911 Pout.ridx (P (i)) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
912 Pout.data (i) = 1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
913 }
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
914
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
915 Pout.cidx (nr) = nr;
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
916
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
917 return Pout;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
918 }
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
919
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
920 template <typename lu_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
921 ColumnVector
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
922 sparse_lu<lu_type>::Pr_vec (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
923 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
924 octave_idx_type nr = Lfact.rows ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
925
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
926 ColumnVector Pout (nr);
8969
3ecbc236e2e0 Have sparse LU return permutation matrices rather than sparse matrices.
Jason Riedy <jason@acm.org>
parents: 8954
diff changeset
927
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
928 for (octave_idx_type i = 0; i < nr; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
929 Pout.xelem (i) = static_cast<double> (P(i) + 1);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
930
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
931 return Pout;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
932 }
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
933
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
934 template <typename lu_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
935 PermMatrix
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
936 sparse_lu<lu_type>::Pr_mat (void) const
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
937 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
938 return PermMatrix (P, false);
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
939 }
21177
a10f60e13243 style fixes in liboctave/numeric directory
John W. Eaton <jwe@octave.org>
parents: 21146
diff changeset
940
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
941 template <typename lu_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
942 SparseMatrix
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
943 sparse_lu<lu_type>::Pc (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
944 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
945 octave_idx_type nc = Ufact.cols ();
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
946
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
947 SparseMatrix Pout (nc, nc, nc);
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
948
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
949 for (octave_idx_type i = 0; i < nc; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
950 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
951 Pout.cidx (i) = i;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
952 Pout.ridx (i) = Q (i);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
953 Pout.data (i) = 1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
954 }
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
955
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
956 Pout.cidx (nc) = nc;
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
957
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
958 return Pout;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
959 }
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
960
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
961 template <typename lu_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
962 ColumnVector
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
963 sparse_lu<lu_type>::Pc_vec (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
964 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
965 octave_idx_type nc = Ufact.cols ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
966
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
967 ColumnVector Pout (nc);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
968
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
969 for (octave_idx_type i = 0; i < nc; i++)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
970 Pout.xelem (i) = static_cast<double> (Q(i) + 1);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
971
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
972 return Pout;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
973 }
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
974
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
975 template <typename lu_type>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
976 PermMatrix
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
977 sparse_lu<lu_type>::Pc_mat (void) const
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
978 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
979 return PermMatrix (Q, true);
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
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
982 // Instantiations we need.
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
983
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
984 template class sparse_lu<SparseMatrix>;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
985
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
986 template class sparse_lu<SparseComplexMatrix>;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
987 }
8969
3ecbc236e2e0 Have sparse LU return permutation matrices rather than sparse matrices.
Jason Riedy <jason@acm.org>
parents: 8954
diff changeset
988 }