[m-rev.] diff: debugging code for fourier elimination
Julien Fischer
juliensf at csse.unimelb.edu.au
Wed Dec 13 14:39:55 AEDT 2006
The following is intended as a source of problems for Thibault,
so he can experiment with his implementation of Fourier
elimination in G12.
Estimated hours taken: 0.1
Branches: main
Add some debugging code to Fourier elimination implementation
used by the termination analyser.
compiler/lp_rational.m:
Add code inside a trace goal that allows the constraint
systems passed to Fourier elimination to be dumped to
stdout.
Julien.
Index: compiler/lp_rational.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lp_rational.m,v
retrieving revision 1.8
diff -u -r1.8 lp_rational.m
--- compiler/lp_rational.m 1 Dec 2006 15:04:04 -0000 1.8
+++ compiler/lp_rational.m 13 Dec 2006 02:33:00 -0000
@@ -1445,8 +1445,24 @@
% Skip the call to fourier_elimination/6 if there are no variables to
% project - this avoids the transformation to vector form.
%
- ( !.Vars \= [] ->
+ (
+ !.Vars = [_ | _],
Matrix0 = constraints_to_matrix(Constraints1),
+ trace [
+ compile_time(flag("debug_fourier_elim")),
+ run_time(env("MC_DUMP_FOURIER_ELIM")),
+ io(!IO)
+ ] (
+ io.write_string("------------------------------------\n", !IO),
+ io.write_string("Matrix passed to fourier_elimination/6\n",
+ !IO),
+ write_matrix(Varset, no, Matrix0, !IO),
+ io.nl(!IO),
+ io.write_string("Variables to project:\n", !IO),
+ write_vars(Varset, !.Vars, !IO),
+ io.nl(!IO),
+ io.write_string("------------------------------------\n", !IO)
+ ),
fourier_elimination(!.Vars, Varset, MaybeThreshold, 0,
Matrix0, FourierResult),
(
@@ -1463,6 +1479,7 @@
% would mean traversing the matrix, so we wait until the next
% operation that needs to traverse it anyway or until the
% next entailment check.
+ !.Vars = [],
Result = ok(Constraints1)
)
).
@@ -1720,10 +1737,13 @@
;
NewMatrix = yes(ZeroMatrix)
),
- ( if NewMatrix = yes(Matrix)
- then fourier_elimination(OtherVars, Varset, MaybeThreshold, !.Step,
+ (
+ NewMatrix = yes(Matrix),
+ fourier_elimination(OtherVars, Varset, MaybeThreshold, !.Step,
Matrix, Result)
- else Result = no
+ ;
+ NewMatrix = no,
+ Result = no
).
% separate_vectors(Matrix, Var, Positive, Negative, Zero, Num).
@@ -2309,7 +2329,7 @@
:- func var_to_string(lp_varset, lp_var) = string.
-var_to_string(Varset, Var) = varset.lookup_name(Varset, Var, "Unnamed").
+var_to_string(Varset, Var) = varset.lookup_name(Varset, Var).
% Write out the matrix used during fourier elimination. If
% `Labels' is `yes' then write out the label for each vector
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list