bugGNU Octave - Bugs: bug #57305, @vpi/sum.m fails in octave (but...

 
 

bug #57305: @vpi/sum.m fails in octave (but not in matlab)

Submitter:  Alois Schlögl <schloegl>
Submitted:  Tue 26 Nov 2019 02:19:29 PM UTC
   
 
Category:  Interpreter Severity:  2 - Minor
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Need Info Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 5.1.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 27 Nov 2019 10:44:22 AM UTC, comment #5: 

A minimal way to reproduce the issue is with the following:


classdef A
end


In Matlab:


>> a = [A, A]
a =
  1x2 A array with no properties.
>> size(a)
ans =
     1     2
>> permute(a,[2 1])
ans =
  2x1 A array with no properties.


In Octave:


octave> a(1) = A; a(2) = A; # workaround for bug #53906 and bug #44665
octave> a
a =
  A object array with properties:

octave> size(a)
ans =
   1   2
octave> permute(a,[2 1])
error: octave_base_value::permute (): wrong type argument 'object'


So Matlab has a default implementation of permute for classes.

Guillaume <gyom>
Wed 27 Nov 2019 10:10:10 AM UTC, comment #4: 

The problem is this line

  A = permute(A,P);

where the workspace has this content:

whos

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  =====
    f   A           1x10                       664  vpi
        P           1x2                         16  double
  a     argn        1x1                          1  char
    f   dim         1x1                          8  double

Total is 14 elements using 689 bytes

A =
 
Columns 1 through 4
               17              289             4913            83521
 
Columns 5 through 8
          1419857         24137569        410338673       6975757441
 
Columns 9 through 10
     118587876497    2015993900449
P =

   2   1

and

  A = permute(A,P);

fails with this error:

error: octave_base_value::permute (): wrong type argument 'class'



Alois Schlögl <schloegl>
Tue 26 Nov 2019 04:49:41 PM UTC, comment #3: 

Regardless of licensing issues, if there is a problem with overloading functions for legacy classes I'd like to see if there is a relatively easy fix for the problem.  Can you provide a self-contained test case that does not rely on the vpi code?

John W. Eaton <jwe>
Group administrator
Tue 26 Nov 2019 04:23:49 PM UTC, comment #2: 

As suggested, I'll try to contact the author.

Until, I got some endorsement from the author, I'll remove the copy of VPI from my homepage as well.







Anonymous
Tue 26 Nov 2019 02:40:57 PM UTC, comment #1: 

First we need to know, if the "Variable Precision Integer Arithmetic" toolbox by "John D'Errico" is only available from ML File Exchange, please read

https://wiki.octave.org/FAQ#Why_can.27t_I_use_code_from_File_Exchange_in_Octave.3F

very carefully.  The BSD license is not the problem.  If the original author "John D'Errico" does not distribute it at some other location, we are simply not allowed to use it with Octave.  You can ask the author to distribute it somewhere else (GitHub, ...) with the BSD-license as well.

https://www.mathworks.com/matlabcentral/about/fx/#Why_GitHub

Kai Torben Ohlhus <siko1056>
Group Member
Tue 26 Nov 2019 02:19:29 PM UTC, original submission:  


The VPI toolbox [1] (licensed with 2-clause BSD License) seems to work mostly on octave, too.
One problem is that the overloading of sum (@vpi/sum ) does not seem to work on octave, it works on Matlab.

In order to reproduce, download vpi from [1] or [2], unzip, and addpath; then run

   demo_vpi

It fails with this error

...
error: octave_base_value::permute (): wrong type argument 'class'
error: called from
    sum at line 53 column 5
    demo_vpi at line 88 column 1


octave:5> whos
Variables visible from the current scope:

variables in scope: top scope

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  =====
A           1x1                         24  vpi
B           1x10                       664  vpi
INT         1x1                       2536  vpi
a           1x1                        232  vpi
ans         1x1                         16  vpi
p           1x1                          8  double

Total is 15 elements using 3480 bytes

octave:6> sum(B)
error: octave_base_value::permute (): wrong type argument 'class'
error: called from
    sum at line 53 column 5


I've tested this with octave 4.4.1 (from Debian/Buster) and 5.1.0 (compiled from source some weeks ago).
In case you do not have an account at matlabcentral, You can get vpi from here [2], too.
 

[1] https://de.mathworks.com/matlabcentral/fileexchange/22725-variable-precision-integer-arithmetic
[2] https://pub.ist.ac.at/~schloegl/VariablePrecisionIntegers.zip
    sha256sum: 5a1639fc4e6d3e74dcec9add6e0aeeaf5eb5e1784db936a571d8123702397615  VariablePrecisionIntegers.zip


Alois Schlögl <schloegl>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gyom (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by schloegl (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-11-26 siko1056 Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-c373.
    Corresponding source code