octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #52723] unexpected space in matrix expression


From: anonymous
Subject: [Octave-bug-tracker] [bug #52723] unexpected space in matrix expression (brackets) in document
Date: Fri, 22 Dec 2017 23:42:01 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #4, bug #52723 (project octave):

Thank maintainers very much for fixing so many small issues found recently.

The Advanced Indexing section seems still have problems:
(1)
after using 'nd' instead of 'n', some following 'n' should also be changed to
'nd'.
and (2)
there are still 'm' and 'm(i)', so 'm' is still ambiguous.

Possible solutions:
(1)
like 'nd', let 'md' denote the number of indices (i.e. 'md=numel(m)'), and
'm(i)' still denotes the i-th index.
or (2)
do not use 'm(i)' at all, then there is no ambiguity, and we can still let
'm'/'n' denote the number of indices/dimensions as the original version. This
makes less difference from the original version.


patch for solution (1):

--- a/doc/interpreter/expr.txi
+++ b/doc/interpreter/expr.txi
@@ -123,7 +123,7 @@
 a(end) = [];      # delete element
 a(1:2:end)        # odd elements of a => [1, 3]
 a(2:2:end)        # even elements of a => [2, 4]
-a(end:-1:1)       # reversal of a => [4, 3, 2 , 1]
+a(end:-1:1)       # reversal of a => [4, 3, 2, 1]
 @end group
 @end example
 
@@ -134,18 +134,18 @@
 @node Advanced Indexing
 @subsection Advanced Indexing
 
-An array with @samp{nd} dimensions can be indexed using @samp{m}
+An array with @samp{nd} dimensions can be indexed using @samp{md}
 indices.  More generally, the set of index tuples determining the
 result is formed by the Cartesian product of the index vectors (or
 ranges or scalars).
 
-For the ordinary and most common case, @address@hidden == nd}}, and each
-index corresponds to its respective dimension.  If @address@hidden < nd}},
+For the ordinary and most common case, @address@hidden == nd}}, and each
+index corresponds to its respective dimension.  If @address@hidden < nd}},
 and every index is less than the size of the array in the @math{i^{th}}
 dimension (@code{m(i) < size (@var{array}, i)}), then the index expression
-is padded with @address@hidden - m}} trailing singleton dimensions. 
-If @address@hidden < nd}} but one of the indices @code{m(i)} is outside the
-size of the current array, then the last @address@hidden dimensions
+is padded with @address@hidden - md}} trailing singleton dimensions.
+If @address@hidden < nd}} but one of the indices @code{m(i)} is outside the
+size of the current array, then the last @address@hidden dimensions
 are folded into a single dimension with an extent equal to the product
 of extents of the original dimensions.  This is easiest to understand
 with an example.
@@ -164,10 +164,10 @@
    5   7
    6   8
 
-a(2,1,2);   # Case (m == n): ans = 6
-a(2,1);     # Case (m < n), idx within array:
+a(2,1,2);   # Case (md == nd): ans = 6
+a(2,1);     # Case (md < nd), idx within array:
             # equivalent to a(2,1,1), ans = 2
-a(2,4);     # Case (m < n), idx outside array:
+a(2,4);     # Case (md < nd), idx outside array:
             # Dimension 2 & 3 folded into new dimension of size 2x2 = 4
             # Select 2nd row, 4th element of [2, 4, 6, 8], ans = 8
 @end example


patch for solution (2):

--- a/doc/interpreter/expr.txi
+++ b/doc/interpreter/expr.txi
@@ -123,7 +123,7 @@
 a(end) = [];      # delete element
 a(1:2:end)        # odd elements of a => [1, 3]
 a(2:2:end)        # even elements of a => [2, 4]
-a(end:-1:1)       # reversal of a => [4, 3, 2 , 1]
+a(end:-1:1)       # reversal of a => [4, 3, 2, 1]
 @end group
 @end example
 
@@ -134,17 +134,17 @@
 @node Advanced Indexing
 @subsection Advanced Indexing
 
-An array with @samp{nd} dimensions can be indexed using @samp{m}
+An array with @samp{n} dimensions can be indexed using @samp{m}
 indices.  More generally, the set of index tuples determining the
 result is formed by the Cartesian product of the index vectors (or
 ranges or scalars).
 
-For the ordinary and most common case, @address@hidden == nd}}, and each
-index corresponds to its respective dimension.  If @address@hidden < nd}},
+For the ordinary and most common case, @address@hidden == n}}, and each
+index corresponds to its respective dimension.  If @address@hidden < n}},
 and every index is less than the size of the array in the @math{i^{th}}
-dimension (@code{m(i) < size (@var{array}, i)}), then the index expression
-is padded with @address@hidden - m}} trailing singleton dimensions. 
-If @address@hidden < nd}} but one of the indices @code{m(i)} is outside the
+dimension (size (@var{array}, i)}), then the index expression
+is padded with @address@hidden - m}} trailing singleton dimensions.
+If @address@hidden < n}} but one of the indices is outside the
 size of the current array, then the last @address@hidden dimensions
 are folded into a single dimension with an extent equal to the product
 of extents of the original dimensions.  This is easiest to understand



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52723>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]