help-octave
[Top][All Lists]
Advanced

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

Re: Running m-files generated by Petsc 3.4.3


From: c.
Subject: Re: Running m-files generated by Petsc 3.4.3
Date: Sat, 25 Jan 2014 10:52:58 +0100

On 24 Jan 2014, at 14:46, Torquil Macdonald Sørensen <address@hidden> wrote:

> Hi!
> 
> My Petsc 3.4.3-based program outputs a Matlab-file that defines some sparse 
> matrices in CSC format. They run fine in Matlab R2013b, but not in Octave 
> 3.4.3. The error output I'm getting when running the m-file in Octave is:
> 
> error: spconvert: argument must be sparse or real matrix with 3 or 4 columns
> error: called from:
> error:   /usr/share/octave/3.4.3/m/sparse/spconvert.m at line 37, column 7
> error:   /tmp/build/output.m at line 99, column 4
> 
> Is the m-file supposed to work in Octave, since it works in Matlab? Is it 
> likely to work if I upgrade to the newest Octave? I'm attaching the m-file in 
> this message.
> 
> Thanks!
> Torquil Sørensen

It seems the problem is that spconvert in Octave does not accept
a complex matrix as input, while Matlab maybe does.

Can you check the output of the following line in Matlab?

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

In Octave it returns

 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

This behaviour is not documented in Matlab's manual though:

 http://www.mathworks.it/it/help/matlab/ref/spconvert.html

so I am not sure whether it is wanted to work or simply by mistake.

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) 

You should post this to the bug tracker and see wether it is accepted to apply 
this change.

Personally, though, I'm rather inclined towards considering this a bug in 
PETSc, as
the correct, documented, way to use spconvert to generate complex matrices 
would be
to use real matrices with 4 columns.

HTH,
c.





reply via email to

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