################################################################################
##
## simpcomp / pkghomalg.gi
##
## Loaded when package `homalg' is available
##
## $Id$
##
################################################################################
# helper function that converts an integer modulus to an homalg ring according
# to the following table:
# modulus - homalg ring
# 0 - rationals
# 1 - integers
# n - integers mod n
SCIntFunc.ModulusToHomalgRing:=function(modulus)
if(modulus<0) then
return fail;
elif(modulus=1) then
return HomalgRingOfIntegers();
elif(modulus=0) then
return HomalgFieldOfRationals();
else
return HomalgRingOfIntegers(modulus);
fi;
end;
SCIntFunc.bdOperator:=function(simplex)
local b,cur,i,j,pos; b:=[];
#all positions, i=kill entry
for i in [1..Length(simplex)] do
cur:=[];
pos:=1;
#extract one boundary face
for j in [1..Length(simplex)] do
if(i=j) then continue; fi;
cur[pos]:=simplex[j];
pos:=pos+1;
od;
#add to list of boundary faces
Add(b,ShallowCopy(cur));
od;
return b;
end;
################################################################################
##<#GAPDoc Label="SCHomalgBoundaryMatrices">
## <ManSection>
## <Meth Name="SCHomalgBoundaryMatrices" Arg="complex,modulus"/>
## <Returns>a list of <Package>homalg</Package> objects upon success,
## <K>fail</K> otherwise.</Returns>
## <Description>
## This function computes the boundary operator matrices for the simplicial
## complex <Arg>complex</Arg> with a ring of coefficients as specified by
## <Arg>modulus</Arg>: a value of <C>0</C> yields <M>\mathbb{Q}</M>-matrices,
## a value of <C>1</C> yields <M>\mathbb{Z}</M>-matrices and a value of
## <C>q</C>, qa prime or a prime power, computes the
## <M>\mathbb{F}_q</M>-matrices.<P/>
## <Example><![CDATA[
## gap> SCLib.SearchByName("CP^2 (VT)");
## gap> c:=SCLib.Load(last[1][1]);;
## gap> SCHomalgBoundaryMatrices(c,0);
## ]]></Example>
## </Description>
## </ManSection>
##<#/GAPDoc>
################################################################################
InstallMethod(SCHomalgBoundaryMatricesOp, "for SCSimplicialComplex and Integer",
[SCIsSimplicialComplex, IsInt],
function(complex, modulus)
local tmp,skel,x,matrices,one,minusone,k,p,i,j,b,ind,pos,res,d,ring;
ring:=SCIntFunc.ModulusToHomalgRing(modulus);
if(ring=fail) then
return fail;
fi;
# for matrices
matrices := [];
# 1 and -1 in ring
one:=One(ring);
minusone:=MinusOne(ring);
matrices[d+1]:=HomalgInitialMatrix(0,Length(skel[d+1]),ring);
ResetFilterObj(matrices[d+1], IsInitialMatrix);
for k in [2..d+1] do
matrices[k-1] := HomalgInitialMatrix(Length(skel[k]),
Length(skel[k-1]),ring);
for i in [1..Length(skel[k])] do
#get boundary of current simplex b:=SCIntFunc.bdOperator(skel[k][i]);
for j in [1..Length(b)] do
pos:=Position(skel[k-1],b[j]);
if(pos<>fail) then
if((j mod 2)=0) then
AddToMatElm( matrices[k-1], i, pos, one );
else
AddToMatElm( matrices[k-1], i, pos, minusone );
fi;
else
Info(InfoSimpcomp,1,"SCHomalgBoundaryOperatorMatrices: list of ", "boundary skel[k-1] is not complete k=",k,", b[j]=",b[j],"!");
return fail;
fi;
od;
od;
ResetFilterObj(matrices[k-1],IsInitialMatrix);
od;
return matrices;
end);
################################################################################
##<#GAPDoc Label="SCHomalgCoboundaryMatrices">
## <ManSection>
## <Meth Name="SCHomalgCoboundaryMatrices" Arg="complex,modulus"/>
## <Returns>a list of <Package>homalg</Package> objects upon success,
## <K>fail</K> otherwise.</Returns>
## <Description>
## This function computes the coboundary operator matrices for the simplicial
## complex <Arg>complex</Arg> with a ring of coefficients as specified by
## <Arg>modulus</Arg>: a value of <C>0</C> yields <M>\mathbb{Q}</M>-matrices,
## a value of <C>1</C> yields <M>\mathbb{Z}</M>-matrices and a value of
## <C>q</C>, qa prime or a prime power, computes the
## <M>\mathbb{F}_q</M>-matrices.<P/>
## <Example><![CDATA[
## gap> SCLib.SearchByName("CP^2 (VT)");
## gap> c:=SCLib.Load(last[1][1]);;
## gap> SCHomalgCoboundaryMatrices(c,0);
## ]]></Example>
## </Description>
## </ManSection>
##<#/GAPDoc>
################################################################################
InstallMethod(SCHomalgCoboundaryMatricesOp, "for SCSimplicialComplex and Integer",
[SCIsSimplicialComplex, IsInt],
function( complex, modulus )
local tmp,skel,x,matrices,one,minusone,k,p,i,j,b,ind,pos,res,d,ring;
ring:=SCIntFunc.ModulusToHomalgRing(modulus);
if(ring=fail) then
return fail;
fi;
# for matrices
matrices := [];
# 1 and -1 in ring
one:=One(ring);
minusone:=MinusOne(ring);
matrices[d+1]:=HomalgInitialMatrix(Length(skel[d+1]),0,ring);
ResetFilterObj(matrices[d+1],IsInitialMatrix);
for k in [2..d+1] do
matrices[k-1]:=HomalgInitialMatrix(Length(skel[k-1]),Length(skel[k]),ring);
for i in [1..Length(skel[k])] do
#get boundary of current simplex b:=SCIntFunc.bdOperator(skel[k][i]);
for j in [1..Length(b)] do
pos:=Position(skel[k-1],b[j]);
if(pos<>fail) java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
if(jmod)0
AddToMatElm(#gap java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 11
else
AddToMatElm(##<a<ackage><Packageo,<>fail/>java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
# fcomputes i bases
Info(1":list , "boundary skel[k] is not complete!");
return fail;
fi;
od;
od;
ResetFilterObj(matrices[k-1],## <M>\mathbb{Z}</M>-homology and a value of><C,qaprime java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
od;
return matrices;
;
#########################################
#<=>
## <ManSection>
## <Meth Name="SCHomalgHomology" Arg="complex,modulus"/>
## <## generatorsof<hk/>can thenbe obtainedvia
# <java.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 16
# function computes the ranks of the homology groups of
## <#tit usethefuntion Ref=SCHomalgHomology"/
## <Arg>modulus</Arg>:#is fasterjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
##M\Q<M- avalue C1/>computes java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
# <>m{</>hand a f<>q/> aprimeo
## prime power, computes the <M>\mathbb{F}_q</M# (,)
#N you notonly intheranks thomology
## />
## <Ref Meth="SCHomalgHomologyBasis" # <ManSection>
#><[[
## gap> SCLib.SearchByName("K3##########################################
# =.(last1[];
f ndInteger,
## ]]></Example>
# <Descriptionjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
#<ManSection>
##<#/GAPDoc>
############ MR ,mmorphisms,iH,;
InstallMethod(SCHomalgHomologyOp,
f CSimplicialComplex andInteger"
S,IsInt]
if=java.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 19
rnam:RingNamering;
M:=SCcomplexmodulus)
C: ( 1]) ;
ing=ModulusToHomalgRing(;
ngfail then
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
# C.kipHighestDegreeHomology: ;
rnam:=RingName(ring);
!HomologyOnLessGenerators:java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
Info(InfoSimpcomp,2,"SCHomalgHomologyOp: java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 2
- roups";
L := [];
for i in [ 1 .. Length( M ) ] do
L[i] := SCIntFunc.DeepCopy(DimensionsMat( M[i] ));
L[i][3] := RowRankOfMatrix( M[ return Homology()
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
d
H := [ L[1][4] ]; #first#<java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
in . java.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34 i : L[[]-L[-]3] d ker-dimijava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
od#Thisfcomputestheranks c
Info(InfoSimpcomp,1,"SCHomalgHomologyOp: "#Acomplex/>witharingofas java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
return H;
end);
############ <M>mathbb{}/>cohomology,a C1/>computes java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
##Label">
## <## primepower the M\{}_q/>cohomology <>
## thatif a notonly he ranksofthe
## <#< = >java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
#</java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
## # ]<Ejava.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 16
## #</APDoc
#######################################java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
## IsInt]java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
## <M>\mathbb{Q}</M>-homology, a value of <C>1</C> computes the
## <M>\mathbb{Z}</M>-homology and a value of <C>q</C>, qa prime or a prime
## power, computes the <M>\mathbb{F}_q</M>-homology groups.<P/>
## The <M>k</M>-th homology group <C>hk</C> can be obtained by calling
## <C>hk:=CertainObject(homology,k);</C>, where <C>homology</C> is the
## <Package>homalg</Package> object returned by this function. The
## generators of <C>hk</C> can then be obtained via
## <C>GeneratorsOfModule(hk);</C>.<P/>
## Note that if you are only interested in the ranks of the homology groups,
## then it is ##]]<Example>
## which is way faster.
## <Example><![CDATA[
## gap> SCLib.SearchByName
## gap> c:=SCLib.Load(last[1]# />
(c0;
#########################################java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
# <Description
## </SCIsSimplicialC,IsInt]java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
##<#/GAPDoc>
###################### MR,C ,,,H,,;
InstallMethod(SCHomalgHomologyBasisOp, "or SCSimplicialComplexand ,
[CIsSimplicialComplex ,
function(complex,modulus)
# if =fail then
returnfail;
ring:=SCIntFunc.ModulusToHomalgRing(java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 7
if
return ;
fi;
rnam:=RingName : []) ;
M:= inM[2 . -] o
C := HomalgComplex( HomalgMap( M[1 Add(C, ;
for m in M{ ;
Add( C, m );
od; :ByASmallerPresentation)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
# C:=ByASmallerPresentation(C);
#C. =true
#java.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32
# C!.DisplayHomology := true;
# C!.StringBeforeDisplay :="";
################################################################################
##<#GAPDoc Label="SCHomalgCohomology">
## <ManSection>
## <Meth Name="SCHomalgCohomology" Arg="complex,modulus"/>
## <Returns>a list of integers upon success, <K>fail</K> otherwise.</Returns>
## <Description>
## This function computes the ranks of the cohomology groups of
## <Arg>complex</Arg> with a ring of coefficients as specified by
## <Arg>modulus</Arg>: a value of InfoInfoSimpcomp1"CHomalgHomologyBasisOp "rnam,
## <M>\mathbb{ "-homology groups.");
>\Z<M- avalue <><C,qa a
#primepower <>mathbb}q>-</java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
#Note areionly ranksthe
## groups, but rather their full structure, have a look##APDoc Label=SCHomalgCohomology"
### Meth Name=SCHomalgCohomology Arg=complexmodulus">
## <Example><![CDATA# Returns>a ring of coefficients as specified by
## gap> SCLib.SearchByName("K3");
## gap> c:=SCLib.Load(last[1][1]);;
## gap> SCHomalgCohomology(c,0);
## ]]></Example>
## </Description>
## </ManSection>
##<#/GAPDoc>
################################################################################
InstallMethod(SCHomalgCohomologyOp, "for SCSimplicialComplex and Integer",
[SCIsSimplicialComplex, IsInt],
function(complex,modulus)
#cohomology: ker( M[i+1] ) / im( M[i] )
local M,R, C, m,morphisms,L,i,H,ring,rnam;
ring:=SCIntFunc.ModulusToHomalgRing(modulus);
if ring=fail then
return fail;
fi;
rnam:=RingName(ring);
M:=SCHomalgCoboundaryMatrices(complex,modulus);
Info(InfoSimpcomp,2,"SCHomalgCohomologyOp: computing ",rnam, "-cohomology ranks..## <Arg>modulus<Arg:ajava.lang.StringIndexOutOfBoundsException: Range [30, 25) out of bounds for length 56
L :#M\Z<M-ohomology value of<q/> a
or . Length( java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
L]: CIntFuncDeepCopy( i]);
L[i][3] := RowRankOfMatrix( M[i] );
i[ =Li[]-[]3;
od;
H := [ L[1][4] ];# RefMeth=SCHomalgCohomologyBasis" >.
java.lang.StringIndexOutOfBoundsException: Range [10, 2) out of bounds for length 34
H[i] := L[i]# gap>SCLibSearchByName(K3);
od;
Info(InfoSimpcomp,1,"SCHomalgCohomologyOp: ",rnam## >c=SCLib.([#####################################java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
java.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 11
end)
######################################
#
SCIntFuncModulusToHomalgRing;
#Meth=SCHomalgCohomologyBasis Arg"omplex">
# rfail
#./java.lang.StringIndexOutOfBoundsException: Range [23, 24) out of bounds for length 23
## M=(modulus;
## This function computes the cohomology groups (including explicit java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
## the "-cohomologyjava.lang.StringIndexOutOfBoundsException: Range [28, 16) out of bounds for length 28
#specifiedby<>modulusArg: C<C
## <M>\mathbb{Q Li D( []);
# M>mathbbZ<Mcohomology anda of<><C,qaprimeaprime
# <>mathbb}q<M-omologygroups.P>
## The <M>k</M>-th cohomology group <C>ck</C> can java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 5
#<C>:CertainObject(ohomologyk;/>
## <Package# <java.lang.StringIndexOutOfBoundsException: Range [15, 16) out of bounds for length 15
## generators of <C>ck<C>can thenbe viajava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
## omputes the groups including bases ofjava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
of thecohomologygroups,
## then it is#specified yA>/Arg>: a value of <C>0</C> computes the
## which is way faster.
>!CDATA[
#gap>SCLibSearchByName(K3)
# power computes the M\F_q/></java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
#gap ck=cohomologyk;<C,Ccohomologyis
## ]]></Example>
## </Description>
#>
##<#/GAPDoc>
### Cck/> can then be java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
for "
SCIsSimplicialComplex,IsInt,
function(complex,modulus)
### <Example><CDATA[
local M,R, C, #g>SCLib.earchByName"3)
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 2
=.()java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
##GAPDocjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
return ail i
rnam:=RingName(ring);
M:(m;
= (HomalgMap(M1 , ;
for m in M{[ 2 .. Length #ohomology ker [+])/i([ java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(C ;
od;
# C:=java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 2
!SkipHighestDegreeHomology: ;
# C!.HomologyOnLessGenerators := fail;
# C!.DisplayHomology := true;
#fi
Info( rnam:=RingName)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 "-C =HomalgCocomplex(HomalgMap []) ;
CC)
end)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
#homologybasis:=
#function(h,k)
# local#C.SkipHighestDegreeHomology = java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
hk=hk;
# # C.StringBeforeDisplay =";
#end;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.