Skip to content

Commit 68f3da6

Browse files
added CompileGapPackage and UseExternalSingular
1 parent c9450cb commit 68f3da6

File tree

6 files changed

+91
-151
lines changed

6 files changed

+91
-151
lines changed

Project.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "HomalgProject"
22
uuid = "50bd374c-87b5-11e9-015a-2febe71398bd"
33
authors = ["Mohamed Barakat <mohamed.barakat@uni-siegen.de>"]
4-
version = "0.1.5"
4+
version = "0.1.6"
55

66
[deps]
77
GAP = "c863536a-3901-11e9-33e7-d5cd0df7b904"
@@ -14,6 +14,7 @@ Singular = "^0.2"
1414

1515
[extras]
1616
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
17+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
1718

1819
[targets]
19-
test = ["Test"]
20+
test = ["Test","Documenter"]

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
HomalgProject = "50bd374c-87b5-11e9-015a-2febe71398bd"

docs/make.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
using Documenter, HomalgProject
22

33
makedocs(;
4-
modules=[HomalgProject],
5-
format=Documenter.HTML(assets=String[]),
6-
pages=[
4+
modules = [HomalgProject],
5+
format = Documenter.HTML(assets=String[]),
6+
pages = [
77
"Home" => "index.md",
88
"Examples" => "examples.md",
99
],
10-
repo="https://github.com/homalg-project/HomalgProject.jl/blob/{commit}{path}#L{line}",
11-
sitename="HomalgProject.jl",
12-
authors="Mohamed Barakat <mohamed.barakat@uni-siegen.de>",
10+
doctest = false,
11+
repo = "https://github.com/homalg-project/HomalgProject.jl/blob/{commit}{path}#L{line}",
12+
sitename = "HomalgProject.jl",
13+
authors = "Mohamed Barakat <mohamed.barakat@uni-siegen.de>",
1314
)
1415

1516
deploydocs(;
16-
repo="github.com/homalg-project/HomalgProject.jl",
17+
repo = "github.com/homalg-project/HomalgProject.jl",
1718
)

docs/src/examples.md

Lines changed: 2 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ The following examples tests the functionality of the software projects
99
```@meta
1010
DocTestSetup = quote
1111
using HomalgProject
12+
GAP.Globals.SizeScreen( GAP.julia_to_gap( [ 4096 ] ) )
13+
LoadPackageAndExposeGlobals( "IO_ForHomalg", Main, all_globals = true )
1214
LoadPackageAndExposeGlobals( "GradedModules", Main, all_globals = true )
13-
LoadPackageAndExposeGlobals( "GradedModulePresentationsForCAP", Main, all_globals = true )
1415
GAP.Globals.HOMALG_IO.show_banners = false
1516
HomalgFieldOfRationalsInSingular = GAP.Globals.HomalgFieldOfRationalsInSingular
1617
LeftPresentation = GAP.Globals.LeftPresentation
@@ -20,33 +21,12 @@ DocTestSetup = quote
2021
FilteredByPurity = GAP.Globals.FilteredByPurity
2122
OnFirstStoredPresentation = GAP.Globals.OnFirstStoredPresentation
2223
OnLastStoredPresentation = GAP.Globals.OnLastStoredPresentation
23-
GradedRing = GAP.Globals.GradedRing
24-
GradedLeftPresentations = GAP.Globals.GradedLeftPresentations
25-
InfoOfInstalledOperationsOfCategory = GAP.Globals.InfoOfInstalledOperationsOfCategory
26-
ListPrimitivelyInstalledOperationsOfCategory = GAP.Globals.ListPrimitivelyInstalledOperationsOfCategory
27-
GradedFreeLeftPresentation = GAP.Globals.GradedFreeLeftPresentation
28-
GradedPresentationMorphism = GAP.Globals.GradedPresentationMorphism
29-
IsWellDefined = GAP.Globals.IsWellDefined
30-
IsMonomorphism = GAP.Globals.IsMonomorphism
31-
IsEpimorphism = GAP.Globals.IsEpimorphism
32-
ImageEmbedding = GAP.Globals.ImageEmbedding
33-
CokernelObject = GAP.Globals.CokernelObject
34-
IsZero = GAP.Globals.IsZero
35-
AffineDimension = GAP.Globals.AffineDimension
36-
FullSubcategoryByMembershipFunction = GAP.Globals.FullSubcategoryByMembershipFunction
37-
/ = GAP.Globals.QUO
38-
CanonicalProjection = GAP.Globals.CanonicalProjection
39-
InstallFunctor = GAP.Globals.InstallFunctor
40-
ApplyFunctor = GAP.Globals.ApplyFunctor
41-
IsIsomorphism = GAP.Globals.IsIsomorphism
4224
end
4325
```
4426

4527
```jldoctest
4628
julia> using HomalgProject
4729
48-
julia> LoadPackageAndExposeGlobals( "OscarForHomalg", Main, all_globals = true )
49-
5030
julia> LoadPackageAndExposeGlobals( "GradedModules", Main, all_globals = true )
5131
5232
julia> ℚ = HomalgFieldOfRationalsInSingular( )
@@ -255,120 +235,6 @@ currently represented by the above matrix
255235
256236
```
257237

258-
```jldoctest
259-
julia> using HomalgProject
260-
261-
julia> LoadPackageAndExposeGlobals( "GradedModulePresentationsForCAP", Main, all_globals = true )
262-
263-
julia> ℚ = HomalgFieldOfRationalsInSingular( )
264-
GAP: Q
265-
266-
julia> S = GradedRing( ℚ["x,y"] )
267-
GAP: Q[x,y]
268-
(weights: yet unset)
269-
270-
julia> Sgrmod = GradedLeftPresentations( S )
271-
GAP: The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ])
272-
273-
julia> InfoOfInstalledOperationsOfCategory( Sgrmod )
274-
40 primitive operations were used to derive 179 operations for this category which
275-
* IsAbCategory
276-
* IsMonoidalCategory
277-
* IsAbelianCategoryWithEnoughProjectives
278-
279-
julia> #ListPrimitivelyInstalledOperationsOfCategory( Sgrmod )
280-
281-
julia> M = GradedFreeLeftPresentation( 2, S, @gap([ 1, 1 ]) )
282-
GAP: <An object in The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ])>
283-
284-
julia> N = GradedFreeLeftPresentation( 1, S, @gap([ 0 ]) )
285-
GAP: <An object in The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ])>
286-
287-
julia> mat = HomalgMatrix( "[x,y]", 2, 1, S )
288-
GAP: <A 2 x 1 matrix over a graded ring>
289-
290-
julia> Display( mat )
291-
x,
292-
y
293-
294-
(over a graded ring)
295-
296-
julia> ϕ = GradedPresentationMorphism( M, mat, N )
297-
GAP: <A morphism in The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ])>
298-
299-
julia> IsWellDefined( ϕ )
300-
true
301-
302-
julia> IsMonomorphism( ϕ )
303-
false
304-
305-
julia> IsEpimorphism( ϕ )
306-
false
307-
308-
julia> ι = ImageEmbedding( ϕ )
309-
GAP: <A monomorphism in The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ])>
310-
311-
julia> IsMonomorphism( ι )
312-
true
313-
314-
julia> IsIsomorphism( ι )
315-
false
316-
317-
julia> coker_mod = CokernelObject( ϕ )
318-
GAP: <An object in The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ])>
319-
320-
julia> Display( coker_mod )
321-
x,
322-
y
323-
(over a graded ring)
324-
325-
An object in The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ])
326-
327-
(graded, degree of generator:[ 0 ])
328-
329-
julia> IsZero( coker_mod )
330-
false
331-
332-
julia> is_artinian = GAP.julia_to_gap( M -> AffineDimension( M ) <= 0 );
333-
334-
julia> C = FullSubcategoryByMembershipFunction( Sgrmod, is_artinian );
335-
336-
julia> CohP1 = Sgrmod / C
337-
GAP: The Serre quotient category of The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ]) by test function with name: #1
338-
339-
julia> InfoOfInstalledOperationsOfCategory( CohP1 )
340-
21 primitive operations were used to derive 146 operations for this category which
341-
* IsAbCategory
342-
* IsAbelianCategory
343-
344-
julia> Sh = CanonicalProjection( CohP1 )
345-
GAP: Embedding in The Serre quotient category of The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ]) by test function with name: #1
346-
347-
julia> InstallFunctor( Sh, g"Sheafification" )
348-
349-
julia> ψ = ApplyFunctor( Sh, ϕ )
350-
GAP: <A morphism in The Serre quotient category of The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ]) by test function with name: #1>
351-
352-
julia> IsMonomorphism( ψ )
353-
false
354-
355-
julia> IsEpimorphism( ψ )
356-
true
357-
358-
julia> coker_shv = CokernelObject( ψ )
359-
GAP: <A zero object in The Serre quotient category of The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ]) by test function with name: #1>
360-
361-
julia> IsZero( coker_shv )
362-
true
363-
364-
julia> ϵ = ApplyFunctor( Sh, ι )
365-
GAP: <A morphism in The Serre quotient category of The category of graded left f.p. modules over Q[x,y] (with weights [ 1, 1 ]) by test function with name: #1>
366-
367-
julia> IsIsomorphism( ϵ )
368-
true
369-
370-
```
371-
372238
```@meta
373239
DocTestSetup = nothing
374240
```

src/HomalgProject.jl

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,88 @@ end
2121

2222
export HomalgMatrix
2323

24-
function __init__()
24+
function UseExternalSingular( )
2525

26-
GAP.Globals.ExtendRootDirectories( GAP.julia_to_gap( [ GAP.Globals.UserHomeExpand( GAP.julia_to_gap( "~/.gap/" ) ) ] ) )
27-
singular = GAP.julia_to_gap(joinpath(splitdir(splitdir(pathof(Singular))[1])[1],"deps/usr/bin/"))
28-
lib = joinpath(splitdir(splitdir(pathof(Singular))[1])[1],"deps/usr/lib/")
26+
## add ~/.julia/.../Singular/deps/usr/bin/ to GAPInfo.DirectoriesSystemPrograms
27+
singular = splitdir(splitdir(pathof(Singular))[1])[1]
28+
lib = joinpath(splitdir(splitdir(pathof(Singular))[1])[1],"deps","usr","lib")
29+
singular = GAP.julia_to_gap(joinpath(singular,"deps","usr","bin"))
2930
paths = GAP.Globals.Concatenation( GAP.julia_to_gap( [ singular ] ), GAP.Globals.GAPInfo.DirectoriesSystemPrograms )
3031
GAP.Globals.GAPInfo.DirectoriesSystemPrograms = paths
32+
33+
## LoadPackage( "IO_ForHomalg" ) ## needed to when reading LaunchCAS_IO_ForHomalg.g below
3134
LoadPackageAndExposeGlobals( "IO_ForHomalg", Main, all_globals = true )
32-
homalg = joinpath(splitdir(splitdir(pathof(HomalgProject))[1])[1],"src/")
33-
path = GAP.julia_to_gap(joinpath(homalg,"LaunchCAS_IO_ForHomalg.g"))
35+
36+
## Read( "LaunchCAS_IO_ForHomalg.g" )
37+
homalg = splitdir(splitdir(pathof(HomalgProject))[1])[1]
38+
path = GAP.julia_to_gap(joinpath(joinpath(homalg,"src"),"LaunchCAS_IO_ForHomalg.g"))
3439
GAP.Globals.Read(path)
40+
41+
## LoadPackage( "RingsForHomalg" ) ## needed by the variable HOMALG_IO_Singular below
3542
LoadPackageAndExposeGlobals( "RingsForHomalg", Main, all_globals = true )
43+
44+
## add ~/.julia/.../Singular/deps/usr/lib/ to LD_LIBRARY_PATH and DYLD_LIBRARY_PATH
3645
lib = [ "LD_LIBRARY_PATH="*lib*":\$LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH="*lib*":\$DYLD_LIBRARY_PATH" ]
3746
GAP.Globals.HOMALG_IO_Singular.environment = GAP.julia_to_gap( [GAP.julia_to_gap(lib[1]), GAP.julia_to_gap(lib[2])] )
47+
48+
return nothing
49+
50+
end
51+
52+
export UseExternalSingular
53+
54+
function CompileGapPackage( name; print_available = true )
55+
56+
gstr = GAP.julia_to_gap( name )
57+
58+
if GAP.Globals.TestPackageAvailability( gstr ) == GAP.Globals.fail
59+
60+
gap = splitdir(splitdir(pathof(GAP))[1])[1]
61+
62+
pkg = GAP.Globals.Filtered( GAP.Globals.PackageInfo( gstr ), a -> splitdir(splitdir(splitdir(GAP.gap_to_julia( a.InstallationPath ))[1])[1])[1] == gap )
63+
64+
if GAP.Globals.Length( pkg ) == 0
65+
print( "unable to find package named " * name * " in " * gap * "\n\n" )
66+
return false
67+
end
68+
69+
pkg = pkg[1]
70+
path = GAP.gap_to_julia( pkg.InstallationPath )
71+
72+
print( "Start compiling " * path * ":\n\n" )
73+
cd(path)
74+
run(`./configure`)
75+
run(`make -j$(Sys.CPU_THREADS)`)
76+
if GAP.Globals.TestPackageAvailability( gstr ) == GAP.Globals.fail
77+
print( "\nThe compilation of the package " * name * " failed.\n\n" )
78+
return false
79+
end
80+
81+
print( "\nThe compilation of the package " * name * " was successful.\n\n" )
82+
return true
83+
84+
end
85+
86+
if print_available == true
87+
print( "package " * name * " is already installed\n\n" )
88+
end
89+
90+
return true
91+
92+
end
93+
94+
export CompileGapPackage
95+
96+
function __init__()
97+
98+
## add ~/.gap/ to GAPInfo.RootPaths
99+
GAP.Globals.ExtendRootDirectories( GAP.julia_to_gap( [ GAP.Globals.UserHomeExpand( GAP.julia_to_gap( "~/.gap/" ) ) ] ) )
100+
101+
CompileGapPackage( "io", print_available = false )
102+
CompileGapPackage( "Gauss", print_available = false )
103+
104+
UseExternalSingular( )
105+
38106
end
39107

40108
end # module

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using HomalgProject
22
using Test
3+
using Documenter
34

45
@testset "HomalgProject.jl" begin
56
LoadPackageAndExposeGlobals( "GradedModules", Main, all_globals = true )
@@ -23,3 +24,5 @@ using Test
2324
@test NrRelations( M ) == 12
2425
@test NrGenerators( M ) == 9
2526
end
27+
28+
doctest( HomalgProject )

0 commit comments

Comments
 (0)