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

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

[Octave-bug-tracker] [bug #63132] cell input for cell()


From: Rik
Subject: [Octave-bug-tracker] [bug #63132] cell input for cell()
Date: Tue, 4 Oct 2022 18:11:53 -0400 (EDT)

Update of bug #63132 (project octave):

                Severity:              3 - Normal => 1 - Wish               
                Priority:              5 - Normal => 2                      
                  Status:                    None => Patch Submitted        

    _______________________________________________________

Follow-up Comment #1:

This is effectively a no-operation.  I also checked with empty arrays which
are not 0x0 and Matlab just passes through the dimensions.  For example,


x = cell (0, 3);
y = cell (x)


y is a 0x3 cell array.

I changed the priority to low since it is easy to workaround (don't call
cell() on existing cell arrays).  On the other hand, it wouldn't be that hard
to add this functionality.

The issue seems to be this call in ov-cell.cc inside Fcell


    case 1:
      get_dimensions (args(0), "cell", dims);
      break;


The call to get_dimensions throws the error.  That function is inside
libinterp/corefcn/utils.cc and looks somewhat harder to modify.

I think it is easier just to check whether the input to cell() is already a
cell array and pass it to the output if it is.


     case 1:
-      get_dimensions (args(0), "cell", dims);
+      if (args(0).iscell ())
+        return args(0);  // shortcut path for input which is already a Cell
+      else
+        get_dimensions (args(0), "cell", dims);
       break;


I'm attaching a cset for this trivial change.

(file #53790)

    _______________________________________________________

Additional Item Attachment:

File name: bug63132.cset                  Size:1 KB
    <https://file.savannah.gnu.org/file/bug63132.cset?file_id=53790>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63132>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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