Skip to content

Commit

Permalink
Adapt to renaming of Nemo types
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Feb 21, 2023
1 parent 03ebbd9 commit 777949d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/src/matrix_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ dense_matrix_type(::Type{T}) where T <: RingElem

Return the type of dense matrices whose entries have the given type. E.g.
in Nemo, which depends on AbstractAlgebra, we define
`dense_matrix_type(::Type{fmpz}) = fmpz_mat`.
`dense_matrix_type(::Type{ZZRingElem}) = ZZMatrix`.

```julia
nrows(M::MyMatSpace{T}) where T <: RingElem
Expand Down
4 changes: 2 additions & 2 deletions src/AbstractTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ abstract type SimpleNumFieldElem{T} <: NumFieldElem{T} end
# additional abstract types for parents, added ad hoc to form
# collections of types as needed by applications

abstract type FinField <: Field end # for fq, fq_nmod, etc
abstract type FinField <: Field end # for FqPolyRepFieldElem, fqPolyRepFieldElem, etc

# additional abstract types for elements, added ad hoc to form
# collections of types as needed by applications

abstract type FinFieldElem <: FieldElem end # for fq, fq_nmod, etc
abstract type FinFieldElem <: FieldElem end # for FqPolyRepFieldElem, fqPolyRepFieldElem, etc

################################################################################
#
Expand Down
2 changes: 1 addition & 1 deletion src/Factor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ end
Test whether $a$ is a factor of $b$.
"""
function Base.in(a, b::Fac{T}) where {T}
# convert is necessary when T == fmpz, because hash on fmpz
# convert is necessary when T == ZZRingElem, because hash on ZZRingElem
# doesn't coincide with hash on Integer
convert(T, a) in keys(b.fac)
end
Expand Down
2 changes: 1 addition & 1 deletion src/Poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,7 @@ end

# can throw NotInvertibleError for T <: ResElem
#
# To get a good gcd for fmpz_mod_poly/nmod_poly that can throw NotInvertibleError:
# To get a good gcd for ZZModPolyRingElem/zzModPolyRingElem that can throw NotInvertibleError:
# 1. Ensure that flint is only used for polynomial addition and multiplication
# and is never used for mod or divrem or divexact. Or, if using flint for
# division, check the invertibility of the leading coefficient first.
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/GenericFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function remove(a::T, b::T) where T <: Union{RingElem, Number}
throw(ArgumentError("Second argument must be a non-zero non-unit"))
end
if iszero(a)
return (0, zero(parent(a))) # questionable case, consistent with fmpz
return (0, zero(parent(a))) # questionable case, consistent with ZZRingElem
end
v = 0
while begin; (ok, q) = divides(a, b); ok; end
Expand Down
8 changes: 4 additions & 4 deletions test/generic/Fraction-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,14 @@ end
@test gcd(a, (x + 1)//(x - 1)) == 1//(2*x^2-x-1)
end

if @isdefined fmpq
if @isdefined QQFieldElem
@testset "Generic.Frac.remove_valuation" begin
a = fmpq(2, 3)
a = QQFieldElem(2, 3)

@test remove(a, BigInt(2)) == (1, fmpq(1, 3))
@test remove(a, BigInt(2)) == (1, QQFieldElem(1, 3))
@test valuation(a, BigInt(2)) == 1

@test remove(a, BigInt(3)) == (-1, fmpq(2, 1))
@test remove(a, BigInt(3)) == (-1, QQFieldElem(2, 1))
@test valuation(a, BigInt(3)) == -1
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/generic/Matrix-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Base.getindex(a::MyTestMatrix{T}, r::Int, c::Int) where T = a.d
Base.size(a::MyTestMatrix{T}) where T = a.dim, a.dim

# Simulate user Field, together with a specialized matrix type
# (like fmpz / fmpz_mat)
# (like ZZRingElem / ZZMatrix)
struct F2 <: AbstractAlgebra.Field end

Base.zero(::F2) = F2Elem(false)
Expand Down

0 comments on commit 777949d

Please sign in to comment.