annotate libinterp/corefcn/luinc.cc @ 20831:35241c4b696c

eliminate return statements after calls to error * Cell.cc, __ichol__.cc, __lin_interpn__.cc, __pchip_deriv__.cc, besselj.cc, cellfun.cc, colloc.cc, debug.cc, dlmread.cc, dynamic-ld.cc, filter.cc, find.cc, gl2ps-renderer.cc, load-path.cc, load-save.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-text.cc, luinc.cc, max.cc, nproc.cc, oct-hist.cc, oct-map.cc, oct-obj.cc, oct-stream.cc, ordschur.cc, pinv.cc, pr-output.cc, profiler.cc, psi.cc, quadcc.cc, qz.cc, rand.cc, strfind.cc, strfns.cc, sysdep.cc, toplev.cc, tril.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc: Eliminate return statements after calls to error.
author John W. Eaton <jwe@octave.org>
date Wed, 09 Dec 2015 14:00:43 -0500
parents a542a9bf177e
children 1142cf6abc0d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
1 /*
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19148
diff changeset
3 Copyright (C) 2005-2015 David Bateman
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
4
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
5 This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
6
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
10 option) any later version.
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
11
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
15 for more details.
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
16
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
17 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: 7001
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
19 <http://www.gnu.org/licenses/>.
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
20
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
21 */
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
22
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
24 #include <config.h>
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
25 #endif
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
26
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
27 #include "defun.h"
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
28 #include "error.h"
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
29 #include "gripes.h"
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
30 #include "oct-obj.h"
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
31 #include "utils.h"
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
32 #include "oct-map.h"
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
33
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5775
diff changeset
34 #include "MatrixType.h"
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
35 #include "SparseCmplxLU.h"
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
36 #include "SparsedbleLU.h"
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
37 #include "ov-re-sparse.h"
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
38 #include "ov-cx-sparse.h"
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
39
20172
4f45eaf83908 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
40 // FIXME: Deprecated in 4.0 and should be removed in 4.4.
19148
e278c939a419 Deprecate luinc.
Rik <rik@octave.org>
parents: 19055
diff changeset
41 DEFUN (__luinc__, args, nargout,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
42 "-*- texinfo -*-\n\
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
43 @deftypefn {Built-in Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, '0')\n\
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
44 @deftypefnx {Built-in Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, @var{droptol})\n\
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
45 @deftypefnx {Built-in Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, @var{opts})\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
46 @cindex LU decomposition\n\
11593
1577c6f80926 Use non-breaking spaces between certain adjectives and their nouns in docstrings.
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
47 Produce the incomplete LU@tie{}factorization of the sparse matrix @var{A}.\n\
20172
4f45eaf83908 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
48 \n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
49 Two types of incomplete factorization are possible, and the type\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
50 is determined by the second argument to @code{luinc}.\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
51 \n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 15195
diff changeset
52 Called with a second argument of @qcode{'0'}, the zero-level incomplete\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
53 LU@tie{}factorization is produced. This creates a factorization of @var{A}\n\
18812
9ac2357f19bc doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents: 18678
diff changeset
54 where the position of the nonzero arguments correspond to the same\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
55 positions as in the matrix @var{A}.\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
56 \n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
57 Alternatively, the fill-in of the incomplete LU@tie{}factorization can\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
58 be controlled through the variable @var{droptol} or the structure\n\
10711
fbd7843974fa Periodic grammar check of documentation files to ensure common format.
Rik <octave@nomad.inbox5.com>
parents: 10155
diff changeset
59 @var{opts}. The @sc{umfpack} multifrontal factorization code by Tim A.\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
60 Davis is used for the incomplete LU@tie{}factorization, (availability\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
61 @url{http://www.cise.ufl.edu/research/sparse/umfpack/})\n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
62 \n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
63 @var{droptol} determines the values below which the values in the\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
64 LU@tie{} factorization are dropped and replaced by zero. It must be a\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
65 positive scalar, and any values in the factorization whose absolute value\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
66 are less than this value are dropped, expect if leaving them increase the\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
67 sparsity of the matrix. Setting @var{droptol} to zero results in a complete\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
68 LU@tie{}factorization which is the default.\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
69 \n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
70 @var{opts} is a structure containing one or more of the fields\n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
71 \n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
72 @table @code\n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
73 @item droptol\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
74 The drop tolerance as above. If @var{opts} only contains @code{droptol}\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
75 then this is equivalent to using the variable @var{droptol}.\n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
76 \n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
77 @item milu\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
78 A logical variable flagging whether to use the modified incomplete\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
79 LU@tie{} factorization. In the case that @code{milu} is true, the dropped\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
80 values are subtracted from the diagonal of the matrix @var{U} of the\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
81 factorization. The default is @code{false}.\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
82 \n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
83 @item udiag\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
84 A logical variable that flags whether zero elements on the diagonal of\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
85 @var{U} should be replaced with @var{droptol} to attempt to avoid singular\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
86 factors. The default is @code{false}.\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
87 \n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
88 @item thresh\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
89 Defines the pivot threshold in the interval [0,1]. Values outside that\n\
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
90 range are ignored.\n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
91 @end table\n\
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
92 \n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
93 All other fields in @var{opts} are ignored. The outputs from @code{luinc}\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
94 are the same as for @code{lu}.\n\
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7243
diff changeset
95 \n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 15195
diff changeset
96 Given the string argument @qcode{\"vector\"}, @code{luinc} returns the\n\
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 15195
diff changeset
97 values of @var{p} @var{q} as vector values.\n\
19055
38937efbee21 Incorporate new functions ichol and ilu into Octave.
Rik <rik@octave.org>
parents: 18812
diff changeset
98 @seealso{sparse, lu, ilu, ichol}\n\
5642
2618a0750ae6 [project @ 2006-03-06 21:26:48 by jwe]
jwe
parents: 5610
diff changeset
99 @end deftypefn")
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
100 {
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
101 int nargin = args.length ();
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
102 octave_value_list retval;
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
103
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
104 if (nargin < 2 || nargin > 3)
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5785
diff changeset
105 print_usage ();
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
106
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
107 bool zero_level = false;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
108 bool milu = false;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
109 bool udiag = false;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
110 Matrix thresh;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
111 double droptol = -1.;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
112 bool vecout = false;
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
113
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
114 if (args(1).is_string ())
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
115 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
116 if (args(1).string_value () == "0")
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
117 zero_level = true;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
118 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
119 error ("luinc: unrecognized string argument");
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
120 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
121 else if (args(1).is_map ())
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
122 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
123 octave_scalar_map map = args(1).xscalar_map_value ("luinc: OPTS must be a scalar structure");
11049
b0a9450d81c6 luinc.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents: 10840
diff changeset
124
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
125 octave_value tmp;
11049
b0a9450d81c6 luinc.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents: 10840
diff changeset
126
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
127 tmp = map.getfield ("droptol");
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
128 if (tmp.is_defined ())
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
129 droptol = tmp.double_value ();
20704
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20556
diff changeset
130
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
131 tmp = map.getfield ("milu");
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
132 if (tmp.is_defined ())
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
133 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
134 double val = tmp.double_value ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
135
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
136 milu = (val == 0. ? false : true);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
137 }
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
138
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
139 tmp = map.getfield ("udiag");
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
140 if (tmp.is_defined ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
141 {
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
142 double val = tmp.double_value ();
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7243
diff changeset
143
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
144 udiag = (val == 0. ? false : true);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
145 }
7515
f3c00dc0912b Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents: 7243
diff changeset
146
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
147 tmp = map.getfield ("thresh");
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
148 if (tmp.is_defined ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
149 {
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
150 thresh = tmp.matrix_value ();
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
151
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
152 if (thresh.numel () == 1)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
153 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
154 thresh.resize (1,2);
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
155 thresh(1) = thresh(0);
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
156 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
157 else if (thresh.numel () != 2)
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20801
diff changeset
158 error ("luinc: THRESH must be a 1 or 2-element vector");
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
159 }
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
160 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
161 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
162 droptol = args(1).double_value ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
163
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
164 if (nargin == 3)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
165 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
166 std::string tmp = args(2).string_value ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
167
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
168 if (tmp.compare ("vector") == 0)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
169 vecout = true;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
170 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
171 error ("luinc: unrecognized string argument");
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
172 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
173
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
174 // FIXME: Add code for zero-level factorization
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
175 if (zero_level)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
176 error ("luinc: zero-level factorization not implemented");
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
177
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
178 if (args(0).type_name () == "sparse matrix")
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
179 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
180 SparseMatrix sm = args(0).sparse_matrix_value ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
181 octave_idx_type sm_nr = sm.rows ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
182 octave_idx_type sm_nc = sm.cols ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
183 ColumnVector Qinit (sm_nc);
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
184
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
185 for (octave_idx_type i = 0; i < sm_nc; i++)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
186 Qinit (i) = i;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
187
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
188 switch (nargout)
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
189 {
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
190 case 0:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
191 case 1:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
192 case 2:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
193 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
194 SparseLU fact (sm, Qinit, thresh, false, true, droptol,
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
195 milu, udiag);
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
196
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
197 SparseMatrix P = fact.Pr ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
198 SparseMatrix L = P.transpose () * fact.L ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
199
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
200 retval(1)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
201 = octave_value (fact.U (), MatrixType (MatrixType::Upper));
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
202
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
203 retval(0)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
204 = octave_value (L, MatrixType (MatrixType::Permuted_Lower,
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
205 sm_nr, fact.row_perm ()));
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
206 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
207 break;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
208
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
209 case 3:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
210 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
211 SparseLU fact (sm, Qinit, thresh, false, true, droptol,
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
212 milu, udiag);
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
213
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
214 if (vecout)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
215 retval(2) = fact.Pr_vec ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
216 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
217 retval(2) = fact.Pr_mat ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
218
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
219 retval(1)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
220 = octave_value (fact.U (), MatrixType (MatrixType::Upper));
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
221
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
222 retval(0)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
223 = octave_value (fact.L (), MatrixType (MatrixType::Lower));
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
224 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
225 break;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
226
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
227 case 4:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
228 default:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
229 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
230 SparseLU fact (sm, Qinit, thresh, false, false, droptol,
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
231 milu, udiag);
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
232
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
233 if (vecout)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
234 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
235 retval(3) = fact.Pc_vec ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
236 retval(2) = fact.Pr_vec ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
237 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
238 else
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
239 {
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
240 retval(3) = fact.Pc_mat ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
241 retval(2) = fact.Pr_mat ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
242 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
243
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
244 retval(1)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
245 = octave_value (fact.U (), MatrixType (MatrixType::Upper));
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
246
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
247 retval(0)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
248 = octave_value (fact.L (), MatrixType (MatrixType::Lower));
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
249 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
250 break;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
251 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
252 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
253 else if (args(0).type_name () == "sparse complex matrix")
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
254 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
255 SparseComplexMatrix sm =
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
256 args(0).sparse_complex_matrix_value ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
257 octave_idx_type sm_nr = sm.rows ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
258 octave_idx_type sm_nc = sm.cols ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
259 ColumnVector Qinit (sm_nc);
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
260
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
261 for (octave_idx_type i = 0; i < sm_nc; i++)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
262 Qinit (i) = i;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
263
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
264 switch (nargout)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
265 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
266 case 0:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
267 case 1:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
268 case 2:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
269 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
270 SparseComplexLU fact (sm, Qinit, thresh, false, true,
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
271 droptol, milu, udiag);
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
272
6027
068e52f1c005 [project @ 2006-10-03 20:07:56 by jwe]
jwe
parents: 5823
diff changeset
273
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
274 SparseMatrix P = fact.Pr ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
275 SparseComplexMatrix L = P.transpose () * fact.L ();
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
276
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
277 retval(1)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
278 = octave_value (fact.U (), MatrixType (MatrixType::Upper));
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
279
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
280 retval(0)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
281 = octave_value (L, MatrixType (MatrixType::Permuted_Lower,
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
282 sm_nr, fact.row_perm ()));
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
283 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
284 break;
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
285
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
286 case 3:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
287 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
288 SparseComplexLU fact (sm, Qinit, thresh, false, true,
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
289 droptol, milu, udiag);
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
290
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
291 if (vecout)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
292 retval(2) = fact.Pr_vec ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
293 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
294 retval(2) = fact.Pr_mat ();
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
295
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
296 retval(1)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
297 = octave_value (fact.U (), MatrixType (MatrixType::Upper));
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
298
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
299 retval(0)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
300 = octave_value (fact.L (), MatrixType (MatrixType::Lower));
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
301 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
302 break;
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
303
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
304 case 4:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
305 default:
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
306 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
307 SparseComplexLU fact (sm, Qinit, thresh, false, false,
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
308 droptol, milu, udiag);
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
309
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
310 if (vecout)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
311 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
312 retval(3) = fact.Pc_vec ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
313 retval(2) = fact.Pr_vec ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
314 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
315 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
316 {
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
317 retval(3) = fact.Pc_mat ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
318 retval(2) = fact.Pr_mat ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
319 }
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
320
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
321 retval(1)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
322 = octave_value (fact.U (), MatrixType (MatrixType::Upper));
20556
4bed806ee3d4 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20228
diff changeset
323
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
324 retval(0)
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
325 = octave_value (fact.L (), MatrixType (MatrixType::Lower));
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
326 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
327 break;
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
328 }
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
329 }
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
330 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
331 error ("luinc: matrix A must be sparse");
5282
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
332
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
333 return retval;
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
334 }
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
335
5bdc3f24cd5f [project @ 2005-04-14 22:17:26 by dbateman]
dbateman
parents:
diff changeset
336 /*
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
337 %!testif HAVE_UMFPACK
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
338 %! a = sparse ([1,2,0,0;0,1,2,0;1e-14,0,3,0;0,0,0,1]);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
339 %! [l,u] = luinc (a, 1e-10);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
340 %! assert (l*u, sparse ([1,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
341 %! opts.droptol = 1e-10;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
342 %! [l,u] = luinc (a, opts);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
343 %! assert (l*u, sparse ([1,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
5610
9761b7d24e9e [project @ 2006-02-09 09:12:02 by dbateman]
dbateman
parents: 5322
diff changeset
344
7243
e8d7eed42935 [project @ 2007-12-04 02:10:17 by jwe]
jwe
parents: 7017
diff changeset
345 %!testif HAVE_UMFPACK
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
346 %! a = sparse ([1i,2,0,0;0,1,2,0;1e-14,0,3,0;0,0,0,1]);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
347 %! [l,u] = luinc (a, 1e-10);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
348 %! assert (l*u, sparse ([1i,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
349 %! opts.droptol = 1e-10;
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
350 %! [l,u] = luinc (a, opts);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14361
diff changeset
351 %! assert (l*u, sparse ([1i,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10);
5610
9761b7d24e9e [project @ 2006-02-09 09:12:02 by dbateman]
dbateman
parents: 5322
diff changeset
352 */