Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lifeware
biocham
Commits
a00d282d
Commit
a00d282d
authored
Jul 30, 2019
by
Mathieu Hemery
Browse files
Merge branch 'gpac' into develop
parents
ee35299a
c77404de
Changes
2
Hide whitespace changes
Inline
Side-by-side
gpac.pl
View file @
a00d282d
...
...
@@ -785,13 +785,15 @@ substract_N_exp([Head_m|Tail_m],N,[Head_s|Tail_s],[Head_new|Tail_new]):-
% Generate all exponents that are not null and strictly smaller than existing monomial
% These are sufficient variables for binomial reduction. Subroutines are:
% is_monomial(PODE, Monom) to extract the monomial from the PODE
% all_smaller(List, Exponent) recursion over all monomials of strictly_smaller
% highest_exponent(Set, Exp) that extract the highest exponent for each place in the set
% highest(A,B,Max) such that Max is the maximum of A and B
% strictly_smaller(+E1,-E2) generate E2 as non null and strictly smaller than E1
% smaller(+E1,-E2) generate E2 smaller than E1
generate_sufficient_variables
(
PODE
,
Final_set
)
:-
setof
(
Exp
,
is_monomial
(
PODE
,
Exp
),
Exp_set
),
setof
(
Var
,
all_smaller
(
Exp_set
,
Var
),
Var_set
),
highest_exponent
(
Exp_set
,
Highest_Exp
),
setof
(
Var
,
strictly_smaller
(
Highest_Exp
,
Var
),
Var_set
),
[
Head
|
_Remainder
]
=
Var_set
,
length
(
Head
,
L
),
Lm
is
L
-
1
,
displace_exponent
([
1
],
0
,
Lm
,
First_Var
),
...
...
@@ -807,9 +809,25 @@ is_monomial(PODE,Monom) :-
member
(
Der
,
PODE
),
member
([
_R
,
Monom
],
Der
).
all_smaller
(
List
,
Exponent
)
:-
member
(
ExpHigh
,
List
),
strictly_smaller
(
ExpHigh
,
Exponent
).
% highest_exponent(+Exp_Set, -Highest_Exp)
highest_exponent
([
Head
|
Tail
],
HExp
)
:-
highest_exponent
(
Tail
,
HExp_tmp
),
highest
(
Head
,
HExp_tmp
,
HExp
),!.
highest_exponent
([
HExp
],
HExp
)
:-
!.
% highest(+H1,+H2,-Max)
highest
([
Head1
|
Tail1
],[
Head2
|
Tail2
],[
HeadM
|
TailM
])
:-
max_list
([
Head1
,
Head2
],
HeadM
),
highest
(
Tail1
,
Tail2
,
TailM
).
highest
([],[],[]).
% strictly_smaller(+ExpM,+Exp)
strictly_smaller
(
ExpM
,
Exp
)
:-
smaller
(
ExpM
,
Exp
),
...
...
gpac.plt
View file @
a00d282d
...
...
@@ -36,12 +36,13 @@ test(compute_number_species) :-
test(generate_sufficient_variables1) :-
PODE = [[[1,[1, 1]],[3,[0, 1]]],[[-1,[3, 0]]]],
gpac:generate_sufficient_variables(PODE,Set),
once(permutation(Set, [[1,0],[0,1],[2,0]])).
once(permutation(Set, [[1,0],[0,1],[2,0]
,[1,1],[3,0],[2,1]
])).
test(generate_sufficient_variables2) :-
PODE = [[[1,[3, 1]]],[[-1,[1, 3]]]],
gpac:generate_sufficient_variables(PODE,Set),
once(permutation(Set, [[1,0],[0,1],[2,0],[1,1],[0,2],[3,0],[1,2],[2,1],[0,3]])).
once(permutation(Set, [[1,0],[0,1],[2,0],[1,1],[0,2],[3,0],[1,2],[2,1],[0,3],
[3,1],[2,2],[1,3],[3,2],[2,3]])).
test(generate_sufficient_variables3) :-
PODE = [[[1,[0, 3]]],[[-1,[0, 2]]]],
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment