Goto Chapter: Top 1 2 3 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

3 Precompilation
 3.1 Precompiling the category of skeletal finite sets
 3.2 Precompiling ProjectionInFactorOfBinaryDirectProduct

3 Precompilation

3.1 Precompiling the category of skeletal finite sets

#@if ValueOption( "no_precompiled_code" ) <> true
gap> LoadPackage( "FinSetsForCAP", false );
true
gap> LoadPackage( "CompilerForCAP", ">= 2023.10-03", false );
true
gap> ReadPackageOnce( "FinSetsForCAP", "gap/CompilerLogic.gi" );
true
gap> category_constructor := {} -> SkeletalCategoryOfFiniteSets( );;
gap> given_arguments := [ ];;
gap> compiled_category_name :=
>   "SkeletalCategoryOfFiniteSetsWithMorphismsGivenByLists_precompiled";;
gap> package_name := "FinSetsForCAP";;
gap> primitive_operations :=
>   ListPrimitivelyInstalledOperationsOfCategory(
>           category_constructor( : no_precompiled_code := true ) );;
gap> list_of_operations :=
>   SortedList( Concatenation( primitive_operations, [
>           "CartesianBraidingWithGivenDirectProducts",
>           "CartesianBraidingInverseWithGivenDirectProducts",
>           "CartesianLambdaIntroduction",
>           "CartesianRightEvaluationMorphismWithGivenSource",
>           "CartesianRightCoevaluationMorphismWithGivenRange",
>           "CoastrictionToImage",
>           "CoimageProjection",
>           "IsHomSetInhabited",
>           "TruthMorphismOfImplies",
>           "SingletonMorphismWithGivenPowerObject",
>           #"HasPushoutComplement",
>           "PushoutComplement",
>           ] ) );;
gap> CapJitPrecompileCategoryAndCompareResult(
>         category_constructor,
>         given_arguments,
>         package_name,
>         compiled_category_name
>         : operations := list_of_operations,
>         number_of_objectified_objects_in_data_structure_of_object := 1,
>         number_of_objectified_morphisms_in_data_structure_of_object := 0,
>         number_of_objectified_objects_in_data_structure_of_morphism := 2,
>         number_of_objectified_morphisms_in_data_structure_of_morphism := 1
> );;
gap> SkeletalCategoryOfFiniteSetsWithMorphismsGivenByLists_precompiled( );
SkeletalFinSets
gap> cat := SkeletalCategoryOfFiniteSets( );
SkeletalFinSets
gap> cat!.precompiled_functions_added;
true
#@fi

3.2 Precompiling ProjectionInFactorOfBinaryDirectProduct

#@if ValueOption( "no_precompiled_code" ) <> true
gap> LoadPackage( "FinSetsForCAP", false );
true
gap> LoadPackage( "CompilerForCAP", ">= 2023.12-09", false );
true
gap> ReadPackageOnce( "FinSetsForCAP", "gap/CompilerLogic.gi" );
true
gap> sFinSets := CategoryOfSkeletalFinSets( : no_precompiled_code := true );
SkeletalFinSets
gap> LeftProjectionInFactorOfBinaryDirectProduct :=
>   function( cat, a, b, axb )
>     return ProjectionInFactorOfDirectProductWithGivenDirectProduct( cat,
>                    [ a, b ],
>                    1,
>                    axb ); end;
function( cat, a, b, axb ) ... end
gap> RightProjectionInFactorOfBinaryDirectProduct :=
>   function( cat, a, b, axb )
>     return ProjectionInFactorOfDirectProductWithGivenDirectProduct( cat,
>                    [ a, b ],
>                    2,
>                    axb ); end;
function( cat, a, b, axb ) ... end
gap> StartTimer( "ProjectionInFactorOfBinaryDirectProduct" );
gap> compiled_LeftProjectionInFactorOfBinaryDirectProduct :=
>   CapJitCompiledFunction( LeftProjectionInFactorOfBinaryDirectProduct,
>           sFinSets,
>           [ "category", "object", "object", "object" ],
>           "morphism" );
function( cat_1, a_1, b_1, axb_1 ) ... end
gap> compiled_RightProjectionInFactorOfBinaryDirectProduct :=
>   CapJitCompiledFunction( RightProjectionInFactorOfBinaryDirectProduct,
>           sFinSets,
>           [ "category", "object", "object", "object" ],
>           "morphism" );
function( cat_1, a_1, b_1, axb_1 ) ... end
gap> StopTimer( "ProjectionInFactorOfBinaryDirectProduct" );
gap> #DisplayTimer( "ProjectionInFactorOfBinaryDirectProduct" );
gap> Display( compiled_LeftProjectionInFactorOfBinaryDirectProduct );
function ( cat_1, a_1, b_1, axb_1 )
    local hoisted_1_1, deduped_3_1;
    deduped_3_1 := Length( axb_1 );
    hoisted_1_1 := Length( a_1 );
    return CreateCapCategoryMorphismWithAttributes( cat_1, axb_1, a_1,
       AsList, List( [ 0 .. deduped_3_1 - 1 ], function ( i_2 )
              return RemIntWithDomain( i_2, hoisted_1_1, deduped_3_1 );
          end ) );
end
gap> Display( compiled_RightProjectionInFactorOfBinaryDirectProduct );
function ( cat_1, a_1, b_1, axb_1 )
    local hoisted_1_1, deduped_3_1;
    deduped_3_1 := Length( axb_1 );
    hoisted_1_1 := Length( a_1 );
    return CreateCapCategoryMorphismWithAttributes( cat_1, axb_1, b_1,
       AsList, List( [ 0 .. deduped_3_1 - 1 ], function ( i_2 )
              return QuoIntWithDomain( i_2, hoisted_1_1, deduped_3_1 );
          end ) );
end
#@fi
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 Ind

generated by GAPDoc2HTML