bugGNU Octave - Bugs: bug #37411, Diagonal matrix attribution error...

 
 

bug #37411: Diagonal matrix attribution error and diag function bugs

Submitter:  None
Submitted:  Thu 20 Sep 2012 12:13:08 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Steffen Hoernig Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.2
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 21 Sep 2012 09:44:43 PM UTC, comment #4: 

Thanks to Arun's very generous contribution of a 75 USD Amazon gift certificate, I have rebased this change to the upcoming stable bugfixing release 3.6.4, which should happen within the next few weeks:

http://hg.savannah.gnu.org/hgweb/octave/graph/21467c7fc08f

Thank you very much, and I hope 3.6.4 meets your needs.

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Fri 21 Sep 2012 01:16:19 PM UTC, comment #3: 

Please forgive for the lack of brevity, but I have to get this off my
chest...

This bug is very minor. In order to manifest itself, the following
conditions have to be met:

    * You must create a diagonal matrix

    * You must index the first row or column of this diagonal matrix
      (indexing any other row or column won't trigger the bug)

    * You must take this row or column vector, internally represented
      as a diagonal matrix, and you must feed it back into the diag
      function.

All three conditions at once are rare. Moreover, there is a simple
workaround: use diag(full(e1)) instead of diag(e1), and this
workaround doesn't affect semantics in Matlab.

I have a fix for this bug. It is for the development version, since I
could not do it cleanly without breaking API, and we cannot break API
for the stable version. It will thus have to wait until we can make
another major release.

However, it took me a long time to fix this bug. About 6 hours. I
don't really care about this bug, but I felt driven to fix it because
apparently two people care enough about the bug report it and assure
me that it happens in several places and that it's annoying and
counterintuitive bug. I disagree. It's a very minor bug that was
annoying to fix. I am therefore proposing the following: I will not
release my fix unless the people who care about having this bug fixed
tip me at my Paypal address: jordigh@octave.org. If you send me any
nonzero monetary reward for the time I've spent fixing this bug, I
will gladly apply my fix to the development version. If the amount is
of sufficient magnitude, I may reconsider reworking my fix so that it
doesn't break API and can go into the stable version, which will be
released much sooner than the next major version.

Alternatively, if paying me for fixing this bug is an insurmountable
financial burden for you, you may provide your own patch for this bug.
If the patch does not break anything important in Octave and it
follows our coding standards, I will gladly apply it.

I hope you agree this is a reasonable request.

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Thu 20 Sep 2012 05:13:35 PM UTC, comment #2: 

I confirm the original poster's reported behavior. It's certainly counterintuitive the first time and behaves differently from Matlab (checked on 2011b on Win32), so any Matlab code will need a workaround in Octave like "full(eye(n))" instead of just "eye(n)". This could be reclassified as Matlab Compatibility instead of Incorrect Result though.

Arun Giridhar <arungiridhar>
Group Member
Thu 20 Sep 2012 02:02:11 PM UTC, comment #1: 

This is fairly esoteric. Is this actually causing you any real trouble?

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Thu 20 Sep 2012 12:13:08 PM UTC, original submission:  

The following code creates a square matrix with [1,0] on the diagonal and works fine

diag([1,0])


Now the following defines the unit vector e1 as a column of the identity matrix. Note that it wrongy inherits "diagonal matrix" status from Id.

Id = eye(2); e1 = Id(:,1)


As a result, the diag function returns the number 1 instead of the above diagonal matrix diag([1,0]):

diag(e1)


Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by arungiridhar (Posted a comment)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-09-21 jordigh StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2012-09-21 jordigh StatusConfirmed In Progress
    2012-09-20 jordigh StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code