Skip to content

Commit

Permalink
switched to new ??= notation in a few packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mahrud authored and d-torrance committed Dec 16, 2024
1 parent 411de54 commit 9ae8343
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
8 changes: 3 additions & 5 deletions M2/Macaulay2/packages/Complexes/ChainComplex.m2
Original file line number Diff line number Diff line change
Expand Up @@ -604,15 +604,14 @@ poincare Complex := C -> (

poincareN Complex := C -> (
S := degreesRing ring C;
if not S.?poincareN then S.poincareN = (
R := S.poincareN ??= (
s := getSymbol "S";
t := getSymbol "T";
ZZ (monoid[s, t_0 .. t_(degreeLength ring C - 1),
Inverses=>true,
MonomialOrder => RevLex,
Global => false])
);
R := S.poincareN;
(lo,hi) := concentration C;
f := 0_R;
for i from lo to hi do (
Expand Down Expand Up @@ -1089,7 +1088,7 @@ Ext(ZZ, Module, Module) := Module => opts -> (i,M,N) -> (
liftmap := null; -- given f : R^1 --> H, returns g : R^1 --> Hom(FM_i, N)
invmap := null; -- given g : R^1 --> Hom(FM_i, N), returns f : R^1 --> H = Ext^i(M,N)
Y := youngest(M.cache.cache,N.cache.cache);
if not Y#?(Ext,i,M,N) then Y#(Ext,i,M,N) = (
Y#(Ext,i,M,N) ??= (
R := ring M;
if not isCommutative R then error "'Ext' not implemented yet for noncommutative rings.";
if R =!= ring N then error "expected modules over the same ring";
Expand Down Expand Up @@ -1134,8 +1133,7 @@ Ext(ZZ, Module, Module) := Module => opts -> (i,M,N) -> (
H.cache.formation = FunctionApplication { Ext, (i, M, N) };
H.cache.Ext = (i,M,N);
H
);
Y#(Ext,i,M,N)
)
)

yonedaExtension = method()
Expand Down
6 changes: 2 additions & 4 deletions M2/Macaulay2/packages/MinimalPrimes/AnnotatedIdeal.m2
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ ideal AnnotatedIdeal := Ideal => (cacheValue "CachedIdeal") (I -> (
-- TODO: is this still needed?
ideal AnnotatedIdeal := (I) -> (
--F := product unique join(I.Linears / (x -> x#1),I.Inverted);
if not I#?"CachedIdeal" then I#"CachedIdeal" = (
I#"CachedIdeal" ??= (
F := product unique (I.Linears / (x -> x#1));
I1 := ideal(I.Linears/last);
I2 := if I.?IndependentSet then (
Expand All @@ -158,9 +158,7 @@ ideal AnnotatedIdeal := (I) -> (
I3 := if numgens I1 === 0 then I2 else if numgens I2 === 0 then I1 else I1+I2;
--if F == 1 then I3 else saturate(I3, F)
if F == 1 then I3 else mySat(I3, F)
);
I#"CachedIdeal"
)
))
*-

isSubset(Ideal, AnnotatedIdeal) := (I, J) -> isSubset(I, ideal J) -- naive attempt first...
Expand Down
2 changes: 1 addition & 1 deletion M2/Macaulay2/packages/MinimalPrimes/decompose2-test.m2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
decompose Ideal := (I) -> if I.cache.?decompose then I.cache.decompose else I.cache.decompose = (
decompose Ideal := (I) -> I.cache.decompose ??= (
R := ring I;
if isQuotientRing R then (
A := ultimate(ambient, R);
Expand Down
9 changes: 4 additions & 5 deletions M2/Macaulay2/packages/Polyhedra/extended/legacy.m2
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,13 @@ imageFan (Matrix,Cone) := (M,C) -> (
-- OUTPUT : 'C', a Cone, the inner normal cone of P in the face Q
-- COMMENT : 'Q' must be a face of P
normalCone (Polyhedron,Polyhedron) := Cone => {} >> opts -> (P,Q) -> (
if not P.cache.?normalCone then P.cache.normalCone = new MutableHashTable;
if not P.cache.normalCone#?Q then (
P.cache.normalCone ??= new MutableHashTable;
P.cache.normalCone#Q ??= (
-- Checking for input errors
if not isFace(Q,P) then error("The second polyhedron must be a face of the first one");
p := interiorPoint Q;
P.cache.normalCone#Q = dualCone coneFromVData affineImage(P,-p));
P.cache.normalCone#Q)

dualCone coneFromVData affineImage(P, -p))
)


-- INPUT : 'M', a Matrix
Expand Down
4 changes: 1 addition & 3 deletions M2/Macaulay2/packages/PrimaryDecomposition.m2
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,7 @@ ass0 = I -> (
J := dual I;
M := first entries generators J;
H := new MutableHashTable;
scan(M, m -> (
s := rawIndices raw m;
if not H#?s then H#s = true));
scan(M, m -> H#(rawIndices raw m) ??= true);
inds := sort apply(keys H, ind -> (#ind, ind));
apply(inds, s -> s#1))

Expand Down

0 comments on commit 9ae8343

Please sign in to comment.