@@ -235,6 +235,27 @@ addHook((kernel, Matrix), Strategy => "PushForward",
235235 M := coimage map (target m, f ** source m, raw m);
236236 image pushNonLinear(options pushForward , f, M)))
237237
238+ -- ---------------------------------------------------------------------------
239+
240+ -- pushforward the module to PP^n via S/I <-- S
241+ -- this is used for instance before computing pdim
242+ -- or regularity of a module over a quotient ring.
243+ -- cf. https://github.com/Macaulay2/M2/issues/3321
244+ flattenModule = M -> (
245+ if instance (ring M, PolynomialRing ) then M
246+ else cokernel flattenMorphism presentation M)
247+ -- TODO: find a name that can't be confused with flatness.
248+ -- Currently this is simply named after flattenRing.
249+ flattenMorphism = f -> f.cache #" flattenMorphism" ??= (
250+ if instance (ring f, PolynomialRing ) then return f;
251+ g := presentation ring f;
252+ -- FIXME: if ring f is a quotient of another quotient ring Q,
253+ -- "ambient ring f" would give Q, not a polynomial ring as we want.
254+ S := ring g;
255+ -- TODO: sometimes lifting to ring g is enough, how can we detect this?
256+ -- TODO: why doesn't lift(f, ring g) do this automatically?
257+ map (target f ** S, source f ** S, lift (cover f, S)) ** cokernel g)
258+
238259-- Local Variables:
239260-- compile-command: "make -C $M2BUILDDIR/Macaulay2/m2 "
240261-- End:
0 commit comments