Skip to content

Commit

Permalink
Merge pull request #321 from mohamed-barakat/devel
Browse files Browse the repository at this point in the history
PrecompilePreSheavesOfFpCategoryInSkeletalFinSetsSubobjectClassifier
  • Loading branch information
mohamed-barakat committed Jan 23, 2023
2 parents c4dcfbc + 66af89b commit b5123eb
Show file tree
Hide file tree
Showing 5 changed files with 766 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "FunctorCategories",
Subtitle := "Categories of functors",
Version := "2023.01-09",
Version := "2023.01-10",

Date := ~.Version{[ 1 .. 10 ]},
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
Expand Down
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
2 changes: 2 additions & 0 deletions gap/PreSheaves.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,8 @@ InstallMethodWithCache( PreSheavesOfFpEnrichedCategory,

ADD_FUNCTIONS_FOR_PreSheavesOfFpCategoryInSkeletalFinSetsPrecompiled( PSh );

ADD_FUNCTIONS_FOR_PreSheavesOfFpCategoryInSkeletalFinSetsSubobjectClassifierPrecompiled( PSh );

elif IsAlgebroid( B ) then

if IsCategoryOfRows( C ) then
Expand Down
Loading

0 comments on commit b5123eb

Please sign in to comment.