1
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
1
|
21 |
|
22 */ |
|
23 |
240
|
24 #ifdef HAVE_CONFIG_H |
1192
|
25 #include <config.h> |
1
|
26 #endif |
|
27 |
2089
|
28 #include <cctype> |
3010
|
29 #include <cfloat> |
1
|
30 |
4524
|
31 #include "lo-ieee.h" |
3156
|
32 #include "lo-specfun.h" |
2889
|
33 #include "lo-mappers.h" |
|
34 |
1352
|
35 #include "defun.h" |
|
36 #include "error.h" |
2970
|
37 #include "ov-mapper.h" |
2955
|
38 #include "variables.h" |
1
|
39 |
5775
|
40 // FIXME -- perhaps this could be avoided by determining |
2190
|
41 // whether the is* functions are actually functions or just macros. |
|
42 |
2889
|
43 static int |
4100
|
44 xabs (int c) |
|
45 { |
|
46 return static_cast<unsigned char> (c); |
|
47 } |
|
48 |
|
49 static int |
2190
|
50 xisalnum (int c) |
|
51 { |
|
52 return isalnum (c); |
|
53 } |
|
54 |
2889
|
55 static int |
2190
|
56 xisalpha (int c) |
|
57 { |
|
58 return isalpha (c); |
|
59 } |
|
60 |
2889
|
61 static int |
2190
|
62 xisascii (int c) |
|
63 { |
|
64 return isascii (c); |
|
65 } |
|
66 |
2889
|
67 static int |
2190
|
68 xiscntrl (int c) |
|
69 { |
|
70 return iscntrl (c); |
|
71 } |
|
72 |
2889
|
73 static int |
2190
|
74 xisdigit (int c) |
|
75 { |
|
76 return isdigit (c); |
|
77 } |
|
78 |
2889
|
79 static int |
2190
|
80 xisgraph (int c) |
|
81 { |
|
82 return isgraph (c); |
|
83 } |
|
84 |
2889
|
85 static int |
2190
|
86 xislower (int c) |
|
87 { |
|
88 return islower (c); |
|
89 } |
|
90 |
2889
|
91 static int |
2190
|
92 xisprint (int c) |
|
93 { |
|
94 return isprint (c); |
|
95 } |
|
96 |
2889
|
97 static int |
2190
|
98 xispunct (int c) |
|
99 { |
|
100 return ispunct (c); |
|
101 } |
|
102 |
2889
|
103 static int |
2190
|
104 xisspace (int c) |
|
105 { |
|
106 return isspace (c); |
|
107 } |
|
108 |
2889
|
109 static int |
2190
|
110 xisupper (int c) |
|
111 { |
|
112 return isupper (c); |
|
113 } |
|
114 |
2889
|
115 static int |
2190
|
116 xisxdigit (int c) |
|
117 { |
|
118 return isxdigit (c); |
|
119 } |
|
120 |
2889
|
121 static int |
2267
|
122 xtoascii (int c) |
|
123 { |
5760
|
124 return toascii (c); |
2267
|
125 } |
|
126 |
2889
|
127 static int |
2267
|
128 xtolower (int c) |
|
129 { |
|
130 return tolower (c); |
|
131 } |
|
132 |
2889
|
133 static int |
2267
|
134 xtoupper (int c) |
|
135 { |
|
136 return toupper (c); |
|
137 } |
|
138 |
4524
|
139 static double |
|
140 xabs (const Complex& x) |
|
141 { |
|
142 return (xisinf (x.real ()) || xisinf (x.imag ())) ? octave_Inf : abs (x); |
|
143 } |
|
144 |
3564
|
145 static Complex |
|
146 xconj (const Complex& x) |
|
147 { |
|
148 return conj (x); |
|
149 } |
|
150 |
|
151 static double |
|
152 xconj (double x) |
|
153 { |
|
154 return x; |
|
155 } |
|
156 |
3586
|
157 static double |
3564
|
158 ximag (const Complex& x) |
|
159 { |
3586
|
160 return x.imag (); |
3564
|
161 } |
|
162 |
3586
|
163 static double |
3564
|
164 xreal (const Complex& x) |
|
165 { |
3586
|
166 return x.real (); |
3564
|
167 } |
|
168 |
529
|
169 void |
|
170 install_mapper_functions (void) |
|
171 { |
4524
|
172 DEFUN_MAPPER (abs, xabs, 0, 0, fabs, xabs, 0, 0.0, 0.0, 1, 0, |
3321
|
173 "-*- texinfo -*-\n\ |
|
174 @deftypefn {Mapping Function} {} abs (@var{z})\n\ |
|
175 Compute the magnitude of @var{z}, defined as\n\ |
|
176 @iftex\n\ |
|
177 @tex\n\ |
|
178 $|z| = \\sqrt{x^2 + y^2}$.\n\ |
|
179 @end tex\n\ |
|
180 @end iftex\n\ |
|
181 @ifinfo\n\ |
|
182 |@var{z}| = @code{sqrt (x^2 + y^2)}.\n\ |
|
183 @end ifinfo\n\ |
|
184 \n\ |
|
185 For example,\n\ |
|
186 \n\ |
|
187 @example\n\ |
|
188 @group\n\ |
|
189 abs (3 + 4i)\n\ |
|
190 @result{} 5\n\ |
|
191 @end group\n\ |
|
192 @end example\n\ |
|
193 @end deftypefn"); |
529
|
194 |
4268
|
195 DEFUN_MAPPER (acos, 0, 0, 0, acos, 0, acos, -1.0, 1.0, 0, 1, |
3321
|
196 "-*- texinfo -*-\n\ |
3428
|
197 @deftypefn {Mapping Function} {} acos (@var{x})\n\ |
|
198 Compute the inverse cosine of each element of @var{x}.\n\ |
3321
|
199 @end deftypefn"); |
529
|
200 |
4668
|
201 DEFUN_MAPPER (acosh, 0, 0, 0, acosh, 0, acosh, 1.0, octave_Inf, 0, 1, |
3321
|
202 "-*- texinfo -*-\n\ |
3428
|
203 @deftypefn {Mapping Function} {} acosh (@var{x})\n\ |
|
204 Compute the inverse hyperbolic cosine of each element of @var{x}.\n\ |
3321
|
205 @end deftypefn"); |
529
|
206 |
5261
|
207 DEFUN_MAPPER (angle, 0, 0, 0, arg, std::arg, 0, 0.0, 0.0, 0, 0, |
3458
|
208 "-*- texinfo -*-\n\ |
|
209 @deftypefn {Mapping Function} {} angle (@var{z})\n\ |
|
210 See arg.\n\ |
|
211 @end deftypefn"); |
529
|
212 |
5261
|
213 DEFUN_MAPPER (arg, 0, 0, 0, arg, std::arg, 0, 0.0, 0.0, 0, 0, |
3321
|
214 "-*- texinfo -*-\n\ |
3446
|
215 @deftypefn {Mapping Function} {} arg (@var{z})\n\ |
3458
|
216 @deftypefnx {Mapping Function} {} angle (@var{z})\n\ |
3321
|
217 Compute the argument of @var{z}, defined as\n\ |
|
218 @iftex\n\ |
|
219 @tex\n\ |
|
220 $\\theta = \\tan^{-1}(y/x)$.\n\ |
|
221 @end tex\n\ |
|
222 @end iftex\n\ |
|
223 @ifinfo\n\ |
|
224 @var{theta} = @code{atan (@var{y}/@var{x})}.\n\ |
|
225 @end ifinfo\n\ |
|
226 @noindent\n\ |
|
227 in radians. \n\ |
|
228 \n\ |
|
229 For example,\n\ |
|
230 \n\ |
|
231 @example\n\ |
|
232 @group\n\ |
|
233 arg (3 + 4i)\n\ |
|
234 @result{} 0.92730\n\ |
|
235 @end group\n\ |
|
236 @end example\n\ |
|
237 @end deftypefn"); |
529
|
238 |
4268
|
239 DEFUN_MAPPER (asin, 0, 0, 0, asin, 0, asin, -1.0, 1.0, 0, 1, |
3321
|
240 "-*- texinfo -*-\n\ |
3428
|
241 @deftypefn {Mapping Function} {} asin (@var{x})\n\ |
|
242 Compute the inverse sine of each element of @var{x}.\n\ |
3321
|
243 @end deftypefn"); |
529
|
244 |
4100
|
245 DEFUN_MAPPER (asinh, 0, 0, 0, asinh, 0, asinh, 0.0, 0.0, 0, 0, |
3321
|
246 "-*- texinfo -*-\n\ |
3428
|
247 @deftypefn {Mapping Function} {} asinh (@var{x})\n\ |
5016
|
248 Compute the inverse hyperbolic sine of each element of @var{x}.\n\ |
3321
|
249 @end deftypefn"); |
529
|
250 |
4268
|
251 DEFUN_MAPPER (atan, 0, 0, 0, atan, 0, atan, 0.0, 0.0, 0, 0, |
3321
|
252 "-*- texinfo -*-\n\ |
3428
|
253 @deftypefn {Mapping Function} {} atan (@var{x})\n\ |
|
254 Compute the inverse tangent of each element of @var{x}.\n\ |
3321
|
255 @end deftypefn"); |
529
|
256 |
4100
|
257 DEFUN_MAPPER (atanh, 0, 0, 0, atanh, 0, atanh, -1.0, 1.0, 0, 1, |
3321
|
258 "-*- texinfo -*-\n\ |
3428
|
259 @deftypefn {Mapping Function} {} atanh (@var{x})\n\ |
5016
|
260 Compute the inverse hyperbolic tangent of each element of @var{x}.\n\ |
3321
|
261 @end deftypefn"); |
529
|
262 |
4268
|
263 DEFUN_MAPPER (ceil, 0, 0, 0, ceil, 0, ceil, 0.0, 0.0, 0, 0, |
3321
|
264 "-*- texinfo -*-\n\ |
3373
|
265 @deftypefn {Mapping Function} {} ceil (@var{x})\n\ |
3321
|
266 Return the smallest integer not less than @var{x}. If @var{x} is\n\ |
|
267 complex, return @code{ceil (real (@var{x})) + ceil (imag (@var{x})) * I}.\n\ |
|
268 @end deftypefn"); |
529
|
269 |
4100
|
270 DEFUN_MAPPER (conj, 0, 0, 0, xconj, 0, xconj, 0.0, 0.0, 0, 0, |
3381
|
271 "-*- texinfo -*-\n\ |
3321
|
272 @deftypefn {Mapping Function} {} conj (@var{z})\n\ |
|
273 Return the complex conjugate of @var{z}, defined as\n\ |
|
274 @iftex\n\ |
|
275 @tex\n\ |
|
276 $\\bar{z} = x - iy$.\n\ |
|
277 @end tex\n\ |
|
278 @end iftex\n\ |
|
279 @ifinfo\n\ |
|
280 @code{conj (@var{z})} = @var{x} - @var{i}@var{y}.\n\ |
|
281 @end ifinfo\n\ |
5642
|
282 @seealso{real, imag}\n\ |
5646
|
283 @end deftypefn"); |
529
|
284 |
5261
|
285 DEFUN_MAPPER (cos, 0, 0, 0, cos, 0, std::cos, 0.0, 0.0, 0, 0, |
3321
|
286 "-*- texinfo -*-\n\ |
3428
|
287 @deftypefn {Mapping Function} {} cos (@var{x})\n\ |
|
288 Compute the cosine of each element of @var{x}.\n\ |
3321
|
289 @end deftypefn"); |
529
|
290 |
5261
|
291 DEFUN_MAPPER (cosh, 0, 0, 0, cosh, 0, std::cosh, 0.0, 0.0, 0, 0, |
3321
|
292 "-*- texinfo -*-\n\ |
3428
|
293 @deftypefn {Mapping Function} {} cosh (@var{x})\n\ |
|
294 Compute the hyperbolic cosine of each element of @var{x}.\n\ |
3321
|
295 @end deftypefn"); |
529
|
296 |
4100
|
297 DEFUN_MAPPER (erf, 0, 0, 0, erf, 0, 0, 0.0, 0.0, 0, 0, |
3321
|
298 "-*- texinfo -*-\n\ |
|
299 @deftypefn {Mapping Function} {} erf (@var{z})\n\ |
|
300 Computes the error function,\n\ |
|
301 @iftex\n\ |
|
302 @tex\n\ |
|
303 $$\n\ |
|
304 {\\rm erf} (z) = {2 \\over \\sqrt{\\pi}}\\int_0^z e^{-t^2} dt\n\ |
|
305 $$\n\ |
|
306 @end tex\n\ |
|
307 @end iftex\n\ |
|
308 @ifinfo\n\ |
|
309 \n\ |
|
310 @smallexample\n\ |
|
311 z\n\ |
|
312 /\n\ |
|
313 erf (z) = (2/sqrt (pi)) | e^(-t^2) dt\n\ |
|
314 /\n\ |
|
315 t=0\n\ |
|
316 @end smallexample\n\ |
|
317 @end ifinfo\n\ |
5642
|
318 @seealso{erfc, erfinv}\n\ |
|
319 @end deftypefn"); |
624
|
320 |
4100
|
321 DEFUN_MAPPER (erfc, 0, 0, 0, erfc, 0, 0, 0.0, 0.0, 0, 0, |
3321
|
322 "-*- texinfo -*-\n\ |
|
323 @deftypefn {Mapping Function} {} erfc (@var{z})\n\ |
|
324 Computes the complementary error function,\n\ |
|
325 @iftex\n\ |
|
326 @tex\n\ |
|
327 $1 - {\\rm erf} (z)$.\n\ |
|
328 @end tex\n\ |
|
329 @end iftex\n\ |
|
330 @ifinfo\n\ |
|
331 @code{1 - erf (@var{z})}.\n\ |
|
332 @end ifinfo\n\ |
5642
|
333 @seealso{erf, erfinv}\n\ |
|
334 @end deftypefn"); |
624
|
335 |
5261
|
336 DEFUN_MAPPER (exp, 0, 0, 0, exp, 0, std::exp, 0.0, 0.0, 0, 0, |
3321
|
337 "-*- texinfo -*-\n\ |
3373
|
338 @deftypefn {Mapping Function} {} exp (@var{x})\n\ |
3321
|
339 Compute the exponential of @var{x}. To compute the matrix exponential,\n\ |
|
340 see @ref{Linear Algebra}.\n\ |
|
341 @end deftypefn"); |
529
|
342 |
4100
|
343 DEFUN_MAPPER (finite, 0, xfinite, xfinite, 0, 0, 0, 0.0, 0.0, 0, 0, |
3369
|
344 "-*- texinfo -*-\n\ |
|
345 @deftypefn {Mapping Function} {} finite (@var{x})\n\ |
3600
|
346 Return 1 for elements of @var{x} that are finite values and zero\n\ |
3369
|
347 otherwise. For example,\n\ |
|
348 \n\ |
|
349 @example\n\ |
|
350 @group\n\ |
5016
|
351 finite ([13, Inf, NA, NaN])\n\ |
|
352 @result{} [ 1, 0, 0, 0 ]\n\ |
3369
|
353 @end group\n\ |
|
354 @end example\n\ |
|
355 @end deftypefn"); |
529
|
356 |
4100
|
357 DEFUN_MAPPER (fix, 0, 0, 0, fix, 0, fix, 0.0, 0.0, 0, 0, |
3321
|
358 "-*- texinfo -*-\n\ |
3373
|
359 @deftypefn {Mapping Function} {} fix (@var{x})\n\ |
3321
|
360 Truncate @var{x} toward zero. If @var{x} is complex, return\n\ |
|
361 @code{fix (real (@var{x})) + fix (imag (@var{x})) * I}.\n\ |
|
362 @end deftypefn"); |
529
|
363 |
4268
|
364 DEFUN_MAPPER (floor, 0, 0, 0, floor, 0, floor, 0.0, 0.0, 0, 0, |
3321
|
365 "-*- texinfo -*-\n\ |
3373
|
366 @deftypefn {Mapping Function} {} floor (@var{x})\n\ |
3321
|
367 Return the largest integer not greater than @var{x}. If @var{x} is\n\ |
|
368 complex, return @code{floor (real (@var{x})) + floor (imag (@var{x})) * I}.\n\ |
|
369 @end deftypefn"); |
529
|
370 |
4100
|
371 DEFUN_MAPPER (gamma, 0, 0, 0, xgamma, 0, 0, 0.0, 0.0, 0, 0, |
3321
|
372 "-*- texinfo -*-\n\ |
|
373 @deftypefn {Mapping Function} {} gamma (@var{z})\n\ |
|
374 Computes the Gamma function,\n\ |
|
375 @iftex\n\ |
|
376 @tex\n\ |
|
377 $$\n\ |
|
378 \\Gamma (z) = \\int_0^\\infty t^{z-1} e^{-t} dt.\n\ |
|
379 $$\n\ |
|
380 @end tex\n\ |
|
381 @end iftex\n\ |
|
382 @ifinfo\n\ |
|
383 \n\ |
|
384 @example\n\ |
|
385 infinity\n\ |
|
386 /\n\ |
|
387 gamma (z) = | t^(z-1) exp (-t) dt.\n\ |
|
388 /\n\ |
|
389 t=0\n\ |
|
390 @end example\n\ |
|
391 @end ifinfo\n\ |
5642
|
392 @seealso{gammai, lgamma}\n\ |
|
393 @end deftypefn"); |
624
|
394 |
4100
|
395 DEFUN_MAPPER (imag, 0, 0, 0, imag, ximag, 0, 0.0, 0.0, 0, 0, |
3321
|
396 "-*- texinfo -*-\n\ |
|
397 @deftypefn {Mapping Function} {} imag (@var{z})\n\ |
|
398 Return the imaginary part of @var{z} as a real number.\n\ |
5642
|
399 @seealso{real, conj}\n\ |
|
400 @end deftypefn"); |
2089
|
401 |
4100
|
402 DEFUN_MAPPER (isalnum, xisalnum, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
403 "-*- texinfo -*-\n\ |
|
404 @deftypefn {Mapping Function} {} isalnum (@var{s})\n\ |
|
405 Return 1 for characters that are letters or digits (@code{isalpha\n\ |
4165
|
406 (@var{s})} or @code{isdigit (@var{s})} is true).\n\ |
3361
|
407 @end deftypefn"); |
2089
|
408 |
4100
|
409 DEFUN_MAPPER (isalpha, xisalpha, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
410 "-*- texinfo -*-\n\ |
|
411 @deftypefn {Mapping Function} {} isalpha (@var{s})\n\ |
4168
|
412 @deftypefnx {Mapping Function} {} isletter (@var{s})\n\ |
4165
|
413 Return true for characters that are letters (@code{isupper (@var{s})}\n\ |
|
414 or @code{islower (@var{s})} is true).\n\ |
3361
|
415 @end deftypefn"); |
2089
|
416 |
6206
|
417 #ifdef isascii |
|
418 #undef isascii |
|
419 #endif |
|
420 |
4100
|
421 DEFUN_MAPPER (isascii, xisascii, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
422 "-*- texinfo -*-\n\ |
|
423 @deftypefn {Mapping Function} {} isascii (@var{s})\n\ |
|
424 Return 1 for characters that are ASCII (in the range 0 to 127 decimal).\n\ |
|
425 @end deftypefn"); |
2089
|
426 |
4100
|
427 DEFUN_MAPPER (iscntrl, xiscntrl, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
428 "-*- texinfo -*-\n\ |
|
429 @deftypefn {Mapping Function} {} iscntrl (@var{s})\n\ |
|
430 Return 1 for control characters.\n\ |
|
431 @end deftypefn"); |
2089
|
432 |
4100
|
433 DEFUN_MAPPER (isdigit, xisdigit, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
434 "-*- texinfo -*-\n\ |
|
435 @deftypefn {Mapping Function} {} isdigit (@var{s})\n\ |
|
436 Return 1 for characters that are decimal digits.\n\ |
|
437 @end deftypefn"); |
2089
|
438 |
4100
|
439 DEFUN_MAPPER (isinf, 0, xisinf, xisinf, 0, 0, 0, 0.0, 0.0, 0, 0, |
3369
|
440 "-*- texinfo -*-\n\ |
|
441 @deftypefn {Mapping Function} {} isinf (@var{x})\n\ |
|
442 Return 1 for elements of @var{x} that are infinite and zero\n\ |
|
443 otherwise. For example,\n\ |
|
444 \n\ |
|
445 @example\n\ |
|
446 @group\n\ |
4025
|
447 isinf ([13, Inf, NA, NaN])\n\ |
|
448 @result{} [ 0, 1, 0, 0 ]\n\ |
3369
|
449 @end group\n\ |
|
450 @end example\n\ |
|
451 @end deftypefn"); |
529
|
452 |
4100
|
453 DEFUN_MAPPER (isgraph, xisgraph, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
454 "-*- texinfo -*-\n\ |
|
455 @deftypefn {Mapping Function} {} isgraph (@var{s})\n\ |
|
456 Return 1 for printable characters (but not the space character).\n\ |
|
457 @end deftypefn"); |
529
|
458 |
4100
|
459 DEFUN_MAPPER (islower, xislower, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
460 "-*- texinfo -*-\n\ |
|
461 @deftypefn {Mapping Function} {} islower (@var{s})\n\ |
|
462 Return 1 for characters that are lower case letters.\n\ |
|
463 @end deftypefn"); |
2089
|
464 |
4100
|
465 DEFUN_MAPPER (isna, 0, octave_is_NA, octave_is_NA, 0, 0, 0, 0.0, 0.0, 0, 0, |
4025
|
466 "-*- texinfo -*-\n\ |
|
467 @deftypefn {Mapping Function} {} isna (@var{x})\n\ |
|
468 Return 1 for elements of @var{x} that are NA (missing) values and zero\n\ |
5389
|
469 otherwise. For example,\n\ |
4025
|
470 \n\ |
|
471 @example\n\ |
|
472 @group\n\ |
|
473 is_NA ([13, Inf, NA, NaN])\n\ |
|
474 @result{} [ 0, 0, 1, 0 ]\n\ |
|
475 @end group\n\ |
|
476 @end example\n\ |
|
477 @end deftypefn"); |
|
478 |
4100
|
479 DEFUN_MAPPER (isnan, 0, xisnan, xisnan, 0, 0, 0, 0.0, 0.0, 0, 0, |
3369
|
480 "-*- texinfo -*-\n\ |
|
481 @deftypefn {Mapping Function} {} isnan (@var{x})\n\ |
|
482 Return 1 for elements of @var{x} that are NaN values and zero\n\ |
5389
|
483 otherwise. NA values are also considered NaN values. For example,\n\ |
3369
|
484 \n\ |
|
485 @example\n\ |
|
486 @group\n\ |
4025
|
487 isnan ([13, Inf, NA, NaN])\n\ |
5389
|
488 @result{} [ 0, 0, 1, 1 ]\n\ |
3369
|
489 @end group\n\ |
|
490 @end example\n\ |
|
491 @end deftypefn"); |
624
|
492 |
4100
|
493 DEFUN_MAPPER (isprint, xisprint, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
494 "-*- texinfo -*-\n\ |
|
495 @deftypefn {Mapping Function} {} isprint (@var{s})\n\ |
|
496 Return 1 for printable characters (including the space character).\n\ |
|
497 @end deftypefn"); |
2089
|
498 |
4100
|
499 DEFUN_MAPPER (ispunct, xispunct, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
500 "-*- texinfo -*-\n\ |
|
501 @deftypefn {Mapping Function} {} ispunct (@var{s})\n\ |
|
502 Return 1 for punctuation characters.\n\ |
|
503 @end deftypefn"); |
2089
|
504 |
4100
|
505 DEFUN_MAPPER (isspace, xisspace, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
506 "-*- texinfo -*-\n\ |
|
507 @deftypefn {Mapping Function} {} isspace (@var{s})\n\ |
|
508 Return 1 for whitespace characters (space, formfeed, newline,\n\ |
|
509 carriage return, tab, and vertical tab).\n\ |
|
510 @end deftypefn"); |
2089
|
511 |
4100
|
512 DEFUN_MAPPER (isupper, xisupper, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
513 "-*- texinfo -*-\n\ |
|
514 @deftypefn {Mapping Function} {} isupper (@var{s})\n\ |
|
515 Return 1 for upper case letters.\n\ |
|
516 @end deftypefn"); |
2089
|
517 |
4100
|
518 DEFUN_MAPPER (isxdigit, xisxdigit, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
519 "-*- texinfo -*-\n\ |
|
520 @deftypefn {Mapping Function} {} isxdigit (@var{s})\n\ |
|
521 Return 1 for characters that are hexadecimal digits.\n\ |
|
522 @end deftypefn"); |
2089
|
523 |
4100
|
524 DEFUN_MAPPER (lgamma, 0, 0, 0, xlgamma, 0, 0, 0.0, 0.0, 0, 0, |
3321
|
525 "-*- texinfo -*-\n\ |
5518
|
526 @deftypefn {Mapping Function} {} lgamma (@var{x})\n\ |
|
527 @deftypefnx {Mapping Function} {} gammaln (@var{x})\n\ |
3321
|
528 Return the natural logarithm of the gamma function.\n\ |
5642
|
529 @seealso{gamma, gammai}\n\ |
|
530 @end deftypefn"); |
529
|
531 |
5261
|
532 DEFUN_MAPPER (log, 0, 0, 0, log, 0, std::log, 0.0, octave_Inf, 0, 1, |
3321
|
533 "-*- texinfo -*-\n\ |
|
534 @deftypefn {Mapping Function} {} log (@var{x})\n\ |
|
535 Compute the natural logarithm for each element of @var{x}. To compute the\n\ |
|
536 matrix logarithm, see @ref{Linear Algebra}.\n\ |
5642
|
537 @seealso{log2, log10, logspace, exp}\n\ |
|
538 @end deftypefn"); |
529
|
539 |
5261
|
540 DEFUN_MAPPER (log10, 0, 0, 0, log10, 0, std::log10, 0.0, octave_Inf, 0, 1, |
3321
|
541 "-*- texinfo -*-\n\ |
|
542 @deftypefn {Mapping Function} {} log10 (@var{x})\n\ |
|
543 Compute the base-10 logarithm for each element of @var{x}.\n\ |
5642
|
544 @seealso{log, log2, logspace, exp}\n\ |
|
545 @end deftypefn"); |
529
|
546 |
4100
|
547 DEFUN_MAPPER (real, 0, 0, 0, real, xreal, 0, 0.0, 0.0, 0, 0, |
3381
|
548 "-*- texinfo -*-\n\ |
3321
|
549 @deftypefn {Mapping Function} {} real (@var{z})\n\ |
|
550 Return the real part of @var{z}.\n\ |
5642
|
551 @seealso{imag, conj}\n\ |
|
552 @end deftypefn"); |
529
|
553 |
4968
|
554 DEFUN_MAPPER (round, 0, 0, 0, xround, 0, xround, 0.0, 0.0, 0, 0, |
3321
|
555 "-*- texinfo -*-\n\ |
|
556 @deftypefn {Mapping Function} {} round (@var{x})\n\ |
|
557 Return the integer nearest to @var{x}. If @var{x} is complex, return\n\ |
|
558 @code{round (real (@var{x})) + round (imag (@var{x})) * I}.\n\ |
5642
|
559 @seealso{rem}\n\ |
|
560 @end deftypefn"); |
529
|
561 |
4100
|
562 DEFUN_MAPPER (sign, 0, 0, 0, signum, 0, signum, 0.0, 0.0, 0, 0, |
3321
|
563 "-*- texinfo -*-\n\ |
|
564 @deftypefn {Mapping Function} {} sign (@var{x})\n\ |
|
565 Compute the @dfn{signum} function, which is defined as\n\ |
|
566 @iftex\n\ |
|
567 @tex\n\ |
|
568 $$\n\ |
|
569 {\\rm sign} (@var{x}) = \\cases{1,&$x>0$;\\cr 0,&$x=0$;\\cr -1,&$x<0$.\\cr}\n\ |
|
570 $$\n\ |
|
571 @end tex\n\ |
|
572 @end iftex\n\ |
|
573 @ifinfo\n\ |
|
574 \n\ |
|
575 @example\n\ |
|
576 -1, x < 0;\n\ |
|
577 sign (x) = 0, x = 0;\n\ |
|
578 1, x > 0.\n\ |
|
579 @end example\n\ |
|
580 @end ifinfo\n\ |
|
581 \n\ |
|
582 For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\ |
|
583 @end deftypefn"); |
529
|
584 |
5261
|
585 DEFUN_MAPPER (sin, 0, 0, 0, sin, 0, std::sin, 0.0, 0.0, 0, 0, |
3321
|
586 "-*- texinfo -*-\n\ |
3428
|
587 @deftypefn {Mapping Function} {} sin (@var{x})\n\ |
5016
|
588 Compute the sine of each element of @var{x}.\n\ |
3321
|
589 @end deftypefn"); |
529
|
590 |
5261
|
591 DEFUN_MAPPER (sinh, 0, 0, 0, sinh, 0, std::sinh, 0.0, 0.0, 0, 0, |
3321
|
592 "-*- texinfo -*-\n\ |
3428
|
593 @deftypefn {Mapping Function} {} sinh (@var{x})\n\ |
5418
|
594 Compute the hyperbolic sine of each element of @var{x}.\n\ |
3321
|
595 @end deftypefn"); |
529
|
596 |
5261
|
597 DEFUN_MAPPER (sqrt, 0, 0, 0, sqrt, 0, std::sqrt, 0.0, octave_Inf, 0, 1, |
3321
|
598 "-*- texinfo -*-\n\ |
|
599 @deftypefn {Mapping Function} {} sqrt (@var{x})\n\ |
|
600 Compute the square root of @var{x}. If @var{x} is negative, a complex\n\ |
|
601 result is returned. To compute the matrix square root, see\n\ |
|
602 @ref{Linear Algebra}.\n\ |
|
603 @end deftypefn"); |
529
|
604 |
5261
|
605 DEFUN_MAPPER (tan, 0, 0, 0, tan, 0, std::tan, 0.0, 0.0, 0, 0, |
3321
|
606 "-*- texinfo -*-\n\ |
|
607 @deftypefn {Mapping Function} {} tan (@var{z})\n\ |
5016
|
608 Compute tangent of each element of @var{x}.\n\ |
3321
|
609 @end deftypefn"); |
529
|
610 |
5261
|
611 DEFUN_MAPPER (tanh, 0, 0, 0, tanh, 0, std::tanh, 0.0, 0.0, 0, 0, |
3321
|
612 "-*- texinfo -*-\n\ |
3428
|
613 @deftypefn {Mapping Function} {} tanh (@var{x})\n\ |
|
614 Compute hyperbolic tangent of each element of @var{x}.\n\ |
3321
|
615 @end deftypefn"); |
1562
|
616 |
6123
|
617 #ifdef toascii |
|
618 #undef toascii |
|
619 #endif |
|
620 |
4100
|
621 DEFUN_MAPPER (toascii, xtoascii, 0, 0, 0, 0, 0, 0.0, 0.0, 1, 0, |
3361
|
622 "-*- texinfo -*-\n\ |
|
623 @deftypefn {Mapping Function} {} toascii (@var{s})\n\ |
|
624 Return ASCII representation of @var{s} in a matrix. For example,\n\ |
|
625 \n\ |
|
626 @example\n\ |
|
627 @group\n\ |
|
628 toascii (\"ASCII\")\n\ |
|
629 @result{} [ 65, 83, 67, 73, 73 ]\n\ |
|
630 @end group\n\ |
|
631 \n\ |
|
632 @end example\n\ |
3362
|
633 @end deftypefn"); |
2267
|
634 |
4100
|
635 DEFUN_MAPPER (tolower, xtolower, 0, 0, 0, 0, 0, 0.0, 0.0, 2, 0, |
3361
|
636 "-*- texinfo -*-\n\ |
|
637 @deftypefn {Mapping Function} {} tolower (@var{s})\n\ |
|
638 Return a copy of the string @var{s}, with each upper-case character\n\ |
|
639 replaced by the corresponding lower-case one; nonalphabetic characters\n\ |
|
640 are left unchanged. For example,\n\ |
|
641 \n\ |
|
642 @example\n\ |
|
643 tolower (\"MiXeD cAsE 123\")\n\ |
|
644 @result{} \"mixed case 123\"\n\ |
|
645 @end example\n\ |
3362
|
646 @end deftypefn"); |
2267
|
647 |
4100
|
648 DEFUN_MAPPER (toupper, xtoupper, 0, 0, 0, 0, 0, 0.0, 0.0, 2, 0, |
3361
|
649 "-*- texinfo -*-\n\ |
3368
|
650 @deftypefn {Built-in Function} {} toupper (@var{s})\n\ |
3361
|
651 Return a copy of the string @var{s}, with each lower-case character\n\ |
|
652 replaced by the corresponding upper-case one; nonalphabetic characters\n\ |
|
653 are left unchanged. For example,\n\ |
|
654 \n\ |
|
655 @example\n\ |
|
656 @group\n\ |
3552
|
657 toupper (\"MiXeD cAsE 123\")\n\ |
3361
|
658 @result{} \"MIXED CASE 123\"\n\ |
|
659 @end group\n\ |
|
660 @end example\n\ |
3362
|
661 @end deftypefn"); |
2267
|
662 |
1562
|
663 DEFALIAS (gammaln, lgamma); |
3206
|
664 |
|
665 DEFALIAS (isfinite, finite); |
3321
|
666 |
|
667 // Leave the previous new line, mkgendoc needs it! |
529
|
668 } |
|
669 |
1
|
670 /* |
|
671 ;;; Local Variables: *** |
|
672 ;;; mode: C++ *** |
|
673 ;;; End: *** |
|
674 */ |