Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 A B C D E F G H I Bib Ind
 Top of Book   Previous Chapter   Next Chapter 

F The subpackage ResidueClassRingForHomalg as a sample ring package
 F.1 The Mandatory Basic Operations
  F.1-1 BasisOfRowModule

  F.1-2 BasisOfColumnModule

  F.1-3 DecideZeroRows

  F.1-4 DecideZeroColumns

  F.1-5 SyzygiesGeneratorsOfRows

  F.1-6 SyzygiesGeneratorsOfColumns

  F.1-7 BasisOfRowsCoeff

  F.1-8 BasisOfColumnsCoeff

  F.1-9 DecideZeroRowsEffectively

  F.1-10 DecideZeroColumnsEffectively

  F.1-11 RelativeSyzygiesGeneratorsOfRows

  F.1-12 RelativeSyzygiesGeneratorsOfColumns
 F.2 The Mandatory Tool Operations
  F.2-1 ZeroMatrix

  F.2-2 IdentityMatrix

  F.2-3 Involution

  F.2-4 CertainRows

  F.2-5 CertainColumns

  F.2-6 UnionOfRows

  F.2-7 UnionOfColumns

  F.2-8 DiagMat

  F.2-9 KroneckerMat

  F.2-10 MulMat

  F.2-11 AddMat

  F.2-12 SubMat

  F.2-13 Compose

  F.2-14 IsZeroMatrix

  F.2-15 NrRows

  F.2-16 NrColumns

  F.2-17 Determinant
 F.3 Some of the Recommended Tool Operations
  F.3-1 AreEqualMatrices

  F.3-2 IsIdentityMatrix

  F.3-3 IsDiagonalMatrix

  F.3-4 ZeroRows

  F.3-5 ZeroColumns

F The subpackage ResidueClassRingForHomalg as a sample ring package

For an example see 3.3-1.

F.1 The Mandatory Basic Operations

F.1-1 BasisOfRowModule
> BasisOfRowModule( M )( function )

Returns: a homalg matrix over the ambient ring

BasisOfRowModule :=
  function( M )
    local Mrel;
    
    Mrel := UnionOfRows( M );
    
    Mrel := HomalgResidueClassMatrix(
                    BasisOfRowModule( Mrel ), HomalgRing( M ) );
    
    return GetRidOfObsoleteRows( Mrel );
    
  end,

F.1-2 BasisOfColumnModule
> BasisOfColumnModule( M )( function )

Returns: a homalg matrix over the ambient ring

BasisOfColumnModule :=
  function( M )
    local Mrel;
    
    Mrel := UnionOfColumns( M );
    
    Mrel := HomalgResidueClassMatrix(
                    BasisOfColumnModule( Mrel ), HomalgRing( M ) );
    
    return GetRidOfObsoleteColumns( Mrel );
    
  end,

F.1-3 DecideZeroRows
> DecideZeroRows( A, B )( function )

Returns: a homalg matrix over the ambient ring

DecideZeroRows :=
  function( A, B )
    local Brel;
    
    Brel := UnionOfRows( B );
    
    Brel := BasisOfRowModule( Brel );
    
    return HomalgResidueClassMatrix(
                   DecideZeroRows( Eval( A ), Brel ), HomalgRing( A ) );
    
  end,

F.1-4 DecideZeroColumns
> DecideZeroColumns( A, B )( function )

Returns: a homalg matrix over the ambient ring

DecideZeroColumns :=
  function( A, B )
    local Brel;
    
    Brel := UnionOfColumns( B );
    
    Brel := BasisOfColumnModule( Brel );
    
    return HomalgResidueClassMatrix(
                   DecideZeroColumns( Eval( A ), Brel ), HomalgRing( A ) );
    
  end,

F.1-5 SyzygiesGeneratorsOfRows
> SyzygiesGeneratorsOfRows( M )( function )

Returns: a homalg matrix over the ambient ring

SyzygiesGeneratorsOfRows :=
  function( M )
    local R, ring_rel, rel, S;
    
    R := HomalgRing( M );
    
    ring_rel := RingRelations( R );
    
    rel := MatrixOfRelations( ring_rel );
    
    if IsHomalgRelationsOfRightModule( ring_rel ) then
        rel := Involution( rel );
    fi;
    
    rel := DiagMat( ListWithIdenticalEntries( NrColumns( M ), rel ) );
    
    S := SyzygiesGeneratorsOfRows( Eval( M ), rel );
    
    S := HomalgResidueClassMatrix( S, R );
    
    S := GetRidOfObsoleteRows( S );
    
    if IsZero( S ) then
        
        SetIsLeftRegularMatrix( M, true );
        
    fi;
    
    return S;
    
  end,

F.1-6 SyzygiesGeneratorsOfColumns
> SyzygiesGeneratorsOfColumns( M )( function )

Returns: a homalg matrix over the ambient ring

SyzygiesGeneratorsOfColumns :=
  function( M )
    local R, ring_rel, rel, S;
    
    R := HomalgRing( M );
    
    ring_rel := RingRelations( R );
    
    rel := MatrixOfRelations( ring_rel );
    
    if IsHomalgRelationsOfLeftModule( ring_rel ) then
        rel := Involution( rel );
    fi;
    
    rel := DiagMat( ListWithIdenticalEntries( NrRows( M ), rel ) );
    
    S := SyzygiesGeneratorsOfColumns( Eval( M ), rel );
    
    S := HomalgResidueClassMatrix( S, R );
    
    S := GetRidOfObsoleteColumns( S );
    
    if IsZero( S ) then
        
        SetIsRightRegularMatrix( M, true );
        
    fi;
    
    return S;
    
  end,

F.1-7 BasisOfRowsCoeff
> BasisOfRowsCoeff( M, T )( function )

Returns: a homalg matrix over the ambient ring

BasisOfRowsCoeff :=
  function( M, T )
    local Mrel, TT, bas;
    
    Mrel := UnionOfRows( M );
    
    TT := HomalgVoidMatrix( HomalgRing( Mrel ) );
    
    bas := BasisOfRowsCoeff( Mrel, TT );
    
    SetEval( T, CertainColumns( TT, [ 1 .. NrRows( M ) ] ) );
    
    ResetFilterObj( T, IsVoidMatrix );
    
    ## FIXME: GetRidOfObsoleteRows and correct T
    return HomalgResidueClassMatrix( bas, HomalgRing( M ) );
    
  end,

F.1-8 BasisOfColumnsCoeff
> BasisOfColumnsCoeff( M, T )( function )

Returns: a homalg matrix over the ambient ring

BasisOfColumnsCoeff :=
  function( M, T )
    local Mrel, TT, bas;
    
    Mrel := UnionOfColumns( M );
    
    TT := HomalgVoidMatrix( HomalgRing( Mrel ) );
    
    bas := BasisOfColumnsCoeff( Mrel, TT );
    
    SetEval( T, CertainRows( TT, [ 1 .. NrColumns( M ) ] ) );
    
    ResetFilterObj( T, IsVoidMatrix );
    
    ## FIXME: GetRidOfObsoleteColumns and correct T
    return HomalgResidueClassMatrix( bas, HomalgRing( M ) );
    
  end,

F.1-9 DecideZeroRowsEffectively
> DecideZeroRowsEffectively( A, B, T )( function )

Returns: a homalg matrix over the ambient ring

DecideZeroRowsEffectively :=
  function( A, B, T )
    local Brel, TT, red;
    
    Brel := UnionOfRows( B );
    
    TT := HomalgVoidMatrix( HomalgRing( Brel ) );
    
    red := DecideZeroRowsEffectively( Eval( A ), Brel, TT );
    
    SetEval( T, CertainColumns( TT, [ 1 .. NrRows( B ) ] ) );
    
    ResetFilterObj( T, IsVoidMatrix );
    
    return HomalgResidueClassMatrix( red, HomalgRing( A ) );
    
  end,

F.1-10 DecideZeroColumnsEffectively
> DecideZeroColumnsEffectively( A, B, T )( function )

Returns: a homalg matrix over the ambient ring

DecideZeroColumnsEffectively :=
  function( A, B, T )
    local Brel, TT, red;
    
    Brel := UnionOfColumns( B );
    
    TT := HomalgVoidMatrix( HomalgRing( Brel ) );
    
    red := DecideZeroColumnsEffectively( Eval( A ), Brel, TT );
    
    SetEval( T, CertainRows( TT, [ 1 .. NrColumns( B ) ] ) );
    
    ResetFilterObj( T, IsVoidMatrix );
    
    return HomalgResidueClassMatrix( red, HomalgRing( A ) );
    
  end,

F.1-11 RelativeSyzygiesGeneratorsOfRows
> RelativeSyzygiesGeneratorsOfRows( M, M2 )( function )

Returns: a homalg matrix over the ambient ring

RelativeSyzygiesGeneratorsOfRows :=
  function( M, M2 )
    local M2rel, S;
    
    M2rel := UnionOfRows( M2 );
    
    S := SyzygiesGeneratorsOfRows( Eval( M ), M2rel );
    
    S := HomalgResidueClassMatrix( S, HomalgRing( M ) );
    
    S := GetRidOfObsoleteRows( S );
    
    if IsZero( S ) then
        
        SetIsLeftRegularMatrix( M, true );
        
    fi;
    
    return S;
    
  end,

F.1-12 RelativeSyzygiesGeneratorsOfColumns
> RelativeSyzygiesGeneratorsOfColumns( M, M2 )( function )

Returns: a homalg matrix over the ambient ring

RelativeSyzygiesGeneratorsOfColumns :=
  function( M, M2 )
    local M2rel, S;
    
    M2rel := UnionOfColumns( M2 );
    
    S := SyzygiesGeneratorsOfColumns( Eval( M ), M2rel );
    
    S := HomalgResidueClassMatrix( S, HomalgRing( M ) );
    
    S := GetRidOfObsoleteColumns( S );
    
    if IsZero( S ) then
        
        SetIsRightRegularMatrix( M, true );
        
    fi;
    
    return S;
    
  end,

F.2 The Mandatory Tool Operations

Here we list those matrix operations for which homalg provides no fallback method.

F.2-1 ZeroMatrix
> ZeroMatrix( )( function )

Returns: a homalg matrix over the ambient ring

(--> ZeroMatrix (D.1-1) and ZeroMatrix (D.1-3))

ZeroMatrix := C -> HomalgZeroMatrix(
                      NrRows( C ), NrColumns( C ), AmbientRing( HomalgRing( C ) ) ),

F.2-2 IdentityMatrix
> IdentityMatrix( )( function )

Returns: a homalg matrix over the ambient ring

(--> IdentityMatrix (D.1-2) and IdentityMatrix (D.1-4))

IdentityMatrix := C -> HomalgIdentityMatrix(
        NrRows( C ), AmbientRing( HomalgRing( C ) ) ),

F.2-3 Involution
> Involution( )( function )

Returns: a homalg matrix over the ambient ring

(--> Involution (D.1-5))

Involution :=
  function( M )
    local N, R;
    
    N := Involution( Eval( M ) );
    
    R := HomalgRing( N );
    
    if not ( HasIsCommutative( R ) and IsCommutative( R ) and
             HasIsReducedModuloRingRelations( M ) and
             IsReducedModuloRingRelations( M ) ) then
        
        ## reduce the matrix N w.r.t. the ring relations
        N := DecideZero( N, HomalgRing( M ) );
    fi;
    
    return N;
    
  end,

F.2-4 CertainRows
> CertainRows( )( function )

Returns: a homalg matrix over the ambient ring

(--> CertainRows (D.1-6))

CertainRows :=
  function( M, plist )
    local N;
    
    N := CertainRows( Eval( M ), plist );
    
    if not ( HasIsReducedModuloRingRelations( M ) and
             IsReducedModuloRingRelations( M ) ) then
        
        ## reduce the matrix N w.r.t. the ring relations
        N := DecideZero( N, HomalgRing( M ) );
    fi;
    
    return N;
    
  end,

F.2-5 CertainColumns
> CertainColumns( )( function )

Returns: a homalg matrix over the ambient ring

(--> CertainColumns (D.1-7))

CertainColumns :=
  function( M, plist )
    local N;
    
    N := CertainColumns( Eval( M ), plist );
    
    if not ( HasIsReducedModuloRingRelations( M ) and
             IsReducedModuloRingRelations( M ) ) then
        
        ## reduce the matrix N w.r.t. the ring relations
        N := DecideZero( N, HomalgRing( M ) );
    fi;
    
    return N;
    
  end,

F.2-6 UnionOfRows
> UnionOfRows( )( function )

Returns: a homalg matrix over the ambient ring

(--> UnionOfRows (D.1-8))

UnionOfRows :=
  function( A, B )
    local N;
    
    N := UnionOfRows( Eval( A ), Eval( B ) );
    
    if not ForAll( [ A, B ], HasIsReducedModuloRingRelations and
               IsReducedModuloRingRelations ) then
        
        ## reduce the matrix N w.r.t. the ring relations
        N := DecideZero( N, HomalgRing( A ) );
    fi;
    
    return N;
    
  end,

F.2-7 UnionOfColumns
> UnionOfColumns( )( function )

Returns: a homalg matrix over the ambient ring

(--> UnionOfColumns (D.1-9))

UnionOfColumns :=
  function( A, B )
    local N;
    
    N := UnionOfColumns( Eval( A ), Eval( B ) );
    
    if not ForAll( [ A, B ], HasIsReducedModuloRingRelations and
               IsReducedModuloRingRelations ) then
        
        ## reduce the matrix N w.r.t. the ring relations
        N := DecideZero( N, HomalgRing( A ) );
    fi;
    
    return N;
    
  end,

F.2-8 DiagMat
> DiagMat( )( function )

Returns: a homalg matrix over the ambient ring

(--> DiagMat (D.1-10))

DiagMat :=
  function( e )
    local N;
    
    N := DiagMat( List( e, Eval ) );
    
    if not ForAll( e, HasIsReducedModuloRingRelations and
               IsReducedModuloRingRelations ) then
        
        ## reduce the matrix N w.r.t. the ring relations
        N := DecideZero( N, HomalgRing( e[1] ) );
    fi;
    
    return N;
    
  end,

F.2-9 KroneckerMat
> KroneckerMat( )( function )

Returns: a homalg matrix over the ambient ring

(--> KroneckerMat (D.1-11))

KroneckerMat :=
  function( A, B )
    local N;
    
    N := KroneckerMat( Eval( A ), Eval( B ) );
    
    if not ForAll( [ A, B ], HasIsReducedModuloRingRelations and
               IsReducedModuloRingRelations ) then
        
        ## reduce the matrix N w.r.t. the ring relations
        N := DecideZero( N, HomalgRing( A ) );
    fi;
    
    return N;
    
  end,

F.2-10 MulMat
> MulMat( )( function )

Returns: a homalg matrix over the ambient ring

(--> MulMat (D.1-12))

MulMat :=
  function( a, A )
    
    return DecideZero( EvalRingElement( a ) * Eval( A ), HomalgRing( A ) );
    
  end,

F.2-11 AddMat
> AddMat( )( function )

Returns: a homalg matrix over the ambient ring

(--> AddMat (D.1-13))

AddMat :=
  function( A, B )
    
    return DecideZero( Eval( A ) + Eval( B ), HomalgRing( A ) );
    
  end,

F.2-12 SubMat
> SubMat( )( function )

Returns: a homalg matrix over the ambient ring

(--> SubMat (D.1-14))

SubMat :=
  function( A, B )
    
    return DecideZero( Eval( A ) - Eval( B ), HomalgRing( A ) );
    
  end,

F.2-13 Compose
> Compose( )( function )

Returns: a homalg matrix over the ambient ring

(--> Compose (D.1-15))

Compose :=
  function( A, B )
    
    return DecideZero( Eval( A ) * Eval( B ), HomalgRing( A ) );
    
  end,

F.2-14 IsZeroMatrix
> IsZeroMatrix( M )( function )

Returns: true or false

(--> IsZeroMatrix (D.1-16))

IsZeroMatrix := M -> IsZero( DecideZero( Eval( M ), HomalgRing( M ) ) ),

F.2-15 NrRows
> NrRows( C )( function )

Returns: a nonnegative integer

(--> NrRows (D.1-17))

NrRows := C -> NrRows( Eval( C ) ),

F.2-16 NrColumns
> NrColumns( C )( function )

Returns: a nonnegative integer

(--> NrColumns (D.1-18))

NrColumns := C -> NrColumns( Eval( C ) ),

F.2-17 Determinant
> Determinant( C )( function )

Returns: an element of ambient homalg ring

(--> Determinant (D.1-19))

Determinant := C -> DecideZero( Determinant( Eval( C ) ), HomalgRing( C ) ),

F.3 Some of the Recommended Tool Operations

Here we list those matrix operations for which homalg does provide a fallback method. But specifying the below homalgTable functions increases the performance by replacing the fallback method.

F.3-1 AreEqualMatrices
> AreEqualMatrices( A, B )( function )

Returns: true or false

(--> AreEqualMatrices (D.2-1))

AreEqualMatrices :=
  function( A, B )
    
    return IsZero( DecideZero( Eval( A ) - Eval( B ), HomalgRing( A ) ) );
    
  end,

F.3-2 IsIdentityMatrix
> IsIdentityMatrix( M )( function )

Returns: true or false

(--> IsIdentityMatrix (D.2-2))

IsIdentityMatrix := M ->
          IsIdentityMatrix( DecideZero( Eval( M ), HomalgRing( M ) ) ),

F.3-3 IsDiagonalMatrix
> IsDiagonalMatrix( M )( function )

Returns: true or false

(--> IsDiagonalMatrix (D.2-3))

IsDiagonalMatrix := M ->
          IsDiagonalMatrix( DecideZero( Eval( M ), HomalgRing( M ) ) ),

F.3-4 ZeroRows
> ZeroRows( C )( function )

Returns: a homalg matrix over the ambient ring

(--> ZeroRows (D.2-4))

ZeroRows := C -> ZeroRows( DecideZero( Eval( C ), HomalgRing( C ) ) ),

F.3-5 ZeroColumns
> ZeroColumns( C )( function )

Returns: a homalg matrix over the ambient ring

(--> ZeroColumns (D.2-5))

ZeroColumns := C -> ZeroColumns( DecideZero( Eval( C ), HomalgRing( C ) ) ),
 Top of Book   Previous Chapter   Next Chapter 
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 A B C D E F G H I Bib Ind

generated by GAPDoc2HTML