Skip to content

Commit

Permalink
removing minOrmax, fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
danteluber committed Jul 17, 2024
1 parent 7b7e956 commit 6f8348d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/TropicalGeometry/matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,21 @@ function det(A::Matrix{TropicalSemiringElem{minOrMax}}) where {minOrMax<:Union{t
end

@doc raw"""
is_tropically_generic(A::MatrixElem{<:TropicalSemiringElem}, minOrMax)
is_tropically_generic(A::MatrixElem{<:TropicalSemiringElem})
Check if a collection of vectors in the tropical torus (given as rows of a matrix `A`) are in tropical general position with respect to the `minOrMax` convention.
Check if a collection of vectors in the tropical torus (given as rows of a matrix `A`) are in tropical general position.
# Examples
```jldoctest
julia> A = matrix(tropical_semiring(),[1 0;0 1])
[(1) (0)]
[(0) (1)]
julia> is_tropically_generic(A,min)
julia> is_tropically_generic(A)
true
```
"""
function is_tropically_generic(A::MatrixElem{<:TropicalSemiringElem}, minOrMax)
@req convention(A) == minOrMax "Semiring convention not as declared"
function is_tropically_generic(A::MatrixElem{<:TropicalSemiringElem})
function helper(A,C,B)
for b in subsets(C,B)
Polymake.tropical.tsgn(A[b,:]) == 0 && return false
Expand All @@ -69,7 +68,7 @@ function is_tropically_generic(A::MatrixElem{<:TropicalSemiringElem}, minOrMax)
nra = nrows(A)
if nca == nra
return Polymake.tropical.tsgn(A) != 0
elseif nca>nra
elseif nra>nca
return helper(A,nra,nca)
else
return helper(transpose(A),nca,nra)
Expand Down
8 changes: 3 additions & 5 deletions test/TropicalGeometry/matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ end

@testset "tropical general position" begin
A = matrix(tropical_semiring(),[1 0;0 1])
@test is_tropically_generic(A,min) == true
A = matrix(tropical_semiring(max),[1 0;0 1])
@test_throws ArgumentError is_tropically_generic(A,min)
@test is_tropically_generic(A) == true
A = matrix(tropical_semiring(max),[1 5;0 0;0 0])
@test is_tropically_generic(A,max) == false
@test is_tropically_generic(transpose(A),max) == false
@test is_tropically_generic(A) == false
@test is_tropically_generic(transpose(A)) == false
end

0 comments on commit 6f8348d

Please sign in to comment.