Mercurial > octave-nkf
comparison libinterp/corefcn/data.cc @ 20207:4f45eaf83908 stable
doc: Update more docstrings to have one sentence summary as first line.
Reviewed libinterp/corefcn directory.
* libinterp/corefcn/__ilu__.cc, libinterp/corefcn/balance.cc,
libinterp/corefcn/besselj.cc, libinterp/corefcn/betainc.cc,
libinterp/corefcn/bitfcns.cc, libinterp/corefcn/bsxfun.cc,
libinterp/corefcn/cellfun.cc, libinterp/corefcn/colloc.cc,
libinterp/corefcn/conv2.cc, libinterp/corefcn/data.cc,
libinterp/corefcn/debug.cc, libinterp/corefcn/defaults.cc,
libinterp/corefcn/det.cc, libinterp/corefcn/dirfns.cc,
libinterp/corefcn/dlmread.cc, libinterp/corefcn/dot.cc,
libinterp/corefcn/eig.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/fft2.cc, libinterp/corefcn/fftn.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/filter.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gammainc.cc,
libinterp/corefcn/gcd.cc, libinterp/corefcn/getgrent.cc,
libinterp/corefcn/getpwent.cc, libinterp/corefcn/getrusage.cc,
libinterp/corefcn/graphics.cc, libinterp/corefcn/help.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/inv.cc, libinterp/corefcn/kron.cc,
libinterp/corefcn/load-path.cc, libinterp/corefcn/load-save.cc,
libinterp/corefcn/lookup.cc, libinterp/corefcn/ls-oct-ascii.cc,
libinterp/corefcn/lsode.cc, libinterp/corefcn/lu.cc,
libinterp/corefcn/luinc.cc, libinterp/corefcn/mappers.cc,
libinterp/corefcn/matrix_type.cc, libinterp/corefcn/max.cc,
libinterp/corefcn/md5sum.cc, libinterp/corefcn/mgorth.cc,
libinterp/corefcn/nproc.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/ordschur.cc, libinterp/corefcn/pager.cc,
libinterp/corefcn/pinv.cc, libinterp/corefcn/pr-output.cc,
libinterp/corefcn/pt-jit.cc, libinterp/corefcn/quad.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/qz.cc,
libinterp/corefcn/rand.cc, libinterp/corefcn/rcond.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc,
libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sparse.cc,
libinterp/corefcn/spparms.cc, libinterp/corefcn/str2double.cc,
libinterp/corefcn/strfind.cc, libinterp/corefcn/strfns.cc,
libinterp/corefcn/sub2ind.cc, libinterp/corefcn/svd.cc,
libinterp/corefcn/symtab.cc, libinterp/corefcn/syscalls.cc,
libinterp/corefcn/sysdep.cc, libinterp/corefcn/time.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/tril.cc,
libinterp/corefcn/tsearch.cc, libinterp/corefcn/typecast.cc,
libinterp/corefcn/urlwrite.cc, libinterp/corefcn/utils.cc,
libinterp/corefcn/variables.cc, scripts/polynomial/spline.m:
Update more docstrings to have one sentence summary as first line.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 09 May 2015 17:19:30 -0700 |
parents | 19755f4fc851 |
children | 4e7f12a763cd |
comparison
equal
deleted
inserted
replaced
20206:b70f8da6dcd3 | 20207:4f45eaf83908 |
---|---|
212 | 212 |
213 DEFUN (atan2, args, , | 213 DEFUN (atan2, args, , |
214 "-*- texinfo -*-\n\ | 214 "-*- texinfo -*-\n\ |
215 @deftypefn {Mapping Function} {} atan2 (@var{y}, @var{x})\n\ | 215 @deftypefn {Mapping Function} {} atan2 (@var{y}, @var{x})\n\ |
216 Compute atan (@var{y} / @var{x}) for corresponding elements of @var{y}\n\ | 216 Compute atan (@var{y} / @var{x}) for corresponding elements of @var{y}\n\ |
217 and @var{x}. Signal an error if @var{y} and @var{x} do not match in size\n\ | 217 and @var{x}.\n\ |
218 and orientation.\n\ | 218 \n\ |
219 @var{y} and @var{x} must match in size and orientation.\n\ | |
219 @seealso{tan, tand, tanh, atanh}\n\ | 220 @seealso{tan, tand, tanh, atanh}\n\ |
220 @end deftypefn") | 221 @end deftypefn") |
221 { | 222 { |
222 octave_value retval; | 223 octave_value retval; |
223 | 224 |
382 DEFUN (hypot, args, , | 383 DEFUN (hypot, args, , |
383 "-*- texinfo -*-\n\ | 384 "-*- texinfo -*-\n\ |
384 @deftypefn {Built-in Function} {} hypot (@var{x}, @var{y})\n\ | 385 @deftypefn {Built-in Function} {} hypot (@var{x}, @var{y})\n\ |
385 @deftypefnx {Built-in Function} {} hypot (@var{x}, @var{y}, @var{z}, @dots{})\n\ | 386 @deftypefnx {Built-in Function} {} hypot (@var{x}, @var{y}, @var{z}, @dots{})\n\ |
386 Compute the element-by-element square root of the sum of the squares of\n\ | 387 Compute the element-by-element square root of the sum of the squares of\n\ |
387 @var{x} and @var{y}. This is equivalent to\n\ | 388 @var{x} and @var{y}.\n\ |
388 @code{sqrt (@var{x}.^2 + @var{y}.^2)}, but calculated in a manner that\n\ | 389 \n\ |
390 This is equivalent to\n\ | |
391 @code{sqrt (@var{x}.^2 + @var{y}.^2)}, but is calculated in a manner that\n\ | |
389 avoids overflows for large values of @var{x} or @var{y}.\n\ | 392 avoids overflows for large values of @var{x} or @var{y}.\n\ |
393 \n\ | |
390 @code{hypot} can also be called with more than 2 arguments; in this case,\n\ | 394 @code{hypot} can also be called with more than 2 arguments; in this case,\n\ |
391 the arguments are accumulated from left to right:\n\ | 395 the arguments are accumulated from left to right:\n\ |
392 \n\ | 396 \n\ |
393 @example\n\ | 397 @example\n\ |
394 @group\n\ | 398 @group\n\ |
575 */ | 579 */ |
576 | 580 |
577 DEFUN (rem, args, , | 581 DEFUN (rem, args, , |
578 "-*- texinfo -*-\n\ | 582 "-*- texinfo -*-\n\ |
579 @deftypefn {Mapping Function} {} rem (@var{x}, @var{y})\n\ | 583 @deftypefn {Mapping Function} {} rem (@var{x}, @var{y})\n\ |
580 Return the remainder of the division @code{@var{x} / @var{y}}, computed\n\ | 584 Return the remainder of the division @code{@var{x} / @var{y}}.\n\ |
581 using the expression\n\ | 585 \n\ |
586 The remainder is computed using the expression\n\ | |
582 \n\ | 587 \n\ |
583 @example\n\ | 588 @example\n\ |
584 x - y .* fix (x ./ y)\n\ | 589 x - y .* fix (x ./ y)\n\ |
585 @end example\n\ | 590 @end example\n\ |
586 \n\ | 591 \n\ |
587 An error message is printed if the dimensions of the arguments do not\n\ | 592 An error message is printed if the dimensions of the arguments do not agree,\n\ |
588 agree, or if either of the arguments is complex.\n\ | 593 or if either of the arguments is complex.\n\ |
589 @seealso{mod}\n\ | 594 @seealso{mod}\n\ |
590 @end deftypefn") | 595 @end deftypefn") |
591 { | 596 { |
592 octave_value retval; | 597 octave_value retval; |
593 | 598 |
727 */ | 732 */ |
728 | 733 |
729 DEFUN (mod, args, , | 734 DEFUN (mod, args, , |
730 "-*- texinfo -*-\n\ | 735 "-*- texinfo -*-\n\ |
731 @deftypefn {Mapping Function} {} mod (@var{x}, @var{y})\n\ | 736 @deftypefn {Mapping Function} {} mod (@var{x}, @var{y})\n\ |
732 Compute the modulo of @var{x} and @var{y}. Conceptually this is given by\n\ | 737 Compute the modulo of @var{x} and @var{y}.\n\ |
738 \n\ | |
739 Conceptually this is given by\n\ | |
733 \n\ | 740 \n\ |
734 @example\n\ | 741 @example\n\ |
735 x - y .* floor (x ./ y)\n\ | 742 x - y .* floor (x ./ y)\n\ |
736 @end example\n\ | 743 @end example\n\ |
737 \n\ | 744 \n\ |
738 @noindent\n\ | 745 @noindent\n\ |
739 and is written such that the correct modulus is returned for\n\ | 746 and is written such that the correct modulus is returned for integer types.\n\ |
740 integer types. This function handles negative values correctly. That\n\ | 747 This function handles negative values correctly. That is,\n\ |
741 is, @code{mod (-1, 3)} is 2, not -1, as @code{rem (-1, 3)} returns.\n\ | 748 @code{mod (-1, 3)} is 2, not -1, as @code{rem (-1, 3)} returns.\n\ |
742 @code{mod (@var{x}, 0)} returns @var{x}.\n\ | 749 @code{mod (@var{x}, 0)} returns @var{x}.\n\ |
743 \n\ | 750 \n\ |
744 An error results if the dimensions of the arguments do not agree, or if\n\ | 751 An error results if the dimensions of the arguments do not agree, or if\n\ |
745 either of the arguments is complex.\n\ | 752 either of the arguments is complex.\n\ |
746 @seealso{rem}\n\ | 753 @seealso{rem}\n\ |
1138 | 1145 |
1139 DEFUN (cumprod, args, , | 1146 DEFUN (cumprod, args, , |
1140 "-*- texinfo -*-\n\ | 1147 "-*- texinfo -*-\n\ |
1141 @deftypefn {Built-in Function} {} cumprod (@var{x})\n\ | 1148 @deftypefn {Built-in Function} {} cumprod (@var{x})\n\ |
1142 @deftypefnx {Built-in Function} {} cumprod (@var{x}, @var{dim})\n\ | 1149 @deftypefnx {Built-in Function} {} cumprod (@var{x}, @var{dim})\n\ |
1143 Cumulative product of elements along dimension @var{dim}. If\n\ | 1150 Cumulative product of elements along dimension @var{dim}.\n\ |
1144 @var{dim} is omitted, it defaults to the first non-singleton dimension.\n\ | 1151 \n\ |
1145 \n\ | 1152 If @var{dim} is omitted, it defaults to the first non-singleton dimension.\n\ |
1146 @seealso{prod, cumsum}\n\ | 1153 @seealso{prod, cumsum}\n\ |
1147 @end deftypefn") | 1154 @end deftypefn") |
1148 { | 1155 { |
1149 DATA_REDUCTION (cumprod); | 1156 DATA_REDUCTION (cumprod); |
1150 } | 1157 } |
1174 @deftypefn {Built-in Function} {} cumsum (@var{x})\n\ | 1181 @deftypefn {Built-in Function} {} cumsum (@var{x})\n\ |
1175 @deftypefnx {Built-in Function} {} cumsum (@var{x}, @var{dim})\n\ | 1182 @deftypefnx {Built-in Function} {} cumsum (@var{x}, @var{dim})\n\ |
1176 @deftypefnx {Built-in Function} {} cumsum (@dots{}, \"native\")\n\ | 1183 @deftypefnx {Built-in Function} {} cumsum (@dots{}, \"native\")\n\ |
1177 @deftypefnx {Built-in Function} {} cumsum (@dots{}, \"double\")\n\ | 1184 @deftypefnx {Built-in Function} {} cumsum (@dots{}, \"double\")\n\ |
1178 @deftypefnx {Built-in Function} {} cumsum (@dots{}, \"extra\")\n\ | 1185 @deftypefnx {Built-in Function} {} cumsum (@dots{}, \"extra\")\n\ |
1179 Cumulative sum of elements along dimension @var{dim}. If @var{dim}\n\ | 1186 Cumulative sum of elements along dimension @var{dim}.\n\ |
1180 is omitted, it defaults to the first non-singleton dimension.\n\ | 1187 \n\ |
1188 If @var{dim} is omitted, it defaults to the first non-singleton dimension.\n\ | |
1181 \n\ | 1189 \n\ |
1182 See @code{sum} for an explanation of the optional parameters\n\ | 1190 See @code{sum} for an explanation of the optional parameters\n\ |
1183 @qcode{\"native\"}, @qcode{\"double\"}, and @qcode{\"extra\"}.\n\ | 1191 @qcode{\"native\"}, @qcode{\"double\"}, and @qcode{\"extra\"}.\n\ |
1184 @seealso{sum, cumprod}\n\ | 1192 @seealso{sum, cumprod}\n\ |
1185 @end deftypefn") | 1193 @end deftypefn") |
1320 @deftypefn {Built-in Function} {@var{M} =} diag (@var{v})\n\ | 1328 @deftypefn {Built-in Function} {@var{M} =} diag (@var{v})\n\ |
1321 @deftypefnx {Built-in Function} {@var{M} =} diag (@var{v}, @var{k})\n\ | 1329 @deftypefnx {Built-in Function} {@var{M} =} diag (@var{v}, @var{k})\n\ |
1322 @deftypefnx {Built-in Function} {@var{M} =} diag (@var{v}, @var{m}, @var{n})\n\ | 1330 @deftypefnx {Built-in Function} {@var{M} =} diag (@var{v}, @var{m}, @var{n})\n\ |
1323 @deftypefnx {Built-in Function} {@var{v} =} diag (@var{M})\n\ | 1331 @deftypefnx {Built-in Function} {@var{v} =} diag (@var{M})\n\ |
1324 @deftypefnx {Built-in Function} {@var{v} =} diag (@var{M}, @var{k})\n\ | 1332 @deftypefnx {Built-in Function} {@var{v} =} diag (@var{M}, @var{k})\n\ |
1325 Return a diagonal matrix with vector @var{v} on diagonal @var{k}. The\n\ | 1333 Return a diagonal matrix with vector @var{v} on diagonal @var{k}.\n\ |
1326 second argument is optional. If it is positive, the vector is placed on\n\ | 1334 \n\ |
1335 The second argument is optional. If it is positive, the vector is placed on\n\ | |
1327 the @var{k}-th superdiagonal. If it is negative, it is placed on the\n\ | 1336 the @var{k}-th superdiagonal. If it is negative, it is placed on the\n\ |
1328 @var{-k}-th subdiagonal. The default value of @var{k} is 0, and the\n\ | 1337 @var{-k}-th subdiagonal. The default value of @var{k} is 0, and the vector\n\ |
1329 vector is placed on the main diagonal. For example:\n\ | 1338 is placed on the main diagonal. For example:\n\ |
1330 \n\ | 1339 \n\ |
1331 @example\n\ | 1340 @example\n\ |
1332 @group\n\ | 1341 @group\n\ |
1333 diag ([1, 2, 3], 1)\n\ | 1342 diag ([1, 2, 3], 1)\n\ |
1334 @result{} 0 1 0 0\n\ | 1343 @result{} 0 1 0 0\n\ |
2593 | 2602 |
2594 DEFUN (permute, args, , | 2603 DEFUN (permute, args, , |
2595 "-*- texinfo -*-\n\ | 2604 "-*- texinfo -*-\n\ |
2596 @deftypefn {Built-in Function} {} permute (@var{A}, @var{perm})\n\ | 2605 @deftypefn {Built-in Function} {} permute (@var{A}, @var{perm})\n\ |
2597 Return the generalized transpose for an N-D array object @var{A}.\n\ | 2606 Return the generalized transpose for an N-D array object @var{A}.\n\ |
2607 \n\ | |
2598 The permutation vector @var{perm} must contain the elements\n\ | 2608 The permutation vector @var{perm} must contain the elements\n\ |
2599 @code{1:ndims (A)} (in any order, but each element must appear only once).\n\ | 2609 @code{1:ndims (A)} (in any order, but each element must appear only once).\n\ |
2600 \n\ | 2610 \n\ |
2601 The @var{N}th dimension of @var{A} gets remapped to dimension \n\ | 2611 The @var{N}th dimension of @var{A} gets remapped to dimension\n\ |
2602 @code{@var{PERM}(@var{N})}. For example:\n\ | 2612 @code{@var{PERM}(@var{N})}. For example:\n\ |
2603 \n\ | 2613 \n\ |
2604 @example\n\ | 2614 @example\n\ |
2605 @group\n\ | 2615 @group\n\ |
2606 @var{x} = zeros ([2, 3, 5, 7]);\n\ | 2616 @var{x} = zeros ([2, 3, 5, 7]);\n\ |
2625 } | 2635 } |
2626 | 2636 |
2627 DEFUN (ipermute, args, , | 2637 DEFUN (ipermute, args, , |
2628 "-*- texinfo -*-\n\ | 2638 "-*- texinfo -*-\n\ |
2629 @deftypefn {Built-in Function} {} ipermute (@var{A}, @var{iperm})\n\ | 2639 @deftypefn {Built-in Function} {} ipermute (@var{A}, @var{iperm})\n\ |
2630 The inverse of the @code{permute} function. The expression\n\ | 2640 The inverse of the @code{permute} function.\n\ |
2641 \n\ | |
2642 The expression\n\ | |
2631 \n\ | 2643 \n\ |
2632 @example\n\ | 2644 @example\n\ |
2633 ipermute (permute (A, perm), perm)\n\ | 2645 ipermute (permute (A, perm), perm)\n\ |
2634 @end example\n\ | 2646 @end example\n\ |
2635 \n\ | 2647 \n\ |
2665 | 2677 |
2666 DEFUN (ndims, args, , | 2678 DEFUN (ndims, args, , |
2667 "-*- texinfo -*-\n\ | 2679 "-*- texinfo -*-\n\ |
2668 @deftypefn {Built-in Function} {} ndims (@var{a})\n\ | 2680 @deftypefn {Built-in Function} {} ndims (@var{a})\n\ |
2669 Return the number of dimensions of @var{a}.\n\ | 2681 Return the number of dimensions of @var{a}.\n\ |
2670 For any array, the result will always be larger than or equal to 2.\n\ | 2682 \n\ |
2683 For any array, the result will always be greater than or equal to 2.\n\ | |
2671 Trailing singleton dimensions are not counted.\n\ | 2684 Trailing singleton dimensions are not counted.\n\ |
2672 \n\ | 2685 \n\ |
2673 @example\n\ | 2686 @example\n\ |
2674 @group\n\ | 2687 @group\n\ |
2675 ndims (ones (4, 1, 2, 1))\n\ | 2688 ndims (ones (4, 1, 2, 1))\n\ |
2692 DEFUN (numel, args, , | 2705 DEFUN (numel, args, , |
2693 "-*- texinfo -*-\n\ | 2706 "-*- texinfo -*-\n\ |
2694 @deftypefn {Built-in Function} {} numel (@var{a})\n\ | 2707 @deftypefn {Built-in Function} {} numel (@var{a})\n\ |
2695 @deftypefnx {Built-in Function} {} numel (@var{a}, @var{idx1}, @var{idx2}, @dots{})\n\ | 2708 @deftypefnx {Built-in Function} {} numel (@var{a}, @var{idx1}, @var{idx2}, @dots{})\n\ |
2696 Return the number of elements in the object @var{a}.\n\ | 2709 Return the number of elements in the object @var{a}.\n\ |
2710 \n\ | |
2697 Optionally, if indices @var{idx1}, @var{idx2}, @dots{} are supplied,\n\ | 2711 Optionally, if indices @var{idx1}, @var{idx2}, @dots{} are supplied,\n\ |
2698 return the number of elements that would result from the indexing\n\ | 2712 return the number of elements that would result from the indexing\n\ |
2699 \n\ | 2713 \n\ |
2700 @example\n\ | 2714 @example\n\ |
2701 @var{a}(@var{idx1}, @var{idx2}, @dots{})\n\ | 2715 @var{a}(@var{idx1}, @var{idx2}, @dots{})\n\ |
2829 | 2843 |
2830 DEFUN (size_equal, args, , | 2844 DEFUN (size_equal, args, , |
2831 "-*- texinfo -*-\n\ | 2845 "-*- texinfo -*-\n\ |
2832 @deftypefn {Built-in Function} {} size_equal (@var{a}, @var{b}, @dots{})\n\ | 2846 @deftypefn {Built-in Function} {} size_equal (@var{a}, @var{b}, @dots{})\n\ |
2833 Return true if the dimensions of all arguments agree.\n\ | 2847 Return true if the dimensions of all arguments agree.\n\ |
2848 \n\ | |
2834 Trailing singleton dimensions are ignored.\n\ | 2849 Trailing singleton dimensions are ignored.\n\ |
2835 Called with a single or no argument, size_equal returns true.\n\ | 2850 When called with a single or no argument @code{size_equal} returns true.\n\ |
2836 @seealso{size, numel, ndims}\n\ | 2851 @seealso{size, numel, ndims}\n\ |
2837 @end deftypefn") | 2852 @end deftypefn") |
2838 { | 2853 { |
2839 octave_value retval; | 2854 octave_value retval; |
2840 | 2855 |
3165 | 3180 |
3166 DEFUN (sumsq, args, , | 3181 DEFUN (sumsq, args, , |
3167 "-*- texinfo -*-\n\ | 3182 "-*- texinfo -*-\n\ |
3168 @deftypefn {Built-in Function} {} sumsq (@var{x})\n\ | 3183 @deftypefn {Built-in Function} {} sumsq (@var{x})\n\ |
3169 @deftypefnx {Built-in Function} {} sumsq (@var{x}, @var{dim})\n\ | 3184 @deftypefnx {Built-in Function} {} sumsq (@var{x}, @var{dim})\n\ |
3170 Sum of squares of elements along dimension @var{dim}. If @var{dim}\n\ | 3185 Sum of squares of elements along dimension @var{dim}.\n\ |
3171 is omitted, it defaults to the first non-singleton dimension.\n\ | 3186 \n\ |
3187 If @var{dim} is omitted, it defaults to the first non-singleton dimension.\n\ | |
3172 \n\ | 3188 \n\ |
3173 This function is conceptually equivalent to computing\n\ | 3189 This function is conceptually equivalent to computing\n\ |
3174 \n\ | 3190 \n\ |
3175 @example\n\ | 3191 @example\n\ |
3176 sum (x .* conj (x), dim)\n\ | 3192 sum (x .* conj (x), dim)\n\ |
3238 | 3254 |
3239 DEFUN (isinteger, args, , | 3255 DEFUN (isinteger, args, , |
3240 "-*- texinfo -*-\n\ | 3256 "-*- texinfo -*-\n\ |
3241 @deftypefn {Built-in Function} {} isinteger (@var{x})\n\ | 3257 @deftypefn {Built-in Function} {} isinteger (@var{x})\n\ |
3242 Return true if @var{x} is an integer object (int8, uint8, int16, etc.).\n\ | 3258 Return true if @var{x} is an integer object (int8, uint8, int16, etc.).\n\ |
3259 \n\ | |
3243 Note that @w{@code{isinteger (14)}} is false because numeric constants in\n\ | 3260 Note that @w{@code{isinteger (14)}} is false because numeric constants in\n\ |
3244 Octave are double precision floating point values.\n\ | 3261 Octave are double precision floating point values.\n\ |
3245 @seealso{isfloat, ischar, islogical, isnumeric, isa}\n\ | 3262 @seealso{isfloat, ischar, islogical, isnumeric, isa}\n\ |
3246 @end deftypefn") | 3263 @end deftypefn") |
3247 { | 3264 { |
3274 | 3291 |
3275 DEFUN (isfloat, args, , | 3292 DEFUN (isfloat, args, , |
3276 "-*- texinfo -*-\n\ | 3293 "-*- texinfo -*-\n\ |
3277 @deftypefn {Built-in Function} {} isfloat (@var{x})\n\ | 3294 @deftypefn {Built-in Function} {} isfloat (@var{x})\n\ |
3278 Return true if @var{x} is a floating-point numeric object.\n\ | 3295 Return true if @var{x} is a floating-point numeric object.\n\ |
3296 \n\ | |
3279 Objects of class double or single are floating-point objects.\n\ | 3297 Objects of class double or single are floating-point objects.\n\ |
3280 @seealso{isinteger, ischar, islogical, isnumeric, isa}\n\ | 3298 @seealso{isinteger, ischar, islogical, isnumeric, isa}\n\ |
3281 @end deftypefn") | 3299 @end deftypefn") |
3282 { | 3300 { |
3283 octave_value retval; | 3301 octave_value retval; |
3295 | 3313 |
3296 DEFUN (complex, args, , | 3314 DEFUN (complex, args, , |
3297 "-*- texinfo -*-\n\ | 3315 "-*- texinfo -*-\n\ |
3298 @deftypefn {Built-in Function} {} complex (@var{x})\n\ | 3316 @deftypefn {Built-in Function} {} complex (@var{x})\n\ |
3299 @deftypefnx {Built-in Function} {} complex (@var{re}, @var{im})\n\ | 3317 @deftypefnx {Built-in Function} {} complex (@var{re}, @var{im})\n\ |
3300 Return a complex result from real arguments. With 1 real argument @var{x},\n\ | 3318 Return a complex value from real arguments.\n\ |
3301 return the complex result @code{@var{x} + 0i}. With 2 real arguments,\n\ | 3319 \n\ |
3302 return the complex result @code{@var{re} + @var{im}}. @code{complex} can\n\ | 3320 With 1 real argument @var{x}, return the complex result @code{@var{x} + 0i}.\n\ |
3303 often be more convenient than expressions such as @code{a + i*b}.\n\ | 3321 \n\ |
3322 With 2 real arguments, return the complex result @code{@var{re} + @var{im}}.\n\ | |
3323 @code{complex} can often be more convenient than expressions such as\n\ | |
3324 @code{a + i*b}.\n\ | |
3304 For example:\n\ | 3325 For example:\n\ |
3305 \n\ | 3326 \n\ |
3306 @example\n\ | 3327 @example\n\ |
3307 @group\n\ | 3328 @group\n\ |
3308 complex ([1, 2], [3, 4])\n\ | 3329 complex ([1, 2], [3, 4])\n\ |
3596 | 3617 |
3597 DEFUN (isreal, args, , | 3618 DEFUN (isreal, args, , |
3598 "-*- texinfo -*-\n\ | 3619 "-*- texinfo -*-\n\ |
3599 @deftypefn {Built-in Function} {} isreal (@var{x})\n\ | 3620 @deftypefn {Built-in Function} {} isreal (@var{x})\n\ |
3600 Return true if @var{x} is a non-complex matrix or scalar.\n\ | 3621 Return true if @var{x} is a non-complex matrix or scalar.\n\ |
3622 \n\ | |
3601 For compatibility with @sc{matlab}, this includes logical and character\n\ | 3623 For compatibility with @sc{matlab}, this includes logical and character\n\ |
3602 matrices.\n\ | 3624 matrices.\n\ |
3603 @seealso{iscomplex, isnumeric, isa}\n\ | 3625 @seealso{iscomplex, isnumeric, isa}\n\ |
3604 @end deftypefn") | 3626 @end deftypefn") |
3605 { | 3627 { |
3615 | 3637 |
3616 DEFUN (isempty, args, , | 3638 DEFUN (isempty, args, , |
3617 "-*- texinfo -*-\n\ | 3639 "-*- texinfo -*-\n\ |
3618 @deftypefn {Built-in Function} {} isempty (@var{a})\n\ | 3640 @deftypefn {Built-in Function} {} isempty (@var{a})\n\ |
3619 Return true if @var{a} is an empty matrix (any one of its dimensions is\n\ | 3641 Return true if @var{a} is an empty matrix (any one of its dimensions is\n\ |
3620 zero). Otherwise, return false.\n\ | 3642 zero).\n\ |
3621 @seealso{isnull, isa}\n\ | 3643 @seealso{isnull, isa}\n\ |
3622 @end deftypefn") | 3644 @end deftypefn") |
3623 { | 3645 { |
3624 octave_value retval = false; | 3646 octave_value retval = false; |
3625 | 3647 |
3638 | 3660 |
3639 DEFUN (isnumeric, args, , | 3661 DEFUN (isnumeric, args, , |
3640 "-*- texinfo -*-\n\ | 3662 "-*- texinfo -*-\n\ |
3641 @deftypefn {Built-in Function} {} isnumeric (@var{x})\n\ | 3663 @deftypefn {Built-in Function} {} isnumeric (@var{x})\n\ |
3642 Return true if @var{x} is a numeric object, i.e., an integer, real, or\n\ | 3664 Return true if @var{x} is a numeric object, i.e., an integer, real, or\n\ |
3643 complex array. Logical and character arrays are not considered to be\n\ | 3665 complex array.\n\ |
3644 numeric.\n\ | 3666 \n\ |
3667 Logical and character arrays are not considered to be numeric.\n\ | |
3645 @seealso{isinteger, isfloat, isreal, iscomplex, islogical, ischar, iscell, isstruct, isa}\n\ | 3668 @seealso{isinteger, isfloat, isreal, iscomplex, islogical, ischar, iscell, isstruct, isa}\n\ |
3646 @end deftypefn") | 3669 @end deftypefn") |
3647 { | 3670 { |
3648 octave_value retval; | 3671 octave_value retval; |
3649 | 3672 |
4364 @deftypefnx {Built-in Function} {} ones (@var{m}, @var{n})\n\ | 4387 @deftypefnx {Built-in Function} {} ones (@var{m}, @var{n})\n\ |
4365 @deftypefnx {Built-in Function} {} ones (@var{m}, @var{n}, @var{k}, @dots{})\n\ | 4388 @deftypefnx {Built-in Function} {} ones (@var{m}, @var{n}, @var{k}, @dots{})\n\ |
4366 @deftypefnx {Built-in Function} {} ones ([@var{m} @var{n} @dots{}])\n\ | 4389 @deftypefnx {Built-in Function} {} ones ([@var{m} @var{n} @dots{}])\n\ |
4367 @deftypefnx {Built-in Function} {} ones (@dots{}, @var{class})\n\ | 4390 @deftypefnx {Built-in Function} {} ones (@dots{}, @var{class})\n\ |
4368 Return a matrix or N-dimensional array whose elements are all 1.\n\ | 4391 Return a matrix or N-dimensional array whose elements are all 1.\n\ |
4392 \n\ | |
4369 If invoked with a single scalar integer argument @var{n}, return a square\n\ | 4393 If invoked with a single scalar integer argument @var{n}, return a square\n\ |
4370 @nospell{NxN} matrix. If invoked with two or more scalar\n\ | 4394 @nospell{NxN} matrix.\n\ |
4371 integer arguments, or a vector of integer values, return an array with\n\ | 4395 \n\ |
4372 the given dimensions.\n\ | 4396 If invoked with two or more scalar integer arguments, or a vector of integer\n\ |
4373 \n\ | 4397 values, return an array with the given dimensions.\n\ |
4374 If you need to create a matrix whose values are all the same, you should\n\ | 4398 \n\ |
4375 use an expression like\n\ | 4399 To create a constant matrix whose values are all the same use an expression\n\ |
4400 such as\n\ | |
4376 \n\ | 4401 \n\ |
4377 @example\n\ | 4402 @example\n\ |
4378 val_matrix = val * ones (m, n)\n\ | 4403 val_matrix = val * ones (m, n)\n\ |
4379 @end example\n\ | 4404 @end example\n\ |
4380 \n\ | 4405 \n\ |
4413 @deftypefnx {Built-in Function} {} zeros (@var{m}, @var{n})\n\ | 4438 @deftypefnx {Built-in Function} {} zeros (@var{m}, @var{n})\n\ |
4414 @deftypefnx {Built-in Function} {} zeros (@var{m}, @var{n}, @var{k}, @dots{})\n\ | 4439 @deftypefnx {Built-in Function} {} zeros (@var{m}, @var{n}, @var{k}, @dots{})\n\ |
4415 @deftypefnx {Built-in Function} {} zeros ([@var{m} @var{n} @dots{}])\n\ | 4440 @deftypefnx {Built-in Function} {} zeros ([@var{m} @var{n} @dots{}])\n\ |
4416 @deftypefnx {Built-in Function} {} zeros (@dots{}, @var{class})\n\ | 4441 @deftypefnx {Built-in Function} {} zeros (@dots{}, @var{class})\n\ |
4417 Return a matrix or N-dimensional array whose elements are all 0.\n\ | 4442 Return a matrix or N-dimensional array whose elements are all 0.\n\ |
4443 \n\ | |
4418 If invoked with a single scalar integer argument, return a square\n\ | 4444 If invoked with a single scalar integer argument, return a square\n\ |
4419 @nospell{NxN} matrix. If invoked with two or more scalar\n\ | 4445 @nospell{NxN} matrix.\n\ |
4420 integer arguments, or a vector of integer values, return an array with\n\ | 4446 \n\ |
4421 the given dimensions.\n\ | 4447 If invoked with two or more scalar integer arguments, or a vector of integer\n\ |
4448 values, return an array with the given dimensions.\n\ | |
4422 \n\ | 4449 \n\ |
4423 The optional argument @var{class} specifies the class of the return array\n\ | 4450 The optional argument @var{class} specifies the class of the return array\n\ |
4424 and defaults to double. For example:\n\ | 4451 and defaults to double. For example:\n\ |
4425 \n\ | 4452 \n\ |
4426 @example\n\ | 4453 @example\n\ |
4472 @result{} Inf Inf\n\ | 4499 @result{} Inf Inf\n\ |
4473 @end group\n\ | 4500 @end group\n\ |
4474 @end example\n\ | 4501 @end example\n\ |
4475 \n\ | 4502 \n\ |
4476 When called with no arguments, return a scalar with the value @samp{Inf}.\n\ | 4503 When called with no arguments, return a scalar with the value @samp{Inf}.\n\ |
4504 \n\ | |
4477 When called with a single argument, return a square matrix with the dimension\n\ | 4505 When called with a single argument, return a square matrix with the dimension\n\ |
4478 specified. When called with more than one scalar argument the first two\n\ | 4506 specified.\n\ |
4479 arguments are taken as the number of rows and columns and any further\n\ | 4507 \n\ |
4480 arguments specify additional matrix dimensions.\n\ | 4508 When called with more than one scalar argument the first two arguments are\n\ |
4509 taken as the number of rows and columns and any further arguments specify\n\ | |
4510 additional matrix dimensions.\n\ | |
4511 \n\ | |
4481 The optional argument @var{class} specifies the return type and may be\n\ | 4512 The optional argument @var{class} specifies the return type and may be\n\ |
4482 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ | 4513 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ |
4483 @seealso{isinf, NaN}\n\ | 4514 @seealso{isinf, NaN}\n\ |
4484 @end deftypefn") | 4515 @end deftypefn") |
4485 { | 4516 { |
4516 @deftypefnx {Built-in Function} {} NaN (@var{n}, @var{m})\n\ | 4547 @deftypefnx {Built-in Function} {} NaN (@var{n}, @var{m})\n\ |
4517 @deftypefnx {Built-in Function} {} NaN (@var{n}, @var{m}, @var{k}, @dots{})\n\ | 4548 @deftypefnx {Built-in Function} {} NaN (@var{n}, @var{m}, @var{k}, @dots{})\n\ |
4518 @deftypefnx {Built-in Function} {} NaN (@dots{}, @var{class})\n\ | 4549 @deftypefnx {Built-in Function} {} NaN (@dots{}, @var{class})\n\ |
4519 Return a scalar, matrix, or N-dimensional array whose elements are all equal\n\ | 4550 Return a scalar, matrix, or N-dimensional array whose elements are all equal\n\ |
4520 to the IEEE symbol NaN (Not a Number).\n\ | 4551 to the IEEE symbol NaN (Not a Number).\n\ |
4552 \n\ | |
4521 NaN is the result of operations which do not produce a well defined numerical\n\ | 4553 NaN is the result of operations which do not produce a well defined numerical\n\ |
4522 result. Common operations which produce a NaN are arithmetic with infinity\n\ | 4554 result. Common operations which produce a NaN are arithmetic with infinity\n\ |
4523 @tex\n\ | 4555 @tex\n\ |
4524 ($\\infty - \\infty$), zero divided by zero ($0/0$),\n\ | 4556 ($\\infty - \\infty$), zero divided by zero ($0/0$),\n\ |
4525 @end tex\n\ | 4557 @end tex\n\ |
4527 (Inf - Inf), zero divided by zero (0/0),\n\ | 4559 (Inf - Inf), zero divided by zero (0/0),\n\ |
4528 @end ifnottex\n\ | 4560 @end ifnottex\n\ |
4529 and any operation involving another NaN value (5 + NaN).\n\ | 4561 and any operation involving another NaN value (5 + NaN).\n\ |
4530 \n\ | 4562 \n\ |
4531 Note that NaN always compares not equal to NaN (NaN != NaN). This behavior\n\ | 4563 Note that NaN always compares not equal to NaN (NaN != NaN). This behavior\n\ |
4532 is specified by the IEEE standard for floating point arithmetic. To\n\ | 4564 is specified by the IEEE standard for floating point arithmetic. To find\n\ |
4533 find NaN values, use the @code{isnan} function.\n\ | 4565 NaN values, use the @code{isnan} function.\n\ |
4534 \n\ | 4566 \n\ |
4535 When called with no arguments, return a scalar with the value @samp{NaN}.\n\ | 4567 When called with no arguments, return a scalar with the value @samp{NaN}.\n\ |
4568 \n\ | |
4536 When called with a single argument, return a square matrix with the dimension\n\ | 4569 When called with a single argument, return a square matrix with the dimension\n\ |
4537 specified. When called with more than one scalar argument the first two\n\ | 4570 specified.\n\ |
4538 arguments are taken as the number of rows and columns and any further\n\ | 4571 \n\ |
4539 arguments specify additional matrix dimensions.\n\ | 4572 When called with more than one scalar argument the first two arguments are\n\ |
4573 taken as the number of rows and columns and any further arguments specify\n\ | |
4574 additional matrix dimensions.\n\ | |
4575 \n\ | |
4576 \n\ | |
4540 The optional argument @var{class} specifies the return type and may be\n\ | 4577 The optional argument @var{class} specifies the return type and may be\n\ |
4541 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ | 4578 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ |
4542 @seealso{isnan, Inf}\n\ | 4579 @seealso{isnan, Inf}\n\ |
4543 @end deftypefn") | 4580 @end deftypefn") |
4544 { | 4581 { |
4571 @deftypefnx {Built-in Function} {} e (@var{n})\n\ | 4608 @deftypefnx {Built-in Function} {} e (@var{n})\n\ |
4572 @deftypefnx {Built-in Function} {} e (@var{n}, @var{m})\n\ | 4609 @deftypefnx {Built-in Function} {} e (@var{n}, @var{m})\n\ |
4573 @deftypefnx {Built-in Function} {} e (@var{n}, @var{m}, @var{k}, @dots{})\n\ | 4610 @deftypefnx {Built-in Function} {} e (@var{n}, @var{m}, @var{k}, @dots{})\n\ |
4574 @deftypefnx {Built-in Function} {} e (@dots{}, @var{class})\n\ | 4611 @deftypefnx {Built-in Function} {} e (@dots{}, @var{class})\n\ |
4575 Return a scalar, matrix, or N-dimensional array whose elements are all equal\n\ | 4612 Return a scalar, matrix, or N-dimensional array whose elements are all equal\n\ |
4576 to the base of natural logarithms. The constant\n\ | 4613 to the base of natural logarithms.\n\ |
4614 \n\ | |
4615 The constant\n\ | |
4577 @tex\n\ | 4616 @tex\n\ |
4578 $e$ satisfies the equation $\\log (e) = 1$.\n\ | 4617 $e$ satisfies the equation $\\log (e) = 1$.\n\ |
4579 @end tex\n\ | 4618 @end tex\n\ |
4580 @ifnottex\n\ | 4619 @ifnottex\n\ |
4581 @samp{e} satisfies the equation @code{log} (e) = 1.\n\ | 4620 @samp{e} satisfies the equation @code{log} (e) = 1.\n\ |
4582 @end ifnottex\n\ | 4621 @end ifnottex\n\ |
4583 \n\ | 4622 \n\ |
4584 When called with no arguments, return a scalar with the value @math{e}. When\n\ | 4623 When called with no arguments, return a scalar with the value @math{e}.\n\ |
4585 called with a single argument, return a square matrix with the dimension\n\ | 4624 \n\ |
4586 specified. When called with more than one scalar argument the first two\n\ | 4625 When called with a single argument, return a square matrix with the dimension\n\ |
4587 arguments are taken as the number of rows and columns and any further\n\ | 4626 specified.\n\ |
4588 arguments specify additional matrix dimensions.\n\ | 4627 \n\ |
4628 When called with more than one scalar argument the first two arguments are\n\ | |
4629 taken as the number of rows and columns and any further arguments specify\n\ | |
4630 additional matrix dimensions.\n\ | |
4631 \n\ | |
4589 The optional argument @var{class} specifies the return type and may be\n\ | 4632 The optional argument @var{class} specifies the return type and may be\n\ |
4590 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ | 4633 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ |
4591 @seealso{log, exp, pi, I}\n\ | 4634 @seealso{log, exp, pi, I}\n\ |
4592 @end deftypefn") | 4635 @end deftypefn") |
4593 { | 4636 { |
4606 @deftypefnx {Built-in Function} {} eps (@var{x})\n\ | 4649 @deftypefnx {Built-in Function} {} eps (@var{x})\n\ |
4607 @deftypefnx {Built-in Function} {} eps (@var{n}, @var{m})\n\ | 4650 @deftypefnx {Built-in Function} {} eps (@var{n}, @var{m})\n\ |
4608 @deftypefnx {Built-in Function} {} eps (@var{n}, @var{m}, @var{k}, @dots{})\n\ | 4651 @deftypefnx {Built-in Function} {} eps (@var{n}, @var{m}, @var{k}, @dots{})\n\ |
4609 @deftypefnx {Built-in Function} {} eps (@dots{}, @var{class})\n\ | 4652 @deftypefnx {Built-in Function} {} eps (@dots{}, @var{class})\n\ |
4610 Return a scalar, matrix or N-dimensional array whose elements are all eps,\n\ | 4653 Return a scalar, matrix or N-dimensional array whose elements are all eps,\n\ |
4611 the machine precision. More precisely, @code{eps} is the relative spacing\n\ | 4654 the machine precision.\n\ |
4612 between any two adjacent numbers in the machine's floating point system.\n\ | 4655 \n\ |
4613 This number is obviously system dependent. On machines that support IEEE\n\ | 4656 More precisely, @code{eps} is the relative spacing between any two adjacent\n\ |
4614 floating point arithmetic, @code{eps} is approximately\n\ | 4657 numbers in the machine's floating point system. This number is obviously\n\ |
4658 system dependent. On machines that support IEEE floating point arithmetic,\n\ | |
4659 @code{eps} is approximately\n\ | |
4615 @tex\n\ | 4660 @tex\n\ |
4616 $2.2204\\times10^{-16}$ for double precision and $1.1921\\times10^{-7}$\n\ | 4661 $2.2204\\times10^{-16}$ for double precision and $1.1921\\times10^{-7}$\n\ |
4617 @end tex\n\ | 4662 @end tex\n\ |
4618 @ifnottex\n\ | 4663 @ifnottex\n\ |
4619 2.2204e-16 for double precision and 1.1921e-07\n\ | 4664 2.2204e-16 for double precision and 1.1921e-07\n\ |
4620 @end ifnottex\n\ | 4665 @end ifnottex\n\ |
4621 for single precision.\n\ | 4666 for single precision.\n\ |
4622 \n\ | 4667 \n\ |
4623 When called with no arguments, return a scalar with the value\n\ | 4668 When called with no arguments, return a scalar with the value\n\ |
4624 @code{eps (1.0)}.\n\ | 4669 @code{eps (1.0)}.\n\ |
4625 Given a single argument @var{x}, return the distance between @var{x} and\n\ | 4670 \n\ |
4626 the next largest value.\n\ | 4671 Given a single argument @var{x}, return the distance between @var{x} and the\n\ |
4672 next largest value.\n\ | |
4673 \n\ | |
4627 When called with more than one argument the first two arguments are taken as\n\ | 4674 When called with more than one argument the first two arguments are taken as\n\ |
4628 the number of rows and columns and any further\n\ | 4675 the number of rows and columns and any further arguments specify additional\n\ |
4629 arguments specify additional matrix dimensions.\n\ | 4676 matrix dimensions. The optional argument @var{class} specifies the return\n\ |
4630 The optional argument @var{class} specifies the return type and may be\n\ | 4677 type and may be either @qcode{\"double\"} or @qcode{\"single\"}.\n\ |
4631 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ | |
4632 @seealso{realmax, realmin, intmax, bitmax}\n\ | 4678 @seealso{realmax, realmin, intmax, bitmax}\n\ |
4633 @end deftypefn") | 4679 @end deftypefn") |
4634 { | 4680 { |
4635 int nargin = args.length (); | 4681 int nargin = args.length (); |
4636 octave_value retval; | 4682 octave_value retval; |
4736 diameter($\\pi$).\n\ | 4782 diameter($\\pi$).\n\ |
4737 @end tex\n\ | 4783 @end tex\n\ |
4738 @ifnottex\n\ | 4784 @ifnottex\n\ |
4739 diameter.\n\ | 4785 diameter.\n\ |
4740 @end ifnottex\n\ | 4786 @end ifnottex\n\ |
4787 \n\ | |
4741 Internally, @code{pi} is computed as @samp{4.0 * atan (1.0)}.\n\ | 4788 Internally, @code{pi} is computed as @samp{4.0 * atan (1.0)}.\n\ |
4742 \n\ | 4789 \n\ |
4743 When called with no arguments, return a scalar with the value of\n\ | 4790 When called with no arguments, return a scalar with the value of\n\ |
4744 @tex\n\ | 4791 @tex\n\ |
4745 $\\pi$.\n\ | 4792 $\\pi$.\n\ |
4746 @end tex\n\ | 4793 @end tex\n\ |
4747 @ifnottex\n\ | 4794 @ifnottex\n\ |
4748 pi.\n\ | 4795 pi.\n\ |
4749 @end ifnottex\n\ | 4796 @end ifnottex\n\ |
4797 \n\ | |
4750 When called with a single argument, return a square matrix with the dimension\n\ | 4798 When called with a single argument, return a square matrix with the dimension\n\ |
4751 specified. When called with more than one scalar argument the first two\n\ | 4799 specified.\n\ |
4752 arguments are taken as the number of rows and columns and any further\n\ | 4800 \n\ |
4753 arguments specify additional matrix dimensions.\n\ | 4801 When called with more than one scalar argument the first two arguments are\n\ |
4802 taken as the number of rows and columns and any further arguments specify\n\ | |
4803 additional matrix dimensions.\n\ | |
4804 \n\ | |
4754 The optional argument @var{class} specifies the return type and may be\n\ | 4805 The optional argument @var{class} specifies the return type and may be\n\ |
4755 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ | 4806 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ |
4756 @seealso{e, I}\n\ | 4807 @seealso{e, I}\n\ |
4757 @end deftypefn") | 4808 @end deftypefn") |
4758 { | 4809 { |
4770 @deftypefn {Built-in Function} {} realmax\n\ | 4821 @deftypefn {Built-in Function} {} realmax\n\ |
4771 @deftypefnx {Built-in Function} {} realmax (@var{n})\n\ | 4822 @deftypefnx {Built-in Function} {} realmax (@var{n})\n\ |
4772 @deftypefnx {Built-in Function} {} realmax (@var{n}, @var{m})\n\ | 4823 @deftypefnx {Built-in Function} {} realmax (@var{n}, @var{m})\n\ |
4773 @deftypefnx {Built-in Function} {} realmax (@var{n}, @var{m}, @var{k}, @dots{})\n\ | 4824 @deftypefnx {Built-in Function} {} realmax (@var{n}, @var{m}, @var{k}, @dots{})\n\ |
4774 @deftypefnx {Built-in Function} {} realmax (@dots{}, @var{class})\n\ | 4825 @deftypefnx {Built-in Function} {} realmax (@dots{}, @var{class})\n\ |
4775 Return a scalar, matrix or N-dimensional array whose elements are all equal\n\ | 4826 Return a scalar, matrix, or N-dimensional array whose elements are all equal\n\ |
4776 to the largest floating point number that is representable. The actual\n\ | 4827 to the largest floating point number that is representable.\n\ |
4777 value is system dependent. On machines that support IEEE\n\ | 4828 \n\ |
4829 The actual value is system dependent. On machines that support IEEE\n\ | |
4778 floating point arithmetic, @code{realmax} is approximately\n\ | 4830 floating point arithmetic, @code{realmax} is approximately\n\ |
4779 @tex\n\ | 4831 @tex\n\ |
4780 $1.7977\\times10^{308}$ for double precision and $3.4028\\times10^{38}$\n\ | 4832 $1.7977\\times10^{308}$ for double precision and $3.4028\\times10^{38}$\n\ |
4781 @end tex\n\ | 4833 @end tex\n\ |
4782 @ifnottex\n\ | 4834 @ifnottex\n\ |
4784 @end ifnottex\n\ | 4836 @end ifnottex\n\ |
4785 for single precision.\n\ | 4837 for single precision.\n\ |
4786 \n\ | 4838 \n\ |
4787 When called with no arguments, return a scalar with the value\n\ | 4839 When called with no arguments, return a scalar with the value\n\ |
4788 @code{realmax (@qcode{\"double\"})}.\n\ | 4840 @code{realmax (@qcode{\"double\"})}.\n\ |
4841 \n\ | |
4789 When called with a single argument, return a square matrix with the dimension\n\ | 4842 When called with a single argument, return a square matrix with the dimension\n\ |
4790 specified. When called with more than one scalar argument the first two\n\ | 4843 specified.\n\ |
4791 arguments are taken as the number of rows and columns and any further\n\ | 4844 \n\ |
4792 arguments specify additional matrix dimensions.\n\ | 4845 When called with more than one scalar argument the first two arguments are\n\ |
4846 taken as the number of rows and columns and any further arguments specify\n\ | |
4847 additional matrix dimensions.\n\ | |
4848 \n\ | |
4793 The optional argument @var{class} specifies the return type and may be\n\ | 4849 The optional argument @var{class} specifies the return type and may be\n\ |
4794 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ | 4850 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ |
4795 @seealso{realmin, intmax, bitmax, eps}\n\ | 4851 @seealso{realmin, intmax, bitmax, eps}\n\ |
4796 @end deftypefn") | 4852 @end deftypefn") |
4797 { | 4853 { |
4804 @deftypefn {Built-in Function} {} realmin\n\ | 4860 @deftypefn {Built-in Function} {} realmin\n\ |
4805 @deftypefnx {Built-in Function} {} realmin (@var{n})\n\ | 4861 @deftypefnx {Built-in Function} {} realmin (@var{n})\n\ |
4806 @deftypefnx {Built-in Function} {} realmin (@var{n}, @var{m})\n\ | 4862 @deftypefnx {Built-in Function} {} realmin (@var{n}, @var{m})\n\ |
4807 @deftypefnx {Built-in Function} {} realmin (@var{n}, @var{m}, @var{k}, @dots{})\n\ | 4863 @deftypefnx {Built-in Function} {} realmin (@var{n}, @var{m}, @var{k}, @dots{})\n\ |
4808 @deftypefnx {Built-in Function} {} realmin (@dots{}, @var{class})\n\ | 4864 @deftypefnx {Built-in Function} {} realmin (@dots{}, @var{class})\n\ |
4809 Return a scalar, matrix or N-dimensional array whose elements are all equal\n\ | 4865 Return a scalar, matrix, or N-dimensional array whose elements are all equal\n\ |
4810 to the smallest normalized floating point number that is representable.\n\ | 4866 to the smallest normalized floating point number that is representable.\n\ |
4867 \n\ | |
4811 The actual value is system dependent. On machines that support\n\ | 4868 The actual value is system dependent. On machines that support\n\ |
4812 IEEE floating point arithmetic, @code{realmin} is approximately\n\ | 4869 IEEE floating point arithmetic, @code{realmin} is approximately\n\ |
4813 @tex\n\ | 4870 @tex\n\ |
4814 $2.2251\\times10^{-308}$ for double precision and $1.1755\\times10^{-38}$\n\ | 4871 $2.2251\\times10^{-308}$ for double precision and $1.1755\\times10^{-38}$\n\ |
4815 @end tex\n\ | 4872 @end tex\n\ |
4818 @end ifnottex\n\ | 4875 @end ifnottex\n\ |
4819 for single precision.\n\ | 4876 for single precision.\n\ |
4820 \n\ | 4877 \n\ |
4821 When called with no arguments, return a scalar with the value\n\ | 4878 When called with no arguments, return a scalar with the value\n\ |
4822 @code{realmin (@qcode{\"double\"})}.\n\ | 4879 @code{realmin (@qcode{\"double\"})}.\n\ |
4880 \n\ | |
4823 When called with a single argument, return a square matrix with the dimension\n\ | 4881 When called with a single argument, return a square matrix with the dimension\n\ |
4824 specified. When called with more than one scalar argument the first two\n\ | 4882 specified.\n\ |
4825 arguments are taken as the number of rows and columns and any further\n\ | 4883 \n\ |
4826 arguments specify additional matrix dimensions.\n\ | 4884 When called with more than one scalar argument the first two arguments are\n\ |
4885 taken as the number of rows and columns and any further arguments specify\n\ | |
4886 additional matrix dimensions.\n\ | |
4887 \n\ | |
4827 The optional argument @var{class} specifies the return type and may be\n\ | 4888 The optional argument @var{class} specifies the return type and may be\n\ |
4828 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ | 4889 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ |
4829 @seealso{realmax, intmin, eps}\n\ | 4890 @seealso{realmax, intmin, eps}\n\ |
4830 @end deftypefn") | 4891 @end deftypefn") |
4831 { | 4892 { |
4855 @end ifnottex\n\ | 4916 @end ifnottex\n\ |
4856 \n\ | 4917 \n\ |
4857 I, and its equivalents i, j, and J, are functions so any of the names may\n\ | 4918 I, and its equivalents i, j, and J, are functions so any of the names may\n\ |
4858 be reused for other purposes (such as i for a counter variable).\n\ | 4919 be reused for other purposes (such as i for a counter variable).\n\ |
4859 \n\ | 4920 \n\ |
4860 When called with no arguments, return a scalar with the value @math{i}. When\n\ | 4921 When called with no arguments, return a scalar with the value @math{i}.\n\ |
4861 called with a single argument, return a square matrix with the dimension\n\ | 4922 \n\ |
4862 specified. When called with more than one scalar argument the first two\n\ | 4923 When called with a single argument, return a square matrix with the dimension\n\ |
4863 arguments are taken as the number of rows and columns and any further\n\ | 4924 specified.\n\ |
4864 arguments specify additional matrix dimensions.\n\ | 4925 \n\ |
4926 When called with more than one scalar argument the first two arguments are\n\ | |
4927 taken as the number of rows and columns and any further arguments specify\n\ | |
4928 additional matrix dimensions.\n\ | |
4929 \n\ | |
4865 The optional argument @var{class} specifies the return type and may be\n\ | 4930 The optional argument @var{class} specifies the return type and may be\n\ |
4866 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ | 4931 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ |
4867 @seealso{e, pi, log, exp}\n\ | 4932 @seealso{e, pi, log, exp}\n\ |
4868 @end deftypefn") | 4933 @end deftypefn") |
4869 { | 4934 { |
4886 \n\ | 4951 \n\ |
4887 Note that NA always compares not equal to NA (NA != NA).\n\ | 4952 Note that NA always compares not equal to NA (NA != NA).\n\ |
4888 To find NA values, use the @code{isna} function.\n\ | 4953 To find NA values, use the @code{isna} function.\n\ |
4889 \n\ | 4954 \n\ |
4890 When called with no arguments, return a scalar with the value @samp{NA}.\n\ | 4955 When called with no arguments, return a scalar with the value @samp{NA}.\n\ |
4956 \n\ | |
4891 When called with a single argument, return a square matrix with the dimension\n\ | 4957 When called with a single argument, return a square matrix with the dimension\n\ |
4892 specified. When called with more than one scalar argument the first two\n\ | 4958 specified.\n\ |
4893 arguments are taken as the number of rows and columns and any further\n\ | 4959 \n\ |
4894 arguments specify additional matrix dimensions.\n\ | 4960 When called with more than one scalar argument the first two arguments are\n\ |
4961 taken as the number of rows and columns and any further arguments specify\n\ | |
4962 additional matrix dimensions.\n\ | |
4963 \n\ | |
4895 The optional argument @var{class} specifies the return type and may be\n\ | 4964 The optional argument @var{class} specifies the return type and may be\n\ |
4896 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ | 4965 either @qcode{\"double\"} or @qcode{\"single\"}.\n\ |
4897 @seealso{isna}\n\ | 4966 @seealso{isna}\n\ |
4898 @end deftypefn") | 4967 @end deftypefn") |
4899 { | 4968 { |
4910 "-*- texinfo -*-\n\ | 4979 "-*- texinfo -*-\n\ |
4911 @deftypefn {Built-in Function} {} false (@var{x})\n\ | 4980 @deftypefn {Built-in Function} {} false (@var{x})\n\ |
4912 @deftypefnx {Built-in Function} {} false (@var{n}, @var{m})\n\ | 4981 @deftypefnx {Built-in Function} {} false (@var{n}, @var{m})\n\ |
4913 @deftypefnx {Built-in Function} {} false (@var{n}, @var{m}, @var{k}, @dots{})\n\ | 4982 @deftypefnx {Built-in Function} {} false (@var{n}, @var{m}, @var{k}, @dots{})\n\ |
4914 Return a matrix or N-dimensional array whose elements are all logical 0.\n\ | 4983 Return a matrix or N-dimensional array whose elements are all logical 0.\n\ |
4984 \n\ | |
4915 If invoked with a single scalar integer argument, return a square\n\ | 4985 If invoked with a single scalar integer argument, return a square\n\ |
4916 matrix of the specified size. If invoked with two or more scalar\n\ | 4986 matrix of the specified size.\n\ |
4917 integer arguments, or a vector of integer values, return an array with\n\ | 4987 \n\ |
4918 given dimensions.\n\ | 4988 If invoked with two or more scalar integer arguments, or a vector of integer\n\ |
4989 values, return an array with given dimensions.\n\ | |
4919 @seealso{true}\n\ | 4990 @seealso{true}\n\ |
4920 @end deftypefn") | 4991 @end deftypefn") |
4921 { | 4992 { |
4922 return fill_matrix (args, false, "false"); | 4993 return fill_matrix (args, false, "false"); |
4923 } | 4994 } |
4926 "-*- texinfo -*-\n\ | 4997 "-*- texinfo -*-\n\ |
4927 @deftypefn {Built-in Function} {} true (@var{x})\n\ | 4998 @deftypefn {Built-in Function} {} true (@var{x})\n\ |
4928 @deftypefnx {Built-in Function} {} true (@var{n}, @var{m})\n\ | 4999 @deftypefnx {Built-in Function} {} true (@var{n}, @var{m})\n\ |
4929 @deftypefnx {Built-in Function} {} true (@var{n}, @var{m}, @var{k}, @dots{})\n\ | 5000 @deftypefnx {Built-in Function} {} true (@var{n}, @var{m}, @var{k}, @dots{})\n\ |
4930 Return a matrix or N-dimensional array whose elements are all logical 1.\n\ | 5001 Return a matrix or N-dimensional array whose elements are all logical 1.\n\ |
5002 \n\ | |
4931 If invoked with a single scalar integer argument, return a square\n\ | 5003 If invoked with a single scalar integer argument, return a square\n\ |
4932 matrix of the specified size. If invoked with two or more scalar\n\ | 5004 matrix of the specified size.\n\ |
4933 integer arguments, or a vector of integer values, return an array with\n\ | 5005 \n\ |
4934 given dimensions.\n\ | 5006 If invoked with two or more scalar integer arguments, or a vector of integer\n\ |
5007 values, return an array with given dimensions.\n\ | |
4935 @seealso{false}\n\ | 5008 @seealso{false}\n\ |
4936 @end deftypefn") | 5009 @end deftypefn") |
4937 { | 5010 { |
4938 return fill_matrix (args, true, "true"); | 5011 return fill_matrix (args, true, "true"); |
4939 } | 5012 } |
5057 "-*- texinfo -*-\n\ | 5130 "-*- texinfo -*-\n\ |
5058 @deftypefn {Built-in Function} {} eye (@var{n})\n\ | 5131 @deftypefn {Built-in Function} {} eye (@var{n})\n\ |
5059 @deftypefnx {Built-in Function} {} eye (@var{m}, @var{n})\n\ | 5132 @deftypefnx {Built-in Function} {} eye (@var{m}, @var{n})\n\ |
5060 @deftypefnx {Built-in Function} {} eye ([@var{m} @var{n}])\n\ | 5133 @deftypefnx {Built-in Function} {} eye ([@var{m} @var{n}])\n\ |
5061 @deftypefnx {Built-in Function} {} eye (@dots{}, @var{class})\n\ | 5134 @deftypefnx {Built-in Function} {} eye (@dots{}, @var{class})\n\ |
5062 Return an identity matrix. If invoked with a single scalar argument @var{n},\n\ | 5135 Return an identity matrix.\n\ |
5063 return a square @nospell{NxN} identity matrix. If\n\ | 5136 \n\ |
5064 supplied two scalar arguments (@var{m}, @var{n}), @code{eye} takes them to be\n\ | 5137 If invoked with a single scalar argument @var{n}, return a square\n\ |
5065 the number of rows and columns. If given a vector with two elements,\n\ | 5138 @nospell{NxN} identity matrix.\n\ |
5066 @code{eye} uses the values of the elements as the number of rows and columns,\n\ | 5139 \n\ |
5067 respectively. For example:\n\ | 5140 If supplied two scalar arguments (@var{m}, @var{n}), @code{eye} takes them\n\ |
5141 to be the number of rows and columns. If given a vector with two elements,\n\ | |
5142 @code{eye} uses the values of the elements as the number of rows and\n\ | |
5143 columns, respectively. For example:\n\ | |
5068 \n\ | 5144 \n\ |
5069 @example\n\ | 5145 @example\n\ |
5070 @group\n\ | 5146 @group\n\ |
5071 eye (3)\n\ | 5147 eye (3)\n\ |
5072 @result{} 1 0 0\n\ | 5148 @result{} 1 0 0\n\ |
5092 \n\ | 5168 \n\ |
5093 @example\n\ | 5169 @example\n\ |
5094 val = zeros (n,m, \"uint8\")\n\ | 5170 val = zeros (n,m, \"uint8\")\n\ |
5095 @end example\n\ | 5171 @end example\n\ |
5096 \n\ | 5172 \n\ |
5097 Calling @code{eye} with no arguments is equivalent to calling it\n\ | 5173 Calling @code{eye} with no arguments is equivalent to calling it with an\n\ |
5098 with an argument of 1. Any negative dimensions are treated as zero. \n\ | 5174 argument of 1. Any negative dimensions are treated as zero. These odd\n\ |
5099 These odd definitions are for compatibility with @sc{matlab}.\n\ | 5175 definitions are for compatibility with @sc{matlab}.\n\ |
5100 @seealso{speye, ones, zeros}\n\ | 5176 @seealso{speye, ones, zeros}\n\ |
5101 @end deftypefn") | 5177 @end deftypefn") |
5102 { | 5178 { |
5103 octave_value retval; | 5179 octave_value retval; |
5104 | 5180 |
5213 DEFUN (linspace, args, , | 5289 DEFUN (linspace, args, , |
5214 "-*- texinfo -*-\n\ | 5290 "-*- texinfo -*-\n\ |
5215 @deftypefn {Built-in Function} {} linspace (@var{base}, @var{limit})\n\ | 5291 @deftypefn {Built-in Function} {} linspace (@var{base}, @var{limit})\n\ |
5216 @deftypefnx {Built-in Function} {} linspace (@var{base}, @var{limit}, @var{n})\n\ | 5292 @deftypefnx {Built-in Function} {} linspace (@var{base}, @var{limit}, @var{n})\n\ |
5217 Return a row vector with @var{n} linearly spaced elements between\n\ | 5293 Return a row vector with @var{n} linearly spaced elements between\n\ |
5218 @var{base} and @var{limit}. If the number of elements is greater than one,\n\ | 5294 @var{base} and @var{limit}.\n\ |
5219 then the endpoints @var{base} and @var{limit} are always included in\n\ | 5295 \n\ |
5220 the range. If @var{base} is greater than @var{limit}, the elements are\n\ | 5296 If the number of elements is greater than one, then the endpoints @var{base}\n\ |
5221 stored in decreasing order. If the number of points is not specified, a\n\ | 5297 and @var{limit} are always included in the range. If @var{base} is greater\n\ |
5222 value of 100 is used.\n\ | 5298 than @var{limit}, the elements are stored in decreasing order. If the\n\ |
5223 \n\ | 5299 number of points is not specified, a value of 100 is used.\n\ |
5224 The @code{linspace} function always returns a row vector if both\n\ | 5300 \n\ |
5225 @var{base} and @var{limit} are scalars. If one, or both, of them are column\n\ | 5301 The @code{linspace} function always returns a row vector if both @var{base}\n\ |
5226 vectors, @code{linspace} returns a matrix.\n\ | 5302 and @var{limit} are scalars. If one, or both, of them are column vectors,\n\ |
5303 @code{linspace} returns a matrix.\n\ | |
5227 \n\ | 5304 \n\ |
5228 For compatibility with @sc{matlab}, return the second argument (@var{limit})\n\ | 5305 For compatibility with @sc{matlab}, return the second argument (@var{limit})\n\ |
5229 if fewer than two values are requested.\n\ | 5306 if fewer than two values are requested.\n\ |
5230 @seealso{logspace}\n\ | 5307 @seealso{logspace}\n\ |
5231 @end deftypefn") | 5308 @end deftypefn") |
5398 @deftypefn {Built-in Function} {} reshape (@var{A}, @var{m}, @var{n}, @dots{})\n\ | 5475 @deftypefn {Built-in Function} {} reshape (@var{A}, @var{m}, @var{n}, @dots{})\n\ |
5399 @deftypefnx {Built-in Function} {} reshape (@var{A}, [@var{m} @var{n} @dots{}])\n\ | 5476 @deftypefnx {Built-in Function} {} reshape (@var{A}, [@var{m} @var{n} @dots{}])\n\ |
5400 @deftypefnx {Built-in Function} {} reshape (@var{A}, @dots{}, [], @dots{})\n\ | 5477 @deftypefnx {Built-in Function} {} reshape (@var{A}, @dots{}, [], @dots{})\n\ |
5401 @deftypefnx {Built-in Function} {} reshape (@var{A}, @var{size})\n\ | 5478 @deftypefnx {Built-in Function} {} reshape (@var{A}, @var{size})\n\ |
5402 Return a matrix with the specified dimensions (@var{m}, @var{n}, @dots{})\n\ | 5479 Return a matrix with the specified dimensions (@var{m}, @var{n}, @dots{})\n\ |
5403 whose elements are taken from the matrix @var{A}. The elements of the\n\ | 5480 whose elements are taken from the matrix @var{A}.\n\ |
5404 matrix are accessed in column-major order (like Fortran arrays are stored).\n\ | 5481 \n\ |
5482 The elements of the matrix are accessed in column-major order (like Fortran\n\ | |
5483 arrays are stored).\n\ | |
5405 \n\ | 5484 \n\ |
5406 The following code demonstrates reshaping a 1x4 row vector into a 2x2 square\n\ | 5485 The following code demonstrates reshaping a 1x4 row vector into a 2x2 square\n\ |
5407 matrix.\n\ | 5486 matrix.\n\ |
5408 \n\ | 5487 \n\ |
5409 @example\n\ | 5488 @example\n\ |
5413 2 4\n\ | 5492 2 4\n\ |
5414 @end group\n\ | 5493 @end group\n\ |
5415 @end example\n\ | 5494 @end example\n\ |
5416 \n\ | 5495 \n\ |
5417 @noindent\n\ | 5496 @noindent\n\ |
5418 Note that the total number of elements in the original\n\ | 5497 Note that the total number of elements in the original matrix\n\ |
5419 matrix (@code{prod (size (@var{A}))}) must match the total number of elements\n\ | 5498 (@code{prod (size (@var{A}))}) must match the total number of elements\n\ |
5420 in the new matrix (@code{prod ([@var{m} @var{n} @dots{}])}).\n\ | 5499 in the new matrix (@code{prod ([@var{m} @var{n} @dots{}])}).\n\ |
5421 \n\ | 5500 \n\ |
5422 A single dimension of the return matrix may be left unspecified and Octave\n\ | 5501 A single dimension of the return matrix may be left unspecified and Octave\n\ |
5423 will determine its size automatically. An empty matrix ([]) is used to flag\n\ | 5502 will determine its size automatically. An empty matrix ([]) is used to flag\n\ |
5424 the unspecified dimension.\n\ | 5503 the unspecified dimension.\n\ |
5546 DEFUN (vec, args, , | 5625 DEFUN (vec, args, , |
5547 "-*- texinfo -*-\n\ | 5626 "-*- texinfo -*-\n\ |
5548 @deftypefn {Built-in Function} {@var{v} =} vec (@var{x})\n\ | 5627 @deftypefn {Built-in Function} {@var{v} =} vec (@var{x})\n\ |
5549 @deftypefnx {Built-in Function} {@var{v} =} vec (@var{x}, @var{dim})\n\ | 5628 @deftypefnx {Built-in Function} {@var{v} =} vec (@var{x}, @var{dim})\n\ |
5550 Return the vector obtained by stacking the columns of the matrix @var{x}\n\ | 5629 Return the vector obtained by stacking the columns of the matrix @var{x}\n\ |
5551 one above the other. Without @var{dim} this is equivalent to\n\ | 5630 one above the other.\n\ |
5552 @code{@var{x}(:)}. If @var{dim} is supplied, the dimensions of @var{v}\n\ | 5631 \n\ |
5553 are set to @var{dim} with all elements along the last dimension.\n\ | 5632 Without @var{dim} this is equivalent to @code{@var{x}(:)}.\n\ |
5554 This is equivalent to @code{shiftdim (@var{x}(:), 1-@var{dim})}.\n\ | 5633 \n\ |
5634 If @var{dim} is supplied, the dimensions of @var{v} are set to @var{dim}\n\ | |
5635 with all elements along the last dimension. This is equivalent to\n\ | |
5636 @code{shiftdim (@var{x}(:), 1-@var{dim})}.\n\ | |
5555 @seealso{vech, resize, cat}\n\ | 5637 @seealso{vech, resize, cat}\n\ |
5556 @end deftypefn") | 5638 @end deftypefn") |
5557 { | 5639 { |
5558 octave_value retval; | 5640 octave_value retval; |
5559 int dim = 1; | 5641 int dim = 1; |
5611 | 5693 |
5612 DEFUN (squeeze, args, , | 5694 DEFUN (squeeze, args, , |
5613 "-*- texinfo -*-\n\ | 5695 "-*- texinfo -*-\n\ |
5614 @deftypefn {Built-in Function} {} squeeze (@var{x})\n\ | 5696 @deftypefn {Built-in Function} {} squeeze (@var{x})\n\ |
5615 Remove singleton dimensions from @var{x} and return the result.\n\ | 5697 Remove singleton dimensions from @var{x} and return the result.\n\ |
5698 \n\ | |
5616 Note that for compatibility with @sc{matlab}, all objects have\n\ | 5699 Note that for compatibility with @sc{matlab}, all objects have\n\ |
5617 a minimum of two dimensions and row vectors are left unchanged.\n\ | 5700 a minimum of two dimensions and row vectors are left unchanged.\n\ |
5618 @seealso{reshape}\n\ | 5701 @seealso{reshape}\n\ |
5619 @end deftypefn") | 5702 @end deftypefn") |
5620 { | 5703 { |
5629 } | 5712 } |
5630 | 5713 |
5631 DEFUN (full, args, , | 5714 DEFUN (full, args, , |
5632 "-*- texinfo -*-\n\ | 5715 "-*- texinfo -*-\n\ |
5633 @deftypefn {Built-in Function} {@var{FM} =} full (@var{SM})\n\ | 5716 @deftypefn {Built-in Function} {@var{FM} =} full (@var{SM})\n\ |
5634 Return a full storage matrix from a sparse, diagonal, permutation matrix,\n\ | 5717 Return a full storage matrix from a sparse, diagonal, or permutation matrix,\n\ |
5635 or a range.\n\ | 5718 or a range.\n\ |
5636 @seealso{sparse, issparse}\n\ | 5719 @seealso{sparse, issparse}\n\ |
5637 @end deftypefn") | 5720 @end deftypefn") |
5638 { | 5721 { |
5639 octave_value retval; | 5722 octave_value retval; |
5651 DEFUN (norm, args, , | 5734 DEFUN (norm, args, , |
5652 "-*- texinfo -*-\n\ | 5735 "-*- texinfo -*-\n\ |
5653 @deftypefn {Built-in Function} {} norm (@var{A})\n\ | 5736 @deftypefn {Built-in Function} {} norm (@var{A})\n\ |
5654 @deftypefnx {Built-in Function} {} norm (@var{A}, @var{p})\n\ | 5737 @deftypefnx {Built-in Function} {} norm (@var{A}, @var{p})\n\ |
5655 @deftypefnx {Built-in Function} {} norm (@var{A}, @var{p}, @var{opt})\n\ | 5738 @deftypefnx {Built-in Function} {} norm (@var{A}, @var{p}, @var{opt})\n\ |
5656 Compute the p-norm of the matrix @var{A}. If the second argument is\n\ | 5739 Compute the p-norm of the matrix @var{A}.\n\ |
5657 missing, @code{p = 2} is assumed.\n\ | 5740 \n\ |
5741 If the second argument is missing, @code{p = 2} is assumed.\n\ | |
5658 \n\ | 5742 \n\ |
5659 If @var{A} is a matrix (or sparse matrix):\n\ | 5743 If @var{A} is a matrix (or sparse matrix):\n\ |
5660 \n\ | 5744 \n\ |
5661 @table @asis\n\ | 5745 @table @asis\n\ |
5662 @item @var{p} = @code{1}\n\ | 5746 @item @var{p} = @code{1}\n\ |
5910 | 5994 |
5911 DEFUN (transpose, args, , | 5995 DEFUN (transpose, args, , |
5912 "-*- texinfo -*-\n\ | 5996 "-*- texinfo -*-\n\ |
5913 @deftypefn {Built-in Function} {} transpose (@var{x})\n\ | 5997 @deftypefn {Built-in Function} {} transpose (@var{x})\n\ |
5914 Return the transpose of @var{x}.\n\ | 5998 Return the transpose of @var{x}.\n\ |
5999 \n\ | |
5915 This function and @tcode{x.'} are equivalent.\n\ | 6000 This function and @tcode{x.'} are equivalent.\n\ |
5916 @seealso{ctranspose}\n\ | 6001 @seealso{ctranspose}\n\ |
5917 @end deftypefn") | 6002 @end deftypefn") |
5918 { | 6003 { |
5919 return unary_op_defun_body (octave_value::op_transpose, args); | 6004 return unary_op_defun_body (octave_value::op_transpose, args); |
5941 | 6026 |
5942 DEFUN (ctranspose, args, , | 6027 DEFUN (ctranspose, args, , |
5943 "-*- texinfo -*-\n\ | 6028 "-*- texinfo -*-\n\ |
5944 @deftypefn {Built-in Function} {} ctranspose (@var{x})\n\ | 6029 @deftypefn {Built-in Function} {} ctranspose (@var{x})\n\ |
5945 Return the complex conjugate transpose of @var{x}.\n\ | 6030 Return the complex conjugate transpose of @var{x}.\n\ |
6031 \n\ | |
5946 This function and @tcode{x'} are equivalent.\n\ | 6032 This function and @tcode{x'} are equivalent.\n\ |
5947 @seealso{transpose}\n\ | 6033 @seealso{transpose}\n\ |
5948 @end deftypefn") | 6034 @end deftypefn") |
5949 { | 6035 { |
5950 return unary_op_defun_body (octave_value::op_hermitian, args); | 6036 return unary_op_defun_body (octave_value::op_hermitian, args); |
6016 DEFUN (plus, args, , | 6102 DEFUN (plus, args, , |
6017 "-*- texinfo -*-\n\ | 6103 "-*- texinfo -*-\n\ |
6018 @deftypefn {Built-in Function} {} plus (@var{x}, @var{y})\n\ | 6104 @deftypefn {Built-in Function} {} plus (@var{x}, @var{y})\n\ |
6019 @deftypefnx {Built-in Function} {} plus (@var{x1}, @var{x2}, @dots{})\n\ | 6105 @deftypefnx {Built-in Function} {} plus (@var{x1}, @var{x2}, @dots{})\n\ |
6020 This function and @w{@tcode{x + y}} are equivalent.\n\ | 6106 This function and @w{@tcode{x + y}} are equivalent.\n\ |
6107 \n\ | |
6021 If more arguments are given, the summation is applied\n\ | 6108 If more arguments are given, the summation is applied\n\ |
6022 cumulatively from left to right:\n\ | 6109 cumulatively from left to right:\n\ |
6023 \n\ | 6110 \n\ |
6024 @example\n\ | 6111 @example\n\ |
6025 (@dots{}((x1 + x2) + x3) + @dots{})\n\ | 6112 (@dots{}((x1 + x2) + x3) + @dots{})\n\ |
6046 DEFUN (mtimes, args, , | 6133 DEFUN (mtimes, args, , |
6047 "-*- texinfo -*-\n\ | 6134 "-*- texinfo -*-\n\ |
6048 @deftypefn {Built-in Function} {} mtimes (@var{x}, @var{y})\n\ | 6135 @deftypefn {Built-in Function} {} mtimes (@var{x}, @var{y})\n\ |
6049 @deftypefnx {Built-in Function} {} mtimes (@var{x1}, @var{x2}, @dots{})\n\ | 6136 @deftypefnx {Built-in Function} {} mtimes (@var{x1}, @var{x2}, @dots{})\n\ |
6050 Return the matrix multiplication product of inputs.\n\ | 6137 Return the matrix multiplication product of inputs.\n\ |
6138 \n\ | |
6051 This function and @w{@tcode{x * y}} are equivalent.\n\ | 6139 This function and @w{@tcode{x * y}} are equivalent.\n\ |
6052 If more arguments are given, the multiplication is applied\n\ | 6140 If more arguments are given, the multiplication is applied\n\ |
6053 cumulatively from left to right:\n\ | 6141 cumulatively from left to right:\n\ |
6054 \n\ | 6142 \n\ |
6055 @example\n\ | 6143 @example\n\ |
6066 | 6154 |
6067 DEFUN (mrdivide, args, , | 6155 DEFUN (mrdivide, args, , |
6068 "-*- texinfo -*-\n\ | 6156 "-*- texinfo -*-\n\ |
6069 @deftypefn {Built-in Function} {} mrdivide (@var{x}, @var{y})\n\ | 6157 @deftypefn {Built-in Function} {} mrdivide (@var{x}, @var{y})\n\ |
6070 Return the matrix right division of @var{x} and @var{y}.\n\ | 6158 Return the matrix right division of @var{x} and @var{y}.\n\ |
6159 \n\ | |
6071 This function and @w{@tcode{x / y}} are equivalent.\n\ | 6160 This function and @w{@tcode{x / y}} are equivalent.\n\ |
6072 @seealso{mldivide, rdivide, plus, minus}\n\ | 6161 @seealso{mldivide, rdivide, plus, minus}\n\ |
6073 @end deftypefn") | 6162 @end deftypefn") |
6074 { | 6163 { |
6075 return binary_op_defun_body (octave_value::op_div, args); | 6164 return binary_op_defun_body (octave_value::op_div, args); |
6077 | 6166 |
6078 DEFUN (mpower, args, , | 6167 DEFUN (mpower, args, , |
6079 "-*- texinfo -*-\n\ | 6168 "-*- texinfo -*-\n\ |
6080 @deftypefn {Built-in Function} {} mpower (@var{x}, @var{y})\n\ | 6169 @deftypefn {Built-in Function} {} mpower (@var{x}, @var{y})\n\ |
6081 Return the matrix power operation of @var{x} raised to the @var{y} power.\n\ | 6170 Return the matrix power operation of @var{x} raised to the @var{y} power.\n\ |
6171 \n\ | |
6082 This function and @w{@tcode{x ^ y}} are equivalent.\n\ | 6172 This function and @w{@tcode{x ^ y}} are equivalent.\n\ |
6083 @seealso{power, mtimes, plus, minus}\n\ | 6173 @seealso{power, mtimes, plus, minus}\n\ |
6084 @end deftypefn") | 6174 @end deftypefn") |
6085 { | 6175 { |
6086 return binary_op_defun_body (octave_value::op_pow, args); | 6176 return binary_op_defun_body (octave_value::op_pow, args); |
6088 | 6178 |
6089 DEFUN (mldivide, args, , | 6179 DEFUN (mldivide, args, , |
6090 "-*- texinfo -*-\n\ | 6180 "-*- texinfo -*-\n\ |
6091 @deftypefn {Built-in Function} {} mldivide (@var{x}, @var{y})\n\ | 6181 @deftypefn {Built-in Function} {} mldivide (@var{x}, @var{y})\n\ |
6092 Return the matrix left division of @var{x} and @var{y}.\n\ | 6182 Return the matrix left division of @var{x} and @var{y}.\n\ |
6183 \n\ | |
6093 This function and @w{@tcode{x @xbackslashchar{} y}} are equivalent.\n\ | 6184 This function and @w{@tcode{x @xbackslashchar{} y}} are equivalent.\n\ |
6094 @seealso{mrdivide, ldivide, rdivide}\n\ | 6185 @seealso{mrdivide, ldivide, rdivide}\n\ |
6095 @end deftypefn") | 6186 @end deftypefn") |
6096 { | 6187 { |
6097 return binary_op_defun_body (octave_value::op_ldiv, args); | 6188 return binary_op_defun_body (octave_value::op_ldiv, args); |
6119 | 6210 |
6120 DEFUN (eq, args, , | 6211 DEFUN (eq, args, , |
6121 "-*- texinfo -*-\n\ | 6212 "-*- texinfo -*-\n\ |
6122 @deftypefn {Built-in Function} {} eq (@var{x}, @var{y})\n\ | 6213 @deftypefn {Built-in Function} {} eq (@var{x}, @var{y})\n\ |
6123 Return true if the two inputs are equal.\n\ | 6214 Return true if the two inputs are equal.\n\ |
6215 \n\ | |
6124 This function is equivalent to @w{@code{x == y}}.\n\ | 6216 This function is equivalent to @w{@code{x == y}}.\n\ |
6125 @seealso{ne, isequal, le, ge, gt, ne, lt}\n\ | 6217 @seealso{ne, isequal, le, ge, gt, ne, lt}\n\ |
6126 @end deftypefn") | 6218 @end deftypefn") |
6127 { | 6219 { |
6128 return binary_op_defun_body (octave_value::op_eq, args); | 6220 return binary_op_defun_body (octave_value::op_eq, args); |
6150 | 6242 |
6151 DEFUN (ne, args, , | 6243 DEFUN (ne, args, , |
6152 "-*- texinfo -*-\n\ | 6244 "-*- texinfo -*-\n\ |
6153 @deftypefn {Built-in Function} {} ne (@var{x}, @var{y})\n\ | 6245 @deftypefn {Built-in Function} {} ne (@var{x}, @var{y})\n\ |
6154 Return true if the two inputs are not equal.\n\ | 6246 Return true if the two inputs are not equal.\n\ |
6247 \n\ | |
6155 This function is equivalent to @w{@code{x != y}}.\n\ | 6248 This function is equivalent to @w{@code{x != y}}.\n\ |
6156 @seealso{eq, isequal, le, ge, lt}\n\ | 6249 @seealso{eq, isequal, le, ge, lt}\n\ |
6157 @end deftypefn") | 6250 @end deftypefn") |
6158 { | 6251 { |
6159 return binary_op_defun_body (octave_value::op_ne, args); | 6252 return binary_op_defun_body (octave_value::op_ne, args); |
6162 DEFUN (times, args, , | 6255 DEFUN (times, args, , |
6163 "-*- texinfo -*-\n\ | 6256 "-*- texinfo -*-\n\ |
6164 @deftypefn {Built-in Function} {} times (@var{x}, @var{y})\n\ | 6257 @deftypefn {Built-in Function} {} times (@var{x}, @var{y})\n\ |
6165 @deftypefnx {Built-in Function} {} times (@var{x1}, @var{x2}, @dots{})\n\ | 6258 @deftypefnx {Built-in Function} {} times (@var{x1}, @var{x2}, @dots{})\n\ |
6166 Return the element-by-element multiplication product of inputs.\n\ | 6259 Return the element-by-element multiplication product of inputs.\n\ |
6260 \n\ | |
6167 This function and @w{@tcode{x .* y}} are equivalent.\n\ | 6261 This function and @w{@tcode{x .* y}} are equivalent.\n\ |
6168 If more arguments are given, the multiplication is applied\n\ | 6262 If more arguments are given, the multiplication is applied\n\ |
6169 cumulatively from left to right:\n\ | 6263 cumulatively from left to right:\n\ |
6170 \n\ | 6264 \n\ |
6171 @example\n\ | 6265 @example\n\ |
6182 | 6276 |
6183 DEFUN (rdivide, args, , | 6277 DEFUN (rdivide, args, , |
6184 "-*- texinfo -*-\n\ | 6278 "-*- texinfo -*-\n\ |
6185 @deftypefn {Built-in Function} {} rdivide (@var{x}, @var{y})\n\ | 6279 @deftypefn {Built-in Function} {} rdivide (@var{x}, @var{y})\n\ |
6186 Return the element-by-element right division of @var{x} and @var{y}.\n\ | 6280 Return the element-by-element right division of @var{x} and @var{y}.\n\ |
6281 \n\ | |
6187 This function and @w{@tcode{x ./ y}} are equivalent.\n\ | 6282 This function and @w{@tcode{x ./ y}} are equivalent.\n\ |
6188 @seealso{ldivide, mrdivide, times, plus}\n\ | 6283 @seealso{ldivide, mrdivide, times, plus}\n\ |
6189 @end deftypefn") | 6284 @end deftypefn") |
6190 { | 6285 { |
6191 return binary_op_defun_body (octave_value::op_el_div, args); | 6286 return binary_op_defun_body (octave_value::op_el_div, args); |
6193 | 6288 |
6194 DEFUN (power, args, , | 6289 DEFUN (power, args, , |
6195 "-*- texinfo -*-\n\ | 6290 "-*- texinfo -*-\n\ |
6196 @deftypefn {Built-in Function} {} power (@var{x}, @var{y})\n\ | 6291 @deftypefn {Built-in Function} {} power (@var{x}, @var{y})\n\ |
6197 Return the element-by-element operation of @var{x} raised to the\n\ | 6292 Return the element-by-element operation of @var{x} raised to the\n\ |
6198 @var{y} power. If several complex results are possible,\n\ | 6293 @var{y} power.\n\ |
6199 returns the one with smallest non-negative argument (angle). Use\n\ | |
6200 @code{realpow}, @code{realsqrt}, @code{cbrt}, or @code{nthroot} if a\n\ | |
6201 real result is preferred.\n\ | |
6202 \n\ | 6294 \n\ |
6203 This function and @w{@tcode{x .^ y}} are equivalent.\n\ | 6295 This function and @w{@tcode{x .^ y}} are equivalent.\n\ |
6296 \n\ | |
6297 If several complex results are possible, returns the one with smallest\n\ | |
6298 non-negative argument (angle). Use @code{realpow}, @code{realsqrt},\n\ | |
6299 @code{cbrt}, or @code{nthroot} if a real result is preferred.\n\ | |
6300 \n\ | |
6204 @seealso{mpower, realpow, realsqrt, cbrt, nthroot}\n\ | 6301 @seealso{mpower, realpow, realsqrt, cbrt, nthroot}\n\ |
6205 @end deftypefn") | 6302 @end deftypefn") |
6206 { | 6303 { |
6207 return binary_op_defun_body (octave_value::op_el_pow, args); | 6304 return binary_op_defun_body (octave_value::op_el_pow, args); |
6208 } | 6305 } |
6209 | 6306 |
6210 DEFUN (ldivide, args, , | 6307 DEFUN (ldivide, args, , |
6211 "-*- texinfo -*-\n\ | 6308 "-*- texinfo -*-\n\ |
6212 @deftypefn {Built-in Function} {} ldivide (@var{x}, @var{y})\n\ | 6309 @deftypefn {Built-in Function} {} ldivide (@var{x}, @var{y})\n\ |
6213 Return the element-by-element left division of @var{x} and @var{y}.\n\ | 6310 Return the element-by-element left division of @var{x} and @var{y}.\n\ |
6311 \n\ | |
6214 This function and @w{@tcode{x .@xbackslashchar{} y}} are equivalent.\n\ | 6312 This function and @w{@tcode{x .@xbackslashchar{} y}} are equivalent.\n\ |
6215 @seealso{rdivide, mldivide, times, plus}\n\ | 6313 @seealso{rdivide, mldivide, times, plus}\n\ |
6216 @end deftypefn") | 6314 @end deftypefn") |
6217 { | 6315 { |
6218 return binary_op_defun_body (octave_value::op_el_ldiv, args); | 6316 return binary_op_defun_body (octave_value::op_el_ldiv, args); |
6301 @deftypefn {Built-in Function} {} tic ()\n\ | 6399 @deftypefn {Built-in Function} {} tic ()\n\ |
6302 @deftypefnx {Built-in Function} {@var{id} =} tic ()\n\ | 6400 @deftypefnx {Built-in Function} {@var{id} =} tic ()\n\ |
6303 @deftypefnx {Built-in Function} {} toc ()\n\ | 6401 @deftypefnx {Built-in Function} {} toc ()\n\ |
6304 @deftypefnx {Built-in Function} {} toc (@var{id})\n\ | 6402 @deftypefnx {Built-in Function} {} toc (@var{id})\n\ |
6305 @deftypefnx {Built-in Function} {@var{val} =} toc (@dots{})\n\ | 6403 @deftypefnx {Built-in Function} {@var{val} =} toc (@dots{})\n\ |
6306 Set or check a wall-clock timer. Calling @code{tic} without an\n\ | 6404 Set or check a wall-clock timer.\n\ |
6307 output argument sets the internal timer state. Subsequent calls\n\ | 6405 \n\ |
6308 to @code{toc} return the number of seconds since the timer was set.\n\ | 6406 Calling @code{tic} without an output argument sets the internal timer state.\n\ |
6407 Subsequent calls to @code{toc} return the number of seconds since the timer\n\ | |
6408 was set.\n\ | |
6309 For example,\n\ | 6409 For example,\n\ |
6310 \n\ | 6410 \n\ |
6311 @example\n\ | 6411 @example\n\ |
6312 @group\n\ | 6412 @group\n\ |
6313 tic ();\n\ | 6413 tic ();\n\ |
6432 */ | 6532 */ |
6433 | 6533 |
6434 DEFUN (cputime, args, , | 6534 DEFUN (cputime, args, , |
6435 "-*- texinfo -*-\n\ | 6535 "-*- texinfo -*-\n\ |
6436 @deftypefn {Built-in Function} {[@var{total}, @var{user}, @var{system}] =} cputime ();\n\ | 6536 @deftypefn {Built-in Function} {[@var{total}, @var{user}, @var{system}] =} cputime ();\n\ |
6437 Return the CPU time used by your Octave session. The first output is\n\ | 6537 Return the CPU time used by your Octave session.\n\ |
6438 the total time spent executing your process and is equal to the sum of\n\ | 6538 \n\ |
6439 second and third outputs, which are the number of CPU seconds spent\n\ | 6539 The first output is the total time spent executing your process and is equal\n\ |
6440 executing in user mode and the number of CPU seconds spent executing in\n\ | 6540 to the sum of second and third outputs, which are the number of CPU seconds\n\ |
6441 system mode, respectively. If your system does not have a way to report\n\ | 6541 spent executing in user mode and the number of CPU seconds spent executing\n\ |
6442 CPU time usage, @code{cputime} returns 0 for each of its output values.\n\ | 6542 in system mode, respectively.\n\ |
6543 \n\ | |
6544 If your system does not have a way to report CPU time usage, @code{cputime}\n\ | |
6545 returns 0 for each of its output values.\n\ | |
6546 \n\ | |
6443 Note that because Octave used some CPU time to start, it is reasonable\n\ | 6547 Note that because Octave used some CPU time to start, it is reasonable\n\ |
6444 to check to see if @code{cputime} works by checking to see if the total\n\ | 6548 to check to see if @code{cputime} works by checking to see if the total\n\ |
6445 CPU time used is nonzero.\n\ | 6549 CPU time used is nonzero.\n\ |
6446 @seealso{tic, toc}\n\ | 6550 @seealso{tic, toc}\n\ |
6447 @end deftypefn") | 6551 @end deftypefn") |
6503 "-*- texinfo -*-\n\ | 6607 "-*- texinfo -*-\n\ |
6504 @deftypefn {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x})\n\ | 6608 @deftypefn {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x})\n\ |
6505 @deftypefnx {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim})\n\ | 6609 @deftypefnx {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim})\n\ |
6506 @deftypefnx {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{mode})\n\ | 6610 @deftypefnx {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{mode})\n\ |
6507 @deftypefnx {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim}, @var{mode})\n\ | 6611 @deftypefnx {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim}, @var{mode})\n\ |
6508 Return a copy of @var{x} with the elements arranged in increasing\n\ | 6612 Return a copy of @var{x} with the elements arranged in increasing order.\n\ |
6509 order. For matrices, @code{sort} orders the elements within columns\n\ | 6613 \n\ |
6614 For matrices, @code{sort} orders the elements within columns\n\ | |
6510 \n\ | 6615 \n\ |
6511 For example:\n\ | 6616 For example:\n\ |
6512 \n\ | 6617 \n\ |
6513 @example\n\ | 6618 @example\n\ |
6514 @group\n\ | 6619 @group\n\ |
6916 @deftypefn {Built-in Function} {} issorted (@var{a})\n\ | 7021 @deftypefn {Built-in Function} {} issorted (@var{a})\n\ |
6917 @deftypefnx {Built-in Function} {} issorted (@var{a}, @var{mode})\n\ | 7022 @deftypefnx {Built-in Function} {} issorted (@var{a}, @var{mode})\n\ |
6918 @deftypefnx {Built-in Function} {} issorted (@var{a}, \"rows\", @var{mode})\n\ | 7023 @deftypefnx {Built-in Function} {} issorted (@var{a}, \"rows\", @var{mode})\n\ |
6919 Return true if the array is sorted according to @var{mode}, which\n\ | 7024 Return true if the array is sorted according to @var{mode}, which\n\ |
6920 may be either @qcode{\"ascending\"}, @qcode{\"descending\"}, or\n\ | 7025 may be either @qcode{\"ascending\"}, @qcode{\"descending\"}, or\n\ |
6921 @qcode{\"either\"}. By default, @var{mode} is @qcode{\"ascending\"}. NaNs\n\ | 7026 @qcode{\"either\"}.\n\ |
6922 are treated in the same manner as @code{sort}.\n\ | 7027 \n\ |
7028 By default, @var{mode} is @qcode{\"ascending\"}. NaNs are treated in the\n\ | |
7029 same manner as @code{sort}.\n\ | |
6923 \n\ | 7030 \n\ |
6924 If the optional argument @qcode{\"rows\"} is supplied, check whether\n\ | 7031 If the optional argument @qcode{\"rows\"} is supplied, check whether\n\ |
6925 the array is sorted by rows as output by the function @code{sortrows}\n\ | 7032 the array is sorted by rows as output by the function @code{sortrows}\n\ |
6926 (with no options).\n\ | 7033 (with no options).\n\ |
6927 \n\ | 7034 \n\ |
7024 DEFUN (nth_element, args, , | 7131 DEFUN (nth_element, args, , |
7025 "-*- texinfo -*-\n\ | 7132 "-*- texinfo -*-\n\ |
7026 @deftypefn {Built-in Function} {} nth_element (@var{x}, @var{n})\n\ | 7133 @deftypefn {Built-in Function} {} nth_element (@var{x}, @var{n})\n\ |
7027 @deftypefnx {Built-in Function} {} nth_element (@var{x}, @var{n}, @var{dim})\n\ | 7134 @deftypefnx {Built-in Function} {} nth_element (@var{x}, @var{n}, @var{dim})\n\ |
7028 Select the n-th smallest element of a vector, using the ordering defined by\n\ | 7135 Select the n-th smallest element of a vector, using the ordering defined by\n\ |
7029 @code{sort}. In other words, the result is equivalent to\n\ | 7136 @code{sort}.\n\ |
7030 @code{sort(@var{x})(@var{n})}.\n\ | 7137 \n\ |
7138 The result is equivalent to @code{sort(@var{x})(@var{n})}.\n\ | |
7139 \n\ | |
7031 @var{n} can also be a contiguous range, either ascending @code{l:u}\n\ | 7140 @var{n} can also be a contiguous range, either ascending @code{l:u}\n\ |
7032 or descending @code{u:-1:l}, in which case a range of elements is returned.\n\ | 7141 or descending @code{u:-1:l}, in which case a range of elements is returned.\n\ |
7142 \n\ | |
7033 If @var{x} is an array, @code{nth_element} operates along the dimension\n\ | 7143 If @var{x} is an array, @code{nth_element} operates along the dimension\n\ |
7034 defined by @var{dim}, or the first non-singleton dimension if @var{dim} is\n\ | 7144 defined by @var{dim}, or the first non-singleton dimension if @var{dim} is\n\ |
7035 not given.\n\ | 7145 not given.\n\ |
7036 \n\ | 7146 \n\ |
7037 nth_element encapsulates the C++ standard library algorithms nth_element and\n\ | 7147 Programming Note: nth_element encapsulates the C++ standard library\n\ |
7038 partial_sort. On average, the complexity of the operation is O(M*log(K)),\n\ | 7148 algorithms nth_element and partial_sort. On average, the complexity of the\n\ |
7039 where @w{@code{M = size (@var{x}, @var{dim})}} and\n\ | 7149 operation is O(M*log(K)), where @w{@code{M = size (@var{x}, @var{dim})}} and\n\ |
7040 @w{@code{K = length (@var{n})}}.\n\ | 7150 @w{@code{K = length (@var{n})}}. This function is intended for cases where\n\ |
7041 This function is intended for cases where the ratio K/M is small; otherwise,\n\ | 7151 the ratio K/M is small; otherwise, it may be better to use @code{sort}.\n\ |
7042 it may be better to use @code{sort}.\n\ | |
7043 @seealso{sort, min, max}\n\ | 7152 @seealso{sort, min, max}\n\ |
7044 @end deftypefn") | 7153 @end deftypefn") |
7045 { | 7154 { |
7046 octave_value retval; | 7155 octave_value retval; |
7047 int nargin = args.length (); | 7156 int nargin = args.length (); |
7450 DEFUN (merge, args, , | 7559 DEFUN (merge, args, , |
7451 "-*- texinfo -*-\n\ | 7560 "-*- texinfo -*-\n\ |
7452 @deftypefn {Built-in Function} {} merge (@var{mask}, @var{tval}, @var{fval})\n\ | 7561 @deftypefn {Built-in Function} {} merge (@var{mask}, @var{tval}, @var{fval})\n\ |
7453 @deftypefnx {Built-in Function} {} ifelse (@var{mask}, @var{tval}, @var{fval})\n\ | 7562 @deftypefnx {Built-in Function} {} ifelse (@var{mask}, @var{tval}, @var{fval})\n\ |
7454 Merge elements of @var{true_val} and @var{false_val}, depending on the\n\ | 7563 Merge elements of @var{true_val} and @var{false_val}, depending on the\n\ |
7455 value of @var{mask}. If @var{mask} is a logical scalar, the other two\n\ | 7564 value of @var{mask}.\n\ |
7456 arguments can be arbitrary values. Otherwise, @var{mask} must be a logical\n\ | 7565 \n\ |
7457 array, and @var{tval}, @var{fval} should be arrays of matching class, or\n\ | 7566 If @var{mask} is a logical scalar, the other two arguments can be arbitrary\n\ |
7458 cell arrays. In the scalar mask case, @var{tval} is returned if @var{mask}\n\ | 7567 values. Otherwise, @var{mask} must be a logical array, and @var{tval},\n\ |
7459 is true, otherwise @var{fval} is returned.\n\ | 7568 @var{fval} should be arrays of matching class, or cell arrays. In the\n\ |
7569 scalar mask case, @var{tval} is returned if @var{mask} is true, otherwise\n\ | |
7570 @var{fval} is returned.\n\ | |
7460 \n\ | 7571 \n\ |
7461 In the array mask case, both @var{tval} and @var{fval} must be either\n\ | 7572 In the array mask case, both @var{tval} and @var{fval} must be either\n\ |
7462 scalars or arrays with dimensions equal to @var{mask}. The result is\n\ | 7573 scalars or arrays with dimensions equal to @var{mask}. The result is\n\ |
7463 constructed as follows:\n\ | 7574 constructed as follows:\n\ |
7464 \n\ | 7575 \n\ |
7467 result(mask) = tval(mask);\n\ | 7578 result(mask) = tval(mask);\n\ |
7468 result(! mask) = fval(! mask);\n\ | 7579 result(! mask) = fval(! mask);\n\ |
7469 @end group\n\ | 7580 @end group\n\ |
7470 @end example\n\ | 7581 @end example\n\ |
7471 \n\ | 7582 \n\ |
7472 @var{mask} can also be arbitrary numeric type, in which case\n\ | 7583 @var{mask} can also be arbitrary numeric type, in which case it is first\n\ |
7473 it is first converted to logical.\n\ | 7584 converted to logical.\n\ |
7474 @seealso{logical, diff}\n\ | 7585 @seealso{logical, diff}\n\ |
7475 @end deftypefn") | 7586 @end deftypefn") |
7476 { | 7587 { |
7477 int nargin = args.length (); | 7588 int nargin = args.length (); |
7478 octave_value retval; | 7589 octave_value retval; |
7793 } | 7904 } |
7794 | 7905 |
7795 DEFUN (repelems, args, , | 7906 DEFUN (repelems, args, , |
7796 "-*- texinfo -*-\n\ | 7907 "-*- texinfo -*-\n\ |
7797 @deftypefn {Built-in Function} {} repelems (@var{x}, @var{r})\n\ | 7908 @deftypefn {Built-in Function} {} repelems (@var{x}, @var{r})\n\ |
7798 Construct a vector of repeated elements from @var{x}. @var{r}\n\ | 7909 Construct a vector of repeated elements from @var{x}.\n\ |
7799 is a 2x@var{N} integer matrix specifying which elements to repeat and\n\ | 7910 \n\ |
7800 how often to repeat each element.\n\ | 7911 @var{r} is a 2x@var{N} integer matrix specifying which elements to repeat and\n\ |
7801 \n\ | 7912 how often to repeat each element. Entries in the first row, @var{r}(1,j),\n\ |
7802 Entries in the first row, @var{r}(1,j), select an element to repeat.\n\ | 7913 select an element to repeat. The corresponding entry in the second row,\n\ |
7803 The corresponding entry in the second row, @var{r}(2,j), specifies\n\ | 7914 @var{r}(2,j), specifies the repeat count. If @var{x} is a matrix then the\n\ |
7804 the repeat count. If @var{x} is a matrix then the columns of @var{x} are\n\ | 7915 columns of @var{x} are imagined to be stacked on top of each other for\n\ |
7805 imagined to be stacked on top of each other for purposes of the selection\n\ | 7916 purposes of the selection index. A row vector is always returned.\n\ |
7806 index. A row vector is always returned.\n\ | |
7807 \n\ | 7917 \n\ |
7808 Conceptually the result is calculated as follows:\n\ | 7918 Conceptually the result is calculated as follows:\n\ |
7809 \n\ | 7919 \n\ |
7810 @example\n\ | 7920 @example\n\ |
7811 @group\n\ | 7921 @group\n\ |
7991 DEFUN (base64_decode, args, , | 8101 DEFUN (base64_decode, args, , |
7992 "-*- texinfo -*-\n\ | 8102 "-*- texinfo -*-\n\ |
7993 @deftypefn {Built-in Function} {@var{x} =} base64_decode (@var{s})\n\ | 8103 @deftypefn {Built-in Function} {@var{x} =} base64_decode (@var{s})\n\ |
7994 @deftypefnx {Built-in Function} {@var{x} =} base64_decode (@var{s}, @var{dims})\n\ | 8104 @deftypefnx {Built-in Function} {@var{x} =} base64_decode (@var{s}, @var{dims})\n\ |
7995 Decode the double matrix or array @var{x} from the base64 encoded string\n\ | 8105 Decode the double matrix or array @var{x} from the base64 encoded string\n\ |
7996 @var{s}. The optional input parameter @var{dims} should be a vector\n\ | 8106 @var{s}.\n\ |
7997 containing the dimensions of the decoded array.\n\ | 8107 \n\ |
8108 The optional input parameter @var{dims} should be a vector containing the\n\ | |
8109 dimensions of the decoded array.\n\ | |
7998 @seealso{base64_encode}\n\ | 8110 @seealso{base64_encode}\n\ |
7999 @end deftypefn") | 8111 @end deftypefn") |
8000 { | 8112 { |
8001 octave_value retval; | 8113 octave_value retval; |
8002 | 8114 |