Skip to content

Commit

Permalink
beta version of 1.59
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamknockillaree committed Sep 17, 2023
1 parent eb5ff68 commit f24ab38
Show file tree
Hide file tree
Showing 27 changed files with 504 additions and 217 deletions.
39 changes: 0 additions & 39 deletions HowToUpdateHap.txt

This file was deleted.

4 changes: 2 additions & 2 deletions PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ AvailabilityTest := ReturnTrue,
BannerString := Concatenation( "Loading HAP ",
String( ~.Version ), " ...\n" ),

TestFile := "tst/testquick.g",
#TestFile := "tst/testall.g",
#TestFile := "tst/testquick.g",
TestFile := "tst/testall.g",

Keywords := [ "homology", "cohomology", "resolution", "homotopy group",
"module of identities", "CW complex", "simplicial complex", "cubical complex", "permutahedral complex", "knots", "nonabelian tensor", "nonabelian exterior", "covering space" ]
Expand Down
27 changes: 27 additions & 0 deletions lib/Functors/various.gi
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,33 @@ a->ImagesRepresentative(x,ImagesRepresentative(y,a)));
end);
#####################################################################

####################################################################
#####################################################################
InstallOtherMethod(Compose,
"for chain homomorphisms FoG=F(G)",
[IsHapChainMap,IsHapChainMap],
function(F,G)
local S,T,map,char;
S:=Source(F);
T:=Target(G);
if not S=T then return fail; fi;
char:=EvaluateProperty(F,"characteristic");

map:=function(n,k);
return F!.mapping(n,G!.mapping(n,k));
end;

return Objectify(HapChainMap,
rec(
source:=Source(G),
target:=Target(F),
mapping:=map,
properties:=[["characteristic", char],["type","chainMap"]]));

end);
#####################################################################


#####################################################################
InstallOtherMethod(Compose,
"for FpG-module homomorphisms xoy=x(y)",
Expand Down
45 changes: 45 additions & 0 deletions lib/Homology/new_persistent.gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

###################################################
###################################################
InstallGlobalFunction(PersistentBettiNumbersViaContractions,
function(FF,n,p)
local F, W, L, E, chnmap, cwmap, map, ln, k, f, homs;

#F:=ContractedFilteredRegularCWComplex(FF);
F:=FF;
ln:=EvaluateProperty(F,"filtration_length");
W:=[];
for k in [1..ln] do
Add(W,FiltrationTerm(F,k));
od;

L:=[];
for k in [1..ln-1] do
map:=function(n,i); return i; end;
cwmap:=Objectify( HapRegularCWMap,
rec(
source:=W[k],
target:=W[k+1],
mapping:=map));
Add(L,ChainMapOfRegularCWMap(cwmap));
od;


E:=[];
for k in [1..ln] do
Add(E,ChainComplexEquivalenceOfRegularCWComplex(W[k]));
od;


homs:=[];
for k in [1..ln-1] do
f:=Compose( E[k+1][1], Compose(L[k],E[k][2]) );
Add(homs,HomologyVectorSpace(TensorWithIntegersModP(f,p),n));
od;
return LinearHomomorphismsPersistenceMat(homs);
end);
###################################################
###################################################



6 changes: 5 additions & 1 deletion lib/Homology/persistent.gi
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,11 @@ if y=x then
else
mat[x][y]:= Product(List([x..y-1],i->HOMS[i]));
fi;
mat[x][y]:=Dimension(Image(mat[x][y]));
if Dimension(Range(mat[x][y])) = 0 or Dimension(Source(mat[x][y])) = 0
then mat[x][y]:=0;
else
mat[x][y]:=Dimension(Image(mat[x][y]));
fi;
od;
od;

Expand Down
90 changes: 87 additions & 3 deletions lib/Operations/hapOps.gi
Original file line number Diff line number Diff line change
Expand Up @@ -951,14 +951,45 @@ InstallOtherMethod(PersistentBettiNumbers,
function(Y,n,prime)
local W;
W:=ContractedFilteredPureCubicalComplex(Y);
W:=Y;
W:= FilteredPureCubicalComplexToCubicalComplex(W);
W:=FilteredCubicalComplexToFilteredRegularCWComplex(W);
return PersistentBettiNumbers(W,n,prime);
end);
##########################################################
##########################################################

##########################################################
##########################################################
InstallOtherMethod(PersistentBettiNumbersAlt,
"Betti number of a filtered pure cubical complex",
[IsHapFilteredPureCubicalComplex,IsInt,IsInt],
function(Y,n,prime)
local W;
W:=ContractedFilteredPureCubicalComplex(Y);
W:= FilteredPureCubicalComplexToCubicalComplex(W);
W:=FilteredCubicalComplexToFilteredRegularCWComplex(W);
return PersistentBettiNumbersAlt(W,n,prime);
end);
##########################################################
##########################################################

##########################################################
##########################################################
InstallOtherMethod(PersistentBettiNumbersAlt,
"Betti number of a filtered pure cubical complex",
[IsHapFilteredPureCubicalComplex,IsInt],
function(Y,n)
local W;

W:=ContractedFilteredPureCubicalComplex(Y);
W:= FilteredPureCubicalComplexToCubicalComplex(W);
W:=FilteredCubicalComplexToFilteredRegularCWComplex(W);
return PersistentBettiNumbersAlt(W,n);
end);
##########################################################
##########################################################




##########################################################
Expand All @@ -974,6 +1005,20 @@ end);
##########################################################
##########################################################

##########################################################
##########################################################
InstallOtherMethod(PersistentBettiNumbersAlt,
"Betti number of a filtered simplicial complex",
[IsHapFilteredSimplicialComplex,IsInt],
function(Y,n)
local W;
W:=FilteredRegularCWComplex(Y);
return PersistentBettiNumbersAlt(W,n);
end);
##########################################################
##########################################################


##########################################################
##########################################################
InstallOtherMethod(PersistentBettiNumbers,
Expand All @@ -987,6 +1032,20 @@ end);
##########################################################
##########################################################

##########################################################
##########################################################
InstallOtherMethod(PersistentBettiNumbersAlt,
"Betti number of a filtered simplicial complex",
[IsHapFilteredSimplicialComplex,IsInt,IsInt],
function(Y,n,prime)
local W;
W:=FilteredRegularCWComplex(Y);
return PersistentBettiNumbersAlt(W,n,prime);
end);
##########################################################
##########################################################





Expand All @@ -997,7 +1056,8 @@ InstallOtherMethod(PersistentBettiNumbers,
[IsHapFilteredRegularCWComplex,IsInt],
function(Y,n)
local W;
W:=ContractedFilteredRegularCWComplex(Y);
#W:=ContractedFilteredRegularCWComplex(Y);
W:=Y;
W:=SparseChainComplexOfFilteredRegularCWComplex(W);
return PersistentBettiNumbers(W,n);
end);
Expand All @@ -1011,13 +1071,37 @@ InstallOtherMethod(PersistentBettiNumbers,
[IsHapFilteredRegularCWComplex,IsInt,IsInt],
function(Y,n,prime)
local W;
W:=ContractedFilteredRegularCWComplex(Y);
#W:=ContractedFilteredRegularCWComplex(Y);
W:=Y;
W:=SparseChainComplexOfFilteredRegularCWComplex(W);
return PersistentBettiNumbers(W,n,prime);
end);
##########################################################
##########################################################

##########################################################
##########################################################
InstallMethod(PersistentBettiNumbersAlt,
"Betti number of a filtered regular CW-complex",
[IsHapFilteredRegularCWComplex,IsInt,IsInt],
function(Y,n,prime);
return PersistentBettiNumbersViaContractions(Y,n,prime);
end);
##########################################################
##########################################################

##########################################################
##########################################################
InstallOtherMethod(PersistentBettiNumbersAlt,
"Betti number of a filtered regular CW-complex",
[IsHapFilteredRegularCWComplex,IsInt],
function(Y,n);
Print("Using homology over GF(2).\n");
return PersistentBettiNumbersViaContractions(Y,n,2);
end);
##########################################################
##########################################################




Expand Down
13 changes: 11 additions & 2 deletions lib/PolyComplexes/filteredCubical.gi
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
InstallGlobalFunction(ThickeningFiltration,
#function(M,n)
function(arg)
local M, n, F, D, T, C, k, A,step,s;
local B,M, n, F, D, T, C, k, A,step,s;

M:=arg[1];
n:=arg[2];
if Length(arg)>2 then step :=arg[3]; else step:=1; fi;
if Length(arg)>2 then

if IsInt(arg[3]) then step :=arg[3];

else step:=1; B:=arg[3]; fi;
else step:=1;
fi;

F:=PureCubicalComplex(M!.binaryArray);
F!.filtration:=StructuralCopy(F!.binaryArray);
Expand All @@ -19,6 +25,9 @@ T:=M;
for k in [2..n+1] do
for s in [1..step] do
T:=ThickenedPureCubicalComplex(T);
if IsBound(B) then
T:=PureCubicalComplexIntersection(T,B);
fi;
od;
D:=PureCubicalComplexDifference(T,F);
D:=k*D!.binaryArray;
Expand Down
2 changes: 1 addition & 1 deletion lib/PolyComplexes/pureCubicalComplexes.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ function(arg)
local i,A,viewer,T,file,file1,file2,tmpdir;
# Function for viewing 2-dimensional pure cubical complexes.

T:=arg[1];
T:=PureCubicalComplex(1*arg[1]!.binaryArray);

if not (Dimension(T)=2 or Dimension(T)=3) then
Print("There is no method for viewing a pure cubical complex of dimension ",
Expand Down
5 changes: 5 additions & 0 deletions lib/RegularCWComplexes/basicRegular.gi
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ if not Y!.criticalCells=fail then
return Y!.criticalCells;
fi;

if Dimension(Y)=0 then
Y!.criticalCells:=List([1..Y!.nrCells(0)],i->[0,i]);
return Y!.criticalCells;
fi;

##############################
if Length(arg)>1 then
cells:=CocriticalCellsOfRegularCWComplex(Y,arg[2]);
Expand Down
Loading

0 comments on commit f24ab38

Please sign in to comment.