  
  [1XA [33X[0;0YOverview of the [5XLocalizeRingForHomalg[105X[101X[1X Package Source Code[133X[101X
  
  [33X[0;0YThis  appendix  is  included in the documentation to shine some light on the
  mathematical  backgrounds of this Package. Neither is it needed to work with
  this  package  nor should the methods presented here be called directly. The
  functions documented here are entries of the so called ring table and not to
  be called directly. There are higher level methods in declared and installed
  in  [5XMatricesForHomalg[105X, which call this functions (--> [10X?MatricesForHomalg:The
  Basic Matrix Operations[110X).[133X
  
  [33X[0;0YWe only present the simpler procedures, where no transformation matrices are
  computed,  since  the  computation  of  transformation  matrices  carries no
  further mathematical ideas.[133X
  
  
  [1XA.1 [33X[0;0YThe generic Methods[133X[101X
  
  [33X[0;0YThere are some methods in localized rings, where homalg is able to fall back
  on  procedures  of  the corresponding global ring. Furthermore these methods
  work  quite  good together with Mora's algorithm as implemented in Singular,
  since we can treat it like a global ring. We will present some methods as an
  example, to show the idea:[133X
  
  [1XA.1-1 BasisOfRowModule[101X
  
  [33X[1;0Y[29X[2XBasisOfRowModule[102X( [3XM[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10Ya "basis" of the module generated by M[133X
  
  [33X[0;0YThis  procedure  computes  a  basis  by  using  the Funcod of the underlying
  computation  ring.  If the computation ring is given by Mora's Algorithm, we
  will  indeed  compute  a  local  basis.  If  we just use the global ring for
  computations,  this  will  be  a  global basis and is just computed for some
  simplifications and not for the use of reducing by it. Of course we can just
  forget about the denominator of [3XM[103X.[133X
  
  [4X[32X  Code  [32X[104X
    [4XBasisOfRowModule :=[104X
    [4X  function( M )[104X
    [4X[104X
    [4X    Info([104X
    [4X      InfoLocalizeRingForHomalg,[104X
    [4X      2,[104X
    [4X      "Start BasisOfRowModule with ",[104X
    [4X      NrRows( M ), "x", NrColumns( M )[104X
    [4X    );[104X
    [4X[104X
    [4X    return HomalgLocalMatrix( BasisOfRowModule( Numerator( M ) ), HomalgRing( M ) );[104X
    [4X    [104X
    [4Xend,[104X
  [4X[32X[104X
  
  [1XA.1-2 DecideZeroRows[101X
  
  [33X[1;0Y[29X[2XDecideZeroRows[102X( [3XA[103X, [3XB[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10Ya "reduced" form of [3XA[103X with respect to [3XB[103X[133X
  
  [33X[0;0YThis procedure just calls the DecideZeroRows of the computation ring for the
  numerator of [3XA[103X.[133X
  
  [33X[0;0YIf  we  use Mora's algorithm this procedure will just call it. The result is
  divided  by  the  denominator  of [3XA[103X afterwards. Again we do not need to care
  about the denominator of B.[133X
  
  [33X[0;0YIf  we  use  the  reduction  implemented  in  this  package,  this Funcod is
  overwritten and will not be called.[133X
  
  [4X[32X  Code  [32X[104X
    [4XDecideZeroRows :=[104X
    [4X  function( A, B )[104X
    [4X    local R, ComputationRing, hook, result;[104X
    [4X    [104X
    [4X    Info([104X
    [4X      InfoLocalizeRingForHomalg,[104X
    [4X      2,[104X
    [4X      "Start DecideZeroRows with ",[104X
    [4X      NrRows( A ), "x", NrColumns( A ),[104X
    [4X      " and ",[104X
    [4X      NrRows( B ), "x", NrColumns( B )[104X
    [4X    );[104X
    [4X    [104X
    [4X    R := HomalgRing( A );[104X
    [4X    ComputationRing := AssociatedComputationRing( R );[104X
    [4X    [104X
    [4X    result := DecideZeroRows( Numerator( A ) , Numerator( B ) );[104X
    [4X    result := HomalgLocalMatrix( result, Denominator( A ) , R );[104X
    [4X    Info( InfoLocalizeRingForHomalgShowUnits, 1, "DecideZeroRows: produces denominator: ", Name( Denominator( result ) ) );[104X
    [4X    return result;[104X
    [4X[104X
    [4X  end,[104X
  [4X[32X[104X
  
  [1XA.1-3 SyzygiesGeneratorsOfRows[101X
  
  [33X[1;0Y[29X[2XSyzygiesGeneratorsOfRows[102X( [3XM[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10Ya  "basis"  of  the syzygies of the arguments (for details consult
            the homalg help)[133X
  
  [33X[0;0YIt  is  easy  to  see,  that a global syzygy is also a local syzygy and vice
  versa  when clearing the local Syzygy of its denominators. So this procedure
  just calls the syzygy Funcod of the underlying computation ring.[133X
  
  [4X[32X  Code  [32X[104X
    [4XSyzygiesGeneratorsOfRows :=[104X
    [4X  function( M )[104X
    [4X    [104X
    [4X    Info([104X
    [4X      InfoLocalizeRingForHomalg,[104X
    [4X      2,[104X
    [4X      "Start SyzygiesGeneratorsOfRows with ",[104X
    [4X      NrRows( M ), "x", NrColumns( M )[104X
    [4X    );[104X
    [4X[104X
    [4X    return HomalgLocalMatrix(\[104X
    [4X             SyzygiesGeneratorsOfRows( Numerator( M ) ), HomalgRing( M )\[104X
    [4X           );[104X
    [4X    [104X
    [4X  end,[104X
  [4X[32X[104X
  
  
  [1XA.2 [33X[0;0YThe Local Decide Zero trick[133X[101X
  
  [1XA.2-1 DecideZeroRows[101X
  
  [33X[1;0Y[29X[2XDecideZeroRows[102X( [3XB[103X, [3XA[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10Ya "reduced" form of [3XB[103X with respect to [3XA[103X[133X
  
  [33X[0;0YThis  procedure is the mathematical core procedure of this package. We use a
  trick to decide locally, whether [3XB[103X can be reduced to zero by [3XA[103X with a global
  computation. First a heuristic is used by just checking, whether the element
  lies  inside  the  global  module,  generated by the generators of the local
  module.  This  of  course  implies  this  for  the  local  module having the
  advantage  of  a  short  computation  time and leaving a normal form free of
  denominators. If this check fails, we use our trick to check for each row of
  [3XB[103X independently, whether it lies in the module generated by [3XB[103X.[133X
  
  [4X[32X  Code  [32X[104X
    [4XDecideZeroRows :=[104X
    [4X  function( B, A )[104X
    [4X    local R, T, m, gens, n, GlobalR, one, N, b, numB, denB, i, B1, A1, B2, A2, B3;[104X
    [4X    [104X
    [4X    Info( [104X
    [4X       InfoLocalizeRingForHomalg,[104X
    [4X       2,[104X
    [4X       "Start DecideZeroRows with ",[104X
    [4X       NrRows( B ), "x", NrColumns( B ),[104X
    [4X       " and ",[104X
    [4X       NrRows( A ), "x", NrColumns( A ) [104X
    [4X    );[104X
    [4X    [104X
    [4X    R := HomalgRing( B );[104X
    [4X    GlobalR := AssociatedComputationRing( R );[104X
    [4X    T := HomalgVoidMatrix( R );[104X
    [4X    gens := GeneratorsOfMaximalLeftIdeal( R );[104X
    [4X    n := NrRows( gens );[104X
    [4X    one := One( GlobalR );[104X
    [4X    [104X
    [4X    m := NrRows( A );[104X
    [4X    A1 := Numerator( A );[104X
    [4X    [104X
    [4X    N := HomalgZeroMatrix( 0, NrColumns( B ), R );[104X
    [4X    b := Eval( B );[104X
    [4X    numB := b[1];[104X
    [4X    denB := b[2];[104X
    [4X    [104X
    [4X    for i in [ 1 .. NrRows( B ) ] do[104X
    [4X    [104X
    [4X        #use global reduction as heuristic[104X
    [4X        B1 := CertainRows( numB, [ i ] );[104X
    [4X        B2 := HomalgLocalMatrix( DecideZeroRows( B1, A1 ), R );[104X
    [4X        [104X
    [4X        #if it is nonzero, check whether local reduction makes it zero[104X
    [4X        if not IsZero( B2 ) then[104X
    [4X          A2 := UnionOfRows( A1, gens * B1 );[104X
    [4X          A2 := BasisOfRows( A2 );[104X
    [4X          B3 := HomalgLocalMatrix( DecideZeroRows( B1, A2 ), R );[104X
    [4X          if IsZero( B3 ) then[104X
    [4X            B2 := B3;[104X
    [4X          fi;[104X
    [4X        fi;[104X
    [4X        [104X
    [4X        N := UnionOfRows( N, B2 );[104X
    [4X        [104X
    [4X    od;[104X
    [4X    [104X
    [4X    N := HomalgRingElement( one, denB, R ) * N;[104X
    [4X    [104X
    [4X    Info( InfoLocalizeRingForHomalgShowUnits, 1, "DecideZeroRows: produces denominator: ", Name( Denominator( N ) ) );[104X
    [4X    [104X
    [4X    return N;[104X
    [4X    [104X
    [4X  end,[104X
  [4X[32X[104X
  
  
  [1XA.3 [33X[0;0YTools[133X[101X
  
  [33X[0;0YThe  package [5XLocalizeRingForHomalg[105X also implements tool functions. These are
  referred  to  from  [5XMatricesForHomalg[105X automatically. We list the implemented
  methods  here  are  and  refer  to  the [5XMatricesForHomalg[105X documentation (-->
  [10X?MatricesForHomalg:       The      Matrix      Tool      Operations[110X      and
  [10X?MatricesForHomalg:RingElement[110X)   for  details.  All  tools  functions  from
  [5XMatricesForHomalg[105X not listed here are also supported by fallback tools.[133X
  
  [30X    [33X[0;6YIsZero[133X
  
  [30X    [33X[0;6YIsOne[133X
  
  [30X    [33X[0;6YMinus[133X
  
  [30X    [33X[0;6YDivideByUnit[133X
  
  [30X    [33X[0;6YIsUnit[133X
  
  [30X    [33X[0;6YSum[133X
  
  [30X    [33X[0;6YProduct[133X
  
  [30X    [33X[0;6YShallowCopy[133X
  
  [30X    [33X[0;6YZeroMatrix[133X
  
  [30X    [33X[0;6YIdentityMatrix[133X
  
  [30X    [33X[0;6YAreEqualMatrices[133X
  
  [30X    [33X[0;6YInvolution[133X
  
  [30X    [33X[0;6YCertainRows[133X
  
  [30X    [33X[0;6YCertainColumns[133X
  
  [30X    [33X[0;6YUnionOfRows[133X
  
  [30X    [33X[0;6YUnionOfColumns[133X
  
  [30X    [33X[0;6YDiagMat[133X
  
  [30X    [33X[0;6YKroneckerMat[133X
  
  [30X    [33X[0;6YDualKroneckerMat[133X
  
  [30X    [33X[0;6YMulMat[133X
  
  [30X    [33X[0;6YAddMat[133X
  
  [30X    [33X[0;6YSubMat[133X
  
  [30X    [33X[0;6YCompose[133X
  
  [30X    [33X[0;6YNrRows[133X
  
  [30X    [33X[0;6YNrColumns[133X
  
  [30X    [33X[0;6YIsZeroMatrix[133X
  
  [30X    [33X[0;6YIsDiagonalMatrix[133X
  
  [30X    [33X[0;6YZeroRows[133X
  
  [30X    [33X[0;6YZeroColumns[133X
  
