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