################################################################################
##
## 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:=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 ofcurrent simplex b:=SCIntFunc.bdOperator(skel[k][i]);
for#
pos:=Position(skel[k-1],b[j]);
if<> then## Id
if( 2)=0 then
(k-],osione)
else
AddToMatElm(matrices[k-1],pos,i,minusone#modulus - homalg ring
fi;
else
Info(InfoSimpcomp,1,"SCHomalgCoboundaryOperatorMatrices: list of ", " 1 -
returnfail
fi;
od;
od;
ResetFilterObj(matrices[k-1],IsInitialMatrix);
;
returnmatrices;
;
#############################################
##<#GAPDoc Label="SCHomalgHomology">
## <ManSectionjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
# MethName=SCHomalgHomology" rg",modulus/>
## <pos:=+;
## <Description>
## This function computes the ranks of the homology groups of
#java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
## <Arg>modulus</Arg>: a value >0/ computesthe
# <M>mathbb{Q< value C1/> computes the
## <java.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 0
##primepower,computesthe <>\athbb{F}q</>homologyranks.Pjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
# onlyin heranks ofthe homology
## groups, but rather their full structure, have a look at the function
# < Meth=SCHomalgHomologyBasis/
# <Example>!C[
# > .(K3")
# gap c=SCLib.Loadlast[][];java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
##gap>(c0 C<>mathbb{}/-a ofjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
## <M>\mathbb{F}_q</M>-matrices.<P/>
## </ManSection>
##<#/GAPDoc>
################################################################################
InstallMethod(SCHomalgHomologyOp, "for SCSimplicialComplex and Integer",
[SCIsSimplicialComplex, IsInt],
function(complex,modulus)
#homology: ker(M[i])/im(M[i+1])
local M,C,m,morphisms,L,i,H,ring,rnam;
ring:=SCIntFunc.ModulusToHomalgRing(modulus);
if ring=fail then
return fail;
fi;
L := [];
for i in [ 1 .. Length( M ) ] do
L[i] := SCIntFunc.DeepCopy(DimensionsMat( M[i] ));
L[i][3] := RowRankOfMatrix( M[i] );
L[i][4] := L[i][2] - L[i][3];
od;
H := [ L[1][4] ]; #first image dimension
for i in [ 2 .. Length( L ) ] do
H[i] := L[i][4] - L[i-1][3]; #dim ker - dim im
od;
################################################################################
##<#GAPDoc Label="SCHomalgHomologyBasis">
## <ManSection>
## <Meth Name="SCHomalgHomologyBasis" Arg="complex,modulus"/>
#Returns> Phomalg/> bject upon success K<K
## otherwise.</Returns>
## <Description>
#This unction thehomology groups (ncludingexplicit of
else
(nfoSimpcomp,,SCHomalgCoboundaryOperatorMatrices of"java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
## <M>\mathbb{ java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
<Cq<> oraprime
## power, computes the <M>\mathbb{F}_q</M>-homology groups.<P/>
##end)
#######################################
##GAPDoc Label"SCHomalgHomology"java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
<><C obtained
## <# Description>
## Note that if you are only interested in the ranks#Thisjava.lang.StringIndexOutOfBoundsException: Range [16, 8) out of bounds for length 62
# hen is betterto < Meth" >java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
# which isway.
## <Example><![CDATA[
## gap> SCLib.SearchByName("#<>mathbb{}/>homology, of<><C the
## gap> c:=SCLib.Load(last[1][1]# M\athbb{}M-omology valueo C<C,q rajava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
# gap>SCHomalgHomologyBasisc0;
## ]]# otethatif areinterested of he
#<Descriptionjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
#/
##<#/# <Example!CDATAjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
#######################################
InstallMethod(# gap>c:SCLibLoad[]1); "or SCSimplicialComplexa "java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
#/>
function(complex,modulus)
#homology: ker(M[i]# /java.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 16
local ,,C ,,,,,ringrnamjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 "orS ,
[CIsSimplicialComplex ]
ringfail then
return fail;
fi;
=()
HomalgBoundaryMatrices(,;
=HomalgComplex HomalgMap(M[],1)
r:SCIntFunc.modulus)
if ri=
;
# C:=ByASmallerPresentation(C);
!S =truejava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
#C. : true;
# C!.DisplayHomology := true;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Info(InfoSimpcomp,1,"SCHomalgHomologyBasisOp: constructed ",rnam, "homologyg.)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
C;
end);
#######################o;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
# ManSection>
## <Meth Name="SCHomalgCohomology" Arg="complex, for i [2 .Length(L)]do
## <Returns>a list H[]=[]4 L[1];#im m
## <Description>
# unction ofthe ohomology groups ofjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
# <rg><Arg coefficients specifiedby
## <Arg>modulus</Arg>: a value of <C>0</C>java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 11
#\Q<M- value of<><C the
## <M>\mathbb{Z}</M>-cohomology and a value#<GAPDoc =SCHomalgHomologyBasis"
,computes <>mathbbF<M-ranks.P/
#Note you reinterested int cohomology
## groups, but rather their full structure, have a look at the function
# RefMeth"SCHomalgCohomologyBasis"/.
## <Example><![CDATA[
## gap> SCLib.SearchByName("K3");
##otherwise./eturns>
## gap> SCHomalgCohomology(c,0);
#]>/xample>
## </Description>
## </ManSection>
##G>
##########################################
InstallMethod(SCHomalgCohomologyOp, "for SCSimplicialComplex and Integer",
IsSimplicialComplex,,
function(java.lang.StringIndexOutOfBoundsException: Range [32, 25) out of bounds for length 32
#cohomology: ker( M[i+1] ) / im( M[i] )
<C>cohomology</C> is the
ring:=SCIntFunc.ModulusToHomalgRing(modulus);
if ring=fail then
return fail;
fi;
L := [];
for i in [ 1 .. Length( M ) ] do
L[i] := SCIntFunc.DeepCopy(DimensionsMat( M[i] ));
L[i][3] := RowRankOfMatrix( M[i] );
L[i][4] := L[i][1] - L[i][3];
od;
H := [ L[1][4] ]; #first kernel dimension
for i in [ 2 .. Length( L ) ] do
H[i] := L[i][4] - L[i-1][3]; #dim ker - dim im
od;
################################################################################
##<#GAPDoc Label="SCHomalgCohomologyBasis">
#ManSection>
## <Meth Name="SCHomalgCohomologyBasis" Arg="complex,modulus"/>
## <Returns>a </ obtained
## otherwise.</Returns>
## <Description>
This functioncomputescohomology (explicit bases
## the modules involved) of <Arg>complex</Arg> with ## Note that if you are only interested in the ranks
# b <rgmodulus<java.lang.StringIndexOutOfBoundsException: Range [49, 33) out of bounds for length 69
#### <M>\mple<[[
## ."";
#,computesthe<>mathbb{}q<M-homology groups.P>
## The <M>k</M>- >SCHomalgCohomologyBasis(c,0);
## <C>ck:CertainObject(,)<C> where <>cohomology</C> thejava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
## <# </ManSectionjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
# generators of<><C obtainedvia
## <C>GeneratorsOfModule(ck);</C>.<P/>
## Note that ifInstallMethod(SCHomalgCohomologyBasisOp,
#"for SCSimplicialComplex andInteger,
#[ ]java.lang.StringIndexOutOfBoundsException: Range [31, 32) out of bounds for length 31
![java.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 21
# ap .(K";
##
## gap> SCHomalgCohomologyBasis(c,0);
ring:SCIntFuncModulusToHomalgRingmodulus;
## </Description>
## </ManSection>
#<#/>
###################f;
InstallMethodf; "java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 2
[:=SCHomalgCoboundaryMatricescomplex,odulus)
C: HomalgCocomplex ([])1)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
c: (Mi1 m M[])
local M,R, C, m,morphisms,L,i,H,ring Add ,m)java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
ring:=SCIntFunc.ModulusToHomalgRing(modulus);
#C. =truejava.lang.StringIndexOutOfBoundsException: Range [41, 42) out of bounds for length 41
return java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
(ring;
M:=SCHomalgCoboundaryMatrices(complex,modulus);
: (M1 ,1)
for return ohomology()
;
od;
#java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
!SkipHighestDegreeHomology: true;
# C!.HomologyOnLessGenerators := true;
# C!.DisplayHomology := true;# :CertainObject(,)
!StringBeforeDisplay:"java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
¤ 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.0.155Bemerkung:
¤
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.