From 0c7bcbc79729dfcf93224482c16a9e3e185145f8 Mon Sep 17 00:00:00 2001 From: Mohamed Barakat Date: Fri, 10 May 2019 16:55:28 +0200 Subject: [PATCH] RingMapOntoRewrittenResidueClassRing avoids creating a new ring if not necessary --- MatricesForHomalg/PackageInfo.g | 2 +- MatricesForHomalg/gap/Tools.gi | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/MatricesForHomalg/PackageInfo.g b/MatricesForHomalg/PackageInfo.g index 9ebc58a94..c01c138a3 100644 --- a/MatricesForHomalg/PackageInfo.g +++ b/MatricesForHomalg/PackageInfo.g @@ -5,7 +5,7 @@ PackageName := "MatricesForHomalg", Subtitle := "Matrices for the homalg project", Version := Maximum( [ - "2019.02.10", ## Mohamed's version + "2019.02.13", ## Mohamed's version ## this line prevents merge conflicts "2019.02.11", ## Fabian's version ## this line prevents merge conflicts diff --git a/MatricesForHomalg/gap/Tools.gi b/MatricesForHomalg/gap/Tools.gi index c3e2885ae..3ef7611c4 100644 --- a/MatricesForHomalg/gap/Tools.gi +++ b/MatricesForHomalg/gap/Tools.gi @@ -7269,9 +7269,13 @@ InstallMethod( RingMapOntoRewrittenResidueClassRing, zero_rows := ZeroRows( matrix - images ); - indets := indets{zero_rows}; - - S := k * List( indets, String ); + if Length( indets ) = Length( zero_rows ) and + IsIdenticalObj( k, CoefficientsRing( A ) ) then + S := A; + else + indets := indets{zero_rows}; + S := k * List( indets, String ); + fi; if not zero_rows = [ ] then map := RingMap( indets, S, R );