@@ -3,6 +3,7 @@ function HermiteReduce(f::AbstractAlgebra.ResFieldElem{P}, DE::AlgebraicExtensio
33 {T<: FieldElement , P<: PolyElem{T} }
44 # "Lazy" Hermite reduction, see Section 2.1 of:
55 # Manuel Bronstein. Symbolic integration tutorial. ISSAC’98, 1998.
6+ # http://www-sop.inria.fr/cafe/Manuel.Bronstein/publications/issac98.pdf
67 iscompatible (f, DE) || error (" rational function f must be in the domain of derivation D" )
78
89 E = parent (f)
@@ -136,15 +137,15 @@ end
136137function IntegralBasis (E:: AbstractAlgebra.ResField{P} ) where {T<: FieldElement , P<: PolyElem{T} }
137138 # Trager's algorithm, see Chapter 2 of
138139 # B.M. Trager. On the integration of algebraic functions. PhD thesis, MIT, Computer Science, 1984.
140+ # https://dspace.mit.edu/bitstream/handle/1721.1/15391/12487590-MIT.pdf
139141 Ky = base_ring (E)
140142 K = base_ring (Ky)
141143 y = E (gen (Ky))
142144 f = modulus (E)
143145 n = degree (f)
144146 M_n_n = MatrixSpace (K, n, n)
145147 MP_n_n = MatrixSpace (base_ring (K), n, n)
146- D = resultant (f, derivative (f))
147- println ()
148+ D = resultant (f, derivative (f))
148149 @assert isone (denominator (D))
149150 D = numerator (D)
150151 D = 1 // leading_coefficient (D) * D
@@ -163,14 +164,14 @@ function IntegralBasis(E::AbstractAlgebra.ResField{P}) where {T<:FieldElement, P
163164
164165 # Compute J, the Q-trace radical of V
165166 ZE = zero (E)
166- S = [p <= q ? bs[p ]* bs[q ] : ZE for p = 1 : n, q = 1 : n] # only upper triangle needed
167+ S = [i <= j ? bs[i ]* bs[j ] : ZE for i = 1 : n, j = 1 : n] # only upper triangle needed
167168 ZK = zero (K)
168169 # TODO : optimize computation of TM, which is one of the bottlenecks.
169170 # Compute only upper triangle of TM, lower triangle by symmetry:
170- TM = [p <= q ? numerator (sum ([coeff (data (S[p,q ]* y^ j ), j ) for j = 0 : n- 1 ])) : ZK for p = 1 : n, q = 1 : n]
171- for p = 1 : n
172- for q = 1 : p- 1
173- TM[p,q] = TM[q,p ]
171+ TM = [i <= j ? numerator (sum ([coeff (data (S[i, j ]* y^ l ), l ) for l = 0 : n- 1 ])) : ZK for i = 1 : n, j = 1 : n]
172+ for i = 1 : n
173+ for j = 1 : p- 1
174+ TM[i, j] = TM[j, i ]
174175 end
175176 end
176177 H = hnf (vcat (MP_n_n (TM), MP_n_n (Q)))[1 : n,:] # Hermite normal form
0 commit comments