<p>Beside the <strong class="pkg">GAP</strong> builtin debugging facilities (--> <a href="../../../doc/ref/chap7.html#X8345F6817DFD6394"><span class="RefLink">Reference: Debugging and Profiling Facilities</span></a>) <strong class="pkg">MatricesForHomalg</strong> provides two ways to debug the computations.</p>
<h4>E.1 <span class="Heading">Increase the assertion level</span></h4>
<p><strong class="pkg">MatricesForHomalg</strong> comes with numerous builtin assertion checks. They are activated if the user increases the assertion level using <br /> <br /> <code class="code">SetAssertionLevel</code>( <var class="Arg">level</var> ); <br /> <br /> (--> <a href="../../../doc/ref/chap7.html#X876C83707F13A0FD"><span class="RefLink">Reference: AssertionLevel</span></a>), where <var class="Arg">level</var> is one of the values below:</p>
<p>In particular, if <strong class="pkg">MatricesForHomalg</strong> delegates matrix operations to an external system then <code class="code">SetAssertionLevel</code>( 4 ); can be used to let <strong class="pkg">MatricesForHomalg</strong> debug the external system. <br /> <br /> Below you can find the record of the available level-4 assertions, which is a <strong class="pkg">GAP</strong>-component of every <strong class="pkg">homalg</strong> ring. Each assertion can thus be overwritten by package developers or even ordinary users.</p>
<div class="example"><pre>
asserts :=
rec(
BasisOfRowModule :=
function( B ) return ( NumberRows( B ) = 0 ) = IsZero( B ); end,
BasisOfColumnModule :=
function( B ) return ( NumberColumns( B ) = 0 ) = IsZero( B ); end,
BasisOfRowsCoeff :=
function( B, T, M ) return B = T * M; end,
BasisOfColumnsCoeff :=
function( B, M, T ) return B = M * T; end,
DecideZeroRows_Effectively :=
function( M, A, B ) return M = DecideZeroRows( A, B ); end,
DecideZeroColumns_Effectively :=
function( M, A, B ) return M = DecideZeroColumns( A, B ); end,
DecideZeroRowsEffectively :=
function( M, A, T, B ) return M = A + T * B; end,
DecideZeroColumnsEffectively :=
function( M, A, B, T ) return M = A + B * T; end,
DecideZeroRowsWRTNonBasis :=
function( B )
local R;
R := HomalgRing( B );
if not ( HasIsBasisOfRowsMatrix( B ) and
IsBasisOfRowsMatrix( B ) ) and
IsBound( R!.DecideZeroWRTNonBasis ) then
if R!.DecideZeroWRTNonBasis = "warn" then
Info( InfoWarning, 1, "about to reduce with respect to a matrix", "with IsBasisOfRowsMatrix not set to true" );
elif R!.DecideZeroWRTNonBasis = "error" then
Error( "about to reduce with respect to a matrix", "with IsBasisOfRowsMatrix not set to true\n" );
fi;
fi;
end,
DecideZeroColumnsWRTNonBasis :=
function( B )
local R;
R := HomalgRing( B );
if not ( HasIsBasisOfColumnsMatrix( B ) and
IsBasisOfColumnsMatrix( B ) ) and
IsBound( R!.DecideZeroWRTNonBasis ) then
if R!.DecideZeroWRTNonBasis = "warn" then
Info( InfoWarning, 1, "about to reduce with respect to a matrix", "with IsBasisOfColumnsMatrix not set to true" );
elif R!.DecideZeroWRTNonBasis = "error" then
Error( "about to reduce with respect to a matrix", "with IsBasisOfColumnsMatrix not set to true\n" );
fi;
fi;
end,
ReducedBasisOfRowModule :=
function( M, B )
return GenerateSameRowModule( B, BasisOfRowModule( M ) );
end,
ReducedBasisOfColumnModule :=
function( M, B )
return GenerateSameColumnModule( B, BasisOfColumnModule( M ) );
end,
ReducedSyzygiesGeneratorsOfRows :=
function( M, S )
return GenerateSameRowModule( S, SyzygiesGeneratorsOfRows( M ) );
end,
ReducedSyzygiesGeneratorsOfColumns :=
function( M, S )
return GenerateSameColumnModule( S, SyzygiesGeneratorsOfColumns( M ) );
end,
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ homalgMode</code>( <var class="Arg">str</var>[, <var class="Arg">str2</var>] )</td><td class="tdright">( method )</td></tr></table></div>
<p>This function sets different modes which influence how much of the basic matrix operations and the logical matrix methods become visible (--> Appendices <a href="chapA.html#X7CB422647C7DD289"><span class="RefLink">A</span></a>, <a href="chapC.html#X8222352C78A19214"><span class="RefLink">C</span></a>). Handling the string <var class="Arg">str</var> is <em>not</em> case-sensitive. If a second string <var class="Arg">str2</var> is given, then <code class="code">homalgMode</code>( <var class="Arg">str2</var> ) is invoked at the end. In case you let <strong class="pkg">homalg</strong> delegate matrix operations to an external system the you might also want to check <code class="code">homalgIOMode</code> in the <strong class="pkg">HomalgToCAS</strong> package manual.</p>
</tr>
<tr>
<td class="tdleft"></td>
<td class="tdcenter"></td>
<td class="tdleft">(<code class="code">homalgMode</code>( ) is a short form for <code class="code">homalgMode</code>( "" ))</td>
</tr>
<tr>
<td class="tdleft"></td>
<td class="tdcenter"></td>
<td class="tdleft"></td>
</tr>
<tr>
<td class="tdleft">"b"</td>
<td class="tdcenter">"basic"</td>
<td class="tdleft">make the basic matrix operations visible + <code class="code">homalgMode</code>( "logic" )</td>
</tr>
<tr>
<td class="tdleft"></td>
<td class="tdcenter"></td>
<td class="tdleft"></td>
</tr>
<tr>
<td class="tdleft">"d"</td>
<td class="tdcenter">"debug"</td>
<td class="tdleft">same as "basic" but also makes <code class="code">Row/ReducedColumnEchelonForm</code> visible</td>
</tr>
<tr>
<td class="tdleft"></td>
<td class="tdcenter"></td>
<td class="tdleft"></td>
</tr>
<tr>
<td class="tdleft">"l"</td>
<td class="tdcenter">"logic"</td>
<td class="tdleft">make the logical methods in <strong class="pkg">LIMAT</strong> and <strong class="pkg">COLEM</strong> visible</td>
</tr>
<tr>
<td class="tdleft"></td>
<td class="tdcenter"></td>
<td class="tdleft"></td>
</tr>
</table><br />
</div>
<p>All modes other than the "default"-mode only set their specific values and leave the other values untouched, which allows combining them to some extent. This also means that in order to get from one mode to a new mode (without the aim to combine them) one needs to reset to the "default"-mode first. This can be done using <code class="code">homalgMode</code>( "", new_mode );</p>
if nargs = 0 or ( IsString( arg[1] ) and arg[1] = "" ) then
mode := "default";
elif IsString( arg[1] ) then ## now we know, the string is not empty
s := arg[1];
if LowercaseString( s{[1]} ) = "b" then
mode := "basic";
elif LowercaseString( s{[1]} ) = "d" then
mode := "debug";
elif LowercaseString( s{[1]} ) = "l" then
mode := "logic";
else
mode := "";
fi;
else
Error( "the first argument must be a string\n" );
fi;
if mode = "default" then
HOMALG_MATRICES.color_display := false;
for s in HOMALG_MATRICES.matrix_logic_infolevels do
SetInfoLevel( s, 1 );
od;
SetInfoLevel( InfoHomalgBasicOperations, 1 );
elif mode = "basic" then
SetInfoLevel( InfoHomalgBasicOperations, 3 );
homalgMode( "logic" );
elif mode = "debug" then
SetInfoLevel( InfoHomalgBasicOperations, 4 );
homalgMode( "logic" );
elif mode = "logic" then
HOMALG_MATRICES.color_display := true;
for s in HOMALG_MATRICES.matrix_logic_infolevels do
SetInfoLevel( s, 2 );
od;
fi;
if nargs > 1 and IsString( arg[2] ) then
homalgMode( arg[2] );
fi;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.