bugGNU Octave - Bugs: bug #30571, expm of diagonal matrices


bug #30571: expm of diagonal matrices

Submitted by:  Marco Caliari <caliari>
Submitted on:  Wed 28 Jul 2010 08:14:06 AM UTC  
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  Jaroslav Hajek <highegg>
Originator Name:  Open/Closed:  Closed
Release:  3.3.51 Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 29 Jul 2010 08:04:00 AM UTC, comment #5: 

Why do you need diagonal sparse matrices to be special cased? You're free to add that feature, of course, I just don't see much use for it.

Jaroslav Hajek <highegg>In charge of this item.
Thu 29 Jul 2010 07:58:59 AM UTC, comment #4: 

I'm just speaking of "diagonal sparse" matrices.
The exponential of "general" sparse matrices is not sparse, so I think it is not a problem if balance can't handle them.


Marco Caliari <caliari>
Project Member
Thu 29 Jul 2010 07:49:17 AM UTC, comment #3: 

Why does it matter?
Btw., expm is not working well with sparse matrices at all, because apparently balance() can't handle them.

Jaroslav Hajek <highegg>In charge of this item.
Thu 29 Jul 2010 07:11:32 AM UTC, comment #2: 

It seems that sparse diagonal matrices are excluded:

octave:1> typeinfo (speye (4))
ans = sparse matrix
octave:2> typeinfo (full (speye (4)))
ans = matrix
octave:3> matrix_type (speye (4))
ans = Diagonal

This was the reason to use matrix_type.


Marco Caliari <caliari>
Project Member
Thu 29 Jul 2010 06:53:14 AM UTC, comment #1: 

First, a scalar is a scalar, not a diagonal matrix.

Second, I'd say ignore the MatrixType check. This is mostly historical and will only be true for matrices that just happen to be diagonal as a result of a computation.

Third, like it or not, typeinfo names include class, so you can have "diagonal matrix" as well as "float complex diagonal matrix",
so using strfind is a better idea. Beware also of "scalar struct" (though scalars can be checked by isscalar()).

I checked in the following change instead:

Jaroslav Hajek <highegg>In charge of this item.
Wed 28 Jul 2010 08:14:06 AM UTC, original submission:  

With the enclosed patch against 3.3.51, expm will reduce to exp on diagonal matrices. By the way, do we really need three comparisons to check if a matrix is diagonal?


Marco Caliari <caliari>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #21092:  expm.m.diff added by caliari (459B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by highegg (Posted a comment)
  • -email is unavailable- added by caliari (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-08-08 rik5 StatusNone => Fixed
        Open/ClosedOpen => Closed
    2010-07-29 highegg Open/ClosedClosed => Open
    2010-07-29 highegg Assigned toNone => highegg
        Open/ClosedOpen => Closed
    2010-07-28 caliari Attached File- => Added expm.m.diff, #21092

    Back to the top

    Powered by Savane 3.5