Mercurial > hg > octave-lyh
comparison scripts/general/strerror.m @ 1576:75077e1455dd
[project @ 1995-10-19 04:46:37 by jwe]
Initial revision
author | jwe |
---|---|
date | Thu, 19 Oct 1995 04:46:37 +0000 |
parents | |
children | 5d29638dd524 |
comparison
equal
deleted
inserted
replaced
1575:6cc5d208c566 | 1576:75077e1455dd |
---|---|
1 # Copyright (C) 1995 John W. Eaton | |
2 # | |
3 # This file is part of Octave. | |
4 # | |
5 # Octave is free software; you can redistribute it and/or modify it | |
6 # under the terms of the GNU General Public License as published by the | |
7 # Free Software Foundation; either version 2, or (at your option) any | |
8 # later version. | |
9 # | |
10 # Octave is distributed in the hope that it will be useful, but WITHOUT | |
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 # for more details. | |
14 # | |
15 # You should have received a copy of the GNU General Public License | |
16 # along with Octave; see the file COPYING. If not, write to the Free | |
17 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
18 | |
19 function msg = strerror (name, err) | |
20 | |
21 # usage: msg = strerror (name, err) | |
22 # | |
23 # Return the text of an error message for error number `err' from | |
24 # function "name". | |
25 # | |
26 # Messages correspond to the following subroutine versions: | |
27 # | |
28 # npsol : 4.0 | |
29 # qpsol : 3.2 | |
30 | |
31 if (nargin != 2) | |
32 usage ("strerror (name, err)"); | |
33 endif | |
34 | |
35 if (! isstr (name)) | |
36 error ("strerror: first argument must be a string"); | |
37 endif | |
38 | |
39 if (! is_scalar (err)) | |
40 error ("strerror: second argument must be a scalar"); | |
41 endif | |
42 | |
43 if (strcmp (name, "fsolve")) | |
44 | |
45 if (err == -2) | |
46 msg = "input error\n"; | |
47 elseif (err == -1) | |
48 msg = "error encountered in user-supplied function\n"; | |
49 elseif (err == 1) | |
50 msg = "solution converged to requested tolerance\n"; | |
51 elseif (err == 4) | |
52 msg = "iteration limit exceeded\n"; | |
53 elseif (err == 3) | |
54 msg = "iteration is not making good progress\n"; | |
55 else | |
56 error ("strerror: unrecognized error code for fsolve"); | |
57 endif | |
58 | |
59 elseif (strcmp (name, "npsol")) | |
60 | |
61 if (err == 0) | |
62 msg = "optimal solution found\n"; | |
63 elseif (err == 1) | |
64 msg = "weak local solution found\n"; | |
65 elseif (err == 2) | |
66 msg = "no feasible point for linear constraints and bounds\n"; | |
67 elseif (err == 3) | |
68 msg = "no feasible point found for nonlinear constraints\n"; | |
69 elseif (err == 4) | |
70 msg = "iteration limit reached\n"; | |
71 elseif (err == 6) | |
72 msg = "current point cannot be improved upon\n"; | |
73 elseif (err == 7) | |
74 msg = "user-supplied derivatives appear to be incorrect\n"; | |
75 elseif (err == 9) | |
76 msg = "internal error: invalid input parameter\n"; | |
77 else | |
78 error ("strerror: unrecognized error code for npsol"); | |
79 endif | |
80 | |
81 elseif (strcmp (name, "qpsol")) | |
82 | |
83 if (err == 0) | |
84 msg = "optimal solution found\n"; | |
85 elseif (err == 1) | |
86 msg = "weak local solution found\n"; | |
87 elseif (err == 2) | |
88 msg = "solution appears to be unbounded\n"; | |
89 elseif (err == 3) | |
90 msg = "solution appears optimal, but optimality can't be verified\n"; | |
91 elseif (err == 4) | |
92 msg = "iterates of the QP phase appear to be cycling\n"; | |
93 elseif (err == 5) | |
94 msg = "iteration limit reached during QP phase\n"; | |
95 elseif (err == 6) | |
96 msg = "no feasible point found during LP phase\n"; | |
97 elseif (err == 7) | |
98 msg = "iterates of the LP phase appear to be cycling\n"; | |
99 elseif (err == 8) | |
100 msg = "iteration limit reached during LP phase\n"; | |
101 elseif (err == 9) | |
102 msg = "internal error: invalid input parameter\n"; | |
103 else | |
104 error ("strerror: unrecognized error code for qpsol"); | |
105 endif | |
106 | |
107 else | |
108 | |
109 error ("strerror: unrecognized function name"); | |
110 | |
111 endif | |
112 | |
113 endfunction |