octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #46123] diagonal matrix and diagonality preser


From: jan
Subject: [Octave-bug-tracker] [bug #46123] diagonal matrix and diagonality preserving matrix operations
Date: Sun, 04 Oct 2015 18:53:45 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0

URL:
  <http://savannah.gnu.org/bugs/?46123>

                 Summary: diagonal matrix and diagonality preserving matrix
operations
                 Project: GNU Octave
            Submitted by: pfa
            Submitted on: sön  4 okt 2015 18.53.44
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Performance
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:


Diagonal matrix is essentially a sparse representation. However, functions
like permute produce full matrix, even if they are sparsity preserving.
[Permute is in fact identity function for diagonal matrix]. In comparision
e.g. inv() or expmI() preserve diagonality. 

As a goal I believe the basic matrix functions/operations (excluding the
elementwise functions) should preferably preserve the structure when the
operatin is closed in the class of diagonal matrices.

More generally, this relates to treating diagonal matrix sparse or not (i.e.
sparse(diag(1:2)) returns false, which is missleading for many uses.) The
memory usage is very different N vs. N^2, so this is somewhat supprising
result. 

As a side note, and somewhat supprisingly, elementwise function sqrt()
preserves the diagonal structure, whereas other elementswise functions like
sin() (for which sin(0)=0) do not. In general elementwise functions preserve
sparsity even if e.g. cos(0)=1.



>> permute(sparse(diag(1:2)),[1,2])
ans =

Compressed Column Sparse (rows = 2, cols = 2, nnz = 2 [50%])

  (1, 1) ->  1
  (2, 2) ->  2

>> permute((diag(1:2)),[1,2])
ans =

   1   0
   0   2







    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?46123>

_______________________________________________
  Meddelandet skickades via/av Savannah
  http://savannah.gnu.org/




reply via email to

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