Line | |
---|
1 | function p_homo = homogenize(p,y); |
---|
2 | %HOMOGENIZE Homogenize polynomial |
---|
3 | % |
---|
4 | % f = homogenize(p,x) |
---|
5 | |
---|
6 | % Author Johan Löfberg |
---|
7 | % $Id: homogenize.m,v 1.1 2006/08/10 18:00:20 joloef Exp $ |
---|
8 | |
---|
9 | deg = degree(p); |
---|
10 | deg_y = degree(y); |
---|
11 | if rem(deg,deg_y)~=0 |
---|
12 | error('The degree of the homogenizer is not an even fraction of deg(p).'); |
---|
13 | end |
---|
14 | |
---|
15 | if 0 |
---|
16 | error('The homogenizer must be homogenious.'); |
---|
17 | end |
---|
18 | |
---|
19 | p_variables = getvariables(p); |
---|
20 | p_homo = getbasematrix(p,0)*y^(deg/deg_y); |
---|
21 | for i = 1:length(p_variables); |
---|
22 | monom = recover(p_variables(i)); |
---|
23 | if degree(monom)<deg |
---|
24 | power = (deg-(degree(monom)))/deg_y; |
---|
25 | p_homo = p_homo + getbasematrix(p,p_variables(i))*monom*y^power; |
---|
26 | else |
---|
27 | p_homo = p_homo + getbasematrix(p,p_variables(i))*monom; |
---|
28 | end; |
---|
29 | end |
---|
30 | % Reset info about conic terms |
---|
31 | p_homo.conicinfo = [0 0]; |
---|
Note: See
TracBrowser
for help on using the repository browser.