CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
##
## These are wrong COLEMs and therefore called WOLEMs ;)
##
## They are here for history not to repeat itself!!!
##


##
InstallMethod( CertainRows,
        "for homalg matrices",
        [ IsHomalgMatrix and HasEvalLeftInverse, IsList ],
        
  function( M, plist )
    local A;
    
    Info( InfoCOLEM, 2, COLEM.color, "\033[01mCOLEM\033[0m ", COLEM.color, "CertainRows( LeftInverse )", "\033[0m" );
    
    A := EvalLeftInverse( M );
    
    return LeftInverse( CertainColumns( A, plist ) );
    
end );

##
InstallMethod( CertainColumns,
        "for homalg matrices",
        [ IsHomalgMatrix and HasEvalRightInverse, IsList ],
        
  function( M, plist )
    local A;
    
    Info( InfoCOLEM, 2, COLEM.color, "\033[01mCOLEM\033[0m ", COLEM.color, "CertainColumns( RightInverse )", "\033[0m" );
    
    A := EvalRightInverse( M );
    
    return RightInverse( CertainRows( A, plist ) );
    
end );

##
InstallImmediateMethod( PositionOfFirstNonZeroEntryPerRow,
        IsHomalgMatrix and HasEvalCertainColumns and HasNrRows, 0,
        
  function( M )
    local e, mat, plist, pos;
    
    e := EvalCertainColumns( M );
    
    mat := e[1];
    
    if HasPositionOfFirstNonZeroEntryPerRow( mat ) then
        
        pos := PositionOfFirstNonZeroEntryPerRow( mat );
        
        plist := e[2];
        
        return List( [ 1 .. NrRows( M ) ], function( i ) if pos[i] in plist then return Position( plist, pos[i] ); else return 0; fi; end );
        
    fi;
    
    TryNextMethod( );
    
end );