[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New sparse class
From: |
David Bateman |
Subject: |
Re: New sparse class |
Date: |
Wed, 3 Nov 2004 10:37:11 +0100 |
User-agent: |
Mutt/1.4.1i |
Daprès Paul Thomas <address@hidden> (le 02/11/2004):
>
> >Also the "./" operator
> > for two sparse matrices doesn't include the NaN values as implied by the
> > division by the zero elements of the sparse matrix. This is how Matlab
> > treats this even though it is inconsistent with full matrices.
> >
>
> R12 seems to do the right thing
>
> >> b = sparse( [1 2] , [2 1] , [5 0] , 2 , 2)
> b =
> (1,2) 5
> >> a = sparse( [1 2] , [2 1] , [5 5] , 2 , 2)
> a =
>
> (2,1) 5
> (1,2) 5
> >> a ./ b
> Warning: Divide by zero.
> ans =
> (1,1) NaN
> (2,1) Inf
> (1,2) 1
> (2,2) NaN
> >> full(a) ./ full(b)
> Warning: Divide by zero.
> ans =
> NaN 1
> Inf NaN
Err, ok, then its a bug on my part... In fact the operation I meant was
".^", which Matlab R12 when used with a matrix and a scalar gives.
>> a = speye(2) .^ 0
a =
(1,1) 1
(2,2) 1
>> eye(2) .^ 0
ans =
1 1
1 1
There are quite a few strange and undocumented misfeatures of this kind
in the Matlab sparse class.
Regards
David
--
David Bateman address@hidden
Motorola CRM +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary