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