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: Torquil Macdonald Sørensen
Subject: Re: Running m-files generated by Petsc 3.4.3
Date: Sat, 25 Jan 2014 11:17:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.2.0

On 25/01/14 10:52, c. wrote:
> 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])

The output in Matlab 2013a is:

ans =

   (8,8)      0.2396 + 4.7917i

> 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.
>

Ok, I'll do that.

Thanks!

Best regards
Torquil Sørensen



reply via email to

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