File tree 3 files changed +24
-0
lines changed
3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 5
5
# ##############################################################################
6
6
include (" semiring.jl" )
7
7
include (" semiring_map.jl" )
8
+ include (" semiring_mpoly.jl" )
8
9
include (" matrix.jl" )
9
10
include (" poly.jl" )
10
11
include (" homogenization.jl" )
Original file line number Diff line number Diff line change
1
+ # ###############################################################################
2
+ #
3
+ # Functionality for multivariate polynomials over tropical semirings
4
+ # (alternatives for generic functions that do not work over tropical semirings)
5
+ #
6
+ # ###############################################################################
7
+
8
+ # exponentiation has to be in multiple functions, otherwise calls become ambiguous
9
+ # due to ^(a::AbstractAlgebra.Generic.MPoly{T}, b::Int64) where T<:RingElement
10
+ # in AbstractAlgebra/src/generic/MPoly.jl:2257
11
+ function Base.:(^ )(a:: Generic.MPoly{<:TropicalSemiringElem} , n:: Int )
12
+ @req n>= 0 " polynomial exponentiation with negative exponent"
13
+ return Generic. pow_rmul (a,n)
14
+ end
15
+ function Base.:(^ )(a:: Generic.MPoly{<:TropicalSemiringElem} , n:: ZZRingElem )
16
+ return Generic. pow_rmul (a,Int (n))
17
+ end
Original file line number Diff line number Diff line change 26
26
@testset " characteristic" begin
27
27
@test characteristic (T) == 0
28
28
end
29
+
30
+ @testset " polynomial exponentiation" begin
31
+ Tx, x = polynomial_ring (T, 1 )
32
+ f = x[1 ]^ 4 + 3 * x[1 ]
33
+ @test f^ 3 == f* f* f
34
+ end
29
35
end
30
36
31
37
end
You can’t perform that action at this time.
0 commit comments