Skip to content

Commit

Permalink
Merge branch 'master' into th/buuuump
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Jul 24, 2024
2 parents 765a87b + dae843c commit b35e687
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ the inverse by invoking `inv`.
anticanonical_bundle(v::NormalToricVarietyType)
canonical_bundle(v::NormalToricVarietyType)
structure_sheaf(v::NormalToricVarietyType)
trivial_line_bundle(v::NormalToricVarietyType)
```


Expand Down
1 change: 1 addition & 0 deletions experimental/IntersectionTheory/src/IntersectionTheory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ..Oscar: basis, betti, chow_ring, codomain, degree, det, dim, domain, dua
import ..Oscar.AbstractAlgebra: combinations
import ..Oscar.AbstractAlgebra.Generic: FunctionalMap
import..Oscar: pullback, pushforward, base, OO, product, compose
import ..Oscar: trivial_line_bundle

export a_hat_genus
export abstract_bundle
Expand Down
2 changes: 1 addition & 1 deletion src/AlgebraicGeometry/ToricVarieties/Proj/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ This function computes the total space of a direct sum of line bundles or diviso
Please see [OM78](@cite) for more background information.
# Examples
Let us construct the toric Calabi-Yau varieties given by the total space of ``\mathcal{O}_{\mathbb{P}^1}(2)\oplus\mathcal{O}_{\mathbb{P}^1}(-4))`` and ``\omega_{\mathbb{P}^2}``.
Let us construct the toric Calabi-Yau varieties given by the total space of ``\mathcal{O}_{\mathbb{P}^1}(2)\oplus\mathcal{O}_{\mathbb{P}^1}(-4)`` and ``\omega_{\mathbb{P}^2}``.
```jldoctest
julia> P1 = projective_space(NormalToricVariety, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
structure_sheaf(v::NormalToricVarietyType)
Construct the structure sheaf of a normal toric variety.
For convenience, we also support `structure_sheaf(variety)`.
# Examples
```jldoctest
Expand All @@ -24,7 +23,6 @@ Toric line bundle on a normal toric variety
anticanonical_bundle(v::NormalToricVarietyType)
Construct the anticanonical bundle of a normal toric variety.
For convenience, we also support `anticanonical_bundle(variety)`.
# Examples
```jldoctest
Expand All @@ -42,7 +40,6 @@ Toric line bundle on a normal toric variety
canonical_bundle(v::NormalToricVarietyType)
Construct the canonical bundle of a normal toric variety.
For convenience, we also support `canonical_bundle(variety)`.
# Examples
```jldoctest
Expand All @@ -54,3 +51,23 @@ Toric line bundle on a normal toric variety
```
"""
@attr ToricLineBundle canonical_bundle(v::NormalToricVarietyType) = inv(anticanonical_bundle(v))


@doc raw"""
trivial_line_bundle(v::NormalToricVarietyType)
Construct the trivial line bundle on a normal toric variety.
# Examples
```jldoctest
julia> v = projective_space(NormalToricVariety, 2)
Normal toric variety
julia> l = trivial_line_bundle(v)
Toric line bundle on a normal toric variety
julia> is_trivial(l)
true
```
"""
@attr ToricLineBundle trivial_line_bundle(v::NormalToricVarietyType) = toric_line_bundle(v, trivial_divisor(v))
33 changes: 33 additions & 0 deletions src/TropicalGeometry/matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,36 @@ function det(A::Matrix{<:TropicalSemiringElem})
@req 0 < nrows(A) == ncols(A) "Non-square or empty matrix"
return det(matrix(parent(first(A)),A))
end

@doc raw"""
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.
# Examples
```jldoctest
julia> A = matrix(tropical_semiring(),[1 0;0 1])
[(1) (0)]
[(0) (1)]
julia> is_tropically_generic(A)
true
```
"""
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
end
return true
end
nca = ncols(A)
nra = nrows(A)
if nca == nra
return Polymake.tropical.tsgn(A) != 0
elseif nra>nca
return helper(A,nra,nca)
else
return helper(transpose(A),nca,nra)
end
end
2 changes: 2 additions & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ export is_total
export is_transitive
export is_transverse_intersection
export is_trivial
export is_tropically_generic
export is_two_sided
export is_unipotent
export is_unit
Expand Down Expand Up @@ -1478,6 +1479,7 @@ export transportation_polytope
export trivial_character
export trivial_divisor
export trivial_divisor_class
export trivial_line_bundle
export trivial_morphism
export trivial_subgroup, has_trivial_subgroup, set_trivial_subgroup
export tropical_matrix
Expand Down
8 changes: 8 additions & 0 deletions test/TropicalGeometry/matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@
end

end

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

0 comments on commit b35e687

Please sign in to comment.