bugGNU Octave - Bugs: bug #45944, eig(X,'nobalance') does not exist...


bug #45944: eig(X,'nobalance') does not exist in Octave vs. Matlab

Submitter:  Yavsy <yavvsy>
Submitted:  Sat 12 Sep 2015 06:56:39 PM UTC
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  yavvsy Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


( Jump to the original submission )

Wed 06 Oct 2021 02:05:17 AM UTC, comment #6: 

Thanks for the investigation.

This option was added in 2016 by patch #8960 .

Closing report.

Kai Torben Ohlhus <siko1056>
Project Member
Mon 08 Mar 2021 08:19:06 AM UTC, comment #5: 

Nir, thank you for the information.

The example shows 'nobalance' was implemented.

Now just need the correct people to determine if this bug can be closed.

Sun 07 Mar 2021 05:16:35 PM UTC, comment #4: 

You can try looking at [1], which gives some examples (involving larger matrices) where balancing influences the answer noticeably.

Also, Octave's current eig function [2] has a test case where balancing changes the answer (albeit probably only by something on the order of roundoff error):

## "balance" is always default
## so the results with and without "balance" should be the same
## while in this case "nobalance" should produce different result
%! A = [3 -2 -0.9 0; -2 4 1 -0; -0 0 -1 0; -0.5 -0.5 0.1 1];
%! [V1, D1] = eig (A);
%! [V2, D2] = eig (A, "balance");
%! [V3, D3] = eig (A, "nobalance");
%! assert (V1, V2)
%! assert (D1, D2)
%! assert (isequal (V2, V3), false)

[1] http://www.sci.wsu.edu/math/faculty/watkins/pdfiles/balbad.pdf
[2] https://hg.savannah.gnu.org/hgweb/octave/file/tip/libinterp/corefcn/eig.cc

Nir Krakauer <nir_krakauer>
Sun 07 Mar 2021 04:51:47 PM UTC, comment #3: 

Nir, thank you for your response.

There has been a lot of development in Octave since this bug was created. I thought to test with the provided example.

Is there a better example which the "nobalance" option should be tested against? Where the results for eig() changes.

Sun 07 Mar 2021 03:35:42 PM UTC, comment #2: 

Your source's understanding of eig is incorrect. 'nobalance' does not affect the returned scaling of the eigenvectors. Accordingly, for your example,

  -0.7071  -0.6000
   0.7071  -0.8000

also in Matlab.

Nir Krakauer <nir_krakauer>
Sat 06 Mar 2021 07:04:28 PM UTC, comment #1: 

As of

ans = 6.0.90

this is still true.

When doing a doc eig
It states there is an option for "nobalance"

The flag balanceOption can be one of:
"balance" (default)
Preliminary balancing is on.
Disables preliminary balancing.

Following slide 6 from:

A = [1 3; 4 2];
X =

  -0.7071  -0.6000
   0.7071  -0.8000

L =

Diagonal Matrix

  -2   0
   0   5

Now testing with "nobalance"

  -0.7071  -0.6000
   0.7071  -0.8000

The expected answer

  -1.0000   -0.7500
   1.0000   -1.0000

Sat 12 Sep 2015 06:56:39 PM UTC, original submission:  

The Matlab function eig() has a 'nobalance' option which does not exist in Octave.  There was a GSoC proposal, but looks like this hasn't been implemented?

Yavsy <yavvsy>


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

Attach Files:

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 siko1056 (Posted a comment)
  • -email is unavailable- added by nir_krakauer (Posted a comment)
  • -email is unavailable- added by yavvsy (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 project members can vote.





    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-10-06 mtmiller Carbon-CopyRemoved 80942 -
    2021-10-06 siko1056 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2015-09-12 mtmiller Severity3 - Normal 1 - Wish
        StatusNone Confirmed
        Release4.0.0 dev

    Back to the top

    Powered by Savane 3.9