bugGNU Octave - Bugs: bug #41346, spconvert() with complex matrices

 
 

bug #41346: spconvert() with complex matrices

Submitted by:  tmac
Submitted on:  Sat 25 Jan 2014 10:41:50 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Wont FixAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.8.0Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 27 Jan 2014 05:06:04 PM UTC, comment #5:

I think the best solution is the one already implemented--to have PETSc use the documented interface. Octave tries to match Matlab's documented API, but not its undocumented one. It's usually a bad idea to rely on the undocumented interface since it won't necessarily work with Octave, and Matlab itself could change it at any time as well.

Rik <rik5>
Project Administrator
Mon 27 Jan 2014 03:04:02 PM UTC, comment #4:

If the fix is indeed merely deleting a few characters from one line, then I would say it's worth applying. Most users don't program by following the spec/documentation, but by iterating until the code "works". If they try to run existing MATLAB code in Octave and it fails, their first impulse will be to blame Octave.

Jed Brown <jedbrown>
Mon 27 Jan 2014 02:46:12 PM UTC, comment #3:

Hi,

Now that the behaviour in PETSc has been modified I think
the motivation of the OP on this issue is gone, but the
question regarding Octave remains open, should we copy the
undocumented Matlab behaviour or not?

I'll wait one more day for comments, then, if no-one cares
I'll just close this report marking it as "Won't fix"

Thanks,
c.

Carlo de Falco <cdf>
Project Member
Sun 26 Jan 2014 06:27:48 PM UTC, comment #2:

Thanks, everyone. I have updated PETSc to use the documented interface.

Jed Brown <jedbrown>
Sat 25 Jan 2014 10:53:40 AM UTC, comment #1:

Hi,

Thanks for posting this report.
As I noted in my reply on the mailing list,
this issue is due to an error on the part of
PETSc which exploits an undocumented feature in
Matlab's 'spconvert' so you should also report
it to the PETSc developers:

http://www.mcs.anl.gov/petsc/documentation/bugreporting.html

The fix would be trivial there to, simply
export complex sparse matrices as real matrices
with four columns instead of complex matrices with
three columns, i.e.:

instead of

Anyway I'll wait for comments
from the core developers
to see if we should follow the undocumented
Matlab behaviour in Octave.

c.

Carlo de Falco <cdf>
Project Member
Sat 25 Jan 2014 10:41:50 AM UTC, original submission:

Hi!

The Matlab 2013a spconvert() works for three-column complex matrices, but the Octave 3.8.0 spconvert() does not. This prevents me from loading m-files generated by Petsc 3.4.3, i.e. to transfer matrices from Petsc to Octave.

For example, consider the following command:

> spconvert ([8 8 2.3958333333333320e-01+4.7916666666666643e+00i])


In Matlab 2013a, the result is:

(8,8) 0.2396 + 4.7917i

In Octave 3.8.0, the result is:

error: spconvert: argument must be sparse or real matrix with 3 or 4 columns
error: called from:
error: /opt/local/share/octave/3.8.0/m/sparse/spconvert.m at line 37, column 7

I posted this to the Octave help mailing list, and one of the resposes included a suggestion for a fix for spconvert. The thread is archived here:

http://octave.1599824.n4.nabble.com/Running-m-files-generated-by-Petsc-3-4-3-td4661348.html

I will quote the fix suggestion of Carlo Defalco:

"If we want to, the ix is trivial, simply change line 35 of "spconvert.m" from

if (nargin != 1 || ! ismatrix (m) || ! isreal (m)

to

if (nargin != 1 || ! ismatrix (m) "

Best regards
Torquil Sørensen

tmac

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jedbrown (Posted a comment)
  • -unavailable- added by cdf (Posted a comment)
  • -unavailable- added by tmac (Submitted the item)
  • -unavailable- added by tmac
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 27 Jan 2014 05:06:04 PM UTCrik5StatusNone=>Wont Fix
      Assigned tocdf=>None
      Open/ClosedOpen=>Closed
      Operating SystemAny=>GNU/Linux
    Mon 27 Jan 2014 02:46:12 PM UTCcdfAssigned toNone=>cdf
      Operating SystemGNU/Linux=>Any
    Sat 25 Jan 2014 10:41:50 AM UTCtmacCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1