-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgetDodet.m
52 lines (45 loc) · 1.03 KB
/
getDodet.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function [d p q] = getDodet(polysys)
% [d p q] = getDodet(polysys)
% ---------------------------
% Determines for which degree d the M matrix will be overdetermined.
%
% d = scalar, degree for which M is overdetermined
%
% p = scalar, number of rows of overdetermined M
%
% q = scalar, number of columns of overdetermined M
%
% polysys = cell containing coefficients and monomials exponents of the
% set of polynomial equations.
%
% CALLS
% -----
%
% Kim Batselier, 2010-10-17
% number of unknowns
n = size(polysys{1,2},2);
% number of equations
n_eq = size(polysys,1);
di = zeros(1,n_eq);
% figure out the degree of each polynomial
for i = 1 : n_eq
di(i) = max(sum(polysys{i,2},2));
end
d0 = max(di);
d = d0;
% initialize number of rows and columns
p = 0;
for i = 1 : n_eq
p = p + nchoosek(d-di(i)+n,n);
end
q = nchoosek(d+n,n);
while p <= q
% update d, p and q
d = d+1;
p = 0;
for i = 1 : n_eq
p = p + nchoosek(d-di(i)+n,n);
end
q = nchoosek(d+n,n);
end
end