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

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

[Octave-bug-tracker] [bug #51196] plus, +, minus, - on column vs row vec


From: Doug McLelland
Subject: [Octave-bug-tracker] [bug #51196] plus, +, minus, - on column vs row vectors should fail but returns matrix
Date: Wed, 7 Jun 2017 04:51:36 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?51196>

                 Summary: plus, +, minus, - on column vs row vectors should
fail but returns matrix
                 Project: GNU Octave
            Submitted by: weedoug
            Submitted on: Wed 07 Jun 2017 08:51:35 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Missed Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

When adding or subtracting a pair of vectors, one column, one row, I expect
them to return an error of unequal size (as Matlab does), or at a push, to
reshape and add if the vectors are of equal length. Instead I get:


>>test1 = 1:5
test1 =

   1   2   3   4   5

>> test2 = (6:10)'
test2 =

    6
    7
    8
    9
   10

>> test1+test2
ans =

    7    8    9   10   11
    8    9   10   11   12
    9   10   11   12   13
   10   11   12   13   14
   11   12   13   14   15



In this example, the vectors are of equal length, but a similar result is
obtained for unequal vectors.

I think this is very unlikely to be intentional? And dangerous, since it can
go completely unnoticed and result in serious errors if you then go on to use
the output referring by index.





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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