-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #321 from mohamed-barakat/devel
PrecompilePreSheavesOfFpCategoryInSkeletalFinSetsSubobjectClassifier
- Loading branch information
Showing
5 changed files
with
766 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
examples/PrecompilePreSheavesOfFpCategoryInSkeletalFinSetsSubobjectClassifier.g
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# @Chapter Precompilation | ||
|
||
# @Section Precompiling the category of presheaves with values in SkeletalFinSets | ||
|
||
# @Example | ||
|
||
LoadPackage( "FunctorCategories", false ); | ||
#! true | ||
|
||
LoadPackage( "CompilerForCAP", ">= 2022.09-02", false ); | ||
#! true | ||
|
||
ReadPackage( "FinSetsForCAP", "gap/CompilerLogic.gi" ); | ||
#! true | ||
|
||
ReadPackage( "FunctorCategories", "gap/CompilerLogic.gi" ); | ||
#! true | ||
|
||
free_category_of_quiver := { quiver, sFinSets } -> FreeCategory( quiver : range_of_HomStructure := sFinSets, FinalizeCategory := true );; | ||
|
||
category_constructor := | ||
function( quiver ) | ||
local sFinSets; sFinSets := CategoryOfSkeletalFinSets( : FinalizeCategory := true ); return PreSheaves( FreeCategory( quiver : range_of_HomStructure := sFinSets, FinalizeCategory := true ), sFinSets ); end;; | ||
|
||
given_arguments := [ RightQuiver( "q(2)[m:1->2]" ) ];; | ||
compiled_category_name := "PreSheavesOfFpCategoryInSkeletalFinSetsSubobjectClassifierPrecompiled";; | ||
package_name := "FunctorCategories";; | ||
|
||
CapJitPrecompileCategoryAndCompareResult( | ||
category_constructor, | ||
given_arguments, | ||
package_name, | ||
compiled_category_name | ||
: operations := [ "SubobjectClassifier", | ||
] | ||
);; | ||
|
||
PreSheavesOfFpCategoryInSkeletalFinSetsSubobjectClassifierPrecompiled( given_arguments[1] ); | ||
#! PreSheaves( FreeCategory( RightQuiver( "q(2)[m:1->2]" ) ), SkeletalFinSets ) | ||
|
||
cat := PreSheaves( free_category_of_quiver( given_arguments[1], SkeletalFinSets ) ); | ||
#! PreSheaves( FreeCategory( RightQuiver( "q(2)[m:1->2]" ) ), SkeletalFinSets ) | ||
|
||
# Now we check whether the compiled code is loaded automatically. | ||
# For this we use the name of the argument of `InitialObject`; | ||
# for non-compiled code it is "cat", while for compiled code it is "cat_1": | ||
argument_name := NamesLocalVariablesFunction( | ||
Last( cat!.added_functions.InitialObject )[1] )[1];; | ||
|
||
(ValueOption( "no_precompiled_code" ) = true and argument_name = "cat") or | ||
(ValueOption( "no_precompiled_code" ) = fail and argument_name = "cat_1"); | ||
#! true | ||
|
||
# @EndExample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.