Kernel_d: Use integral_division()

This commit is contained in:
Andreas Fabri 2024-01-12 07:04:01 +00:00
parent 61800d1be7
commit 961f00d52b
1 changed files with 8 additions and 8 deletions

View File

@ -95,13 +95,13 @@ linear_solver(const Matrix& A, const Vector& b,
for(i = k + 1; i < rows; i++) for(i = k + 1; i < rows; i++)
for (j = 0; j < rows; j++) //and all columns of |L| for (j = 0; j < rows; j++) //and all columns of |L|
L(i,j) = (L(i,j)*C(k,k) - C(i,k)*L(k,j))/denom; L(i,j) = integral_division((L(i,j)*C(k,k) - C(i,k)*L(k,j)), denom);
for(i = k + 1; i < rows; i++) { for(i = k + 1; i < rows; i++) {
/* the following iteration uses and changes |C(i,k)| */ /* the following iteration uses and changes |C(i,k)| */
RT temp = C(i,k); RT temp = C(i,k);
for (j = k; j <= cols; j++) for (j = k; j <= cols; j++)
C(i,j) = (C(i,j)*C(k,k) - temp*C(k,j))/denom; C(i,j) = integral_division((C(i,j)*C(k,k) - temp*C(k,j)), denom);
} }
denom = C(k,k); denom = C(k,k);
#ifdef CGAL_LA_SELFTEST #ifdef CGAL_LA_SELFTEST
@ -140,7 +140,7 @@ linear_solver(const Matrix& A, const Vector& b,
for (j = i + 1; j < rank; j++) { for (j = i + 1; j < rank; j++) {
h -= C(i,j)*x[var[j]]; h -= C(i,j)*x[var[j]];
} }
x[var[i]]= h / C(i,i); x[var[i]]= integral_division(h, C(i,i));
} }
#ifdef CGAL_LA_SELFTEST #ifdef CGAL_LA_SELFTEST
CGAL_assertion( (M*x).is_zero() ); CGAL_assertion( (M*x).is_zero() );
@ -156,7 +156,7 @@ linear_solver(const Matrix& A, const Vector& b,
RT_ h = - C(i,rank + l)*D; RT_ h = - C(i,rank + l)*D;
for ( j= i + 1; j<rank; j++) for ( j= i + 1; j<rank; j++)
h -= C(i,j)*spanning_vectors(var[j],l); h -= C(i,j)*spanning_vectors(var[j],l);
spanning_vectors(var[i],l)= h / C(i,i); spanning_vectors(var[i],l)= integral_division(h, C(i,i));
} }
#ifdef CGAL_LA_SELFTEST #ifdef CGAL_LA_SELFTEST
/* we check whether the $l$ - th spanning vector is a solution /* we check whether the $l$ - th spanning vector is a solution
@ -908,13 +908,13 @@ homogeneous_linear_solver(const Matrix &A,
for(i = k + 1; i < rows; i++) for(i = k + 1; i < rows; i++)
for (j = 0; j < rows; j++) //and all columns of |L| for (j = 0; j < rows; j++) //and all columns of |L|
L(i,j) = (L(i,j)*C(k,k) - C(i,k)*L(k,j))/denom; L(i,j) = integral_division(L(i,j)*C(k,k) - C(i,k)*L(k,j),denom);
for(i = k + 1; i < rows; i++) { for(i = k + 1; i < rows; i++) {
/* the following iteration uses and changes |C(i,k)| */ /* the following iteration uses and changes |C(i,k)| */
RT temp = C(i,k); RT temp = C(i,k);
for (j = k; j <= cols; j++) for (j = k; j <= cols; j++)
C(i,j) = (C(i,j)*C(k,k) - temp*C(k,j))/denom; C(i,j) = integral_division(C(i,j)*C(k,k) - temp*C(k,j), denom);
} }
denom = C(k,k); denom = C(k,k);
#ifdef CGAL_LA_SELFTEST #ifdef CGAL_LA_SELFTEST
@ -949,7 +949,7 @@ homogeneous_linear_solver(const Matrix &A,
for (j = i + 1; j < rank; j++) { for (j = i + 1; j < rank; j++) {
h -= C(i,j)*x[var[j]]; h -= C(i,j)*x[var[j]];
} }
x[var[i]]= h / C(i,i); x[var[i]]= integral_division(h, C(i,i));
} }
#ifdef CGAL_LA_SELFTEST #ifdef CGAL_LA_SELFTEST
CGAL_assertion( (M*x).is_zero() ); CGAL_assertion( (M*x).is_zero() );
@ -965,7 +965,7 @@ homogeneous_linear_solver(const Matrix &A,
RT_ h = - C(i,rank + l)*D; RT_ h = - C(i,rank + l)*D;
for ( j= i + 1; j<rank; j++) for ( j= i + 1; j<rank; j++)
h -= C(i,j)*spanning_vectors(var[j],l); h -= C(i,j)*spanning_vectors(var[j],l);
spanning_vectors(var[i],l)= h / C(i,i); spanning_vectors(var[i],l)= integral_division(h , C(i,i));
} }
#ifdef CGAL_LA_SELFTEST #ifdef CGAL_LA_SELFTEST
/* we check whether the $l$ - th spanning vector is a solution /* we check whether the $l$ - th spanning vector is a solution