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

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

[Octave-bug-tracker] [bug #53675] Warning/documentation of mtimes with n


From: Rik
Subject: [Octave-bug-tracker] [bug #53675] Warning/documentation of mtimes with non-matrix arguments
Date: Tue, 17 Apr 2018 11:30:45 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #1, bug #53675 (project octave):

We certainly don't want to get rid of it.  As for documentation, see the
section 8.1.1 "Advanced Indexing".  There is documentation there, but it is
not an easy concept to explain.  The text is


8.1.1 Advanced Indexing
An array with ‘nd’ dimensions can be indexed by a vector idx which has
from 1 to ‘nd’
elements. If any element of idx is not a scalar then the complete set of index
tuples will be
generated from the Cartesian product of the index elements.
For the ordinary and most common case, the number of indices (nidx = numel
(idx))
matches the number of dimensions ‘nd’. In this case, each element of idx
corresponds to
its respective dimension, i.e., idx(1) refers to dimension 1, idx(2) refers to
dimension 2,
etc. If nidx < nd, and every index is less than the size of the array in the
ith dimension
(idx(i) < size (array, i)), then the index expression is padded with nd - nidx
trailing
singleton dimensions. If nidx < nd but one of the indices idx(i) is outside
the size of the
current array, then the last nd - nidx + 1 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.


In this situation, it is the last bit which takes precedence.  By indexing a
3-D object with only 2 indices (:,:) all of the dimensions >= 2 are folded in
to the second dimension.  So rand (3,3,3) becomes a 3x9 2-D matrix.

If you can think of language that would be clearer to explain this it would be
useful.



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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