Skip to content

Commit 88ccc77

Browse files
committed
fixed the filteredComplex(List) constructor
1 parent 61962f3 commit 88ccc77

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed

M2/Macaulay2/packages/SpectralSequences.m2

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -165,38 +165,41 @@ filteredComplex = method(Options => {
165165
ReducedHomology => true})
166166

167167
filteredComplex(List) := FilteredComplex => opts -> L -> (
168-
local maps;
169-
local C;
170-
if #L === 0
171-
then error "expected at least one chain complex map or simplicial complex";
172-
if all(#L, p -> class L#p === SimplicialComplex) then (
173-
kk := coefficientRing L#0;
174-
if opts.ReducedHomology == true then (
175-
C = complex L#0; -- By default the ambient simplicial complex is the first element of the list
176-
maps = apply(#L-1, p -> map(C, complex L#(p+1),
177-
i -> sub(contract(transpose matrix{faces(i,L#0)}, matrix{faces(i,L#(p+1))}), kk))))
178-
else (C = naiveTruncation(complex L#0,1); -- By default the ambient simplicial complex is the first element of the list
179-
maps = apply(#L-1, p -> map(C, naiveTruncation(complex L#(p+1),1),
180-
i -> sub(contract(transpose matrix{faces(i,L#0)}, matrix{faces(i,L#(p+1))}), kk))))
181-
)
182-
else (
183-
maps = L;
184-
if any(#maps, p -> class maps#p =!= ComplexMap) then (
185-
error "expected sequence of chain complexes");
186-
C = target maps#0;-- By default the ambient chain complex is target of first map.
187-
if any(#maps, p -> target maps#p != C) then (
188-
error "expected all map to have the same target"));
189-
Z := image map(C, C, i -> 0*id_(C_i)); -- make zero subcomplex as a subcomplex of ambient complex
190-
P := {};
191-
myList := {};
192-
for p from 0 to #maps - 1 do (
193-
myList = myList |
194-
{#maps - (p+1) -opts.Shift => image maps#p};
195-
);
196-
if myList != {} then (P = {(#maps-opts.Shift) => C} | myList)
197-
else P = { - opts.Shift => C} ;
198-
if (last P)#1 != Z then (P = P | {(-1-opts.Shift) => Z});
199-
return new FilteredComplex from P | {symbol zero => (ring C)^0, symbol cache => new CacheTable})
168+
if #L == 0 then error "expected at least one complex map or simplicial complex";
169+
if not uniform L then error "expected a list of complex maps or simplicial complexes";
170+
--
171+
maps := if instance(L#0, SimplicialComplex) then (
172+
kk := coefficientRing L#0;
173+
if opts.ReducedHomology == true then (
174+
-- By default the ambient simplicial complex is the first element of the list
175+
C := complex L#0;
176+
apply(#L-1, p -> map(C, complex L#(p+1),
177+
i -> sub(contract(transpose matrix{faces(i,L#0)}, matrix{faces(i,L#(p+1))}), kk))))
178+
else (
179+
-- By default the ambient simplicial complex is the first element of the list
180+
C = complex L#0;
181+
C = naiveTruncation(C, 1);
182+
apply(#L-1, p -> map(C, naiveTruncation(complex L#(p+1), 1),
183+
i -> sub(contract(transpose matrix{faces(i,L#0)}, matrix{faces(i,L#(p+1))}), kk))))
184+
)
185+
else if instance(L#0, ComplexMap) then (
186+
-- By default the ambient chain complex is target of first map.
187+
C = target L#0;
188+
if same apply(L, target) then L
189+
else error "expected all maps to have the same target")
190+
else error "expected a list of complex maps or simplicial complexes";
191+
--
192+
Z := image map(C, C, i -> 0*id_(C_i)); -- make zero subcomplex as a subcomplex of ambient complex
193+
P := {};
194+
myList := {};
195+
for p from 0 to #maps - 1 do (
196+
myList = myList |
197+
{#maps - (p+1) -opts.Shift => image maps#p};
198+
);
199+
if myList != {} then (P = {(#maps-opts.Shift) => C} | myList)
200+
else P = { - opts.Shift => C} ;
201+
if (last P)#1 != Z then (P = P | {(-1-opts.Shift) => Z});
202+
return new FilteredComplex from P | {symbol zero => (ring C)^0, symbol cache => new CacheTable})
200203

201204

202205
--------------------------------------------------------------------------------

0 commit comments

Comments
 (0)