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

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

[Octave-bug-tracker] [bug #50124] cplxpair produces incorrect result for


From: Bill Lash
Subject: [Octave-bug-tracker] [bug #50124] cplxpair produces incorrect result for second column of complex pairs
Date: Sun, 29 Jan 2017 05:38:29 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0

Follow-up Comment #20, bug #50124 (project octave):

Thanks for matlab-izing the test script,  I always forget that octave has a
superset of the matlab syntax.

So as far as I can tell, these are the issues where matlab and octave
disagree:

0  The issue reported originally, when passed an array with columns of complex
pairs, the results for all but the first column are incorrect

0  When passsing a tolerance value of 1 or greater, matlab returns an error

0  Values that cplxpair determines to be real (i.e. have an imaginary part
less than tol * abs(z)) are forced to be real

0  Complex pairs are forced to be true complex conjugates.  It appears that
Matlab chooses the member of the pair that has a positive imaginary part, and
conjugates it to get the member of the pair with the negative part.  The pairs
are sorted with the member that has negative real part listed first.

0  The way that matlab seems to be comparing values to determine if they are
complex pairs is by comparing the conjugate of each value to the other values,
and finding the one with the minimum magnitude of the difference.  If this
minimum difference is less than tol * abs(z) then it is the pair.  

I tried my hand at adressing these issues, and I think I have version that
works.  I made the changes against the latest version in mercurial.  I am
attaching a patch (new_cplxpair.patch) as well as the results of running your
version of the script (latest.out).  There are some formatting differences
(matlab gives one more digit than octave in format long, and in some cases
octave prints 1 or 0 instead of 1.000000000000000), but it seems to match up
other than that.

I did have to change some of the tests, due to forcing of complex pairs to be
conjugates causing test failures.

(file #39599, file #39600)
    _______________________________________________________

Additional Item Attachment:

File name: new_cplxpair.patch             Size:3 KB
File name: latest.out                     Size:2 KB


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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