Skip to content

Commit

Permalink
fix: make dot work again
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma committed Feb 2, 2024
1 parent c8b22bf commit 4c7deac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/AbstractAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const import_exclude = [:import_exclude, :QQ, :ZZ,
# They should not be imported/exported anywhere else.

import LinearAlgebra: det
import LinearAlgebra: dot
import LinearAlgebra: hessenberg
import LinearAlgebra: ishermitian
import LinearAlgebra: issymmetric
Expand Down
12 changes: 12 additions & 0 deletions src/Rings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,15 @@ is_finite(F::FinField) = true
is_finite(F::Field) = characteristic(F) != 0 && throw(NotImplementedError(:is_finite, F))

characteristic(F::NumField) = 0

################################################################################
#
# Dot
#
################################################################################

dot(x::RingElem, y::RingElem) = x * y

dot(x::RingElem, y::Union{Integer, Rational, AbstractFloat}) = x * y

dot(x::Union{Integer, Rational, AbstractFloat}, y::RingElem) = x * y
9 changes: 9 additions & 0 deletions test/Rings-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,12 @@ end
@test is_finite(GF(2))
@test !is_finite(QQ)
end

@testset "dot" begin
Qx, x = QQ["x"]
@test dot([x, x^2], [1, 1]) == x + x^2
@test dot([x, x^2], Rational{BigInt}[1, 1]) == x + x^2
@test dot([1, 1], [x, x^2]) == x + x^2
@test dot(Rational{BigInt}[1, 1], [x, x^2]) == x + x^2
@test dot([x], [x^2]) == x^3
end

0 comments on commit 4c7deac

Please sign in to comment.