diff --git a/M2/Macaulay2/m2/enginering.m2 b/M2/Macaulay2/m2/enginering.m2 index 5dfce521e7..3e5674dc2e 100644 --- a/M2/Macaulay2/m2/enginering.m2 +++ b/M2/Macaulay2/m2/enginering.m2 @@ -331,10 +331,15 @@ frac EngineRing := R -> if isField R then R else if R.?frac then R.frac else ( if R.?numallvars then F.numallvars=R.numallvars; scan(R.baseRings, S -> if S.?frac and not isPromotable(S.frac,F) then ( promote(S.frac,F) := (a,F) -> fraction(promote(numerator a,R),promote(denominator a,R)); - promote(List,S.frac,F) := (m,G,F) -> apply(m, d -> splice ( d | toList(degreeLength F-#d:0) )); -- TODO check + promote(List,S.frac,F) := (m,G,F) -> apply(m, d -> splice ( d | toList(degreeLength F-#d:0) )); promote(Module,S.frac,F) := (M,G,F) -> F ** M; promote(Matrix,S.frac,F) := (m,G,F) -> map(promote(target m,F),promote(source m,F),applyTable(entries m,x->promote(x,F))); promote(MutableMatrix,S.frac,F) := (m,G,F) -> mutableMatrix applyTable(entries m,x->promote(x,F)); + lift(F,S.frac) := opts -> (a,G) -> fraction(lift(numerator a,S),lift(denominator a,S)); + lift(List,F,S.frac) := opts -> (m,F,G) -> apply(m, d -> take(d,degreeLength S.frac)); + lift(Module,F,S.frac) := opts -> (M,F,G) -> S.frac ** M; + lift(Matrix,F,S.frac) := opts -> (m,F,G) -> map(lift(target m,S.frac),lift(source m,S.frac),applyTable(entries m,x->lift(x,S.frac))); + lift(MutableMatrix,F,S.frac) := opts -> (m,F,G) -> mutableMatrix applyTable(entries m,x->lift(x,S.frac)); )); F) diff --git a/M2/Macaulay2/m2/rings.m2 b/M2/Macaulay2/m2/rings.m2 index 5c79e2d681..4f4bbbdfa8 100644 --- a/M2/Macaulay2/m2/rings.m2 +++ b/M2/Macaulay2/m2/rings.m2 @@ -90,6 +90,7 @@ toExternalString Ring := toString @@ describe -- promote, lift, liftable, and isConstant ----------------------------------------------------------------------------- +-- TODO rename isLiftable; add test that lift method exists -- some remnants from lift and promote, version 2 liftable = method(TypicalValue => Boolean, Dispatch => {Thing, Type, Type}) liftable(Number, Number) :=