octave-maintainers
[Top][All Lists]
Advanced

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

Re: New sparse class


From: Paul Thomas
Subject: Re: New sparse class
Date: Tue, 2 Nov 2004 21:20:27 +0100

>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

Paul T



reply via email to

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