Thread: [PyGiNaC-users] strange behavior with the test suite
Status: Alpha
Brought to you by:
jbrandmeyer
From: <pp...@fy...> - 2005-10-03 17:28:13
|
Hi, while playing around with pyginac, I found some strange behavior with the regression test suite. The reason to this behavior escapes me. When running ./run python2.3 bin/checkall.py most of the time everything goes ok, but every now and then an error occurs as follows. ***************************************************************** Failure in example: exam_normal2() from line #1 of exam_normalization.exam_normal2 Expected: 0 Got: normal form of (-y+x)**(-3)*(x**2-y**2) returned (y-x)**(-2)*(y+x) while it should be (-y+x)**(-2)*(y+x) normal form of (x**2-y**2)*(-1/2*y+1/2*x)**(-3) returned (y-x)**(-2)*(8*y+8*x) while it should be (-y+x)**(-2)*(8*y+8*x) 2 ***************************************************************** 1 items had failures: 1 of 1 in exam_normalization.exam_normal2 ***Test Failed*** 1 failures. To get an idea how often this happens, I ran the test 100 times, giving 43 fails and 57 clean passes. The interesting part is that when I run ./run python2.3 exam_normalization.py I am totally unable to reproduce the error above, leading to a guess that this might have something to do with bin/checkall.py and/or the doctest module. However, I have not been able to point any other reason as to why this would be so. I also checked with python 2.4 (Debian-packaged 2.4.1-2) with the same results. I am using an up-to-date cvs of PyGiNaC, GiNaC 1.3.2, boost.python 1.33.0, gcc 4.0.2 and python 2.3.5 (all of which except PyGiNaC are the Debian-packaged versions). So, does anybody have any idea? Can anyone else reproduce this? Best Regards, Matti -- Matti Peltomaki, Graduate Student Laboratory of Physics Helsinki University of Technology 040 7576977, room Y308B |
From: Ondrej C. <on...@ce...> - 2005-10-03 17:37:08
|
Yes, we created another ginac bindings in swig, swiginac.berlios.de, and we have the same problems - they seem to be in ginac. Ondrej On Mon, Oct 03, 2005 at 08:27:02PM +0300, Matti Peltom=E4ki wrote: >=20 > Hi, >=20 > while playing around with pyginac, I found some strange behavior with > the regression test suite. The reason to this behavior escapes me.=20 >=20 > When running ./run python2.3 bin/checkall.py most of the time=20 > everything goes ok, but every now and then an error occurs as follows. >=20 > ***************************************************************** > Failure in example: exam_normal2() > from line #1 of exam_normalization.exam_normal2 > Expected: 0 > Got: > normal form of (-y+x)**(-3)*(x**2-y**2) returned (y-x)**(-2)*(y+x) wh= ile=20 > it should be (-y+x)**(-2)*(y+x) > normal form of (x**2-y**2)*(-1/2*y+1/2*x)**(-3) returned =20 > (y-x)**(-2)*(8*y+8*x) while it should be (-y+x)**(-2)*(8*y+8*x) > 2 > ***************************************************************** > 1 items had failures: > 1 of 1 in exam_normalization.exam_normal2 > ***Test Failed*** 1 failures. >=20 > To get an idea how often this happens, I ran the test 100 times, giving 4= 3=20 > fails and 57 clean passes. The interesting part is that when I run >=20 > ./run python2.3 exam_normalization.py >=20 > I am totally unable to reproduce the error above, leading to a guess that= this=20 > might have something to do with bin/checkall.py and/or the doctest module= =2E=20 > However, I have not been able to point any other reason as to why this wo= uld=20 > be so. I also checked with python 2.4 (Debian-packaged 2.4.1-2) with the = same=20 > results.=20 >=20 > I am using an up-to-date cvs of PyGiNaC, GiNaC 1.3.2, boost.python 1.33.0, > gcc 4.0.2 and python 2.3.5 (all of which except PyGiNaC are the=20 > Debian-packaged versions).=20 >=20 > So, does anybody have any idea? Can anyone else reproduce this? >=20 > Best Regards, > Matti >=20 > --=20 > Matti Peltomaki, Graduate Student > Laboratory of Physics=20 > Helsinki University of Technology > 040 7576977, room Y308B >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Pyginac-users mailing list > Pyg...@li... > https://lists.sourceforge.net/lists/listinfo/pyginac-users |
From: Jonathan B. <jbr...@ea...> - 2005-10-03 18:38:58
|
On Mon, 2005-10-03 at 20:27 +0300, Matti Peltom=E4ki wrote: > Hi, >=20 > while playing around with pyginac, I found some strange behavior with > the regression test suite. The reason to this behavior escapes me.=20 >=20 > When running ./run python2.3 bin/checkall.py most of the time=20 > everything goes ok, but every now and then an error occurs as follows. >=20 > ***************************************************************** > Failure in example: exam_normal2() > from line #1 of exam_normalization.exam_normal2 > Expected: 0 > Got: > normal form of (-y+x)**(-3)*(x**2-y**2) returned (y-x)**(-2)*(y+x) wh= ile=20 > it should be (-y+x)**(-2)*(y+x) > normal form of (x**2-y**2)*(-1/2*y+1/2*x)**(-3) returned =20 > (y-x)**(-2)*(8*y+8*x) while it should be (-y+x)**(-2)*(8*y+8*x) I think that this is a canonicalization issue. If hash(x) is greater than hash(y) (when reinterpret_cast'ed back to unsigned ints), then pow(x - y, 2) normalizes to pow(y - x, 2) I'm not sure if this behavior is deliberate so I'm bringing it up on ginac-list. In the meantime, a patch has been committed to CVS that works around the error. -Jonathan |
From: <pp...@fy...> - 2005-10-04 17:16:06
|
Hi, > I think that this is a canonicalization issue. If hash(x) is greater > than hash(y) (when reinterpret_cast'ed back to unsigned ints), then > pow(x - y, 2) normalizes to pow(y - x, 2) > > I'm not sure if this behavior is deliberate so I'm bringing it up on > ginac-list. In the meantime, a patch has been committed to CVS that > works around the error. I'm afraid there is something wrong in the workaround. I did a cvs update getting your changes (bin/exam_normalization.py and ChangeLog) and rerun the test (again several times since it does not fail every time), and I still get the error sometimes. Are you still able to reproduce the error or is it just me? Regards, Matti -- Matti Peltomaki, Graduate Student Laboratory of Physics Helsinki University of Technology 040 7576977, room Y308B |
From: Jonathan B. <jbr...@ea...> - 2005-10-04 23:51:09
|
On Tue, 2005-10-04 at 20:14 +0300, Matti Peltom=E4ki wrote: > Hi,=20 >=20 > > I think that this is a canonicalization issue. If hash(x) is greater > > than hash(y) (when reinterpret_cast'ed back to unsigned ints), then > > pow(x - y, 2) normalizes to pow(y - x, 2) > >=20 > > I'm not sure if this behavior is deliberate so I'm bringing it up on > > ginac-list. In the meantime, a patch has been committed to CVS that > > works around the error. >=20 > I'm afraid there is something wrong in the workaround. I did a cvs update= =20 > getting your changes (bin/exam_normalization.py and ChangeLog) and rerun=20 > the test (again several times since it does not fail every time), and I=20 > still get the error sometimes.=20 >=20 > Are you still able to reproduce the error or is it just me?=20 I guess I didn't run the test often enough before I committed the fix last night, because you are right. Whatever the cause of the error, I'm inclined to let it slide since this is mathematically correct, and because (pow(x-y, 2)/pow(y-x,2)).normal() evaluates to numeric(1). In the current fix, if the test fails one way, it is retried with the second option. -Jonathan |