[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About diagonal matrices
From: |
Daniel J Sebald |
Subject: |
Re: About diagonal matrices |
Date: |
Fri, 20 Feb 2009 23:13:14 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 |
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
What does 'nnz' mean? "something-not-zero"? If so, then the above is wrong because any
number divided by zero is not zero. Hence, "nnz" should be 9, or 100%.
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.
Maybe it would make more sense to define sparse matrices in terms of index sets
(or I'll offer another REALLY creative alternative below). Say we have
non-intersecting sets IJ1, IJ2, IJ3, ..., IJN which are assigned numbers V0,
V1, V2, V3, ..., VN. Say Omega is the universe, or set of all indeces for an M
x N matrix. Then the assignment for sparse matrix S would be:
(i,j) in IJ1 -> S(i,j) = V1
(i,j) in IJ2 -> S(i,j) = V2
(i,j) in IJ3 -> S(i,j) = V3
...
(i,j) in IJN -> S(i,j) = VN
and finally
(i,j) in Omega-(IJ1+IJ2+IJ3+...+IJN) -> S(i,j) = V0
That last statement means that the index in question is not in any of the other
"sparse subsets".
What that would do is allow some "default sparse value", as well as perhaps
give a bit more compaction in the case of several repeating
Dan
PS: One could maybe dream up a "sub-block" scheme for sparse matrices, but
that might be a programming nightmare.
- Re: About diagonal matrices, John W. Eaton, 2009/02/20
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/20
- Re: About diagonal matrices, John W. Eaton, 2009/02/20
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/20
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/20
- Re: About diagonal matrices, dbateman, 2009/02/20
- Re: About diagonal matrices,
Daniel J Sebald <=
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/21
- Re: About diagonal matrices, John W. Eaton, 2009/02/21
- Re: About diagonal matrices, Søren Hauberg, 2009/02/21
- Re: About diagonal matrices, Daniel J Sebald, 2009/02/21
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/22
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/22
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/22
- Re: About diagonal matrices, Søren Hauberg, 2009/02/22
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/22
- Re: About diagonal matrices, Jaroslav Hajek, 2009/02/22