[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About diagonal matrices
From: |
Jaroslav Hajek |
Subject: |
Re: About diagonal matrices |
Date: |
Sun, 22 Feb 2009 10:35:15 +0100 |
On Sat, Feb 21, 2009 at 10:41 PM, John W. Eaton <address@hidden> wrote:
> On 20-Feb-2009, dbateman wrote:
>
> | I consider that the fact speye(3)/0 returns a full matrix a bug unless the
> | sparse_auto_mutate function is set. In fact this behavior is a hang over
> | from when sparse_auto_mutate(1) was not only the default but only behavior
> | and certain narrowing could be donee in the operators themselves rather than
> | the narrowing function of the octave_value. I pushed a patch..
> |
> |
> |
> | octave:4> a = eye(3)/0
> | a =
> |
> | Inf 0 0
> | 0 Inf 0
> | 0 0 Inf
> |
> | octave:5> a = speye(3)/0
> | warning: division by zero
> | a =
> |
> | Compressed Column Sparse (rows = 3, cols = 3, nnz = 3 [33%])
> | )
> |
> | (1, 1) -> Inf
> | (2, 2) -> Inf
> | (3, 3) -> Inf
> |
> | octave:14> full(a)/0
> | warning: division by zero
> | ans =
> |
> | Inf NaN NaN
> | NaN Inf NaN
> | NaN NaN Inf
> |
> | and would expect the NaN fill in even for diagonal matrices as John
> | suggested and so the NaN values. The current Octave behavior is
> | mathematically wrong and saying thats the answer the user expected is no
> | excuse. We should bring back the NaN fill-in.
>
> With the current sources, which I think includes your patch, I now see
>
> octave:2> speye (3)/0
> warning: division by zero
> ans =
>
> Compressed Column Sparse (rows = 3, cols = 3, nnz = 3 [33%])
> )
>
> (1, 1) -> Inf
> (2, 2) -> Inf
> (3, 3) -> Inf
>
> octave:3> speye (3)*Inf
> ans =
>
> Compressed Column Sparse (rows = 3, cols = 3, nnz = 3 [33%])
> )
>
> (1, 1) -> Inf
> (2, 2) -> Inf
> (3, 3) -> Inf
>
> octave:4> speye (3)*NaN
> ans =
>
> Compressed Column Sparse (rows = 3, cols = 3, nnz = 3 [33%])
> )
>
> (1, 1) -> NaN
> (2, 2) -> NaN
> (3, 3) -> NaN
>
>
> Is that the behavior you want?
>
> jwe
>
Well, this is the "mathematically wrong" behavior David defined.
Still, this is the most reasonable one.
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Re: About diagonal matrices, (continued)
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/22
- Re: About diagonal matrices, dbateman, 2009/02/24
- Re: About diagonal matrices, dbateman, 2009/02/24
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/24
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/24
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/21
- Re: About diagonal matrices, Søren Hauberg, 2009/02/21
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/21
- Re: About diagonal matrices, John W. Eaton, 2009/02/21
- Re: About diagonal matrices, John W. Eaton, 2009/02/21
- Re: About diagonal matrices,
Jaroslav Hajek <=
- Re: About diagonal matrices, dbateman, 2009/02/25
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/25
- Re: About diagonal matrices, dbateman, 2009/02/25
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/26
- Re: About diagonal matrices, John W. Eaton, 2009/02/26
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/26
Re: About diagonal matrices, Daniel J Sebald, 2009/02/20
Re: About diagonal matrices, Daniel J Sebald, 2009/02/20