Skip to content

Commit

Permalink
unary minus for toric divisors (#2697)
Browse files Browse the repository at this point in the history
  • Loading branch information
justus-springer authored Aug 18, 2023
1 parent 8e16945 commit adc6d9f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function Base.:-(tdc1::ToricDivisorClass, tdc2::ToricDivisorClass)
return toric_divisor_class(toric_variety(tdc1), divisor_class(tdc1) - divisor_class(tdc2))
end

Base.:-(td :: ToricDivisorClass) = toric_divisor_class(toric_variety(td), -divisor_class(td))

Base.:*(c::T, tdc::ToricDivisorClass) where {T <: IntegerUnion} = toric_divisor_class(toric_variety(tdc), ZZRingElem(c) * divisor_class(tdc))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ julia> anticanonical_divisor_class(v)
Divisor class on a normal toric variety
```
"""
@attr ToricDivisorClass anticanonical_divisor_class(v::AbstractNormalToricVariety) = toric_divisor_class(anticanonical_divisor(v))
@attr ToricDivisorClass anticanonical_divisor_class(v::AbstractNormalToricVariety) = -canonical_divisor_class(v)


@doc raw"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ function Base.:-(td1::ToricDivisor, td2::ToricDivisor)
return toric_divisor(toric_variety(td1), new_coeffiicients)
end

Base.:-(td :: ToricDivisor) = toric_divisor(toric_variety(td), -coefficients(td))

Base.:*(c::T, td::ToricDivisor) where {T <: IntegerUnion} = toric_divisor(toric_variety(td), [ZZRingElem(c)*x for x in coefficients(td)])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ julia> anticanonical_divisor(v)
Torus-invariant, non-prime divisor on a normal toric variety
```
"""
@attr ToricDivisor anticanonical_divisor(v::AbstractNormalToricVariety) = toric_divisor(v, fill(ZZRingElem(1), nrays(v)))
@attr ToricDivisor anticanonical_divisor(v::AbstractNormalToricVariety) = -canonical_divisor(v)


@doc raw"""
Expand Down

0 comments on commit adc6d9f

Please sign in to comment.