Skip to content

Commit 5cce836

Browse files
authored
Merge pull request #76 from zickgraf/precompilation
Precompile SkeletalFinSets
2 parents 701ae16 + a0faaa1 commit 5cce836

10 files changed

+1071
-145
lines changed

PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "FinSetsForCAP",
1212
Subtitle := "The elementary topos of (skeletal) finite sets",
13-
Version := "2021.11-16",
13+
Version := "2021.12-02",
1414

1515
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
1616
License := "GPL-2.0-or-later",
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#! @Chapter Precompilation
2+
3+
#! @Section Precompiling the category of skeletal finite sets
4+
5+
#! @Example
6+
7+
LoadPackage( "FinSetsForCAP", false );
8+
#! true
9+
10+
category_constructor := {} -> CategoryOfSkeletalFinSets( );;
11+
given_arguments := [ ];;
12+
compiled_category_name := "CategoryOfSkeletalFinSetsPrecompiled";;
13+
package_name := "FinSetsForCAP";;
14+
15+
uncompiled_SkeletalFinSets :=
16+
CategoryOfSkeletalFinSets( : no_precompiled_code := true );;
17+
18+
CapJitPrecompileCategoryAndCompareResult(
19+
category_constructor,
20+
given_arguments,
21+
package_name,
22+
compiled_category_name
23+
: operations := Difference(
24+
ListPrimitivelyInstalledOperationsOfCategory(
25+
uncompiled_SkeletalFinSets
26+
),
27+
[
28+
"ProjectionInFactorOfDirectProduct", # uses CAP prepare functions
29+
"UniversalMorphismIntoDirectProduct", # uses CAP prepare functions
30+
]
31+
)
32+
);;
33+
34+
CategoryOfSkeletalFinSetsPrecompiled( );
35+
#! SkeletalFinSets
36+
37+
cat := CategoryOfSkeletalFinSets( );
38+
#! SkeletalFinSets
39+
40+
# Now we check whether the compiled code is loaded automatically.
41+
# For this we use the name of the argument of `InitialObject`;
42+
# for non-compiled code it is "cat", while for compiled code it is "cat_1":
43+
argument_name := NamesLocalVariablesFunction(
44+
Last( cat!.added_functions.InitialObject )[1] )[1];;
45+
46+
(ValueOption( "no_precompiled_code" ) = true and argument_name = "cat") or
47+
(ValueOption( "no_precompiled_code" ) = fail and argument_name = "cat_1");
48+
#! true
49+
50+
#! @EndExample

examples/SkeletalCoastrictionToImage.g

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ phi := MapOfFinSets( n, [ 7, 5, 5 ], m );
1212
IsWellDefined( phi );
1313
#! true
1414
f := CoastrictionToImage( phi );
15-
#! <An epimorphism in SkeletalFinSets>
15+
#! <A morphism in SkeletalFinSets>
1616
Display( f );
1717
#! [ 3, [ 2, 1, 1 ], 2 ]
1818
IsWellDefined( f );
@@ -32,7 +32,7 @@ IsWellDefined( phi );
3232
iota := ImageEmbedding( phi );
3333
#! <A monomorphism in SkeletalFinSets>
3434
pi := CoastrictionToImage( phi );
35-
#! <An epimorphism in SkeletalFinSets>
35+
#! <A morphism in SkeletalFinSets>
3636
Display( pi );
3737
#! [ 4, [ 3, 1, 2, 1 ], 3 ]
3838
IsWellDefined( pi );

gap/SkeletalFinSetsForCAP.gd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
# Technical functions
88
DeclareGlobalFunction( "INSTALL_FUNCTIONS_FOR_SKELETAL_FIN_SETS" );
99

10+
DeclareGlobalFunction( "SKELETAL_FIN_SETS_ExplicitCoequalizer" );
11+
12+
DeclareGlobalFunction( "SKELETAL_FIN_SETS_IsMonomorphism" );
13+
14+
DeclareGlobalFunction( "SKELETAL_FIN_SETS_IsEpimorphism" );
15+
1016
#! @Chapter The category of skeletal finite sets
1117

1218
#! @Section Skeletal GAP Categories

0 commit comments

Comments
 (0)