From e39ac95d597750cf10d1e2f58e3146f91fb11aaf Mon Sep 17 00:00:00 2001 From: Kamal Saleh Date: Fri, 30 Sep 2022 11:35:36 +0200 Subject: [PATCH] Apply PackageJanitor --- .codecov.yml | 5 +- .github/workflows/Tests.yml | 20 +- PackageInfo.g | 8 +- README.md | 2 +- examples/polyhedrons.g | 46 +-- gap/Cone.gd | 138 ++++----- gap/Cone.gi | 291 ++++++------------ gap/Convex.gd | 2 + gap/Convex.gi | 2 + makedoc.g | 7 +- makedoc_with_overfull_hbox_warnings.g | 1 + makefile | 16 +- ...00_LoadPackage.tst => 100_LoadPackage.tst} | 2 + tst/nconvex01.tst | 141 --------- tst/nconvex02.tst | 75 ----- tst/nconvex03.tst | 34 -- tst/nconvex04.tst | 30 -- tst/nconvex05.tst | 61 ---- tst/nconvex06.tst | 24 -- tst/nconvex07.tst | 19 -- tst/nconvex08.tst | 23 -- tst/nconvex09.tst | 24 -- tst/nconvex10.tst | 96 ------ tst/nconvex11.tst | 20 -- tst/testall.g | 38 ++- 25 files changed, 260 insertions(+), 865 deletions(-) rename tst/{000_LoadPackage.tst => 100_LoadPackage.tst} (83%) delete mode 100644 tst/nconvex01.tst delete mode 100644 tst/nconvex02.tst delete mode 100644 tst/nconvex03.tst delete mode 100644 tst/nconvex04.tst delete mode 100644 tst/nconvex05.tst delete mode 100644 tst/nconvex06.tst delete mode 100644 tst/nconvex07.tst delete mode 100644 tst/nconvex08.tst delete mode 100644 tst/nconvex09.tst delete mode 100644 tst/nconvex10.tst delete mode 100644 tst/nconvex11.tst diff --git a/.codecov.yml b/.codecov.yml index 44d50b8..658e7f0 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,6 +1,3 @@ codecov: disable_default_path_fixes: true -fixes: - - "/home/gap/.gap/pkg/NConvex/::" -ignore: - - "home/" + require_ci_to_pass: false diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index c5f6764..4a8ed7b 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -22,10 +22,11 @@ jobs: steps: # keep workflow active even if repository has no activity for 60 days (do not execute for pull requests) - run: '[ "$GITHUB_EVENT_NAME" = "pull_request" ] || curl --fail -X PUT -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows/Tests.yml/enable' - - uses: actions/checkout@v1 - - run: mkdir -p /home/gap/.gap/pkg/ - - run: sudo cp -a $GITHUB_WORKSPACE /home/gap/.gap/pkg/ - - run: sudo chown -R gap:gap /home/gap/.gap/pkg/ + # checkout needs access to temporary directory + - run: sudo chmod 1777 $RUNNER_TEMP + - run: sudo chown gap:gap $GITHUB_WORKSPACE + - uses: actions/checkout@v3 + - run: cp -a $GITHUB_WORKSPACE /home/gap/.gap/pkg/ - run: | export HOME="/home/gap" cd /home/gap/.gap/pkg/ @@ -36,6 +37,16 @@ jobs: #git clone --depth 1 https://github.com/homalg-project/NormalizInterface.git # set SOURCE_DATE_EPOCH for reproducible PDFs export SOURCE_DATE_EPOCH=0 + # build documentation of packages which we might want to reference, keep this in sync with `release-gap-package` + [ -d "CAP_project/CAP" ] && make -C "CAP_project/CAP" doc + [ -d "CAP_project/CompilerForCAP" ] && make -C "CAP_project/CompilerForCAP" doc + [ -d "CAP_project/MonoidalCategories" ] && make -C "CAP_project/MonoidalCategories" doc + [ -d "CAP_project/CartesianCategories" ] && make -C "CAP_project/CartesianCategories" doc + [ -d "CAP_project/FreydCategoriesForCAP" ] && make -C "CAP_project/FreydCategoriesForCAP" doc + [ -d "HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra" ] && make -C "HigherHomologicalAlgebra/ToolsForHigherHomologicalAlgebra" doc + [ -d "homalg_project/homalg" ] && make -C "homalg_project/homalg" doc + [ -d "homalg_project/Modules" ] && make -C "homalg_project/Modules" doc + [ -d "Toposes" ] && make -C "Toposes" doc TERM=dumb make -C NConvex -j $(nproc) --output-sync ci-test cp ./NConvex/.codecov.yml ./ (cd NConvex && LANG=C.UTF-8 python3 process_coverage.py) @@ -45,6 +56,7 @@ jobs: cd NConvex CUR_SHA=$(git rev-parse --verify HEAD) if [ "${{ matrix.image }}" = "ghcr.io/homalg-project/gap-docker:latest" ] && [ "$CUR_SHA" = "$(git rev-parse origin/master)" ] && [ $(dirname "$GITHUB_REPOSITORY") = "homalg-project" ]; then \ + git fetch origin gh-pages; \ git worktree add gh-pages/ gh-pages || (echo "There was an error. Make sure there is a branch named 'gh-pages'. See https://github.com/homalg-project/PackageJanitor#error-there-was-an-error-make-sure-there-is-a-branch-named-gh-pages"; exit 1); \ git checkout master; \ LANG=C.UTF-8 ./make_dist.sh --token "${{ secrets.GITHUB_TOKEN }}"; \ diff --git a/PackageInfo.g b/PackageInfo.g index c5b2c2c..d2aeff6 100644 --- a/PackageInfo.g +++ b/PackageInfo.g @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# NConvex: Gap package for polyhedral computations +# NConvex: A Gap package to perform polyhedral computations # # This file contains package meta data. For additional information on # the meaning and correct usage of these fields, please consult the @@ -9,8 +9,8 @@ SetPackageInfo( rec( PackageName := "NConvex", -Subtitle := "Gap package for polyhedral computations", -Version := "2022.08-01", +Subtitle := "A Gap package to perform polyhedral computations", +Version := "2022.09-01", Date := ~.Version{[ 1 .. 10 ]}, Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ), License := "GPL-2.0-or-later", @@ -86,7 +86,7 @@ PackageDoc := rec( HTMLStart := "doc/chap0.html", PDFFile := "doc/manual.pdf", SixFile := "doc/manual.six", - LongTitle := "Gap package for polyhedral computations", + LongTitle := "A Gap package to perform polyhedral computations", ), Dependencies := rec( diff --git a/README.md b/README.md index 243bef9..5b3d305 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # NConvex [![View code][code-img]][code-url] -### Gap package for polyhedral computations +### A Gap package to perform polyhedral computations | Documentation | Latest Release | Build Status | Code Coverage | | ------------- | -------------- | ------------ | ------------- | diff --git a/examples/polyhedrons.g b/examples/polyhedrons.g index 23a6eb2..b920afb 100644 --- a/examples/polyhedrons.g +++ b/examples/polyhedrons.g @@ -23,24 +23,14 @@ Q := Polyhedron( [ [ 5, 0 ], [ 0, 6 ] ], [ [ 1, 2 ] , [ -1, -2 ] ] ); #! VerticesOfMainRatPolytope( Q ); #! [ [ 0, 6 ], [ 5, 0 ] ] -V_using_4ti2 := [ [ -3, -16 ], [ -3, 0 ] ];; -V_using_normaliz := [ [ 0, 6 ], [ 5, 0 ] ];; -V := VerticesOfMainPolytope( Q );; -V = V_using_4ti2 or V = V_using_normaliz; -#! true +V := VerticesOfMainPolytope( Q ); +#! [ [ 0, 6 ], [ 5, 0 ] ] -L_using_4ti2 := [ [ [ -3, -16 ], [ -3, -15 ], [ -3, -14 ], -[ -3, -13 ], [ -3, -12 ], [ -3, -11 ], [ -3, -10 ], -[ -3, -9 ], [ -3, -8 ], [ -3, -7 ], [ -3, -6 ], -[ -3, -5 ], [ -3, -4 ], [ -3, -3 ], [ -3, -2 ], -[ -3, -1 ], [ -3, 0 ] ], [ ], [ [ 1, 2 ] ] ];; -L_using_normaliz := [ [ [ 0, -10 ], [ 0, -9 ], [ 0, -8 ], -[ 0, -7 ], [ 0, -6 ], [ 0, -5 ], [ 0, -4 ], [ 0, -3 ], -[ 0, -2 ], [ 0, -1 ], [ 0, 0 ], [ 0, 1 ], [ 0, 2 ], -[ 0, 3 ], [ 0, 4 ], [ 0, 5 ], [ 0, 6 ] ], [ ], [ [ -1, -2 ] ] ];; -L := LatticePointsGenerators( Q );; -L = L_using_4ti2 or L = L_using_normaliz; -#! true +L := LatticePointsGenerators( Q ); +#! [ [ [ 0, -10 ], [ 0, -9 ], [ 0, -8 ], [ 0, -7 ], [ 0, -6 ], +#! [ 0, -5 ], [ 0, -4 ], [ 0, -3 ], [ 0, -2 ], [ 0, -1 ], +#! [ 0, 0 ], [ 0, 1 ], [ 0, 2 ], [ 0, 3 ], [ 0, 4 ], +#! [ 0, 5 ], [ 0, 6 ] ], [ ], [ [ 1, 2 ] ] ] Dimension( Q ); #! 2 RayGeneratorsOfTailCone( Q ); @@ -58,13 +48,8 @@ Q; #! @Example P := PolyhedronByInequalities( [ [ -2, 3, 4, -7 ], -[ -2, 3, 4, -7 ] ] ); #! -L_using_normaliz := [ [ [ -4, 0, -2 ] ], [ ], -[ [ 1, 1, 1 ], [ 4, -3, 0 ] ] ];; -L_using_4ti2 := [ [ [ -2, 2, 0 ] ], [ ], -[ [ 1, 1, 1 ], [ 4, -3, 0 ] ] ];; -L := LatticePointsGenerators( P );; -L = L_using_4ti2 or L = L_using_normaliz; -#! true +L := LatticePointsGenerators( P ); +#! [ [ [ -4, 0, -2 ] ], [ ], [ [ 0, 7, 4 ], [ 1, 1, 1 ] ] ] #! @EndExample #! @BeginLatexOnly #! So the solutions set is $\{ [ -4, 0, -2 ]+ t_1*[ 1, 1, 1 ] + t_2*[ 0, 7, 4 ]; t_1,t_2\in\mathbb{Z}\}$. @@ -75,7 +60,7 @@ L = L_using_4ti2 or L = L_using_normaliz; Q := PolyhedronByInequalities( [ [-3, 4, 6 ], [ 3, -4, -6 ] ] ); #! LatticePointsGenerators( Q ); -#! [ [ ], [ ], [ [ -3, 2 ] ] ] +#! [ [ ], [ ], [ [ 3, -2 ] ] ] #! @EndExample #! @BeginLatexOnly #! Let us solve the folowing linear system @@ -86,14 +71,11 @@ LatticePointsGenerators( Q ); #! $$-3 + 7x + \phantom{3}y + 5v = 0$$ #! @EndLatexOnly #! @Example -P := PolyhedronByInequalities( [ [ -1, 2, 3, 2, 0 ], [ -3, 7, 1, 0, 5 ], -[ 1, -2, -3, -2, 0 ], [ 3, -7, -1, 0, -5 ] ] ); +P := PolyhedronByInequalities( [ [ -1, 2, 3, 2, 0 ], [ -3, 7, 1, 0, 5 ], + [ 1, -2, -3, -2, 0 ], [ 3, -7, -1, 0, -5 ] ] ); #! -L_using_4ti2 := [ [ [ 0, 3, -4, 0 ] ], [ ], [ [ 0, -10, 15, 2 ], [ 1, -2, 2, -1 ] ] ];; -L_using_normaliz := [ [ [ -19, 1, 18, 27 ] ], [ ], [ [ -1, 2, -2, 1 ], [ 5, 0, -5, -7 ] ] ];; -L := LatticePointsGenerators( P );; -L = L_using_4ti2 or L = L_using_normaliz; -#! true +L := LatticePointsGenerators( P ); +#! [ [ [ -19, 1, 18, 27 ] ], [ ], [ [ 0, 10, -15, -2 ], [ 1, -2, 2, -1 ] ] ] #! @EndExample #! @BeginLatexOnly #! I.e., the solutions set is diff --git a/gap/Cone.gd b/gap/Cone.gd index 5d4b1ee..ab2e68d 100644 --- a/gap/Cone.gd +++ b/gap/Cone.gd @@ -7,8 +7,8 @@ DeclareCategory( "IsCone", IsFan ); - - + + ############################## ## ## Constructors @@ -21,17 +21,17 @@ DeclareCategory( "IsCone", #! @Arguments L #! @Returns a Cone Object #! @Description -#! The function takes a list of lists $[L_1, L_2, ...]$ where each $L_j$ represents -#! an inequality and returns the cone defined by them. +#! The function takes a list of lists $[L_1, L_2, ...]$ where each $L_j$ represents +#! an inequality and returns the cone defined by them. #! For example the $j$'th entry $L_j = [a_{j1},a_{j2},...,a_{jn}]$ corresponds to the inequality #! $\sum_{i=1}^n a_{ji}x_i \geq 0$. DeclareOperation( "ConeByInequalities", [ IsList ] ); -#! @Arguments Eq, Ineq +#! @Arguments Eq, Ineq #! @Returns a Cone Object -#! @Description -#! The function takes two lists. The first list is the equalities and the second is +#! @Description +#! The function takes two lists. The first list is the equalities and the second is #! the inequalities and returns the cone defined by them. DeclareOperation( "ConeByEqualitiesAndInequalities", [ IsList, IsList ] ); @@ -40,51 +40,51 @@ DeclareOperation( "ConeByGenerators", [ IsList ] ); #! @Arguments L #! @Returns a Cone Object -#! @Description -#! The function takes a list in which every entry represents a ray in the ambient vector space -#! and returns the cone defined by them. +#! @Description +#! The function takes a list in which every entry represents a ray in the ambient vector space +#! and returns the cone defined by them. DeclareOperation( "Cone", [ IsList ] ); -#! @Arguments cdd_cone +#! @Arguments cdd_cone #! @Returns a Cone Object -#! @Description +#! @Description #! This function takes a cone defined in **CddInterface** and converts it to a cone in **NConvex** DeclareOperation( "Cone", [ IsCddPolyhedron ] ); ############################## ## -## Attributes +## Attributes ## ############################## #! @Section Attributes of Cones -# DeclareAttribute( "RayGenerators", +# DeclareAttribute( "RayGenerators", # IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns a list -#! @Description +#! @Description #! Returns the list of the defining inequalities of the cone C. -DeclareAttribute( "DefiningInequalities", +DeclareAttribute( "DefiningInequalities", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns a list -#! @Description +#! @Description #! Returns the list of the equalities in the defining inequalities of the cone C. -DeclareAttribute( "EqualitiesOfCone", +DeclareAttribute( "EqualitiesOfCone", IsCone ); - + DeclareAttribute( "FactorConeEmbedding", IsCone ); - -#! @Arguments C + +#! @Arguments C #! @Returns a cone -#! @Description +#! @Description #! Returns the dual cone of the cone C. DeclareAttribute( "DualCone", IsCone ); @@ -92,26 +92,26 @@ DeclareAttribute( "DualCone", DeclareAttribute( "RaysInFacets", IsCone ); - + DeclareAttribute( "RaysInFaces", IsCone ); -# @Arguments cone +# @Arguments cone # @Returns a point in the cone -# @Description +# @Description # Returns an interior point of the cone. #DeclareAttribute( "InteriorPoint", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns a list of cones -#! @Description -#! Returns the list of all faces of the cone C. +#! @Description +#! Returns the list of all faces of the cone C. DeclareAttribute( "FacesOfCone", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns a list of cones -#! @Description +#! @Description #! Returns the list of all facets of the cone C. DeclareAttribute( "Facets", IsCone ); @@ -124,44 +124,44 @@ if false then DeclareAttribute( "FVector", IsCone ); fi; -#! @Arguments C +#! @Arguments C #! @Returns a list -#! @Description -#! Returns a relative interior point (or ray) in the cone C. -DeclareAttribute( "RelativeInteriorRay", +#! @Description +#! Returns a relative interior point (or ray) in the cone C. +DeclareAttribute( "RelativeInteriorRay", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns a list -#! @Description +#! @Description #! Returns the Hilbert basis of the cone C DeclareAttribute( "HilbertBasis", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns a list -#! @Description +#! @Description #! Returns the Hilbert basis of the dual cone of the cone C DeclareAttribute( "HilbertBasisOfDualCone", IsCone ); - + DeclareAttribute( "LinearSubspaceGenerators", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns a list -#! @Description +#! @Description #! Returns a basis of the lineality space of the cone C. DeclareAttribute( "LinealitySpaceGenerators", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns a cdd object -#! @Description +#! @Description #! Converts the cone to a cdd object. The operations of CddInterface can then be applied #! on this convex object. DeclareAttribute( "ExternalCddCone", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns an normaliz object -#! @Description +#! @Description #! Converts the cone to a normaliz object. The operations of NormalizInterface can then be applied #! on this convex object. DeclareAttribute( "ExternalNmzCone", IsCone ); @@ -205,7 +205,7 @@ DeclareAttribute( "FactorGridMorphism", #! @Description #! Returns the homalg $\mathbb{Z}$-module that is by generated the ray generators of the orthogonal cone on C. DeclareAttribute( "GridGeneratedByOrthogonalCone", - IsCone ); + IsCone ); ############################## ## @@ -214,23 +214,23 @@ DeclareAttribute( "GridGeneratedByOrthogonalCone", ############################## #! @Section Properties of Cones -#! @Arguments C +#! @Arguments C #! @Returns true or false -#! @Description +#! @Description #! Returns if the cone C is regular or not. DeclareProperty( "IsRegularCone", IsCone ); DeclareProperty( "HasConvexSupport", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns true or false -#! @Description +#! @Description #! Returns if the cone C is ray or not. DeclareProperty( "IsRay", IsCone ); -#! @Arguments C +#! @Arguments C #! @Returns true or false -#! @Description +#! @Description #! Returns whether the cone is the zero cone or not. DeclareProperty( "IsZero", IsCone ); @@ -245,51 +245,51 @@ DeclareAttribute( "SuperFan", IsCone ); ############################## #! @Section Operations on cones -#! @Arguments C, m +#! @Arguments C, m #! @Returns a cone -#! @Description +#! @Description #! Returns the projection of the cone on the space (O, $x_1,...,x_{m-1}, x_{m+1},...,x_n$ ). DeclareOperation( "FourierProjection", [ IsCone, IsInt ] ); #! @Arguments C1, C2 #! @Returns a cone -#! @Description +#! @Description #! Returns the intersection. DeclareOperation( "IntersectionOfCones", [ IsCone, IsCone ] ); -#! @Arguments L +#! @Arguments L #! @Returns a cone -#! @Description +#! @Description #! The input is a list of cones and the output is their intersection. DeclareOperation( "IntersectionOfCones", [ IsList ] ); -#! @Arguments C1, C2 +#! @Arguments C1, C2 #! @Returns a true or false -#! @Description +#! @Description #! Returns if the cone C1 contains the cone C2. DeclareOperation( "Contains", [ IsCone, IsCone ] ); #! @Arguments L, C #! @Returns a true or false -#! @Description +#! @Description #! Checks whether the input point (or ray) L is in the relative interior of the cone C. DeclareOperation( "IsRelativeInteriorRay", [ IsList, IsCone ] ); - + DeclareOperation( "\*", [ IsInt, IsCone ] ); #! @InsertChunk example1 - + DeclareOperation( "\*", [ IsHomalgMatrix, IsCone ] ); #! @Arguments C #! @Returns a list -#! @Description +#! @Description #! It returns a list of inequalities that define the cone. DeclareOperation( "NonReducedInequalities", [ IsCone ] ); @@ -298,14 +298,14 @@ DeclareOperation( "StarSubdivisionOfIthMaximalCone", [ IsFan, IsInt ] ); -DeclareOperation( "StarFan", +DeclareOperation( "StarFan", [ IsCone ] ); -DeclareOperation( "StarFan", +DeclareOperation( "StarFan", [ IsCone, IsFan ] ); -DeclareGlobalFunction( "SolutionPostIntMat" ); -DeclareGlobalFunction( "AddIfPossible" ); +DeclareGlobalFunction( "SolutionPostIntMat" ); +DeclareGlobalFunction( "AddIfPossible" ); DeclareGlobalFunction( "IfNotReducedReduceOnce" ); DeclareGlobalFunction( "ReduceTheBase" ); diff --git a/gap/Cone.gi b/gap/Cone.gi index cbf71b7..664a8b8 100644 --- a/gap/Cone.gi +++ b/gap/Cone.gi @@ -82,7 +82,7 @@ InstallMethod( IsComplete, [ IsCone ], function( cone ) - local rays; + local rays; if IsPointed( cone ) or not IsFullDimensional( cone ) then @@ -96,11 +96,11 @@ InstallMethod( IsComplete, end ); -## Let N= Z^{1 \times n}. Then N is free Z-modue. Let r_1,...,r_k \in N be the generating rays of the +## Let N= Z^{1 \times n}. Then N is free Z-modue. Let r_1,...,r_k \in N be the generating rays of the ## cone. Let A= [ r_1,..., r_k ]^T \in Z^{ k \times n }. Let M= N/ Z^{1 \times k}A. Now let B the smith -## normal form of A. Then B \in Z^{ k \times n } and there exists l<=k, l<=n with B_{i,i} \neq 0 and B_{i-1,i}| B_{i-1,i} for -## all 1l. We have now M= Z/Zb_{1,1} \oplus ... \oplus Z/Zb_{l,l} \oplus Z^{1 \times max{n,k}-l }. -## If all B_{i,i}=1 for i<=l, then M= Z^{1 \times max{n,k}-l }. i.e. M is free. Thus there is H \subset N with N= H \oplus Z^{1 \times k}A. +## normal form of A. Then B \in Z^{ k \times n } and there exists l<=k, l<=n with B_{i,i} \neq 0 and B_{i-1,i}| B_{i-1,i} for +## all 1l. We have now M= Z/Zb_{1,1} \oplus ... \oplus Z/Zb_{l,l} \oplus Z^{1 \times max{n,k}-l }. +## If all B_{i,i}=1 for i<=l, thenM= Z^{1 \times max{n,k}-l }. i.e. M is free. Thus there is H \subset N with N= H \oplus Z^{1 \times k}A. ## ( Corollary 7.55, Advanced modern algebra, J.rotman ). ## InstallMethod( IsSmooth, @@ -159,7 +159,7 @@ end ); ## InstallMethod( IsFullDimensional, "for cones", - [ IsCone ], + [ IsCone ], function( cone ) return RankMat( RayGenerators( cone ) ) = AmbientSpaceDimension( cone ); @@ -213,7 +213,7 @@ InstallMethod( DualCone, local dual; if RayGenerators( cone ) = [ ] then - dual := ConeByInequalities( [ List( [ 1 .. AmbientSpaceDimension( cone ) ], i -> 0 ) ] ); + dual := ConeByInequalities( [ List( [ 1 .. AmbientSpaceDimension( cone ) ], i -> 0 ) ] ); else dual := ConeByInequalities( RayGenerators( cone ) ); fi; @@ -231,35 +231,34 @@ InstallMethod( DefiningInequalities, [ IsCone ], function( cone ) - local inequalities, new_inequalities, equalities, i, u; + local inequalities, new_inequalities, equalities, i, u; inequalities:= ShallowCopy( Cdd_Inequalities( ExternalCddCone( cone ) ) ); equalities:= ShallowCopy( Cdd_Equalities( ExternalCddCone( cone ) ) ); - for i in equalities do - - Append( inequalities, [ i,-i ] ); - + for i in equalities do + + Append( inequalities, [ i,-i ] ); + od; new_inequalities:= [ ]; - for i in inequalities do - - u:= ShallowCopy( i ); - - Remove( u , 1 ); - - Add(new_inequalities, u ); - + for i in inequalities do + + u:= ShallowCopy( i ); + + Remove( u , 1 ); + + Add(new_inequalities, u ); + od; - return new_inequalities; - + return new_inequalities; + end ); - ## InstallMethod( FactorConeEmbedding, "for cones", @@ -283,7 +282,7 @@ InstallMethod( EqualitiesOfCone, new_equalities:= [ ]; - for i in equalities do + for i in equalities do u:= ShallowCopy( i ); @@ -324,95 +323,9 @@ InstallMethod( HilbertBasisOfDualCone, function( cone ) - return HilbertBasis( DualCone( cone ) ); - -end ); - -## This method is commented since it returns a wrong answer for not-pinted cones -## C := Cone( [ e1 ] ); -## -# InstallMethod( HilbertBasisOfDualCone, -# "for cone", -# [ IsCone ], - -# function( cone ) -# local ray_generators, d, i, dim, V, D, max, v, I, b, DpD, d1, d2, Dgens, -# zero_element, entry; - -# ray_generators := RayGenerators( cone ); - -# dim := AmbientSpaceDimension( cone ); - -# max := Maximum( List( Concatenation( ray_generators ), AbsInt ) ); - -# D := [ ]; - -# ## This needs to be done smarter -# I:= Cartesian( List( [ 1 .. dim ], i -> [ -max .. max ] ) ); - -# for v in I do - -# if ForAll( ray_generators, i -> i * v >= 0 ) then - -# Add( D, v ); - -# fi; - -# od; - -# DpD := [ ]; + return HilbertBasis( DualCone( cone ) ); -# for d1 in D do - -# if d1 * d1 <> 0 then - -# for d2 in D do - -# if d2 * d2 <> 0 then - -# Add( DpD, d1 + d2 ); - -# fi; - -# od; - -# fi; - -# od; - -# Dgens := [ ]; - -# for d in D do - -# if not d in DpD then - -# Add( Dgens, d ); - -# fi; - -# od; - -# if not Dgens = [ ] then - -# zero_element := ListWithIdenticalEntries( Length( Dgens[ 1 ] ), 0 ); - -# i := Position( Dgens, zero_element ); - -# if i <> fail then - -# Remove( Dgens, i ); - -# fi; - -# fi; - -# entry := ToDoListEntry( [ [ cone, "DualCone" ] ], [ DualCone, cone ], "HilbertBasis", Dgens ); - -# AddToToDoList( entry ); - -# return Dgens; - -# end); +end ); ## InstallMethod( AmbientSpaceDimension, @@ -422,13 +335,13 @@ InstallMethod( AmbientSpaceDimension, function( cone ) if Length( RayGenerators( cone ) ) > 0 then - - return Length( RayGenerators( cone )[ 1 ] ); - - else - - return 1; - + + return Length( RayGenerators( cone )[ 1 ] ); + + else + + return 1; + fi; end ); @@ -442,12 +355,12 @@ InstallMethod( Dimension, if Length( RayGenerators( cone ) ) > 0 then - return RankMat( RayGenerators( cone ) ); + return RankMat( RayGenerators( cone ) ); + + else + + return 0; - else - - return 0; - fi; TryNextMethod(); @@ -455,13 +368,13 @@ InstallMethod( Dimension, end ); ## -InstallMethod( Dimension, +InstallMethod( Dimension, "for cones", [ IsCone ], function( cone ) - - return Cdd_Dimension( ExternalCddCone( cone ) ); - + + return Cdd_Dimension( ExternalCddCone( cone ) ); + end ); ## @@ -477,24 +390,23 @@ InstallMethod( HilbertBasis, Error( "Hilbert basis for not-pointed cones is not yet implemented, you can use the command 'LatticePointsGenerators' " ); fi; - - + if IsPackageMarkedForLoading( "NormalizInterface", ">=1.1.0" ) then - + return Set( ValueGlobal( "NmzHilbertBasis" )( ExternalNmzCone( cone ) ) ); - + elif IsPackageMarkedForLoading( "4ti2Interface", ">=2018.07.06" ) then ineq := DefiningInequalities( cone ); - + const := ListWithIdenticalEntries( Length( ineq ), 0 ); - + return Set( ValueGlobal( "4ti2Interface_zsolve_equalities_and_inequalities" )( [ ], [ ], ineq, const )[ 2 ]: precision := "gmp" ); - + else - + Error( "4ti2Interface or NormalizInterface should be loaded!" ); - + fi; end ); @@ -505,8 +417,8 @@ InstallMethod( RaysInFacets, [ IsCone ], function( cone ) - local external_cone, list_of_facets, generating_rays, list, current_cone, current_list, current_ray_generators, i; - + local external_cone, list_of_facets, generating_rays, list, current_cone, current_list, current_ray_generators, i; + external_cone := Cdd_H_Rep ( ExternalCddCone ( cone ) ); list_of_facets:= Cdd_Facets( external_cone ); @@ -521,18 +433,18 @@ InstallMethod( RaysInFacets, current_ray_generators := Cdd_GeneratingRays( current_cone ) ; - current_list:= List( [1..Length( generating_rays )], - - function(j) - - if generating_rays[j] in Cone( current_cone ) then - return 1; - else - return 0; - fi; - - end ); - + current_list:= List( [1..Length( generating_rays )], + + function(j) + + if generating_rays[j] in Cone( current_cone ) then + return 1; + else + return 0; + fi; + + end ); + Add( list, current_list ); od; @@ -547,7 +459,7 @@ InstallMethod( RaysInFaces, [ IsCone ], function( cone ) - local external_cone, list_of_faces, generating_rays, list, current_cone, current_list, current_ray_generators, i,j; + local external_cone, list_of_faces, generating_rays, list, current_cone, current_list, current_ray_generators, i,j; external_cone := Cdd_H_Rep( ExternalCddCone ( cone ) ); @@ -565,16 +477,16 @@ InstallMethod( RaysInFaces, current_ray_generators := Cdd_GeneratingRays( current_cone ) ; - current_list:= List( [ 1 .. Length( generating_rays ) ], + current_list:= List( [ 1 .. Length( generating_rays ) ], function(j) if generating_rays[j] in Cone( current_cone ) then - return 1; + return 1; else return 0; fi; - + end ); Add( list, current_list ); @@ -619,7 +531,7 @@ InstallMethod( Facets, od; - if conelist = [ [ ] ] then + if conelist = [ [ ] ] then return [ Cone( [ List( [ 1 .. AmbientSpaceDimension( cone ) ], i->0 ) ] ) ]; fi; @@ -673,10 +585,10 @@ InstallMethod( FVector, local external_cone, faces; external_cone := Cdd_H_Rep( ExternalCddCone( cone ) ); - + faces := Cdd_Faces( external_cone ); - return List( [ 1 .. Dimension( cone ) ], + return List( [ 1 .. Dimension( cone ) ], i -> Length( PositionsProperty( faces, face -> face[ 1 ] = i ) ) ); end ); @@ -797,8 +709,8 @@ InstallMethod( FactorGridMorphism, end ); -InstallMethod( LatticePointsGenerators, - [ IsCone ], +InstallMethod( LatticePointsGenerators, + [ IsCone ], function( cone ) local n; @@ -807,7 +719,7 @@ InstallMethod( LatticePointsGenerators, return LatticePointsGenerators( Polyhedron( [ List( [ 1 .. n ], i -> 0 ) ], cone ) ); -end ); +end ); ## InstallMethod( StarSubdivisionOfIthMaximalCone, @@ -818,7 +730,7 @@ InstallMethod( StarSubdivisionOfIthMaximalCone, local maxcones, cone, ray, cone2; maxcones := MaximalCones( fan ); - + if Length( maxcones ) < noofcone then Error( " not enough maximal cones" ); @@ -830,9 +742,9 @@ InstallMethod( StarSubdivisionOfIthMaximalCone, Error( " the specified cone is not smooth!" ); fi; - + maxcones := List( maxcones, RayGenerators ); - + cone := maxcones[ noofcone ]; ray := Sum( cone ); @@ -1130,27 +1042,27 @@ InstallMethod( Contains, function( ambcone, cone ) local ineq; - + if HasRayGenerators( ambcone ) and HasRayGenerators( cone ) then - + if IsSubset( Set( RayGenerators( ambcone ) ), Set( RayGenerators( cone ) ) ) then - + return true; - + fi; - + fi; - + if HasDefiningInequalities( ambcone ) and HasDefiningInequalities( cone ) then - + if IsSubset( Set( DefiningInequalities( cone ) ), Set( DefiningInequalities( ambcone ) ) ) then - + return true; - + fi; - + fi; - + ineq := NonReducedInequalities( ambcone ); cone := RayGenerators( cone ); @@ -1231,7 +1143,7 @@ InstallMethod( \in, ray_generators := RayGenerators( cone ); ##FIXME: One can use homalg for this, but at the moment - ## we do not want the overhead. + ## we donot want the overhead. matrix := SolutionMat( ray_generators, raygen ); return ForAll( matrix, i -> i >= 0 ); @@ -1285,11 +1197,11 @@ InstallMethod( ExternalCddCone, fi; - if IsBound( cone!.input_rays ) then + if IsBound( cone!.input_rays ) then list := cone!.input_rays; - for i in [1..Length( list ) ] do + for i in [1..Length( list ) ] do u:= ShallowCopy( list[ i ] ); @@ -1314,7 +1226,7 @@ InstallMethod( ExternalCddCone, Append( list, StructuralCopy( cone!.input_inequalities ) ); - for i in [1..Length( list ) ] do + for i in [1..Length( list ) ] do u:= ShallowCopy( list[ i ] ); @@ -1326,11 +1238,11 @@ InstallMethod( ExternalCddCone, return Cdd_PolyhedronByInequalities( new_list, linearity ); - else + else list:= StructuralCopy( cone!.input_inequalities ); - for i in [1..Length( list ) ] do + for i in [1..Length( list ) ] do u:= ShallowCopy( list[ i ] ); @@ -1354,7 +1266,7 @@ InstallMethod( ExternalNmzCone, list:= []; - if IsBound( cone!.input_rays ) then + if IsBound( cone!.input_rays ) then list := StructuralCopy( cone!.input_rays ); @@ -1513,7 +1425,7 @@ InstallMethod( ConeByGenerators, cone, TheTypeConvexCone ); - if Length( raylist ) =1 and IsZero( raylist[ 1 ] ) then + if Length( raylist ) =1 and IsZero( raylist[ 1 ] ) then SetIsZero( cone, true ); @@ -1546,21 +1458,21 @@ InstallMethod( Cone, ); -InstallMethod( Cone, +InstallMethod( Cone, "Construct cone from Cdd cone", [ IsCddPolyhedron ], function( cdd_cone ) - local inequalities, equalities, + local inequalities, equalities, new_inequalities, new_equalities, u, i; - if cdd_cone!.rep_type = "H-rep" then + if cdd_cone!.rep_type = "H-rep" then inequalities:= Cdd_Inequalities( cdd_cone ); new_inequalities:= [ ]; - for i in inequalities do + for i in inequalities do u:= ShallowCopy( i ); @@ -1576,7 +1488,7 @@ InstallMethod( Cone, new_equalities:= [ ]; - for i in equalities do + for i in equalities do u:= ShallowCopy( i ); @@ -1592,7 +1504,7 @@ InstallMethod( Cone, return ConeByInequalities( new_inequalities ); - else + else return ConeByGenerators( Cdd_GeneratingRays( cdd_cone ) ); @@ -1737,3 +1649,4 @@ InstallMethod( Display, Print( ".\n" ); end ); + diff --git a/gap/Convex.gd b/gap/Convex.gd index e69de29..139597f 100644 --- a/gap/Convex.gd +++ b/gap/Convex.gd @@ -0,0 +1,2 @@ + + diff --git a/gap/Convex.gi b/gap/Convex.gi index e69de29..139597f 100644 --- a/gap/Convex.gi +++ b/gap/Convex.gi @@ -0,0 +1,2 @@ + + diff --git a/makedoc.g b/makedoc.g index 0c47617..af4b728 100644 --- a/makedoc.g +++ b/makedoc.g @@ -14,12 +14,13 @@ AutoDoc( rec( files := [ "doc/Doc.autodoc" ], scan_dirs := [ "doc", "gap", "examples", "examples/doc" ], ), - #extract_examples := rec( - # units := "Single", - #), + extract_examples := rec( + units := "Single", + ), gapdoc := rec( LaTeXOptions := rec( LateExtraPreamble := """ + \usepackage{mathtools} """, ), ), diff --git a/makedoc_with_overfull_hbox_warnings.g b/makedoc_with_overfull_hbox_warnings.g index a7bd316..998534b 100644 --- a/makedoc_with_overfull_hbox_warnings.g +++ b/makedoc_with_overfull_hbox_warnings.g @@ -18,6 +18,7 @@ AutoDoc( rec( gapdoc := rec( LaTeXOptions := rec( LateExtraPreamble := """ + \usepackage{mathtools} % Many thanks to https://tex.stackexchange.com/questions/22466/how-to-convince-fancyvrb-to-give-overfull-warnings/534486#534486 \makeatletter \def\FV@ListProcessLine#1{% diff --git a/makefile b/makefile index 2ae3352..ff82bb7 100644 --- a/makefile +++ b/makefile @@ -29,17 +29,21 @@ test-doc: doc test-with-coverage: doc gap --quitonbreak --cover stats tst/testall.g - echo 'LoadPackage("profiling"); OutputJsonCoverage("stats", "coverage.json");' | gap --quitonbreak + gap --quitonbreak --norepl -c 'LoadPackage("profiling"); OutputJsonCoverage("stats", "coverage.json");' test-spacing: - grep -R "[^ [] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0 + grep -R "[^ [\"] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0 grep -RE '[^ ] +$$' gap/* && echo "Trailing whitespace found" && exit 1 || exit 0 for filename in gap/*; do \ echo $$filename; \ - echo "LoadPackage(\"NConvex\"); SizeScreen([4096]); func := ReadAsFunction(\"$$filename\"); FileString(\"gap_spacing\", PrintString(func));" | gap --quitonbreak --banner; \ + gap --quitonbreak --norepl --banner -c "LoadPackage(\"NConvex\"); SizeScreen([4096]); func := ReadAsFunction(\"$$filename\"); FileString(\"gap_spacing\", DisplayString(func));"; \ echo -e "\033[0m"; \ - cat "gap_spacing" | sed 's/^function ( ) //g' | sed 's/ return; end$$//g' | sed 's/;/;\n/g' > modified_gap_spacing; \ - cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" | head -c -1 > modified_custom_spacing; \ + # In a perfect world, the DisplayString of a function would exactly match our code. However, our line breaks and indentation might differ from the GAP ones, \ + # so we remove all indentation, line breaks, and empty lines, and afterwards insert line breaks at semicolons again for better readability. \ + cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/( :/( :/g' | sed 's/ *$$//' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \ + cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" > modified_custom_spacing; \ + # Our code might still differ from the GAP code, for example because of additional brackets. \ + # Thus, we diff the code once as expected and once ignoring all space. Diffing the two diffs then shows lines which only differ by spacing. \ diff modified_gap_spacing modified_custom_spacing > spacing_diff; \ diff modified_gap_spacing modified_custom_spacing --ignore-all-space --ignore-space-change --ignore-trailing-space --ignore-blank-lines > spacing_diff_no_blanks; \ diff spacing_diff_no_blanks spacing_diff || exit; \ @@ -50,4 +54,4 @@ test-spacing: rm spacing_diff rm spacing_diff_no_blanks -ci-test: test-with-coverage +ci-test: test-basic-spacing test-with-coverage diff --git a/tst/000_LoadPackage.tst b/tst/100_LoadPackage.tst similarity index 83% rename from tst/000_LoadPackage.tst rename to tst/100_LoadPackage.tst index eb66857..55db1c0 100644 --- a/tst/000_LoadPackage.tst +++ b/tst/100_LoadPackage.tst @@ -3,6 +3,8 @@ # # This file tests if the package can be loaded without errors or warnings. # +# do not load suggested dependencies automatically +gap> PushOptions( rec( OnlyNeeded := true ) ); gap> package_loading_info_level := InfoLevel( InfoPackageLoading );; gap> SetInfoLevel( InfoPackageLoading, PACKAGE_ERROR );; gap> LoadPackage( "NConvex", false ); diff --git a/tst/nconvex01.tst b/tst/nconvex01.tst deleted file mode 100644 index 96ca7b2..0000000 --- a/tst/nconvex01.tst +++ /dev/null @@ -1,141 +0,0 @@ -# NConvex, single 1 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex01.tst"); - -# doc/_Chunks.xml:2-129 -gap> P:= Cone( [ [ 2, 7 ], [ 0, 12 ], [ -2, 5 ] ] ); - -gap> d:= DefiningInequalities( P ); -[ [ -7, 2 ], [ 5, 2 ] ] -gap> Q:= ConeByInequalities( d ); - -gap> P=Q; -true -gap> IsPointed( P ); -true -gap> RayGenerators( P ); -[ [ -2, 5 ], [ 2, 7 ] ] -gap> HilbertBasis( P ); -[ [ -2, 5 ], [ -1, 3 ], [ 0, 1 ], [ 1, 4 ], [ 2, 7 ] ] -gap> HilbertBasis( Q ); -[ [ -2, 5 ], [ -1, 3 ], [ 0, 1 ], [ 1, 4 ], [ 2, 7 ] ] -gap> P_dual:= DualCone( P ); - -gap> RayGenerators( P_dual ); -[ [ -7, 2 ], [ 5, 2 ] ] -gap> Dimension( P ); -2 -gap> List( Facets( P ), RayGenerators ); -[ [ [ -2, 5 ] ], [ [ 2, 7 ] ] ] -gap> faces := FacesOfCone( P ); -[ , , , - ] -gap> RelativeInteriorRay( P ); -[ -2, 41 ] -gap> IsRelativeInteriorRay( [ -2, 41 ], P ); -true -gap> IsRelativeInteriorRay( [ 2, 7 ], P ); -false -gap> LinealitySpaceGenerators( P ); -[ ] -gap> IsRegularCone( P ); -false -gap> IsRay( P ); -false -gap> proj_x1:= FourierProjection( P, 2 ); - -gap> RayGenerators( proj_x1 ); -[ [ -1 ], [ 1 ] ] -gap> DefiningInequalities( proj_x1 ); -[ [ 0 ] ] -gap> R:= Cone( [ [ 4, 5 ], [ -2, 1 ] ] ); - -gap> T:= IntersectionOfCones( P, R ); - -gap> RayGenerators( T ); -[ [ -2, 5 ], [ 2, 7 ] ] -gap> W:= Cone( [ [-3,-4 ] ] ); - -gap> I:= IntersectionOfCones( P, W ); - -gap> RayGenerators( I ); -[ ] -gap> Contains( P, I ); -true -gap> Contains( W, I ); -true -gap> Contains( P, R ); -false -gap> Contains( R, P ); -true -gap> cdd_cone:= ExternalCddCone( P ); -< Polyhedron given by its V-representation > -gap> Display( cdd_cone ); -V-representation -begin -3 X 3 rational - - 0 2 7 - 0 0 12 - 0 -2 5 -end -gap> Cdd_Dimension( cdd_cone ); -2 -gap> H:= Cdd_H_Rep( cdd_cone ); -< Polyhedron given by its H-representation > -gap> Display( H ); -H-representation -begin - 2 X 3 rational - - 0 5 2 - 0 -7 2 -end -gap> P:= Cone( [ [ 1, 1, -3 ], [ -1, -1, 3 ], [ 1, 2, 1 ], [ 2, 1, 2 ] ] ); -< A cone in |R^3> -gap> IsPointed( P ); -false -gap> Dimension( P ); -3 -gap> IsRegularCone( P ); -false -gap> P; -< A cone in |R^3 of dimension 3 with 4 ray generators> -gap> RayGenerators( P ); -[ [ -1, -1, 3 ], [ 1, 1, -3 ], [ 1, 2, 1 ], [ 2, 1, 2 ] ] -gap> d:= DefiningInequalities( P ); -[ [ -5, 8, 1 ], [ 7, -4, 1 ] ] -gap> facets:= Facets( P ); -[ , ] -gap> faces := FacesOfCone( P ); -[ , , , - , ] -gap> FVector( P ); -[ 1, 2, 1 ] -gap> List( faces, Dimension ); -[ 0, 3, 2, 1, 2 ] -gap> L_using_4ti2 := [ [ [ 0, 0, 0 ] ], [ [ -2, -1, 10 ], -> [ 0, 0, 1 ], [ 2, 1, 2 ] ], [ [ 1, 1, -3 ] ] ];; -gap> L_using_Normaliz := [ [ [ 0, 0, 0 ] ], [ [ -1, 0, 7 ], -> [ 0, 0, 1 ], [ 1, 0, 5 ] ], [ [ 1, 1, -3 ] ] ];; -gap> L := LatticePointsGenerators( P );; -gap> #L = L_using_4ti2 or L = L_using_Normaliz; -gap> DualCone( P ); -< A cone in |R^3> -gap> RayGenerators( DualCone( P ) ); -[ [ -5, 8, 1 ], [ 7, -4, 1 ] ] -gap> Q_x1x3:= FourierProjection(P, 2 ); - -gap> RayGenerators( Q_x1x3 ); -[ [ -1, 3 ], [ 1, -3 ], [ 1, 1 ] ] - -# -gap> STOP_TEST("nconvex01.tst", 1 ); diff --git a/tst/nconvex02.tst b/tst/nconvex02.tst deleted file mode 100644 index dfd08e5..0000000 --- a/tst/nconvex02.tst +++ /dev/null @@ -1,75 +0,0 @@ -# NConvex, single 2 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex02.tst"); - -# doc/_Chunks.xml:138-198 -gap> F1 := Fan( [ [ [ 2, 1 ], [ 1, 2 ] ], [ [ 2, 1 ], [ 1, -1 ] ], -> [ [ -3, 1 ], [ -1, -3 ] ] ] ); - -gap> F2 := Fan( [ [ 2, 1 ], [ 1, 2 ], [ -3, 1 ], [ -1, -3 ], [ 1, -1 ] ], -> [ [ 1, 2 ], [ 1, 5 ], [ 3, 4 ] ] ); - -gap> rays1 := RayGenerators( F1 ); -[ [ -3, 1 ], [ -1, -3 ], [ 1, -1 ], [ 1, 2 ], [ 2, 1 ] ] -gap> rays2 := RayGenerators( F2 ); -[ [ -3, 1 ], [ -1, -3 ], [ 1, -1 ], [ 1, 2 ], [ 2, 1 ] ] -gap> RaysInMaximalCones( F1 ); -[ [ 0, 0, 0, 1, 1 ], [ 0, 0, 1, 0, 1 ], [ 1, 1, 0, 0, 0 ] ] -gap> RaysInMaximalCones( F2 ); -[ [ 0, 0, 0, 1, 1 ], [ 0, 0, 1, 0, 1 ], [ 1, 1, 0, 0, 0 ] ] -gap> RaysInAllCones( F1 ); -[ [ 0, 0, 0, 0, 0 ], [ 0, 0, 0, 1, 1 ], [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], [ 0, 0, 1, 0, 1 ], [ 0, 0, 1, 0, 0 ], - [ 1, 1, 0, 0, 0 ], [ 0, 1, 0, 0, 0 ], [ 1, 0, 0, 0, 0 ] ] -gap> FVector( F1 ); -[ 5, 3 ] -gap> IsComplete( F1 ); -false -gap> IsSimplicial( F1 ); -true -gap> IsNormalFan( F1 ); -false -gap> IsRegularFan( F1 ); -false -gap> P1 := Polytope( [ [ 1 ], [ -1 ] ] ); - -gap> P1 := NormalFan( P1 ); - -gap> RayGenerators( P1 ); -[ [ -1 ], [ 1 ] ] -gap> P3 := P1 * P1 * P1; - -gap> RayGenerators( P3 ); -[ [ -1, 0, 0 ], [ 0, -1, 0 ], [ 0, 0, -1 ], [ 0, 0, 1 ], [ 0, 1, 0 ], - [ 1, 0, 0 ] ] -gap> RaysInMaximalCones( P3 ); -[ [ 0, 0, 0, 1, 1, 1 ], [ 0, 0, 1, 0, 1, 1 ], [ 0, 1, 0, 1, 0, 1 ], - [ 0, 1, 1, 0, 0, 1 ], [ 1, 0, 0, 1, 1, 0 ], [ 1, 0, 1, 0, 1, 0 ], - [ 1, 1, 0, 1, 0, 0 ], [ 1, 1, 1, 0, 0, 0 ] ] -gap> RaysInAllCones( P3 ); -[ [ 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 1, 1, 1 ], [ 0, 0, 0, 1, 1, 0 ], - [ 0, 0, 0, 1, 0, 0 ], [ 0, 0, 0, 0, 1, 0 ], [ 0, 0, 0, 1, 0, 1 ], - [ 0, 0, 0, 0, 0, 1 ], [ 0, 0, 0, 0, 1, 1 ], [ 0, 0, 1, 0, 1, 1 ], - [ 0, 0, 1, 0, 1, 0 ], [ 0, 0, 1, 0, 0, 0 ], [ 0, 0, 1, 0, 0, 1 ], - [ 0, 1, 0, 1, 0, 1 ], [ 0, 1, 0, 1, 0, 0 ], [ 0, 1, 0, 0, 0, 0 ], - [ 0, 1, 0, 0, 0, 1 ], [ 0, 1, 1, 0, 0, 1 ], [ 0, 1, 1, 0, 0, 0 ], - [ 1, 0, 0, 1, 1, 0 ], [ 1, 0, 0, 1, 0, 0 ], [ 1, 0, 0, 0, 0, 0 ], - [ 1, 0, 0, 0, 1, 0 ], [ 1, 0, 1, 0, 1, 0 ], [ 1, 0, 1, 0, 0, 0 ], - [ 1, 1, 0, 1, 0, 0 ], [ 1, 1, 0, 0, 0, 0 ], [ 1, 1, 1, 0, 0, 0 ] ] -gap> IsNormalFan( P3 ); -true -gap> Dimension( P3 ); -3 -gap> PrimitiveCollections( P3 ); -[ [ 4, 3 ], [ 5, 2 ], [ 6, 1 ] ] - -# -gap> STOP_TEST("nconvex02.tst", 1 ); diff --git a/tst/nconvex03.tst b/tst/nconvex03.tst deleted file mode 100644 index 4dcc6e5..0000000 --- a/tst/nconvex03.tst +++ /dev/null @@ -1,34 +0,0 @@ -# NConvex, single 3 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex03.tst"); - -# doc/_Chunks.xml:205-224 -gap> rays := [ [ 1, 0, 0 ], [ -1, 0, 0 ], [ 0, 1, 0 ], [ 0, -1, 0 ], -> [ 0, 0, 1 ], [ 0, 0, -1 ], [ 2, 1, 1 ], [ 1, 2, 1 ], [ 1, 1, 2 ], -> [ 1, 1, 1 ] ];; -gap> cones := [ [ 1, 3, 6 ], [ 1, 4, 6 ], [ 1, 4, 5 ], [ 2, 3, 6 ], -> [ 2, 4, 6 ], [ 2, 3, 5 ], [ 2, 4, 5 ], [ 1, 5, 9 ], [ 3, 5, 8 ], -> [ 1, 3, 7 ], [ 1, 7, 9 ], [ 5, 8, 9 ], [ 3, 7, 8 ], [ 7, 9, 10 ], -> [ 8, 9, 10 ], [ 7, 8, 10 ] ];; -gap> F := Fan( rays, cones ); - -gap> IsComplete( F ); -true -gap> IsNormalFan( F ); -false -gap> PrimitiveCollections( F ); -[ [ 7, 1 ], [ 7, 2 ], [ 7, 3 ], [ 7, 4 ], [ 7, 5 ], [ 7, 6 ], - [ 9, 1 ], [ 9, 2 ], [ 9, 3 ], [ 9, 6 ], [ 10, 1 ], [ 10, 2 ], - [ 10, 3 ], [ 10, 4 ], [ 8, 1 ], [ 8, 2 ], [ 8, 3 ], [ 8, 5 ], - [ 6, 1 ], [ 5, 2 ], [ 4, 3 ], [ 9, 10, 8 ], [ 5, 6, 4 ] ] - -# -gap> STOP_TEST("nconvex03.tst", 1 ); diff --git a/tst/nconvex04.tst b/tst/nconvex04.tst deleted file mode 100644 index b27f3df..0000000 --- a/tst/nconvex04.tst +++ /dev/null @@ -1,30 +0,0 @@ -# NConvex, single 4 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex04.tst"); - -# doc/_Chunks.xml:254-269 -gap> rays := [ [ 1,0 ], [ 0,1 ] ];; -gap> max_cones := [ [1,2] ];; -gap> fan_affine2 := Fan( rays, max_cones );; -gap> fan_blowup_affine2 := StarSubdivisionOfIthMaximalCone( fan_affine2, 1 ); - -gap> Length( RaysInMaximalCones( fan_blowup_affine2 ) ); -2 -gap> rays := [ [ 1,0,0 ], [ 0,1,0 ], [0,0,1] ];; -gap> max_cones := [ [1,2,3] ];; -gap> fan_affine3 := Fan( rays, max_cones );; -gap> fan_blowup_affine3 := StarSubdivisionOfIthMaximalCone( fan_affine3, 1 ); - -gap> Length( RaysInMaximalCones( fan_blowup_affine3 ) ); -3 - -# -gap> STOP_TEST("nconvex04.tst", 1 ); diff --git a/tst/nconvex05.tst b/tst/nconvex05.tst deleted file mode 100644 index 796d627..0000000 --- a/tst/nconvex05.tst +++ /dev/null @@ -1,61 +0,0 @@ -# NConvex, single 5 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex05.tst"); - -# doc/_Chunks.xml:275-323 -gap> P := Polyhedron( [ [ 1, 1 ], [ 4, 7 ] ], [ [ 1, -1 ], [ 1, 1 ] ] ); - -gap> VerticesOfMainRatPolytope( P ); -[ [ 1, 1 ], [ 4, 7 ] ] -gap> VerticesOfMainPolytope( P ); -[ [ 1, 1 ], [ 4, 7 ] ] -gap> P := Polyhedron( [ [ 1/2, 1/2 ] ], [ [ 1, 1 ] ] ); - -gap> VerticesOfMainRatPolytope( P ); -[ [ 1/2, 1/2 ] ] -gap> VerticesOfMainPolytope( P ); -[ [ 1, 1 ] ] -gap> LatticePointsGenerators( P ); -[ [ [ 1, 1 ] ], [ [ 1, 1 ] ], [ ] ] -gap> Dimension( P ); -1 -gap> Q := Polyhedron( [ [ 5, 0 ], [ 0, 6 ] ], [ [ 1, 2 ] , [ -1, -2 ] ] ); - -gap> VerticesOfMainRatPolytope( Q ); -[ [ 0, 6 ], [ 5, 0 ] ] -gap> V_using_4ti2 := [ [ -3, -16 ], [ -3, 0 ] ];; -gap> V_using_normaliz := [ [ 0, 6 ], [ 5, 0 ] ];; -gap> V := VerticesOfMainPolytope( Q );; -gap> #V = V_using_4ti2 or V = V_using_normaliz; true -gap> L_using_4ti2 := [ [ [ -3, -16 ], [ -3, -15 ], [ -3, -14 ], -> [ -3, -13 ], [ -3, -12 ], [ -3, -11 ], [ -3, -10 ], -> [ -3, -9 ], [ -3, -8 ], [ -3, -7 ], [ -3, -6 ], -> [ -3, -5 ], [ -3, -4 ], [ -3, -3 ], [ -3, -2 ], -> [ -3, -1 ], [ -3, 0 ] ], [ ], [ [ 1, 2 ] ] ];; -gap> L_using_normaliz := [ [ [ 0, -10 ], [ 0, -9 ], [ 0, -8 ], -> [ 0, -7 ], [ 0, -6 ], [ 0, -5 ], [ 0, -4 ], [ 0, -3 ], -> [ 0, -2 ], [ 0, -1 ], [ 0, 0 ], [ 0, 1 ], [ 0, 2 ], -> [ 0, 3 ], [ 0, 4 ], [ 0, 5 ], [ 0, 6 ] ], [ ], [ [ -1, -2 ] ] ];; -gap> L := LatticePointsGenerators( Q );; -gap> #L = L_using_4ti2 or L = L_using_normaliz; true -gap> Dimension( Q ); -2 -gap> RayGeneratorsOfTailCone( Q ); -[ [ -1, -2 ], [ 1, 2 ] ] -gap> BasisOfLinealitySpace( Q ); -[ [ 1, 2 ] ] -gap> DefiningInequalities( Q ); -[ [ 6, 2, -1 ], [ 10, -2, 1 ] ] -gap> Q; - - -# -gap> STOP_TEST("nconvex05.tst", 1 ); diff --git a/tst/nconvex06.tst b/tst/nconvex06.tst deleted file mode 100644 index 44014b7..0000000 --- a/tst/nconvex06.tst +++ /dev/null @@ -1,24 +0,0 @@ -# NConvex, single 6 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex06.tst"); - -# doc/_Chunks.xml:329-339 -gap> P := PolyhedronByInequalities( [ [ -2, 3, 4, -7 ], -[ -2, 3, 4, -7 ] ] ); - -gap> L_using_normaliz := [ [ [ -4, 0, -2 ] ], [ ], -> [ [ 1, 1, 1 ], [ 4, -3, 0 ] ] ];; -gap> L_using_4ti2 := [ [ [ -2, 2, 0 ] ], [ ], -> [ [ 1, 1, 1 ], [ 4, -3, 0 ] ] ];; -gap> L := LatticePointsGenerators( P );; -gap> #L = L_using_4ti2 or L = L_using_normaliz; true - -# -gap> STOP_TEST("nconvex06.tst", 1 ); diff --git a/tst/nconvex07.tst b/tst/nconvex07.tst deleted file mode 100644 index 7a8a22b..0000000 --- a/tst/nconvex07.tst +++ /dev/null @@ -1,19 +0,0 @@ -# NConvex, single 7 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex07.tst"); - -# doc/_Chunks.xml:347-352 -gap> Q := PolyhedronByInequalities( [ [-3, 4, 6 ], [ 3, -4, -6 ] ] ); - -gap> #LatticePointsGenerators( Q ); [ [ ], [ ], [ [ -3, 2 ] ] ] - -# -gap> STOP_TEST("nconvex07.tst", 1 ); diff --git a/tst/nconvex08.tst b/tst/nconvex08.tst deleted file mode 100644 index 16d21d6..0000000 --- a/tst/nconvex08.tst +++ /dev/null @@ -1,23 +0,0 @@ -# NConvex, single 8 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex08.tst"); - -# doc/_Chunks.xml:363-372 -gap> P := PolyhedronByInequalities( [ [ -1, 2, 3, 2, 0 ], [ -3, 7, 1, 0, 5 ], -> [ 1, -2, -3, -2, 0 ], [ 3, -7, -1, 0, -5 ] ] ); - -gap> L_using_4ti2 := [ [ [ 0, 3, -4, 0 ] ], [ ], [ [ 0, -10, 15, 2 ], [ 1, -2, 2, -1 ] ] ];; -gap> L_using_normaliz := [ [ [ -19, 1, 18, 27 ] ], [ ], [ [ -1, 2, -2, 1 ], [ 5, 0, -5, -7 ] ] ];; -gap> L := LatticePointsGenerators( P );; -gap> #L = L_using_4ti2 or L = L_using_normaliz; true - -# -gap> STOP_TEST("nconvex08.tst", 1 ); diff --git a/tst/nconvex09.tst b/tst/nconvex09.tst deleted file mode 100644 index 7741849..0000000 --- a/tst/nconvex09.tst +++ /dev/null @@ -1,24 +0,0 @@ -# NConvex, single 9 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex09.tst"); - -# doc/_Chunks.xml:394-403 -gap> P := PolyhedronByInequalities( [ [ -100, 1, 0 ], [ 200, -1, 0 ], -> [ -80, 0, 1 ], [ 170, 0, -1 ], [ -200, 1, 1 ] ] );; -gap> max := SolveLinearProgram( P, "max", [ 1, -2, 5 ] ); -[ [ 100, 170 ], 651 ] -gap> min := SolveLinearProgram( P, "min", [ 1, -2, 5 ] ); -[ [ 200, 80 ], 1 ] -gap> VerticesOfMainRatPolytope( P ); -[ [ 100, 100 ], [ 100, 170 ], [ 120, 80 ], [ 200, 80 ], [ 200, 170 ] ] - -# -gap> STOP_TEST("nconvex09.tst", 1 ); diff --git a/tst/nconvex10.tst b/tst/nconvex10.tst deleted file mode 100644 index 8968693..0000000 --- a/tst/nconvex10.tst +++ /dev/null @@ -1,96 +0,0 @@ -# NConvex, single 10 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex10.tst"); - -# doc/_Chunks.xml:411-492 -gap> P:= Polytope( [ [ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ], [ 1, 1, 2 ] ] ); - -gap> IsNormalPolytope( P ); -false -gap> IsVeryAmple( P ); -false -gap> Q:= Polytope( [ [ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ], [ 1, 1, 1 ] ] ); - -gap> IsNormalPolytope( Q ); -true -gap> IsVeryAmple( Q ); -true -gap> Q; - -gap> T:= Polytope( [ [ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ], [ 1, 1, 4 ] ] ); - -gap> I:= Polytope( [ [ 0, 0, 0 ], [ 0, 0, 1 ] ] ); - -gap> J:= T + I; - -gap> IsVeryAmple( J ); -true -gap> IsNormalPolytope( J ); -false -gap> J; - -gap> # Example 2.2.20 Cox, Toric Varieties -> A:= [ [1,1,1,0,0,0], [1,1,0,1,0,0], [1,0,1,0,1,0], [ 1,0,0,1,0,1], -> [ 1,0,0,0,1,1], [ 0,1,1,0,0,1], [0,1,0,1,1,0], [0,1,0,0,1,1], -> [0,0,1,1,1,0], [0,0,1,1,0,1] ]; -[ [ 1, 1, 1, 0, 0, 0 ], [ 1, 1, 0, 1, 0, 0 ], [ 1, 0, 1, 0, 1, 0 ], -[ 1, 0, 0, 1, 0, 1 ], [ 1, 0, 0, 0, 1, 1 ], [ 0, 1, 1, 0, 0, 1 ], - [ 0, 1, 0, 1, 1, 0 ], [ 0, 1, 0, 0, 1, 1 ], [ 0, 0, 1, 1, 1, 0 ], -[ 0, 0, 1, 1, 0, 1 ] ] -gap> H:= Polytope( A ); - -gap> IsVeryAmple( H ); -true -gap> IsNormalPolytope( H ); -false -gap> H; - -gap> l:= [ [ 0, 0, 1 ], [ 0, 0, 0 ], [ 1, 0, 0 ], [ 1, 0, 1 ], [ 0, 1, 0 ], -> [ 0, 1, 1 ], [ 1, 1, 4 ], [ 1, 1, 5 ] ];; -gap> P:= Polytope( l ); - -gap> IsNormalPolytope( P ); -false -gap> lattic_points:= LatticePoints( P ); -[ [ 0, 0, 0 ], [ 0, 0, 1 ], [ 0, 1, 0 ], [ 0, 1, 1 ], [ 1, 0, 0 ], [ 1, 0, 1 ], -[ 1, 1, 4 ], [ 1, 1, 5 ] ] -gap> u:= Cartesian( lattic_points, lattic_points );; -gap> k:= Set( List( u, u-> u[1]+u[2] ) ); -[ [ 0, 0, 0 ], [ 0, 0, 1 ], [ 0, 0, 2 ], [ 0, 1, 0 ], [ 0, 1, 1 ], [ 0, 1, 2 ], -[ 0, 2, 0 ], [ 0, 2, 1 ], [ 0, 2, 2 ], [ 1, 0, 0 ], [ 1, 0, 1 ], [ 1, 0, 2 ], -[ 1, 1, 0 ], [ 1, 1, 1 ], [ 1, 1, 2 ], [ 1, 1, 4 ], [ 1, 1, 5 ], [ 1, 1, 6 ], -[ 1, 2, 4 ], [ 1, 2, 5 ], [ 1, 2, 6 ], [ 2, 0, 0 ], [ 2, 0, 1 ], [ 2, 0, 2 ], -[ 2, 1, 4 ], [ 2, 1, 5 ], [ 2, 1, 6 ], [ 2, 2, 8 ], [ 2, 2, 9 ], [ 2, 2, 10 ] ] -gap> Q:= 2*P; - -gap> LatticePoints( Q ); -[ [ 0, 0, 0 ], [ 0, 0, 1 ], [ 0, 0, 2 ], [ 0, 1, 0 ], [ 0, 1, 1 ], [ 0, 1, 2 ], -[ 0, 2, 0 ], [ 0, 2, 1 ], [ 0, 2, 2 ], [ 1, 0, 0 ], - [ 1, 0, 1 ], [ 1, 0, 2 ], [ 1, 1, 0 ], [ 1, 1, 1 ], [ 1, 1, 2 ], [ 1, 1, 3 ], -[ 1, 1, 4 ], [ 1, 1, 5 ], [ 1, 1, 6 ], [ 1, 2, 4 ], [ 1, 2, 5 ], [ 1, 2, 6 ], -[ 2, 0, 0 ], [ 2, 0, 1 ], [ 2, 0, 2 ], [ 2, 1, 4 ], - [ 2, 1, 5 ], [ 2, 1, 6 ], [ 2, 2, 8 ], [ 2, 2, 9 ], [ 2, 2, 10 ] ] -gap> P:= Polytope( [ [ 1, 1 ], [ 1, -1 ], [ -1, 1 ], [ -1, -1 ] ] ); - -gap> Q:= PolarPolytope( P ); - -gap> Vertices( Q ); -[ [ -1, 0 ], [ 0, -1 ], [ 0, 1 ], [ 1, 0 ] ] -gap> T := PolarPolytope( Q ); - -gap> Vertices( T ); -[ [ -1, -1 ], [ -1, 1 ], [ 1, -1 ], [ 1, 1 ] ] -gap> P:= Polytope( [ [ 0, 0 ], [ 1, -1], [ -1, 1 ], [ -1, -1 ] ] ); - -gap> # PolarPolytope( P );; - -# -gap> STOP_TEST("nconvex10.tst", 1 ); diff --git a/tst/nconvex11.tst b/tst/nconvex11.tst deleted file mode 100644 index a46ea63..0000000 --- a/tst/nconvex11.tst +++ /dev/null @@ -1,20 +0,0 @@ -# NConvex, single 11 -# -# DO NOT EDIT THIS FILE - EDIT EXAMPLES IN THE SOURCE INSTEAD! -# -# This file has been generated by AutoDoc. It contains examples extracted from -# the package documentation. Each example is preceded by a comment which gives -# the name of a GAPDoc XML file and a line range from which the example were -# taken. Note that the XML file in turn may have been generated by AutoDoc -# from some other input. -# -gap> START_TEST( "nconvex11.tst"); - -# doc/_Chunks.xml:499-504 -gap> P := PolytopeByInequalities( [ [ 0, 0, 1 ], [ 1, -1, -1 ], [ 1, 1, -1 ] ] ); - -gap> Vertices( P ); -[ [ -1, 0 ], [ 0, 1 ], [ 1, 0 ] ] - -# -gap> STOP_TEST("nconvex11.tst", 1 ); diff --git a/tst/testall.g b/tst/testall.g index 08a8e01..a9ce3d1 100644 --- a/tst/testall.g +++ b/tst/testall.g @@ -4,14 +4,40 @@ # This file runs package tests. It is also referenced in the package # metadata in PackageInfo.g. # -LoadPackage( "NConvex" ); -dirs := DirectoriesPackageLibrary( "NConvex", "tst" ); # Until the issue https://github.com/homalg-project/NConvex/issues/5 has been solved -ex := []; +exclude := []; if IsBound( IsPackageLoaded ) and IsPackageLoaded( "majoranaalgebras" ) then - ex := [ "nconvex02.tst" ]; + exclude := [ "nconvex02.tst" ]; fi; -TestDirectory( dirs, rec( exitGAP := true, testOptions:= rec(compareFunction:="uptowhitespace" ), exclude := ex ) ); -FORCE_QUIT_GAP(1); +options := rec( + exitGAP := true, + exclude := exclude, + testOptions := rec( + compareFunction := "uptowhitespace", + ), +); + +# reverse RecNames 50% of the time to detect code relying on the order of RecNames +if Random( RandomSource( IsMersenneTwister, NanosecondsSinceEpoch( ) ), [ false, true ] ) then + + Display( "Executing with reversed RecNames" ); + + MakeReadWriteGlobal( "RecNames" ); + + old_RecNames := RecNames; + + RecNames := record -> Reversed( old_RecNames( record ) ); + + MakeReadOnlyGlobal( "RecNames" ); + +else + + Display( "Executing with non-reversed RecNames" ); + +fi; + +TestDirectory( DirectoriesPackageLibrary( "NConvex", "tst" ), options ); + +FORCE_QUIT_GAP( 1 ); # if we ever get here, there was an error