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 |
6828
|
169 static int |
6831
|
170 dummyp (int) |
6828
|
171 { |
|
172 return 0; |
|
173 } |
|
174 |
529
|
175 void |
|
176 install_mapper_functions (void) |
|
177 { |
4524
|
178 DEFUN_MAPPER (abs, xabs, 0, 0, fabs, xabs, 0, 0.0, 0.0, 1, 0, |
3321
|
179 "-*- texinfo -*-\n\ |
|
180 @deftypefn {Mapping Function} {} abs (@var{z})\n\ |
|
181 Compute the magnitude of @var{z}, defined as\n\ |
|
182 @iftex\n\ |
|
183 @tex\n\ |
|
184 $|z| = \\sqrt{x^2 + y^2}$.\n\ |
|
185 @end tex\n\ |
|
186 @end iftex\n\ |
|
187 @ifinfo\n\ |
|
188 |@var{z}| = @code{sqrt (x^2 + y^2)}.\n\ |
|
189 @end ifinfo\n\ |
|
190 \n\ |
|
191 For example,\n\ |
|
192 \n\ |
|
193 @example\n\ |
|
194 @group\n\ |
|
195 abs (3 + 4i)\n\ |
|
196 @result{} 5\n\ |
|
197 @end group\n\ |
|
198 @end example\n\ |
|
199 @end deftypefn"); |
529
|
200 |
4268
|
201 DEFUN_MAPPER (acos, 0, 0, 0, acos, 0, acos, -1.0, 1.0, 0, 1, |
3321
|
202 "-*- texinfo -*-\n\ |
3428
|
203 @deftypefn {Mapping Function} {} acos (@var{x})\n\ |
|
204 Compute the inverse cosine of each element of @var{x}.\n\ |
3321
|
205 @end deftypefn"); |
529
|
206 |
4668
|
207 DEFUN_MAPPER (acosh, 0, 0, 0, acosh, 0, acosh, 1.0, octave_Inf, 0, 1, |
3321
|
208 "-*- texinfo -*-\n\ |
3428
|
209 @deftypefn {Mapping Function} {} acosh (@var{x})\n\ |
|
210 Compute the inverse hyperbolic cosine of each element of @var{x}.\n\ |
3321
|
211 @end deftypefn"); |
529
|
212 |
5261
|
213 DEFUN_MAPPER (angle, 0, 0, 0, arg, std::arg, 0, 0.0, 0.0, 0, 0, |
3458
|
214 "-*- texinfo -*-\n\ |
|
215 @deftypefn {Mapping Function} {} angle (@var{z})\n\ |
|
216 See arg.\n\ |
|
217 @end deftypefn"); |
529
|
218 |
5261
|
219 DEFUN_MAPPER (arg, 0, 0, 0, arg, std::arg, 0, 0.0, 0.0, 0, 0, |
3321
|
220 "-*- texinfo -*-\n\ |
3446
|
221 @deftypefn {Mapping Function} {} arg (@var{z})\n\ |
3458
|
222 @deftypefnx {Mapping Function} {} angle (@var{z})\n\ |
3321
|
223 Compute the argument of @var{z}, defined as\n\ |
|
224 @iftex\n\ |
|
225 @tex\n\ |
|
226 $\\theta = \\tan^{-1}(y/x)$.\n\ |
|
227 @end tex\n\ |
|
228 @end iftex\n\ |
|
229 @ifinfo\n\ |
|
230 @var{theta} = @code{atan (@var{y}/@var{x})}.\n\ |
|
231 @end ifinfo\n\ |
|
232 @noindent\n\ |
|
233 in radians. \n\ |
|
234 \n\ |
|
235 For example,\n\ |
|
236 \n\ |
|
237 @example\n\ |
|
238 @group\n\ |
|
239 arg (3 + 4i)\n\ |
|
240 @result{} 0.92730\n\ |
|
241 @end group\n\ |
|
242 @end example\n\ |
|
243 @end deftypefn"); |
529
|
244 |
4268
|
245 DEFUN_MAPPER (asin, 0, 0, 0, asin, 0, asin, -1.0, 1.0, 0, 1, |
3321
|
246 "-*- texinfo -*-\n\ |
3428
|
247 @deftypefn {Mapping Function} {} asin (@var{x})\n\ |
|
248 Compute the inverse sine of each element of @var{x}.\n\ |
3321
|
249 @end deftypefn"); |
529
|
250 |
4100
|
251 DEFUN_MAPPER (asinh, 0, 0, 0, asinh, 0, asinh, 0.0, 0.0, 0, 0, |
3321
|
252 "-*- texinfo -*-\n\ |
3428
|
253 @deftypefn {Mapping Function} {} asinh (@var{x})\n\ |
5016
|
254 Compute the inverse hyperbolic sine of each element of @var{x}.\n\ |
3321
|
255 @end deftypefn"); |
529
|
256 |
4268
|
257 DEFUN_MAPPER (atan, 0, 0, 0, atan, 0, atan, 0.0, 0.0, 0, 0, |
3321
|
258 "-*- texinfo -*-\n\ |
3428
|
259 @deftypefn {Mapping Function} {} atan (@var{x})\n\ |
|
260 Compute the inverse tangent of each element of @var{x}.\n\ |
3321
|
261 @end deftypefn"); |
529
|
262 |
4100
|
263 DEFUN_MAPPER (atanh, 0, 0, 0, atanh, 0, atanh, -1.0, 1.0, 0, 1, |
3321
|
264 "-*- texinfo -*-\n\ |
3428
|
265 @deftypefn {Mapping Function} {} atanh (@var{x})\n\ |
5016
|
266 Compute the inverse hyperbolic tangent of each element of @var{x}.\n\ |
3321
|
267 @end deftypefn"); |
529
|
268 |
4268
|
269 DEFUN_MAPPER (ceil, 0, 0, 0, ceil, 0, ceil, 0.0, 0.0, 0, 0, |
3321
|
270 "-*- texinfo -*-\n\ |
3373
|
271 @deftypefn {Mapping Function} {} ceil (@var{x})\n\ |
3321
|
272 Return the smallest integer not less than @var{x}. If @var{x} is\n\ |
|
273 complex, return @code{ceil (real (@var{x})) + ceil (imag (@var{x})) * I}.\n\ |
|
274 @end deftypefn"); |
529
|
275 |
4100
|
276 DEFUN_MAPPER (conj, 0, 0, 0, xconj, 0, xconj, 0.0, 0.0, 0, 0, |
3381
|
277 "-*- texinfo -*-\n\ |
3321
|
278 @deftypefn {Mapping Function} {} conj (@var{z})\n\ |
|
279 Return the complex conjugate of @var{z}, defined as\n\ |
|
280 @iftex\n\ |
|
281 @tex\n\ |
|
282 $\\bar{z} = x - iy$.\n\ |
|
283 @end tex\n\ |
|
284 @end iftex\n\ |
|
285 @ifinfo\n\ |
|
286 @code{conj (@var{z})} = @var{x} - @var{i}@var{y}.\n\ |
|
287 @end ifinfo\n\ |
5642
|
288 @seealso{real, imag}\n\ |
5646
|
289 @end deftypefn"); |
529
|
290 |
5261
|
291 DEFUN_MAPPER (cos, 0, 0, 0, cos, 0, std::cos, 0.0, 0.0, 0, 0, |
3321
|
292 "-*- texinfo -*-\n\ |
3428
|
293 @deftypefn {Mapping Function} {} cos (@var{x})\n\ |
|
294 Compute the cosine of each element of @var{x}.\n\ |
3321
|
295 @end deftypefn"); |
529
|
296 |
5261
|
297 DEFUN_MAPPER (cosh, 0, 0, 0, cosh, 0, std::cosh, 0.0, 0.0, 0, 0, |
3321
|
298 "-*- texinfo -*-\n\ |
3428
|
299 @deftypefn {Mapping Function} {} cosh (@var{x})\n\ |
|
300 Compute the hyperbolic cosine of each element of @var{x}.\n\ |
3321
|
301 @end deftypefn"); |
529
|
302 |
4100
|
303 DEFUN_MAPPER (erf, 0, 0, 0, erf, 0, 0, 0.0, 0.0, 0, 0, |
3321
|
304 "-*- texinfo -*-\n\ |
|
305 @deftypefn {Mapping Function} {} erf (@var{z})\n\ |
|
306 Computes the error function,\n\ |
|
307 @iftex\n\ |
|
308 @tex\n\ |
|
309 $$\n\ |
|
310 {\\rm erf} (z) = {2 \\over \\sqrt{\\pi}}\\int_0^z e^{-t^2} dt\n\ |
|
311 $$\n\ |
|
312 @end tex\n\ |
|
313 @end iftex\n\ |
|
314 @ifinfo\n\ |
|
315 \n\ |
|
316 @smallexample\n\ |
|
317 z\n\ |
|
318 /\n\ |
|
319 erf (z) = (2/sqrt (pi)) | e^(-t^2) dt\n\ |
|
320 /\n\ |
|
321 t=0\n\ |
|
322 @end smallexample\n\ |
|
323 @end ifinfo\n\ |
5642
|
324 @seealso{erfc, erfinv}\n\ |
|
325 @end deftypefn"); |
624
|
326 |
4100
|
327 DEFUN_MAPPER (erfc, 0, 0, 0, erfc, 0, 0, 0.0, 0.0, 0, 0, |
3321
|
328 "-*- texinfo -*-\n\ |
|
329 @deftypefn {Mapping Function} {} erfc (@var{z})\n\ |
|
330 Computes the complementary error function,\n\ |
|
331 @iftex\n\ |
|
332 @tex\n\ |
|
333 $1 - {\\rm erf} (z)$.\n\ |
|
334 @end tex\n\ |
|
335 @end iftex\n\ |
|
336 @ifinfo\n\ |
|
337 @code{1 - erf (@var{z})}.\n\ |
|
338 @end ifinfo\n\ |
5642
|
339 @seealso{erf, erfinv}\n\ |
|
340 @end deftypefn"); |
624
|
341 |
5261
|
342 DEFUN_MAPPER (exp, 0, 0, 0, exp, 0, std::exp, 0.0, 0.0, 0, 0, |
3321
|
343 "-*- texinfo -*-\n\ |
3373
|
344 @deftypefn {Mapping Function} {} exp (@var{x})\n\ |
3321
|
345 Compute the exponential of @var{x}. To compute the matrix exponential,\n\ |
|
346 see @ref{Linear Algebra}.\n\ |
|
347 @end deftypefn"); |
529
|
348 |
6830
|
349 DEFUN_MAPPER (finite, dummyp, xfinite, xfinite, 0, 0, 0, 0.0, 0.0, 0, 0, |
3369
|
350 "-*- texinfo -*-\n\ |
|
351 @deftypefn {Mapping Function} {} finite (@var{x})\n\ |
3600
|
352 Return 1 for elements of @var{x} that are finite values and zero\n\ |
3369
|
353 otherwise. For example,\n\ |
|
354 \n\ |
|
355 @example\n\ |
|
356 @group\n\ |
5016
|
357 finite ([13, Inf, NA, NaN])\n\ |
|
358 @result{} [ 1, 0, 0, 0 ]\n\ |
3369
|
359 @end group\n\ |
|
360 @end example\n\ |
|
361 @end deftypefn"); |
529
|
362 |
4100
|
363 DEFUN_MAPPER (fix, 0, 0, 0, fix, 0, fix, 0.0, 0.0, 0, 0, |
3321
|
364 "-*- texinfo -*-\n\ |
3373
|
365 @deftypefn {Mapping Function} {} fix (@var{x})\n\ |
3321
|
366 Truncate @var{x} toward zero. If @var{x} is complex, return\n\ |
|
367 @code{fix (real (@var{x})) + fix (imag (@var{x})) * I}.\n\ |
|
368 @end deftypefn"); |
529
|
369 |
4268
|
370 DEFUN_MAPPER (floor, 0, 0, 0, floor, 0, floor, 0.0, 0.0, 0, 0, |
3321
|
371 "-*- texinfo -*-\n\ |
3373
|
372 @deftypefn {Mapping Function} {} floor (@var{x})\n\ |
3321
|
373 Return the largest integer not greater than @var{x}. If @var{x} is\n\ |
|
374 complex, return @code{floor (real (@var{x})) + floor (imag (@var{x})) * I}.\n\ |
|
375 @end deftypefn"); |
529
|
376 |
4100
|
377 DEFUN_MAPPER (gamma, 0, 0, 0, xgamma, 0, 0, 0.0, 0.0, 0, 0, |
3321
|
378 "-*- texinfo -*-\n\ |
|
379 @deftypefn {Mapping Function} {} gamma (@var{z})\n\ |
|
380 Computes the Gamma function,\n\ |
|
381 @iftex\n\ |
|
382 @tex\n\ |
|
383 $$\n\ |
|
384 \\Gamma (z) = \\int_0^\\infty t^{z-1} e^{-t} dt.\n\ |
|
385 $$\n\ |
|
386 @end tex\n\ |
|
387 @end iftex\n\ |
|
388 @ifinfo\n\ |
|
389 \n\ |
|
390 @example\n\ |
|
391 infinity\n\ |
|
392 /\n\ |
|
393 gamma (z) = | t^(z-1) exp (-t) dt.\n\ |
|
394 /\n\ |
|
395 t=0\n\ |
|
396 @end example\n\ |
|
397 @end ifinfo\n\ |
5642
|
398 @seealso{gammai, lgamma}\n\ |
|
399 @end deftypefn"); |
624
|
400 |
4100
|
401 DEFUN_MAPPER (imag, 0, 0, 0, imag, ximag, 0, 0.0, 0.0, 0, 0, |
3321
|
402 "-*- texinfo -*-\n\ |
|
403 @deftypefn {Mapping Function} {} imag (@var{z})\n\ |
|
404 Return the imaginary part of @var{z} as a real number.\n\ |
5642
|
405 @seealso{real, conj}\n\ |
|
406 @end deftypefn"); |
2089
|
407 |
4100
|
408 DEFUN_MAPPER (isalnum, xisalnum, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
409 "-*- texinfo -*-\n\ |
|
410 @deftypefn {Mapping Function} {} isalnum (@var{s})\n\ |
|
411 Return 1 for characters that are letters or digits (@code{isalpha\n\ |
4165
|
412 (@var{s})} or @code{isdigit (@var{s})} is true).\n\ |
3361
|
413 @end deftypefn"); |
2089
|
414 |
4100
|
415 DEFUN_MAPPER (isalpha, xisalpha, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
416 "-*- texinfo -*-\n\ |
|
417 @deftypefn {Mapping Function} {} isalpha (@var{s})\n\ |
4168
|
418 @deftypefnx {Mapping Function} {} isletter (@var{s})\n\ |
4165
|
419 Return true for characters that are letters (@code{isupper (@var{s})}\n\ |
|
420 or @code{islower (@var{s})} is true).\n\ |
3361
|
421 @end deftypefn"); |
2089
|
422 |
6206
|
423 #ifdef isascii |
|
424 #undef isascii |
|
425 #endif |
|
426 |
4100
|
427 DEFUN_MAPPER (isascii, xisascii, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
428 "-*- texinfo -*-\n\ |
|
429 @deftypefn {Mapping Function} {} isascii (@var{s})\n\ |
|
430 Return 1 for characters that are ASCII (in the range 0 to 127 decimal).\n\ |
|
431 @end deftypefn"); |
2089
|
432 |
4100
|
433 DEFUN_MAPPER (iscntrl, xiscntrl, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
434 "-*- texinfo -*-\n\ |
|
435 @deftypefn {Mapping Function} {} iscntrl (@var{s})\n\ |
|
436 Return 1 for control characters.\n\ |
|
437 @end deftypefn"); |
2089
|
438 |
4100
|
439 DEFUN_MAPPER (isdigit, xisdigit, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
440 "-*- texinfo -*-\n\ |
|
441 @deftypefn {Mapping Function} {} isdigit (@var{s})\n\ |
|
442 Return 1 for characters that are decimal digits.\n\ |
|
443 @end deftypefn"); |
2089
|
444 |
6830
|
445 DEFUN_MAPPER (isinf, dummyp, xisinf, xisinf, 0, 0, 0, 0.0, 0.0, 0, 0, |
3369
|
446 "-*- texinfo -*-\n\ |
|
447 @deftypefn {Mapping Function} {} isinf (@var{x})\n\ |
|
448 Return 1 for elements of @var{x} that are infinite and zero\n\ |
|
449 otherwise. For example,\n\ |
|
450 \n\ |
|
451 @example\n\ |
|
452 @group\n\ |
4025
|
453 isinf ([13, Inf, NA, NaN])\n\ |
|
454 @result{} [ 0, 1, 0, 0 ]\n\ |
3369
|
455 @end group\n\ |
|
456 @end example\n\ |
|
457 @end deftypefn"); |
529
|
458 |
4100
|
459 DEFUN_MAPPER (isgraph, xisgraph, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
460 "-*- texinfo -*-\n\ |
|
461 @deftypefn {Mapping Function} {} isgraph (@var{s})\n\ |
|
462 Return 1 for printable characters (but not the space character).\n\ |
|
463 @end deftypefn"); |
529
|
464 |
4100
|
465 DEFUN_MAPPER (islower, xislower, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
466 "-*- texinfo -*-\n\ |
|
467 @deftypefn {Mapping Function} {} islower (@var{s})\n\ |
|
468 Return 1 for characters that are lower case letters.\n\ |
|
469 @end deftypefn"); |
2089
|
470 |
6830
|
471 DEFUN_MAPPER (isna, dummyp, octave_is_NA, octave_is_NA, 0, 0, 0, 0.0, 0.0, 0, 0, |
4025
|
472 "-*- texinfo -*-\n\ |
|
473 @deftypefn {Mapping Function} {} isna (@var{x})\n\ |
|
474 Return 1 for elements of @var{x} that are NA (missing) values and zero\n\ |
5389
|
475 otherwise. For example,\n\ |
4025
|
476 \n\ |
|
477 @example\n\ |
|
478 @group\n\ |
6218
|
479 isna ([13, Inf, NA, NaN])\n\ |
4025
|
480 @result{} [ 0, 0, 1, 0 ]\n\ |
|
481 @end group\n\ |
|
482 @end example\n\ |
|
483 @end deftypefn"); |
|
484 |
6830
|
485 DEFUN_MAPPER (isnan, dummyp, xisnan, xisnan, 0, 0, 0, 0.0, 0.0, 0, 0, |
3369
|
486 "-*- texinfo -*-\n\ |
|
487 @deftypefn {Mapping Function} {} isnan (@var{x})\n\ |
|
488 Return 1 for elements of @var{x} that are NaN values and zero\n\ |
5389
|
489 otherwise. NA values are also considered NaN values. For example,\n\ |
3369
|
490 \n\ |
|
491 @example\n\ |
|
492 @group\n\ |
4025
|
493 isnan ([13, Inf, NA, NaN])\n\ |
5389
|
494 @result{} [ 0, 0, 1, 1 ]\n\ |
3369
|
495 @end group\n\ |
|
496 @end example\n\ |
|
497 @end deftypefn"); |
624
|
498 |
4100
|
499 DEFUN_MAPPER (isprint, xisprint, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
500 "-*- texinfo -*-\n\ |
|
501 @deftypefn {Mapping Function} {} isprint (@var{s})\n\ |
|
502 Return 1 for printable characters (including the space character).\n\ |
|
503 @end deftypefn"); |
2089
|
504 |
4100
|
505 DEFUN_MAPPER (ispunct, xispunct, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
506 "-*- texinfo -*-\n\ |
|
507 @deftypefn {Mapping Function} {} ispunct (@var{s})\n\ |
|
508 Return 1 for punctuation characters.\n\ |
|
509 @end deftypefn"); |
2089
|
510 |
4100
|
511 DEFUN_MAPPER (isspace, xisspace, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
512 "-*- texinfo -*-\n\ |
|
513 @deftypefn {Mapping Function} {} isspace (@var{s})\n\ |
|
514 Return 1 for whitespace characters (space, formfeed, newline,\n\ |
|
515 carriage return, tab, and vertical tab).\n\ |
|
516 @end deftypefn"); |
2089
|
517 |
4100
|
518 DEFUN_MAPPER (isupper, xisupper, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
519 "-*- texinfo -*-\n\ |
|
520 @deftypefn {Mapping Function} {} isupper (@var{s})\n\ |
|
521 Return 1 for upper case letters.\n\ |
|
522 @end deftypefn"); |
2089
|
523 |
4100
|
524 DEFUN_MAPPER (isxdigit, xisxdigit, 0, 0, 0, 0, 0, 0.0, 0.0, 0, 0, |
3361
|
525 "-*- texinfo -*-\n\ |
|
526 @deftypefn {Mapping Function} {} isxdigit (@var{s})\n\ |
|
527 Return 1 for characters that are hexadecimal digits.\n\ |
|
528 @end deftypefn"); |
2089
|
529 |
6969
|
530 DEFUN_MAPPER (lgamma, 0, 0, 0, xlgamma, 0, 0, 0.0, 0.0, 0, 0, |
3321
|
531 "-*- texinfo -*-\n\ |
5518
|
532 @deftypefn {Mapping Function} {} lgamma (@var{x})\n\ |
|
533 @deftypefnx {Mapping Function} {} gammaln (@var{x})\n\ |
6969
|
534 Return the natural logarithm of the absolute value of the gamma\n\ |
|
535 function of @var{x}.\n\ |
5642
|
536 @seealso{gamma, gammai}\n\ |
|
537 @end deftypefn"); |
529
|
538 |
5261
|
539 DEFUN_MAPPER (log, 0, 0, 0, log, 0, std::log, 0.0, octave_Inf, 0, 1, |
3321
|
540 "-*- texinfo -*-\n\ |
|
541 @deftypefn {Mapping Function} {} log (@var{x})\n\ |
|
542 Compute the natural logarithm for each element of @var{x}. To compute the\n\ |
|
543 matrix logarithm, see @ref{Linear Algebra}.\n\ |
5642
|
544 @seealso{log2, log10, logspace, exp}\n\ |
|
545 @end deftypefn"); |
529
|
546 |
5261
|
547 DEFUN_MAPPER (log10, 0, 0, 0, log10, 0, std::log10, 0.0, octave_Inf, 0, 1, |
3321
|
548 "-*- texinfo -*-\n\ |
|
549 @deftypefn {Mapping Function} {} log10 (@var{x})\n\ |
|
550 Compute the base-10 logarithm for each element of @var{x}.\n\ |
5642
|
551 @seealso{log, log2, logspace, exp}\n\ |
|
552 @end deftypefn"); |
529
|
553 |
4100
|
554 DEFUN_MAPPER (real, 0, 0, 0, real, xreal, 0, 0.0, 0.0, 0, 0, |
3381
|
555 "-*- texinfo -*-\n\ |
3321
|
556 @deftypefn {Mapping Function} {} real (@var{z})\n\ |
|
557 Return the real part of @var{z}.\n\ |
5642
|
558 @seealso{imag, conj}\n\ |
|
559 @end deftypefn"); |
529
|
560 |
4968
|
561 DEFUN_MAPPER (round, 0, 0, 0, xround, 0, xround, 0.0, 0.0, 0, 0, |
3321
|
562 "-*- texinfo -*-\n\ |
|
563 @deftypefn {Mapping Function} {} round (@var{x})\n\ |
|
564 Return the integer nearest to @var{x}. If @var{x} is complex, return\n\ |
|
565 @code{round (real (@var{x})) + round (imag (@var{x})) * I}.\n\ |
5642
|
566 @seealso{rem}\n\ |
|
567 @end deftypefn"); |
529
|
568 |
4100
|
569 DEFUN_MAPPER (sign, 0, 0, 0, signum, 0, signum, 0.0, 0.0, 0, 0, |
3321
|
570 "-*- texinfo -*-\n\ |
|
571 @deftypefn {Mapping Function} {} sign (@var{x})\n\ |
|
572 Compute the @dfn{signum} function, which is defined as\n\ |
|
573 @iftex\n\ |
|
574 @tex\n\ |
|
575 $$\n\ |
|
576 {\\rm sign} (@var{x}) = \\cases{1,&$x>0$;\\cr 0,&$x=0$;\\cr -1,&$x<0$.\\cr}\n\ |
|
577 $$\n\ |
|
578 @end tex\n\ |
|
579 @end iftex\n\ |
|
580 @ifinfo\n\ |
|
581 \n\ |
|
582 @example\n\ |
|
583 -1, x < 0;\n\ |
|
584 sign (x) = 0, x = 0;\n\ |
|
585 1, x > 0.\n\ |
|
586 @end example\n\ |
|
587 @end ifinfo\n\ |
|
588 \n\ |
|
589 For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\ |
|
590 @end deftypefn"); |
529
|
591 |
5261
|
592 DEFUN_MAPPER (sin, 0, 0, 0, sin, 0, std::sin, 0.0, 0.0, 0, 0, |
3321
|
593 "-*- texinfo -*-\n\ |
3428
|
594 @deftypefn {Mapping Function} {} sin (@var{x})\n\ |
5016
|
595 Compute the sine of each element of @var{x}.\n\ |
3321
|
596 @end deftypefn"); |
529
|
597 |
5261
|
598 DEFUN_MAPPER (sinh, 0, 0, 0, sinh, 0, std::sinh, 0.0, 0.0, 0, 0, |
3321
|
599 "-*- texinfo -*-\n\ |
3428
|
600 @deftypefn {Mapping Function} {} sinh (@var{x})\n\ |
5418
|
601 Compute the hyperbolic sine of each element of @var{x}.\n\ |
3321
|
602 @end deftypefn"); |
529
|
603 |
5261
|
604 DEFUN_MAPPER (sqrt, 0, 0, 0, sqrt, 0, std::sqrt, 0.0, octave_Inf, 0, 1, |
3321
|
605 "-*- texinfo -*-\n\ |
|
606 @deftypefn {Mapping Function} {} sqrt (@var{x})\n\ |
|
607 Compute the square root of @var{x}. If @var{x} is negative, a complex\n\ |
|
608 result is returned. To compute the matrix square root, see\n\ |
|
609 @ref{Linear Algebra}.\n\ |
|
610 @end deftypefn"); |
529
|
611 |
5261
|
612 DEFUN_MAPPER (tan, 0, 0, 0, tan, 0, std::tan, 0.0, 0.0, 0, 0, |
3321
|
613 "-*- texinfo -*-\n\ |
|
614 @deftypefn {Mapping Function} {} tan (@var{z})\n\ |
5016
|
615 Compute tangent of each element of @var{x}.\n\ |
3321
|
616 @end deftypefn"); |
529
|
617 |
5261
|
618 DEFUN_MAPPER (tanh, 0, 0, 0, tanh, 0, std::tanh, 0.0, 0.0, 0, 0, |
3321
|
619 "-*- texinfo -*-\n\ |
3428
|
620 @deftypefn {Mapping Function} {} tanh (@var{x})\n\ |
|
621 Compute hyperbolic tangent of each element of @var{x}.\n\ |
3321
|
622 @end deftypefn"); |
1562
|
623 |
6123
|
624 #ifdef toascii |
|
625 #undef toascii |
|
626 #endif |
|
627 |
4100
|
628 DEFUN_MAPPER (toascii, xtoascii, 0, 0, 0, 0, 0, 0.0, 0.0, 1, 0, |
3361
|
629 "-*- texinfo -*-\n\ |
|
630 @deftypefn {Mapping Function} {} toascii (@var{s})\n\ |
|
631 Return ASCII representation of @var{s} in a matrix. For example,\n\ |
|
632 \n\ |
|
633 @example\n\ |
|
634 @group\n\ |
|
635 toascii (\"ASCII\")\n\ |
|
636 @result{} [ 65, 83, 67, 73, 73 ]\n\ |
|
637 @end group\n\ |
|
638 \n\ |
|
639 @end example\n\ |
3362
|
640 @end deftypefn"); |
2267
|
641 |
4100
|
642 DEFUN_MAPPER (tolower, xtolower, 0, 0, 0, 0, 0, 0.0, 0.0, 2, 0, |
3361
|
643 "-*- texinfo -*-\n\ |
|
644 @deftypefn {Mapping Function} {} tolower (@var{s})\n\ |
|
645 Return a copy of the string @var{s}, with each upper-case character\n\ |
|
646 replaced by the corresponding lower-case one; nonalphabetic characters\n\ |
|
647 are left unchanged. For example,\n\ |
|
648 \n\ |
|
649 @example\n\ |
|
650 tolower (\"MiXeD cAsE 123\")\n\ |
|
651 @result{} \"mixed case 123\"\n\ |
|
652 @end example\n\ |
3362
|
653 @end deftypefn"); |
2267
|
654 |
4100
|
655 DEFUN_MAPPER (toupper, xtoupper, 0, 0, 0, 0, 0, 0.0, 0.0, 2, 0, |
3361
|
656 "-*- texinfo -*-\n\ |
3368
|
657 @deftypefn {Built-in Function} {} toupper (@var{s})\n\ |
3361
|
658 Return a copy of the string @var{s}, with each lower-case character\n\ |
|
659 replaced by the corresponding upper-case one; nonalphabetic characters\n\ |
|
660 are left unchanged. For example,\n\ |
|
661 \n\ |
|
662 @example\n\ |
|
663 @group\n\ |
3552
|
664 toupper (\"MiXeD cAsE 123\")\n\ |
3361
|
665 @result{} \"MIXED CASE 123\"\n\ |
|
666 @end group\n\ |
|
667 @end example\n\ |
3362
|
668 @end deftypefn"); |
2267
|
669 |
1562
|
670 DEFALIAS (gammaln, lgamma); |
3206
|
671 |
|
672 DEFALIAS (isfinite, finite); |
3321
|
673 |
|
674 // Leave the previous new line, mkgendoc needs it! |
529
|
675 } |
|
676 |
1
|
677 /* |
|
678 ;;; Local Variables: *** |
|
679 ;;; mode: C++ *** |
|
680 ;;; End: *** |
|
681 */ |