[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #32966] spdiags is slow and buggy, diag is not
From: |
Marco Caliari |
Subject: |
[Octave-bug-tracker] [bug #32966] spdiags is slow and buggy, diag is not compatible |
Date: |
Thu, 31 Mar 2011 13:21:39 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 |
URL:
<http://savannah.gnu.org/bugs/?32966>
Summary: spdiags is slow and buggy, diag is not compatible
Project: GNU Octave
Submitted by: caliari
Submitted on: Thu 31 Mar 2011 13:21:38 GMT
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 3.4.0
Operating System: GNU/Linux
_______________________________________________________
Details:
Dear maintainers,
stimulated by the comment
## FIXME: we can do this without a loop if we are clever
in spdiags.m, I found the following:
1) diag is much faster then spdiags in extracting diagonals. I get
> v=sprand(1000,1000,0.5);
> tic,spdiags(v,0);,toc
Elapsed time is 0.072 seconds.
> tic,diag(v,0);,toc
Elapsed time is 0.0021 seconds.
2) spdiags fails in the following case:
> spdiags([0,1;0,0],2)
error: spdiags: A(I,J,...) = X: dimensions mismatch
whereas it works with [1,1;1,1].
3) diag is not compatible:
> diag(ones(2),2)
error: diag: requested diagonal out of range
whereas Matlab gives empty matrix 0-by-1.
If 3) is fixed, I can easily rewrite spdiags.m to avoid problems 2) and 1)
(without testing if the diagonal is out of range). However, I'm not clever and
I cannot do it without a loop :-(
4) there is another incompatible behaviour:
> spdiags(ones(2),-1)
ans =
1
0
> spdiags(ones(2,3),-1)
ans =
1
0
whereas in Matlab
>> spdiags(ones(2),-1)
ans =
1
0
>> spdiags(ones(2,3),-1)
ans =
0
1
I do not understand this Matlab (7.6.0) behaviour.
If we take a decision about 4) and someone fixes 3), I can work on 1) and 2).
Cheers,
Marco
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?32966>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #32966] spdiags is slow and buggy, diag is not compatible,
Marco Caliari <=