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

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

[Octave-bug-tracker] [bug #45467] Assigning empty matrix to empty range


From: Lachlan Andrew
Subject: [Octave-bug-tracker] [bug #45467] Assigning empty matrix to empty range gives error
Date: Fri, 03 Jul 2015 10:35:53 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

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

                 Summary: Assigning empty matrix to empty range gives error
                 Project: GNU Octave
            Submitted by: lachlan
            Submitted on: Fri 03 Jul 2015 10:35:51 AM GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Lachlan
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.0
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Assigning a zero-sized matrix to a zero-sized slice of a matrix should work,
even if the non-zero dimensions do not match.

The snippet

z = zeros(2);
empty = [];
z([],1) = [];
z([],1) = empty;

allows the third line, but for the fourth line gives the error

A(I,J,...) = X: dimensions mismatch

In general, Matlab allows assignment of an empty slice from any empty matrix,
regardless of the sizes of the non-zero dimensions.

The attached patch allows Matlab-compliant behaviour.  In order not to slow
down all assignments, the special case code is not on the fast path.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 03 Jul 2015 10:35:51 AM GMT  Name: empty_assignment_patch.txt  Size:
1kB   By: lachlan

<http://savannah.gnu.org/bugs/download.php?file_id=34370>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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