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: Michael Leitner
Subject: [Octave-bug-tracker] [bug #53675] Warning/documentation of mtimes with non-matrix arguments
Date: Wed, 18 Apr 2018 11:31:26 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

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

With respect to the behaviour of mtimes and *: The last paragraph in my
initial bug report was nonsense: as you say, what I describe can be done with
the double colon trick without any explizit reshaping to singleton dimension
and so on. So I do not see a use case for the present behaviour (apart from
saving 5 characters for the parentheses, colons and the comma), and thus it is
probably best to do input validation and raise an error when any argument has
more than two dimensions.

As regards the documentation: yes, in 8.1.1 there is some documentation, but
specifically the action of the colon in this respect is at best implicitly
defined. If I find time, I will think about a rewording of this section. 

But: isn't it the case that the second paragraph in 8.1.1 that you reproduced
below treats cases that cannot validly appear and is thus unnecessarily
complex? What I mean is the case "nidx < nd but one of the indices idx(i) is
outside...". If i<length(nidx), that is, if this excessive idx-entry concerns
any but the last specified dimension, it errors out in any case? So to me it
seems that we can define the action described in this paragraph as: "If nidx <
nd, then the result is an implicit reshape that folds the last nd - nidx + 1
dimensions into one." This includes the case that idx(end) is within the size
of the corresponding dimension, in which case it would be equivalent to the
present definition via addition of singleton dimensions (meaning: idx=[idx
ones(1,nd-nidx)]), as well as if the last entry is larger than the
corresponding dimension. If any other entry is larger than its dimension, it
would give an error.

By the way, this is presumably again an extension over what Matlab allows, I
would guess Matlab would allow only nidx==nd or nidx==1, in which case the
answer is A(:)(idx). This should then probably also be documented.

    _______________________________________________________

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]