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

9 Precompilation

9 Precompilation

#@if ValueOption( "no_precompiled_code" ) <> true
gap> LoadPackage( "Algebroids", false );
true
gap> LoadPackage( "CompilerForCAP", ">= 2024.07-09", 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> SetRingFilter( A, IsQuiverAlgebra );
gap> SetRingElementFilter( A, IsQuiverAlgebraElement );
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 ], CapJitDataTypeOfListOf( IsInt ) );
gap> CapJitAddTypeSignature( "HomStructureOnBasisPaths", [ IsAlgebroid ], function ( input_types )
>     
>     return CapJitDataTypeOfListOf(
>                    CapJitDataTypeOfListOf(
>                            CapJitDataTypeOfListOf(
>                                    CapJitDataTypeOfListOf(
>                                            CapJitDataTypeOfListOf(
>                                                    CapJitDataTypeOfListOf(
>                                                            CapJitDataTypeOfListOf(
>                                                                    CapJitDataTypeOfListOf( IsInt ) ) ) ) ) ) ) ); end );
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 );
AdditiveClosure( 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", ">= 2024.07-09", false );
true
gap> ReadPackageOnce( "Algebroids", "gap/CompilerLogic.gi" );
true
gap> CapJitAddTypeSignature( "\*", [ IsHomalgRingElement, IsInt ], input_types -> input_types[1] );;
gap> category_constructor :=
>   data_tables -> AdditiveClosure( AlgebroidFromDataTables( ShallowCopy( data_tables ) : range_of_HomStructure := CategoryOfRows_as_AdditiveClosure_RingAsCategory( data_tables[1] : FinalizeCategory := true ), FinalizeCategory := true ) );;
gap> Q := HomalgFieldOfRationalsInSingular();;
gap> q := FinQuiver( "q(*)[x:*->*]" );;
gap> given_arguments :=
>   [ NTuple( 5,
>       # coefficients_ring
>       Q,
>       # quiver
>       q,
>       # decomposition_indices_of_bases_elements
>       [ [ [ [ ], [ 1 ], [ 1, 1 ] ] ] ],
>       # hom_structure_gmors_objs
>       [ [ [ [ 0, 1, 0 ], [ 0, 0, 1 ], [ 0, 0, 0 ] ] ] ],
>       # hom_structure_objs_gmors
>       [ [ [ [ 0, 1, 0 ], [ 0, 0, 1 ], [ 0, 0, 0 ] ] ] ] ) ];;
gap> compiled_category_name := "AdditiveClosureOfAlgebroidFromDataTablesPrecompiled";;
gap> package_name := "Algebroids";;
gap> CapJitPrecompileCategoryAndCompareResult(
>     category_constructor,
>     given_arguments,
>     package_name,
>     compiled_category_name
>     : operations := "primitive"
>     );;
gap> A := AdditiveClosureOfAlgebroidFromDataTablesPrecompiled( given_arguments[1] );;
gap> A!.precompiled_functions_added;
true
#@fi
#@if ValueOption( "no_precompiled_code" ) <> true
gap> LoadPackage( "Algebroids", false );
true
gap> LoadPackage( "CompilerForCAP", ">= 2024.07-09", 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> SetRingFilter( A, IsQuiverAlgebra );
gap> SetRingElementFilter( A, IsQuiverAlgebraElement );
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 ], CapJitDataTypeOfListOf( IsInt ) ); fi;
gap> if not IsBound( CAP_JIT_INTERNAL_TYPE_SIGNATURES.HomStructureOnBasisPaths ) then
>     CapJitAddTypeSignature( "HomStructureOnBasisPaths", [ IsAlgebroid ], function ( input_types )
>         
>         return CapJitDataTypeOfListOf(
>                        CapJitDataTypeOfListOf(
>                                CapJitDataTypeOfListOf(
>                                        CapJitDataTypeOfListOf(
>                                                CapJitDataTypeOfListOf(
>                                                        CapJitDataTypeOfListOf(
>                                                                CapJitDataTypeOfListOf(
>                                                                        CapJitDataTypeOfListOf( IsInt ) ) ) ) ) ) ) ); end ); 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( AdditiveClosure( Algebroid( Q, FreeCategory(
RightQuiver( "q(4)[a:1->2,b:2->3,c:3->4]" ) ) ) ) )
gap> AdelmanCategoryOfAdditiveClosureOfAlgebroidOfFiniteDimensionalQuiverAlgebraOfRightQuiverOverZPrecompiled( A );
Adelman category( AdditiveClosure( 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", ">= 2024.07-09", false );
true
gap> ReadPackageOnce( "Algebroids", "gap/CompilerLogic.gi" );
true
gap> category_constructor :=
>   function( quiver )
>     local sFinSets; sFinSets := SkeletalCategoryOfFiniteSets( : 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 11 12 Ind

generated by GAPDoc2HTML