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

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

[Octave-bug-tracker] [bug #47236] output of eigs() with 'sa' option sort


From: Rik
Subject: [Octave-bug-tracker] [bug #47236] output of eigs() with 'sa' option sorted differently from Matlab
Date: Sun, 28 Feb 2016 01:39:25 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #13, bug #47236 (project octave):

It turns out this is very specific to the type of matrix being solved.  The
code for eigs is eventually located in liboctave/numeric/eigs-base.cc.  The
solvers are templates based on qualities of the matrix.  It turns out that
only two of the matrix types are re-ordering the eigenvalues.  One of these
cases is the real symmetric which is what matrix A is.

The code is around line 927.


      octave_idx_type k2 = k / 2;
      if (typ != "SM" && typ != "BE")
        {
          for (octave_idx_type i = 0; i < k2; i++)
            {
              double dtmp = d[i];
              d[i] = d[k - i - 1];
              d[k - i - 1] = dtmp;
            }
        }


If I alter the code to exclude the "SA" option


if (typ != "SM" && typ != "SA" && typ != "BE")


then the results returned are in the same order as eig.

I'm attaching the quick patch I made (eigs_sa.patch) and the test script
tst_eigs.m which depends on the file yaledata.

I think what should happen is a script gets written that does the full
combinatorial test of all matrix types against all solver options ('lm', 'sm',
'sa', 'la' etc.).  Run that script on Octave and Matlab and see where the
differences are.




(file #36496, file #36497)
    _______________________________________________________

Additional Item Attachment:

File name: eigs_sa.patch                  Size:0 KB
File name: tst_eigs.m                     Size:0 KB


    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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