Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weil divisors #1734

Merged
merged 50 commits into from
Nov 25, 2022
Merged

Conversation

HechtiDerLachs
Copy link
Collaborator

This is a new draft PR for Weil divisors and their functionality for discussion and further development.

The internals have changed in the sense that we now build on the new IdealSheaf derived from the presheaf container.

CC: @simonbrandhorst

@HechtiDerLachs HechtiDerLachs marked this pull request as draft November 16, 2022 15:51
@HechtiDerLachs
Copy link
Collaborator Author

Something goes wrong with adjoint(::fmpz_mat). But I didn't even touch this! Does anybody know what's going on?

CC: @HereAround

@thofma
Copy link
Collaborator

thofma commented Nov 16, 2022

What about #1585?

@thofma
Copy link
Collaborator

thofma commented Nov 16, 2022

Someone is using x' for the transpose of x, which does not work.

@lkastner
Copy link
Member

Something goes wrong with adjoint(::fmpz_mat). But I didn't even touch this! Does anybody know what's going on?

CC: @HereAround

Benjamin pointed out that adjoint is in Schemes/SpecOpen.jl which you removed the include of.

@thofma
Copy link
Collaborator

thofma commented Nov 16, 2022

Hm, I don't think that adjoint method should exist, see Nemocas/AbstractAlgebra.jl#838

@lkastner
Copy link
Member

lkastner commented Nov 16, 2022

Ok, so the offending line is

tr = adjoint(lattice_gens)

in src/ToricVarities/NormalToricVarieties/constructors.jl. The reason I was using this is that lattice_gens is a fmpz_mat and hence cannot be inverted. So I thought that inv=adj/det, but I just looked at wikipedia and apparently this is an outdated understanding of adjoint.

Before I used solve multiple time which I found inelegant. The adjoint or rather adjugate works because I only need ray generators, a scalar factor does not matter. This is just to explain what this was supposed to accomplish. Let me know how you want to proceed / whether I need to do something.

@thofma
Copy link
Collaborator

thofma commented Nov 17, 2022

@lkastner Thanks for the explanation and no worries. I will adjust it in a separate PR.

@fieker
Copy link
Contributor

fieker commented Nov 17, 2022 via email

@HechtiDerLachs
Copy link
Collaborator Author

Benjamin pointed out that adjoint is in Schemes/SpecOpen.jl which you removed the include of.

Yes, I was already worried about this. Indeed, some time ago, I wanted to have a toy-implementation of inversion of matrices over rings and I implemented the adjoint method. But this turned out (and probably was expected) to be very inefficient; basically because of the necessity to evaluate large minors. So this was never to be used by anyone, really. Whoever is using it: Please replace by a more efficient method, especially in the fmpz-context.

@HechtiDerLachs
Copy link
Collaborator Author

What about #1585?

It's a remake of that PR. Issues you pointed out there should eventually be addressed again. I'll look into that.

@lkastner
Copy link
Member

Why? if m has det==1, inv will work otherwise, try pseudo_inv which will return a matrix and a scalar (denominator)

Exactly, in my case det!=1. I will try the pseudo_inv.

@lkastner
Copy link
Member

Ok, I switched to pseudo_inv and it just got merged to master. Hopefully a rebase fixes your issues.

Comment on lines 1533 to 1541
@Markdown.doc """
is_integral_domain(R::Ring)

Return whether or not `R` is an integral domain.
"""
function is_integral_domain(R::Ring)
is_domain_type(typeof(R)) && return true
error("method not implemented for rings of type $(typeof(R))")
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thofma @fieker @fingolfin : This would be my implementation of the is_integral_domain thing. The other (implemented) methods are scattered throughout the files in this commit.

I_powers = [(1,I)]

while !P(last(I_powers)[2])
push!(I_powers, (last(I_powers)[1]*2, last(I_powers)[2]^2))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doubling the power with each iteration could be dangerous if
I^16 is just too difficult but I^9 does the trick.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, I would expect small orders of vanishing and hence I, I^2, I^3,... should suffice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was following a hint by @fieker from a long time ago in another context. I see your point, but would vote for first keeping an eye on this in practice. We do not need to compute a Groebner basis of the power, but 'only' a saturation. I'm not sure whether that makes things easier, but it could be possible.

If it turns out that this is where stuff gets stuck, we can switch. But in general, this approach saves us a lot of time since it reduces n computations to 2*log(n) computations. Maybe, we have to introduce another heuristic at some point, depending on the complexity of the input, to go incrementally from some power onwards. Let's see.

@thofma thofma closed this Nov 24, 2022
@thofma thofma reopened this Nov 24, 2022
@HechtiDerLachs HechtiDerLachs marked this pull request as ready for review November 24, 2022 18:46
experimental/Schemes/IdealSheaves.jl Outdated Show resolved Hide resolved
experimental/Schemes/WeilDivisor.jl Outdated Show resolved Hide resolved
experimental/Schemes/WeilDivisor.jl Outdated Show resolved Hide resolved
HechtiDerLachs and others added 5 commits November 24, 2022 22:05
Co-authored-by: simonbrandhorst <51749255+simonbrandhorst@users.noreply.github.com>
Co-authored-by: simonbrandhorst <51749255+simonbrandhorst@users.noreply.github.com>
Co-authored-by: simonbrandhorst <51749255+simonbrandhorst@users.noreply.github.com>
Comment on lines +1707 to +1713
A = zero(MatrixSpace(L, ngens(Jsat), ngens(I)))
for i in 1:length(cache)
(g, a, dttk) = cache[i]
A[i, :] = L(one(dttk), dttk, check=false)*change_base_ring(L, a)*pre_saturation_data(I)
end
I.pre_saturated_ideal = Jsat
I.pre_saturation_data = A
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a test.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I would merge it :-).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I would merge it

But with a squash, please. It's become too messy.

@simonbrandhorst simonbrandhorst enabled auto-merge (squash) November 25, 2022 10:59
@simonbrandhorst simonbrandhorst merged commit aee1c7f into oscar-system:master Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants