gap-packages / NormalizInterface

A package for using normaliz from within GAP
https://gap-packages.github.io/NormalizInterface/
Other
5 stars 8 forks source link

Create a plist with immutable GAP strings for all Normaliz property names #75

Closed fingolfin closed 4 years ago

fingolfin commented 5 years ago

This a minor optimization which would make NmzKnownConeProperties slightly less wasteful. It probably doesn't matter in the big picture, though.

In the reverse direction, we could export a record NmzConeProperties with entries like NmzConeProperties.HilbertSeries containing the actual enum value of libnormaliz::ConeProperty::HilbertSeries. Then code could (optionally?) use those instead of GAP strings, for another minor optimization.

alfsan commented 5 years ago

I don't know if this is what you have in mind for the enhancement about the record with cone properties you mentioned, but I was trying to do it with DeclareGlobalVariable( "NmzConeProperties" ); in lib/normaliz.gd, and with InstallFlushableValueFromFunction("NmzConeProperties", {}->_SetNmzConeProperties()); in lib/normaliz.gi

The function _SetNmzConeProperties() is available in GAP:

gap> _SetNmzConeProperties();
rec( AffineDim := 30, Approximate := 53, BigInt := 51, BottomDecomposition := 54, ClassGroup := 44, ConeDecomposition := 46, Congruences := 14, DefaultMode := 52, Deg1Elements := 7, Dehomogenization := 16, DualMode := 56, 
  EmbeddingDim := 33, E .....

but when I do:

gap> LoadPackage("normal");
Error, InstallValue: a value has been installed already at /home/alfredo/lib/gap-4.10.1/lib/variable.g:180 called from
InstallValue( gvar, ret ); at /home/alfredo/lib/gap-4.10.1/lib/variable.g:198 called from
<function "InstallFlushableValueFromFunction">( <arguments> )
 called from read-eval loop at /home/alfredo/lib/gap-4.10.1/pkg/NormalizInterface/lib/normaliz.gi:10
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue

If I do it "manually", it does not complain:

gap> DeclareGlobalVariable("cheesefun");
gap> InstallFlushableValueFromFunction(cheesefun, {} -> _SetNmzConeProperties());
gap> cheesefun;
rec( AffineDim := 30, Approximate := 53, BigInt := 51, BottomDecomposition := 54, ClassGroup := 44, ConeDecomposition := 46, Congruences := 14, DefaultMode := 52, Deg1Elements := 7, Dehomogenization := 16, DualMode := 56, 
  EmbeddingDim := 33, Equations := 13, ExcludedFaces := 10, ExternalIndex := 25, ExtremeRays := 1, GeneratorOfInterior := 18, Generators := 0, Grading := 15, GradingDenom := 22, HSOP := 66, HilbertBasis := 5, 
  HilbertQuasiPolynomial := 48, Hi......

What am I doing wrong?

fingolfin commented 5 years ago

Without seeing the actual code, I can't tell. If you submit your changes as a PR, I can review them, though (it's fine if it is unfinished code that hasn't been cleaned up yet)

fingolfin commented 4 years ago

Resolved by PR #79