2847
|
1 ## Copyright (C) 1996, 1997 John W. Eaton |
2313
|
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 |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License 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 |
|
18 ## 02111-1307, USA. |
1576
|
19 |
2311
|
20 ## usage: msg = strerror (name, err) |
|
21 ## |
|
22 ## Return the text of an error message for error number `err' from |
|
23 ## function "name". |
|
24 ## |
|
25 ## Messages correspond to the following subroutine versions: |
|
26 ## |
|
27 ## npsol : 4.0 |
|
28 ## qpsol : 3.2 |
1576
|
29 |
2314
|
30 ## Author: jwe |
|
31 |
2311
|
32 function msg = strerror (name, err) |
1576
|
33 |
|
34 if (nargin != 2) |
|
35 usage ("strerror (name, err)"); |
|
36 endif |
|
37 |
|
38 if (! isstr (name)) |
|
39 error ("strerror: first argument must be a string"); |
|
40 endif |
|
41 |
|
42 if (! is_scalar (err)) |
|
43 error ("strerror: second argument must be a scalar"); |
|
44 endif |
|
45 |
|
46 if (strcmp (name, "fsolve")) |
|
47 |
|
48 if (err == -2) |
|
49 msg = "input error\n"; |
|
50 elseif (err == -1) |
|
51 msg = "error encountered in user-supplied function\n"; |
|
52 elseif (err == 1) |
|
53 msg = "solution converged to requested tolerance\n"; |
|
54 elseif (err == 4) |
|
55 msg = "iteration limit exceeded\n"; |
|
56 elseif (err == 3) |
|
57 msg = "iteration is not making good progress\n"; |
|
58 else |
|
59 error ("strerror: unrecognized error code for fsolve"); |
|
60 endif |
|
61 |
|
62 elseif (strcmp (name, "npsol")) |
|
63 |
|
64 if (err == 0) |
|
65 msg = "optimal solution found\n"; |
|
66 elseif (err == 1) |
|
67 msg = "weak local solution found\n"; |
|
68 elseif (err == 2) |
|
69 msg = "no feasible point for linear constraints and bounds\n"; |
|
70 elseif (err == 3) |
|
71 msg = "no feasible point found for nonlinear constraints\n"; |
|
72 elseif (err == 4) |
|
73 msg = "iteration limit reached\n"; |
|
74 elseif (err == 6) |
|
75 msg = "current point cannot be improved upon\n"; |
|
76 elseif (err == 7) |
|
77 msg = "user-supplied derivatives appear to be incorrect\n"; |
|
78 elseif (err == 9) |
|
79 msg = "internal error: invalid input parameter\n"; |
|
80 else |
|
81 error ("strerror: unrecognized error code for npsol"); |
|
82 endif |
|
83 |
|
84 elseif (strcmp (name, "qpsol")) |
|
85 |
|
86 if (err == 0) |
|
87 msg = "optimal solution found\n"; |
|
88 elseif (err == 1) |
|
89 msg = "weak local solution found\n"; |
|
90 elseif (err == 2) |
|
91 msg = "solution appears to be unbounded\n"; |
|
92 elseif (err == 3) |
|
93 msg = "solution appears optimal, but optimality can't be verified\n"; |
|
94 elseif (err == 4) |
|
95 msg = "iterates of the QP phase appear to be cycling\n"; |
|
96 elseif (err == 5) |
|
97 msg = "iteration limit reached during QP phase\n"; |
|
98 elseif (err == 6) |
|
99 msg = "no feasible point found during LP phase\n"; |
|
100 elseif (err == 7) |
|
101 msg = "iterates of the LP phase appear to be cycling\n"; |
|
102 elseif (err == 8) |
|
103 msg = "iteration limit reached during LP phase\n"; |
|
104 elseif (err == 9) |
|
105 msg = "internal error: invalid input parameter\n"; |
|
106 else |
|
107 error ("strerror: unrecognized error code for qpsol"); |
|
108 endif |
|
109 |
|
110 else |
|
111 |
|
112 error ("strerror: unrecognized function name"); |
|
113 |
|
114 endif |
|
115 |
|
116 endfunction |