From: <dgr...@us...> - 2011-01-08 12:42:00
|
Revision: 19366 http://x10.svn.sourceforge.net/x10/?rev=19366&view=rev Author: dgrove-oss Date: 2011-01-08 12:41:53 +0000 (Sat, 08 Jan 2011) Log Message: ----------- XTENLANG-2309 : Improve efficiency of Complex conjugate Modified Paths: -------------- trunk/x10.runtime/src-x10/x10/lang/Complex.x10 trunk/x10.tests/examples/Constructs/Math/TestComplex.x10 Modified: trunk/x10.runtime/src-x10/x10/lang/Complex.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/Complex.x10 2011-01-08 09:51:51 UTC (rev 19365) +++ trunk/x10.runtime/src-x10/x10/lang/Complex.x10 2011-01-08 12:41:53 UTC (rev 19366) @@ -158,12 +158,7 @@ /** * @return the conjugate of this complex number. */ - public def conjugate():Complex { - if (isNaN()) { - return Complex.NaN; - } - return Complex(re, -im); - } + public def conjugate():Complex = Complex(re, -im); /** * @return this complex number. Modified: trunk/x10.tests/examples/Constructs/Math/TestComplex.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Math/TestComplex.x10 2011-01-08 09:51:51 UTC (rev 19365) +++ trunk/x10.tests/examples/Constructs/Math/TestComplex.x10 2011-01-08 12:41:53 UTC (rev 19366) @@ -24,6 +24,7 @@ val b = a.conjugate(); chk (b.conjugate() == a); + chk (Complex.NaN.conjugate().isNaN()); val c = Complex(1.0, 4.0); chk (a + c - c == a, "a + c - c = a"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |