[Top][All Lists]

[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: Tue, 17 Apr 2018 07:31:30 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0


                 Summary: Warning/documentation of mtimes with non-matrix
                 Project: GNU Octave
            Submitted by: mleitner
            Submitted on: Tue 17 Apr 2018 11:31:28 AM UTC
                Category: Documentation
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Documentation
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: Any



I do not know whether I am searching incorrectly, but it seems to me that all
that the documentation has to say about mtimes is "Return the matrix
multiplication product of inputs." But what if the arguments are not matrices,
that is, have more than two dimensions? By testing it seems to me that 


is exactly equivalent (in terms of results, but also under which conditions it
errors out) to


(I do not know whether or where this syntax is documented), which in turn is
equivalent to 


Even the error message is the same: for 


all three give "error: operator *: nonconformant arguments (op1 is 1x6, op2 is

I have been using Octave now eight years nearly daily and did not know about
that feature, so this should be documented at least in section "8.3 Arithmetic
operators", but perhaps one could add a subsection under "8 Expressions"
called something like "Advanced trickery", where such things (also including
indexing by two or more colons) is presented. Further, perhaps the error
checking should be done a bit earlier, so that in the above-mentioned example
the actual dimensions of the input arguments are reported. And finally,
perhaps it would be good to emit a warning whenever
(length(size(a))>2)||(length(size(b))>2), because this is probably often

However, I do not want to argue that under the above-mentioned condition this
should raise an error, as the behaviour is actually useful: for instance, it
allows me to have vectors organized in more dimensions, and to transform them
all by a simple matrix multiplication from the left with a subsequent reshape,
as opposed to have to reshape each argument and introduce singleton
dimensions, do an element-wise multiplication with broadcasting, sum over the
relevant dimension, and do a final reshape.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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