2303
|
1 ### Copyright (C) 1996 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 |
|
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 |
2311
|
30 function msg = strerror (name, err) |
1576
|
31 |
|
32 if (nargin != 2) |
|
33 usage ("strerror (name, err)"); |
|
34 endif |
|
35 |
|
36 if (! isstr (name)) |
|
37 error ("strerror: first argument must be a string"); |
|
38 endif |
|
39 |
|
40 if (! is_scalar (err)) |
|
41 error ("strerror: second argument must be a scalar"); |
|
42 endif |
|
43 |
|
44 if (strcmp (name, "fsolve")) |
|
45 |
|
46 if (err == -2) |
|
47 msg = "input error\n"; |
|
48 elseif (err == -1) |
|
49 msg = "error encountered in user-supplied function\n"; |
|
50 elseif (err == 1) |
|
51 msg = "solution converged to requested tolerance\n"; |
|
52 elseif (err == 4) |
|
53 msg = "iteration limit exceeded\n"; |
|
54 elseif (err == 3) |
|
55 msg = "iteration is not making good progress\n"; |
|
56 else |
|
57 error ("strerror: unrecognized error code for fsolve"); |
|
58 endif |
|
59 |
|
60 elseif (strcmp (name, "npsol")) |
|
61 |
|
62 if (err == 0) |
|
63 msg = "optimal solution found\n"; |
|
64 elseif (err == 1) |
|
65 msg = "weak local solution found\n"; |
|
66 elseif (err == 2) |
|
67 msg = "no feasible point for linear constraints and bounds\n"; |
|
68 elseif (err == 3) |
|
69 msg = "no feasible point found for nonlinear constraints\n"; |
|
70 elseif (err == 4) |
|
71 msg = "iteration limit reached\n"; |
|
72 elseif (err == 6) |
|
73 msg = "current point cannot be improved upon\n"; |
|
74 elseif (err == 7) |
|
75 msg = "user-supplied derivatives appear to be incorrect\n"; |
|
76 elseif (err == 9) |
|
77 msg = "internal error: invalid input parameter\n"; |
|
78 else |
|
79 error ("strerror: unrecognized error code for npsol"); |
|
80 endif |
|
81 |
|
82 elseif (strcmp (name, "qpsol")) |
|
83 |
|
84 if (err == 0) |
|
85 msg = "optimal solution found\n"; |
|
86 elseif (err == 1) |
|
87 msg = "weak local solution found\n"; |
|
88 elseif (err == 2) |
|
89 msg = "solution appears to be unbounded\n"; |
|
90 elseif (err == 3) |
|
91 msg = "solution appears optimal, but optimality can't be verified\n"; |
|
92 elseif (err == 4) |
|
93 msg = "iterates of the QP phase appear to be cycling\n"; |
|
94 elseif (err == 5) |
|
95 msg = "iteration limit reached during QP phase\n"; |
|
96 elseif (err == 6) |
|
97 msg = "no feasible point found during LP phase\n"; |
|
98 elseif (err == 7) |
|
99 msg = "iterates of the LP phase appear to be cycling\n"; |
|
100 elseif (err == 8) |
|
101 msg = "iteration limit reached during LP phase\n"; |
|
102 elseif (err == 9) |
|
103 msg = "internal error: invalid input parameter\n"; |
|
104 else |
|
105 error ("strerror: unrecognized error code for qpsol"); |
|
106 endif |
|
107 |
|
108 else |
|
109 |
|
110 error ("strerror: unrecognized function name"); |
|
111 |
|
112 endif |
|
113 |
|
114 endfunction |