diff src/mappers.cc @ 3321:6923abb04e16

[project @ 1999-10-26 18:15:30 by jwe]
author jwe
date Tue, 26 Oct 1999 18:15:41 +0000
parents 60866c521b92
children 8c6b4de3bdc8
line wrap: on
line diff
--- a/src/mappers.cc	Fri Oct 22 09:46:23 1999 +0000
+++ b/src/mappers.cc	Tue Oct 26 18:15:41 1999 +0000
@@ -132,67 +132,225 @@
 install_mapper_functions (void)
 {
   DEFUN_MAPPER (abs, 0, 0, 0, fabs, abs, 0, 0.0, 0.0, 0,
-    "abs (X): compute abs (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} abs (@var{z})\n\
+Compute the magnitude of @var{z}, defined as\n\
+@iftex\n\
+@tex\n\
+$|z| = \\sqrt{x^2 + y^2}$.\n\
+@end tex\n\
+@end iftex\n\
+@ifinfo\n\
+|@var{z}| = @code{sqrt (x^2 + y^2)}.\n\
+@end ifinfo\n\
+\n\
+For example,\n\
+\n\
+@example\n\
+@group\n\
+abs (3 + 4i)\n\
+     @result{} 5\n\
+@end group\n\
+@end example\n\
+@end deftypefn");
 
   DEFUN_MAPPER (acos, 0, 0, 0, acos, 0, acos, -1.0, 1.0, 1,
-    "acos (X): compute acos (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} acos (@var{X})\n\
+acos (X): compute the inverse cosine of X for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (acosh, 0, 0, 0, acosh, 0, acosh, 1.0, DBL_MAX, 1,
-    "acosh (X): compute acosh (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} acosh (@var{X})\n\
+acosh (X): compute the inverse hyperbolic cosine of X for each element of X.\n\
+@end deftypefn");
 
   DEFUN_MAPPER (angle, 0, 0, 0, arg, arg, 0, 0.0, 0.0, 0,
-    "angle (X): compute arg (X) for each element of X");
+    "See arg.")
 
   DEFUN_MAPPER (arg, 0, 0, 0, arg, arg, 0, 0.0, 0.0, 0,
-    "arg (X): compute arg (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} angle (@var{z})\n\
+Compute the argument of @var{z}, defined as\n\
+@iftex\n\
+@tex\n\
+$\\theta = \\tan^{-1}(y/x)$.\n\
+@end tex\n\
+@end iftex\n\
+@ifinfo\n\
+@var{theta} = @code{atan (@var{y}/@var{x})}.\n\
+@end ifinfo\n\
+\n\
+@noindent\n\
+in radians. \n\
+\n\
+For example,\n\
+\n\
+@example\n\
+@group\n\
+arg (3 + 4i)\n\
+     @result{} 0.92730\n\
+@end group\n\
+@end example\n\
+@end deftypefn");
 
   DEFUN_MAPPER (asin, 0, 0, 0, asin, 0, asin, -1.0, 1.0, 1,
-    "asin (X): compute asin (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} asin (@var{X})\n\
+asin (X): compute inverse sin (X) for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (asinh, 0, 0, 0, asinh, 0, asinh, 0.0, 0.0, 0,
-    "asinh (X): compute asinh (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} asinh (@var{X})\n\
+asinh (X): compute the inverse hyperbolic sin (X) for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (atan, 0, 0, 0, atan, 0, atan, 0.0, 0.0, 0,
-    "atan (X): compute atan (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} atan (@var{X})\n\
+atan (X): compute the inverse tangent of (X) for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (atanh, 0, 0, 0, atanh, 0, atanh, -1.0, 1.0, 1,
-    "atanh (X): compute atanh (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} atanh (@var{X})\n\
+atanh (X): compute the inverse hyperbolic tanget of X for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (ceil, 0, 0, 0, ceil, 0, ceil, 0.0, 0.0, 0,
-    "ceil (X): round elements of X toward +Inf");
+    "-*- texinfo -*-\n\
+@deftypefn {Usage} {} ceil (@var{x})\n\
+Return the smallest integer not less than @var{x}.  If @var{x} is\n\
+complex, return @code{ceil (real (@var{x})) + ceil (imag (@var{x})) * I}.\n\
+@end deftypefn");
 
   DEFUN_MAPPER (conj, 0, 0, 0, conj, 0, conj, 0.0, 0.0, 0,
-    "conj (X): compute complex conjugate for each element of X");
+    "-* texinfo -*-\n\
+@deftypefn {Mapping Function} {} conj (@var{z})\n\
+Return the complex conjugate of @var{z}, defined as\n\
+@iftex\n\
+@tex\n\
+$\\bar{z} = x - iy$.\n\
+@end tex\n\
+@end iftex\n\
+@ifinfo\n\
+@code{conj (@var{z})} = @var{x} - @var{i}@var{y}.\n\
+@end ifinfo\n\
+@end deftypefn\n\
+\n\
+See also: real, imag");
 
   DEFUN_MAPPER (cos, 0, 0, 0, cos, 0, cos, 0.0, 0.0, 0,
-    "cos (X): compute cos (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} cos (@var{X})\n\
+cos (X): compute the cosine of X for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (cosh, 0, 0, 0, cosh, 0, cosh, 0.0, 0.0, 0,
-    "cosh (X): compute cosh (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} acosh (@var{X})\n\
+acosh (X): compute the inverse hyperbolic cosine of X for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (erf, 0, 0, 0, xerf, 0, 0, 0.0, 0.0, 0,
-    "erf (X): compute erf (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} erf (@var{z})\n\
+Computes the error function,\n\
+@iftex\n\
+@tex\n\
+$$\n\
+ {\\rm erf} (z) = {2 \\over \\sqrt{\\pi}}\\int_0^z e^{-t^2} dt\n\
+$$\n\
+@end tex\n\
+@end iftex\n\
+@ifinfo\n\
+\n\
+@smallexample\n\
+                         z\n\
+                        /\n\
+erf (z) = (2/sqrt (pi)) | e^(-t^2) dt\n\
+                        /\n\
+                     t=0\n\
+@end smallexample\n\
+@end ifinfo\n\
+@end deftypefn\n\
+
+See also: erfc, erfinv");
 
   DEFUN_MAPPER (erfc, 0, 0, 0, xerfc, 0, 0, 0.0, 0.0, 0,
-    "erfc (X): compute erfc (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} erfc (@var{z})\n\
+Computes the complementary error function,\n\
+@iftex\n\
+@tex\n\
+$1 - {\\rm erf} (z)$.\n\
+@end tex\n\
+@end iftex\n\
+@ifinfo\n\
+@code{1 - erf (@var{z})}.\n\
+@end ifinfo\n\
+@end deftypefn\n\
+\n\
+See also: erf, erfinv");
 
   DEFUN_MAPPER (exp, 0, 0, 0, exp, 0, exp, 0.0, 0.0, 0,
-    "exp (X): compute exp (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Usage} {} exp (@var{x})\n\
+Compute the exponential of @var{x}.  To compute the matrix exponential,\n\
+see @ref{Linear Algebra}.\n\
+@end deftypefn");
 
   DEFUN_MAPPER (finite, 0, xfinite, xfinite, 0, 0, 0, 0.0, 0.0, 0,
     "finite (X): return 1 for finite elements of X");
 
   DEFUN_MAPPER (fix, 0, 0, 0, fix, 0, fix, 0.0, 0.0, 0,
-    "fix (X): round elements of X toward zero");
+    "-*- texinfo -*-\n\
+@deftypefn {Usage} {} fix (@var{x})\n\
+Truncate @var{x} toward zero.  If @var{x} is complex, return\n\
+@code{fix (real (@var{x})) + fix (imag (@var{x})) * I}.\n\
+@end deftypefn");
 
   DEFUN_MAPPER (floor, 0, 0, 0, floor, 0, floor, 0.0, 0.0, 0,
-    "floor (X): round elements of X toward -Inf");
+    "-*- texinfo -*-\n\
+@deftypefn {Usage} {} floor (@var{x})\n\
+Return the largest integer not greater than @var{x}.  If @var{x} is\n\
+complex, return @code{floor (real (@var{x})) + floor (imag (@var{x})) * I}.\n\
+@end deftypefn");
 
   DEFUN_MAPPER (gamma, 0, 0, 0, xgamma, 0, 0, 0.0, 0.0, 0,
-    "gamma (X): compute gamma (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} gamma (@var{z})\n\
+Computes the Gamma function,\n\
+@iftex\n\
+@tex\n\
+$$\n\
+ \\Gamma (z) = \\int_0^\\infty t^{z-1} e^{-t} dt.\n\
+$$\n\
+@end tex\n\
+@end iftex\n\
+@ifinfo\n\
+\n\
+@example\n\
+            infinity\n\
+            /\n\
+gamma (z) = | t^(z-1) exp (-t) dt.\n\
+            /\n\
+         t=0\n\
+@end example\n\
+@end ifinfo\n\
+@end deftypefn\n\
+\n\
+See also: gammai, lgamma");
 
   DEFUN_MAPPER (imag, 0, 0, 0, imag, imag, 0, 0.0, 0.0, 0,
-    "imag (X): return imaginary part for each elements of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} imag (@var{z})\n\
+Return the imaginary part of @var{z} as a real number.\n\
+@end deftypefn\n\
+\n\
+See also: real, conj");
 
   DEFUN_MAPPER (isalnum, xisalnum, 0, 0, 0, 0, 0, 0.0, 0.0, 0,
     "isalnum (X): ");
@@ -237,37 +395,102 @@
     "isxdigit (X): ");
 
   DEFUN_MAPPER (lgamma, 0, 0, 0, xlgamma, 0, 0, 0.0, 0.0, 0,
-    "lgamma (X): compute log gamma (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} lgamma (@var{a}, @var{x})\n\
+@deftypefnx {Mapping Function} {} gammaln (@var{a}, @var{x})\n\
+Return the natural logarithm of the gamma function.\n\
+@end deftypefn\n\
+\n\
+See also: gamma, gammai");
 
   DEFUN_MAPPER (log, 0, 0, 0, log, 0, log, 0.0, DBL_MAX, 1,
-    "log (X): compute log (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} log (@var{x})\n\
+Compute the natural logarithm for each element of @var{x}.  To compute the\n\
+matrix logarithm, see @ref{Linear Algebra}.\n\
+@end deftypefn\n\
+\n\
+See also: log2, log10, logspace, exp");
 
   DEFUN_MAPPER (log10, 0, 0, 0, log10, 0, log10, 0.0, DBL_MAX, 1,
-    "log10 (X): compute log10 (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} log10 (@var{x})\n\
+Compute the base-10 logarithm for each element of @var{x}.\n\
+@end deftypefn\n\
+\n\
+See also: log, log2, logspace, exp");
 
   DEFUN_MAPPER (real, 0, 0, 0, real, real, 0, 0.0, 0.0, 0,
-    "real (X): return real part for each element of X");
+    "-*-texinfo -*-\n\
+@deftypefn {Mapping Function} {} real (@var{z})\n\
+Return the real part of @var{z}.\n\
+@end deftypefn\n\
+\n\
+See also: imag, conj");
 
   DEFUN_MAPPER (round, 0, 0, 0, round, 0, round, 0.0, 0.0, 0,
-    "round (X): round elements of X to nearest integer");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} round (@var{x})\n\
+Return the integer nearest to @var{x}.  If @var{x} is complex, return\n\
+@code{round (real (@var{x})) + round (imag (@var{x})) * I}.\n\
+@end deftypefn\n\
+\n\
+See also: rem");
 
   DEFUN_MAPPER (sign, 0, 0, 0, signum, 0, signum, 0.0, 0.0, 0,
-    "sign (X): apply signum function to elements of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} sign (@var{x})\n\
+Compute the @dfn{signum} function, which is defined as\n\
+@iftex\n\
+@tex\n\
+$$\n\
+{\\rm sign} (@var{x}) = \\cases{1,&$x>0$;\\cr 0,&$x=0$;\\cr -1,&$x<0$.\\cr}\n\
+$$\n\
+@end tex\n\
+@end iftex\n\
+@ifinfo\n\
+\n\
+@example\n\
+           -1, x < 0;\n\
+sign (x) =  0, x = 0;\n\
+            1, x > 0.\n\
+@end example\n\
+@end ifinfo\n\
+\n\
+For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\
+@end deftypefn");
 
   DEFUN_MAPPER (sin, 0, 0, 0, sin, 0, sin, 0.0, 0.0, 0,
-    "sin (X): compute sin (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} sin (@var{X})\n\
+sin (X): compute the sin of X for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (sinh, 0, 0, 0, sinh, 0, sinh, 0.0, 0.0, 0,
-    "sinh (X): compute sinh (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} sinh (@var{X})\n\
+sinh (X): compute the inverse hyperbolic sin of X for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (sqrt, 0, 0, 0, sqrt, 0, sqrt, 0.0, DBL_MAX, 1,
-    "sqrt (X): compute sqrt (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} sqrt (@var{x})\n\
+Compute the square root of @var{x}.  If @var{x} is negative, a complex\n\
+result is returned.  To compute the matrix square root, see\n\
+@ref{Linear Algebra}.\n\
+@end deftypefn");
 
   DEFUN_MAPPER (tan, 0, 0, 0, tan, 0, tan, 0.0, 0.0, 0,
-    "tan (X): compute tan (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} tan (@var{z})\n\
+tan (X): compute tanget of X for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (tanh, 0, 0, 0, tanh, 0, tanh, 0.0, 0.0, 0,
-    "tanh (X): compute tanh (X) for each element of X");
+    "-*- texinfo -*-\n\
+@deftypefn {Mapping Function} {} tanh (@var{X})\n\
+tanh (X): compute hyperbolic tangent of X for each element of X\n\
+@end deftypefn");
 
   DEFUN_MAPPER (toascii, xtoascii, 0, 0, 0, 0, 0, 0.0, 0.0, 1,
     "toascii (STRING): return ASCII representation of STRING in a matrix");
@@ -281,6 +504,8 @@
   DEFALIAS (gammaln, lgamma);
 
   DEFALIAS (isfinite, finite);
+
+  // Leave the previous new line, mkgendoc needs it!
 }
 
 /*