Mercurial > octave-nkf
comparison libinterp/corefcn/data.cc @ 20626:5fc798a9b32c
maint: Periodic merge of stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 09 Oct 2015 19:28:05 -0700 |
parents | ba2b07c13913 db3286201347 |
children |
comparison
equal
deleted
inserted
replaced
20624:7c0e10f035bd | 20626:5fc798a9b32c |
---|---|
485 binary mantissa and exponent so that\n\ | 485 binary mantissa and exponent so that\n\ |
486 @tex\n\ | 486 @tex\n\ |
487 ${1 \\over 2} \\le \\left| f \\right| < 1$\n\ | 487 ${1 \\over 2} \\le \\left| f \\right| < 1$\n\ |
488 @end tex\n\ | 488 @end tex\n\ |
489 @ifnottex\n\ | 489 @ifnottex\n\ |
490 @code{1/2 <= abs(f) < 1}\n\ | 490 @w{@code{1/2 <= abs(f) < 1}}\n\ |
491 @end ifnottex\n\ | 491 @end ifnottex\n\ |
492 and @var{e} is an integer. If\n\ | 492 and @var{e} is an integer. If\n\ |
493 @tex\n\ | 493 @tex\n\ |
494 $x = 0$, $f = e = 0$.\n\ | 494 $x = 0$, $f = e = 0$.\n\ |
495 @end tex\n\ | 495 @end tex\n\ |
496 @ifnottex\n\ | 496 @ifnottex\n\ |
497 @code{x = 0}, @code{f = e = 0}.\n\ | 497 @w{@code{x = 0}}, @w{@code{f = e = 0}}.\n\ |
498 @end ifnottex\n\ | 498 @end ifnottex\n\ |
499 @seealso{pow2, log, log10, exp}\n\ | 499 @seealso{pow2, log, log10, exp}\n\ |
500 @end deftypefn") | 500 @end deftypefn") |
501 { | 501 { |
502 octave_value_list retval; | 502 octave_value_list retval; |
2591 "-*- texinfo -*-\n\ | 2591 "-*- texinfo -*-\n\ |
2592 @deftypefn {Built-in Function} {} permute (@var{A}, @var{perm})\n\ | 2592 @deftypefn {Built-in Function} {} permute (@var{A}, @var{perm})\n\ |
2593 Return the generalized transpose for an N-D array object @var{A}.\n\ | 2593 Return the generalized transpose for an N-D array object @var{A}.\n\ |
2594 \n\ | 2594 \n\ |
2595 The permutation vector @var{perm} must contain the elements\n\ | 2595 The permutation vector @var{perm} must contain the elements\n\ |
2596 @code{1:ndims (A)} (in any order, but each element must appear only once).\n\ | 2596 @w{@code{1:ndims (A)}} (in any order, but each element must appear only\n\ |
2597 \n\ | 2597 once). The @var{N}th dimension of @var{A} gets remapped to dimension\n\ |
2598 The @var{N}th dimension of @var{A} gets remapped to dimension\n\ | |
2599 @code{@var{PERM}(@var{N})}. For example:\n\ | 2598 @code{@var{PERM}(@var{N})}. For example:\n\ |
2600 \n\ | 2599 \n\ |
2601 @example\n\ | 2600 @example\n\ |
2602 @group\n\ | 2601 @group\n\ |
2603 @var{x} = zeros ([2, 3, 5, 7]);\n\ | 2602 @var{x} = zeros ([2, 3, 5, 7]);\n\ |
2700 \n\ | 2699 \n\ |
2701 @example\n\ | 2700 @example\n\ |
2702 @var{a}(@var{idx1}, @var{idx2}, @dots{})\n\ | 2701 @var{a}(@var{idx1}, @var{idx2}, @dots{})\n\ |
2703 @end example\n\ | 2702 @end example\n\ |
2704 \n\ | 2703 \n\ |
2705 Note that the indices do not have to be numerical. For example,\n\ | 2704 Note that the indices do not have to be scalar numbers. For example,\n\ |
2706 \n\ | 2705 \n\ |
2707 @example\n\ | 2706 @example\n\ |
2708 @group\n\ | 2707 @group\n\ |
2709 @var{a} = 1;\n\ | 2708 @var{a} = 1;\n\ |
2710 @var{b} = ones (2, 3);\n\ | 2709 @var{b} = ones (2, 3);\n\ |
2712 @end group\n\ | 2711 @end group\n\ |
2713 @end example\n\ | 2712 @end example\n\ |
2714 \n\ | 2713 \n\ |
2715 @noindent\n\ | 2714 @noindent\n\ |
2716 will return 6, as this is the number of ways to index with @var{b}.\n\ | 2715 will return 6, as this is the number of ways to index with @var{b}.\n\ |
2716 Or the index could be the string @qcode{\":\"} which represents the colon\n\ | |
2717 operator. For example,\n\ | |
2718 \n\ | |
2719 @example\n\ | |
2720 @group\n\ | |
2721 @var{a} = ones (5, 3);\n\ | |
2722 numel (@var{a}, 2, \":\")\n\ | |
2723 @end group\n\ | |
2724 @end example\n\ | |
2725 \n\ | |
2726 @noindent\n\ | |
2727 will return 3 as the second row has three column entries.\n\ | |
2717 \n\ | 2728 \n\ |
2718 This method is also called when an object appears as lvalue with cs-list\n\ | 2729 This method is also called when an object appears as lvalue with cs-list\n\ |
2719 indexing, i.e., @code{object@{@dots{}@}} or @code{object(@dots{}).field}.\n\ | 2730 indexing, i.e., @code{object@{@dots{}@}} or @code{object(@dots{}).field}.\n\ |
2720 @seealso{size}\n\ | 2731 @seealso{size}\n\ |
2721 @end deftypefn") | 2732 @end deftypefn") |
3296 "-*- texinfo -*-\n\ | 3307 "-*- texinfo -*-\n\ |
3297 @deftypefn {Built-in Function} {} complex (@var{x})\n\ | 3308 @deftypefn {Built-in Function} {} complex (@var{x})\n\ |
3298 @deftypefnx {Built-in Function} {} complex (@var{re}, @var{im})\n\ | 3309 @deftypefnx {Built-in Function} {} complex (@var{re}, @var{im})\n\ |
3299 Return a complex value from real arguments.\n\ | 3310 Return a complex value from real arguments.\n\ |
3300 \n\ | 3311 \n\ |
3301 With 1 real argument @var{x}, return the complex result @code{@var{x} + 0i}.\n\ | 3312 With 1 real argument @var{x}, return the complex result\n\ |
3302 \n\ | 3313 @w{@code{@var{x} + 0i}}.\n\ |
3303 With 2 real arguments, return the complex result @code{@var{re} + @var{im}}.\n\ | 3314 \n\ |
3315 With 2 real arguments, return the complex result\n\ | |
3316 @w{@code{@var{re} + @var{im}}}.\n\ | |
3304 @code{complex} can often be more convenient than expressions such as\n\ | 3317 @code{complex} can often be more convenient than expressions such as\n\ |
3305 @code{a + i*b}.\n\ | 3318 @w{@code{a + i*b}}.\n\ |
3306 For example:\n\ | 3319 For example:\n\ |
3307 \n\ | 3320 \n\ |
3308 @example\n\ | 3321 @example\n\ |
3309 @group\n\ | 3322 @group\n\ |
3310 complex ([1, 2], [3, 4])\n\ | 3323 complex ([1, 2], [3, 4])\n\ |
4818 to the pure imaginary unit, defined as\n\ | 4831 to the pure imaginary unit, defined as\n\ |
4819 @tex\n\ | 4832 @tex\n\ |
4820 $\\sqrt{-1}$.\n\ | 4833 $\\sqrt{-1}$.\n\ |
4821 @end tex\n\ | 4834 @end tex\n\ |
4822 @ifnottex\n\ | 4835 @ifnottex\n\ |
4823 @code{sqrt (-1)}.\n\ | 4836 @w{@code{sqrt (-1)}}.\n\ |
4824 @end ifnottex\n\ | 4837 @end ifnottex\n\ |
4825 \n\ | 4838 \n\ |
4826 I, and its equivalents i, j, and J, are functions so any of the names may\n\ | 4839 I, and its equivalents i, j, and J, are functions so any of the names may\n\ |
4827 be reused for other purposes (such as i for a counter variable).\n\ | 4840 be reused for other purposes (such as i for a counter variable).\n\ |
4828 \n\ | 4841 \n\ |
5671 @deftypefn {Built-in Function} {} norm (@var{A})\n\ | 5684 @deftypefn {Built-in Function} {} norm (@var{A})\n\ |
5672 @deftypefnx {Built-in Function} {} norm (@var{A}, @var{p})\n\ | 5685 @deftypefnx {Built-in Function} {} norm (@var{A}, @var{p})\n\ |
5673 @deftypefnx {Built-in Function} {} norm (@var{A}, @var{p}, @var{opt})\n\ | 5686 @deftypefnx {Built-in Function} {} norm (@var{A}, @var{p}, @var{opt})\n\ |
5674 Compute the p-norm of the matrix @var{A}.\n\ | 5687 Compute the p-norm of the matrix @var{A}.\n\ |
5675 \n\ | 5688 \n\ |
5676 If the second argument is missing, @code{p = 2} is assumed.\n\ | 5689 If the second argument is missing, @w{@code{p = 2}} is assumed.\n\ |
5677 \n\ | 5690 \n\ |
5678 If @var{A} is a matrix (or sparse matrix):\n\ | 5691 If @var{A} is a matrix (or sparse matrix):\n\ |
5679 \n\ | 5692 \n\ |
5680 @table @asis\n\ | 5693 @table @asis\n\ |
5681 @item @var{p} = @code{1}\n\ | 5694 @item @var{p} = @code{1}\n\ |
6572 @end example\n\ | 6585 @end example\n\ |
6573 \n\ | 6586 \n\ |
6574 For equal elements, the indices are such that equal elements are listed\n\ | 6587 For equal elements, the indices are such that equal elements are listed\n\ |
6575 in the order in which they appeared in the original list.\n\ | 6588 in the order in which they appeared in the original list.\n\ |
6576 \n\ | 6589 \n\ |
6577 Sorting of complex entries is done first by magnitude (@code{abs (@var{z})})\n\ | 6590 Sorting of complex entries is done first by magnitude\n\ |
6578 and for any ties by phase angle (@code{angle (z)}). For example:\n\ | 6591 (@w{@code{abs (@var{z})}}) and for any ties by phase angle\n\ |
6592 (@w{@code{angle (z)}}). For example:\n\ | |
6579 \n\ | 6593 \n\ |
6580 @example\n\ | 6594 @example\n\ |
6581 @group\n\ | 6595 @group\n\ |
6582 sort ([1+i; 1; 1-i])\n\ | 6596 sort ([1+i; 1; 1-i])\n\ |
6583 @result{} 1 + 0i\n\ | 6597 @result{} 1 + 0i\n\ |
7718 DEFUN (diff, args, , | 7732 DEFUN (diff, args, , |
7719 "-*- texinfo -*-\n\ | 7733 "-*- texinfo -*-\n\ |
7720 @deftypefn {Built-in Function} {} diff (@var{x})\n\ | 7734 @deftypefn {Built-in Function} {} diff (@var{x})\n\ |
7721 @deftypefnx {Built-in Function} {} diff (@var{x}, @var{k})\n\ | 7735 @deftypefnx {Built-in Function} {} diff (@var{x}, @var{k})\n\ |
7722 @deftypefnx {Built-in Function} {} diff (@var{x}, @var{k}, @var{dim})\n\ | 7736 @deftypefnx {Built-in Function} {} diff (@var{x}, @var{k}, @var{dim})\n\ |
7723 If @var{x} is a vector of length @math{n}, @code{diff (@var{x})} is the\n\ | 7737 If @var{x} is a vector of length @math{n}, @w{@code{diff (@var{x})}} is the\n\ |
7724 vector of first differences\n\ | 7738 vector of first differences\n\ |
7725 @tex\n\ | 7739 @tex\n\ |
7726 $x_2 - x_1, \\ldots{}, x_n - x_{n-1}$.\n\ | 7740 $x_2 - x_1, \\ldots{}, x_n - x_{n-1}$.\n\ |
7727 @end tex\n\ | 7741 @end tex\n\ |
7728 @ifnottex\n\ | 7742 @ifnottex\n\ |
7729 @var{x}(2) - @var{x}(1), @dots{}, @var{x}(n) - @var{x}(n-1).\n\ | 7743 @var{x}(2) - @var{x}(1), @dots{}, @var{x}(n) - @var{x}(n-1).\n\ |
7730 @end ifnottex\n\ | 7744 @end ifnottex\n\ |
7731 \n\ | 7745 \n\ |
7732 If @var{x} is a matrix, @code{diff (@var{x})} is the matrix of column\n\ | 7746 If @var{x} is a matrix, @w{@code{diff (@var{x})}} is the matrix of column\n\ |
7733 differences along the first non-singleton dimension.\n\ | 7747 differences along the first non-singleton dimension.\n\ |
7734 \n\ | 7748 \n\ |
7735 The second argument is optional. If supplied, @code{diff (@var{x},\n\ | 7749 The second argument is optional. If supplied,\n\ |
7736 @var{k})}, where @var{k} is a non-negative integer, returns the\n\ | 7750 @w{@code{diff (@var{x}, @var{k})}}, where @var{k} is a non-negative integer,\n\ |
7737 @var{k}-th differences. It is possible that @var{k} is larger than\n\ | 7751 returns the @var{k}-th differences. It is possible that @var{k} is larger\n\ |
7738 the first non-singleton dimension of the matrix. In this case,\n\ | 7752 than the first non-singleton dimension of the matrix. In this case,\n\ |
7739 @code{diff} continues to take the differences along the next\n\ | 7753 @code{diff} continues to take the differences along the next\n\ |
7740 non-singleton dimension.\n\ | 7754 non-singleton dimension.\n\ |
7741 \n\ | 7755 \n\ |
7742 The dimension along which to take the difference can be explicitly\n\ | 7756 The dimension along which to take the difference can be explicitly\n\ |
7743 stated with the optional variable @var{dim}. In this case the\n\ | 7757 stated with the optional variable @var{dim}. In this case the\n\ |
7744 @var{k}-th order differences are calculated along this dimension.\n\ | 7758 @var{k}-th order differences are calculated along this dimension.\n\ |
7745 In the case where @var{k} exceeds @code{size (@var{x}, @var{dim})}\n\ | 7759 In the case where @var{k} exceeds @w{@code{size (@var{x}, @var{dim})}}\n\ |
7746 an empty matrix is returned.\n\ | 7760 an empty matrix is returned.\n\ |
7747 @seealso{sort, merge}\n\ | 7761 @seealso{sort, merge}\n\ |
7748 @end deftypefn") | 7762 @end deftypefn") |
7749 { | 7763 { |
7750 int nargin = args.length (); | 7764 int nargin = args.length (); |