Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

8 Precompilation

8 Precompilation

#@if ValueOption( "no_precompiled_code" ) <> true
gap> LoadPackage( "Algebroids", false );
true
gap> LoadPackage( "CompilerForCAP", false );
true
gap> QQ := HomalgFieldOfRationals( );;
gap> snake_quiver := RightQuiver( "q(4)[a:1->2,b:2->3,c:3->4]" );;
gap> A := PathAlgebra( QQ, snake_quiver );;
gap> ReadPackageOnce( "Algebroids", "gap/CompilerLogic.gi" );
true
gap> # only valid for the construction above
> # FIXME: IsInt should be IsRat, but specializations of types are not yet supported by CompilerForCAP
> CapJitAddTypeSignature( "CoefficientsOfPaths", [ IsList, IsQuiverAlgebraElement ], rec( filter := IsList, element_type := rec( filter := IsInt ) ) );
gap> # EXPERIMENTAL
> Add( CAP_JIT_EXPENSIVE_FUNCTION_NAMES, "CoefficientsOfPaths" );
gap> precompile_AdditiveClosureOfAlgebroid :=
>   function( Rq, over_Z, ring )
>     CapJitPrecompileCategoryAndCompareResult(
>         EvalString( ReplacedString( """Rq -> AdditiveClosure( Algebroid(
>             Rq, over_Z : FinalizeCategory := true
>         ) )""", "over_Z", String( over_Z ) ) ),
>         [ Rq ],
>         "Algebroids",
>         Concatenation(
>             "AdditiveClosureOfAlgebroidOfFiniteDimensionalQuiverAlgebraOfRightQuiverOver",
>             ring,
>             "Precompiled"
>         ) :
>         operations := "primitive"
>     ); end;;
gap> precompile_AdditiveClosureOfAlgebroid( A, false, "Field" );
gap> precompile_AdditiveClosureOfAlgebroid( A, true, "Z" );
gap> AdditiveClosureOfAlgebroidOfFiniteDimensionalQuiverAlgebraOfRightQuiverOverFieldPrecompiled( A );
Additive closure( Algebroid( Q, FreeCategory( RightQuiver(
"q(4)[a:1->2,b:2->3,c:3->4]" ) ) ) )
gap> AdditiveClosure( Algebroid( A, false ) )!.precompiled_functions_added;
true
gap> AdditiveClosure( Algebroid( A, true ) )!.precompiled_functions_added;
true
#@fi
#@if ValueOption( "no_precompiled_code" ) <> true
gap> LoadPackage( "Algebroids", false );
true
gap> LoadPackage( "CompilerForCAP", false );
true
gap> ReadPackageOnce( "Algebroids", "gap/CompilerLogic.gi" );
true
gap> QQ := HomalgFieldOfRationals( );;
gap> snake_quiver := RightQuiver( "q(4)[a:1->2,b:2->3,c:3->4]" );;
gap> A := PathAlgebra( QQ, snake_quiver );;
gap> ReadPackageOnce( "Algebroids", "gap/CompilerLogic.gi" );
true
gap> # only valid for the construction above
> # FIXME: IsInt should be IsRat, but specializations of types are not yet supported by CompilerForCAP
> # this might already have been added by PrecompileAdditiveClosureOfAlgebroid.g
> if not IsBound( CAP_JIT_INTERNAL_TYPE_SIGNATURES.CoefficientsOfPaths ) then CapJitAddTypeSignature( "CoefficientsOfPaths", [ IsList, IsQuiverAlgebraElement ], rec( filter := IsList, element_type := rec( filter := IsInt ) ) ); fi;
gap> # EXPERIMENTAL
> Add( CAP_JIT_EXPENSIVE_FUNCTION_NAMES, "CoefficientsOfPaths" );
gap> precompile_AdelmanCategoryOfAdditiveClosureOfAlgebroid := function( Rq, over_Z, ring )
>     CapJitPrecompileCategoryAndCompareResult(
>         EvalString( ReplacedString( """Rq -> AdelmanCategory( AdditiveClosure( Algebroid(
>             Rq, over_Z : FinalizeCategory := true
>         ) : FinalizeCategory := true ) )""", "over_Z", String( over_Z ) ) ),
>         [ Rq ],
>         "Algebroids",
>         Concatenation(
>             "AdelmanCategoryOfAdditiveClosureOfAlgebroidOfFiniteDimensionalQuiverAlgebraOfRightQuiverOver",
>             ring,
>             "Precompiled"
>         ) :
>         operations := [
>             "IsZeroForMorphisms",
>             "CokernelProjection",
>             "IsDominating",
>             "IsEqualAsSubobjects",
>         ]
>     ); end;;
gap> precompile_AdelmanCategoryOfAdditiveClosureOfAlgebroid( A, false, "Field" );
gap> precompile_AdelmanCategoryOfAdditiveClosureOfAlgebroid( A, true, "Z" );
gap> AdelmanCategoryOfAdditiveClosureOfAlgebroidOfFiniteDimensionalQuiverAlgebraOfRightQuiverOverFieldPrecompiled( A );
Adelman category( Additive closure( Algebroid( Q, FreeCategory(
RightQuiver( "q(4)[a:1->2,b:2->3,c:3->4]" ) ) ) ) )
gap> AdelmanCategoryOfAdditiveClosureOfAlgebroidOfFiniteDimensionalQuiverAlgebraOfRightQuiverOverZPrecompiled( A );
Adelman category( Additive closure( Algebroid( Z, FreeCategory(
RightQuiver( "q(4)[a:1->2,b:2->3,c:3->4]" ) ) ) ) )
gap> AdelmanCategory( AdditiveClosure( Algebroid( A, false ) ) )!.precompiled_functions_added;
true
gap> AdelmanCategory( AdditiveClosure( Algebroid( A, true ) ) )!.precompiled_functions_added;
true
#@fi
#@if ValueOption( "no_precompiled_code" ) <> true
gap> LoadPackage( "Algebroids", false );
true
gap> LoadPackage( "CompilerForCAP", false );
true
gap> ReadPackageOnce( "Algebroids", "gap/CompilerLogic.gi" );
true
gap> ReadPackageOnce( "FinSetsForCAP", "gap/CompilerLogic.gi" );
true
gap> category_constructor :=
>   function( quiver )
>     local sFinSets; sFinSets := CategoryOfSkeletalFinSets( : FinalizeCategory := true ); return CategoryFromNerveData( FreeCategory( quiver : range_of_HomStructure := sFinSets, FinalizeCategory := true ) ); end;;
gap> given_arguments := [ RightQuiver( "q(a,b)[m:a->b]" ) ];;
gap> compiled_category_name := "CategoryFromNerveDataPrecompiled";;
gap> package_name := "Algebroids";;
gap> CapJitPrecompileCategoryAndCompareResult(
>     category_constructor,
>     given_arguments,
>     package_name,
>     compiled_category_name
>         : operations := Difference( ListPrimitivelyInstalledOperationsOfCategory( category_constructor( given_arguments[1] : no_precompiled_code := true ) ),
>                                 [ "HomomorphismStructureOnMorphismsWithGivenObjects" ] ) );;
gap> CategoryFromNerveDataPrecompiled( given_arguments[1] );
FreeCategory( RightQuiver( "q(a,b)[m:a->b]" ) )
gap> CategoryFromNerveData( FreeCategory( given_arguments[1] ) )!.precompiled_functions_added;
true
#@fi
#@if ValueOption( "no_precompiled_code" ) <> true
gap> LoadPackage( "Algebroids", false );
true
gap> LoadPackage( "CompilerForCAP", false );
true
gap> ReadPackageOnce( "Algebroids", "gap/CompilerLogic.gi" );
true
gap> category_constructor :=
>   function( quiver )
>     local sFinSets; sFinSets := CategoryOfSkeletalFinSets( : FinalizeCategory := true ); return CategoryFromDataTables( FreeCategory( quiver : range_of_HomStructure := sFinSets, FinalizeCategory := true ) ); end;;
gap> given_arguments := [ RightQuiver( "q(a,b)[m:a->b]" ) ];;
gap> compiled_category_name := "CategoryFromDataTablesPrecompiled";;
gap> package_name := "Algebroids";;
gap> CapJitPrecompileCategoryAndCompareResult(
>     category_constructor,
>     given_arguments,
>     package_name,
>     compiled_category_name
>         : operations := "primitive" );;
gap> CategoryFromDataTablesPrecompiled( given_arguments[1] );
FreeCategory( RightQuiver( "q(a,b)[m:a->b]" ) )
gap> CategoryFromDataTables( FreeCategory( given_arguments[1] ) )!.precompiled_functions_added;
true
#@fi
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 Ind

generated by GAPDoc2HTML