[LiDIA] error in quadratic_ideal class

Christian Cornelssen ccorn at cs.tu-berlin.de
Thu Nov 21 17:17:21 CET 2002


Hello again,

On Thu, 21 Nov 2002, Christian Cornelssen wrote:

> I guessed that you have thought this :-)  Then let me ask back: What's
> the "if" for then? Why did you leave it in?
> [...]
> Actually, this thinking is what I haven't completed yet, so you could
> still be right.  But I'll find out, and you could be even faster.

I have worked it out in all detail now.  Alexandr is right in that a
value-preserving transformation would produce the intended result.
This also means that the `if' has to disappear!  The change does not
affect the value of m (resp. q) which has thus been computed
correctly, but the values of n, a, and b are affected.

Regards,

Christian Cornelssen

P.S.: Here is my version of the diff:

Index: src/number_fields/quadratic_order/quadratic_ideal.cc
===================================================================
RCS file: /cdc/home/lidiaadm/CVS/LiDIA/src/number_fields/quadratic_order/quadratic_ideal.cc,v
retrieving revision 2.4
diff -u -r2.4 quadratic_ideal.cc
--- src/number_fields/quadratic_order/quadratic_ideal.cc	20 Jun 2001 13:15:29 -0000	2.4
+++ src/number_fields/quadratic_order/quadratic_ideal.cc	21 Nov 2002 15:51:23 -0000
@@ -1803,7 +1803,7 @@
 // Task:
 //    set to the principal ideal belonging to QO2 generated by the element
 //
-//    (x + (D + sqrt(Delta))/2 y)
+//    (x + (Delta + sqrt(Delta))/2 y)
 //

 void
@@ -1823,11 +1823,11 @@
 		q.assign_zero();
 	}
 	else {
-		// use (x + y \sqrt(Delta))/2 form
+		// use (x2 + y2 \sqrt(Delta))/2 form
 		y2.assign(y);
 		shift_left(x2, x, 1);
-		if (Delta.is_odd())
-			add(x2, x2, y);
+		multiply(temp2, y2, Delta);
+		add(x2, x2, temp2);

 		// compute norm of (x2 + y2 sqrt(Delta))/2
 		square(n, x2);
@@ -1838,7 +1838,6 @@
 		n.absolute_value();

 		// solve m = k y2 + l (x2 + y2 Delta) / 2
-		multiply(temp2, y2, Delta);
 		add(temp2, temp2, x2);
 		temp2.divide_by_2();
 		m.assign(xgcd(k, l, y2, temp2));
@@ -1847,7 +1846,7 @@
 		square(temp, m);
 		divide(a, n, temp);

-		// (b = kx2 + l(x2+y2)D/2 ) / m
+		// b = (kx2 + l(x2+y2)D/2 ) / m
 		add(temp2, x2, y2);
 		multiply(temp2, temp2, l);
 		multiply(b, temp2, Delta);




More information about the LiDIA mailing list