-
Notifications
You must be signed in to change notification settings - Fork 2
/
create_polynomial_coefficients.m
executable file
·183 lines (145 loc) · 6.48 KB
/
create_polynomial_coefficients.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
function [eq, eq_unsquared] = create_polynomial_coefficients(a,b,c,d,t1,t2,e,e1,u,u1,v,v1)
% metric tensor at image i written in terms of CS: g11, g12, g22
g1120 = a.^2.*e;
g1111 = a.*b.*e.*2;
g1102 = b.^2.*e;
g1110 = (a.*e.*t1.*2) -(a.*u.*2);
g1101 = (b.*e.*t1.*2) -(b.*u.*2);
g1100 = (e.*t1.^2) -(t1.*u.*2) + 1;
g1220 = a.*c.*e;
g1211 = (a.*d.*e) + (b.*c.*e);
g1202 = b.*d.*e;
g1210 = -(a.*v)-(c.*u)+(a.*e.*t2)+(c.*e.*t1);
g1201 = -(b.*v)-(d.*u)+(b.*e.*t2)+(d.*e.*t1);
g1200 = -(t2.*u)-(t1.*v)+(e.*t1.*t2);
g2220 = c.^2.*e;
g2211 = c.*d.*e.*2;
g2202 = d.^2.*e;
g2210 = (c.*e.*t2.*2) -(c.*v.*2);
g2201 = (d.*e.*t2.*2) -(d.*v.*2);
g2200 = (e.*t2.^2) -(t2.*v.*2) + 1;
% pullback metric tensor at image i: g11b, g12b, g22b
g11b20 = a.^2.*e1;
g11b11 = a.*b.*e1.*2;
g11b02 = b.^2.*e1;
g11b10 = -(a.^2.*u1.*2)-(a.*b.*v1.*2);
g11b01 = -(b.^2.*v1.*2)-(a.*b.*u1.*2);
g11b00 = a.^2+b.^2;
g12b20 = a.*c.*e1;
g12b11 = (a.*d.*e1) + (b.*c.*e1);
g12b02 = b.*d.*e1;
g12b10 = -(v1.*((a.*d) + (b.*c)))-(a.*c.*u1.*2);
g12b01 = -(u1.*((a.*d) + (b.*c)))-(b.*d.*v1.*2);
g12b00 = a.*c+b.*d;
g22b20 = c.^2.*e1;
g22b11 = c.*d.*e1.*2;
g22b02 = d.^2.*e1;
g22b10 = -(c.^2.*u1.*2)-(c.*d.*v1.*2);
g22b01 = -(d.^2.*v1.*2)-(c.*d.*u1.*2);
g22b00 = c.^2+d.^2;
%eq1 = g11*g22b - g11b*g22
eq130 = g1110.*g22b20 + g1120.*g22b10 - g11b10.*g2220 - g11b20.*g2210;
eq121 = g1101.*g22b20 + g1110.*g22b11 + g1111.*g22b10 + g1120.*g22b01 - g11b01.*g2220 - g11b10.*g2211 - g11b11.*g2210 - g11b20.*g2201;
eq112 = g1101.*g22b11 + g1102.*g22b10 + g1110.*g22b02 + g1111.*g22b01 - g11b01.*g2211 - g11b02.*g2210 - g11b10.*g2202 - g11b11.*g2201;
eq103 = g1101.*g22b02 + g1102.*g22b01 - g11b01.*g2202 - g11b02.*g2201;
eq120 = g1100.*g22b20 + g1110.*g22b10 + g1120.*g22b00 - g11b00.*g2220 - g11b10.*g2210 - g11b20.*g2200;
eq111 = g1100.*g22b11 + g1101.*g22b10 + g1110.*g22b01 + g1111.*g22b00 - g11b00.*g2211 - g11b01.*g2210 - g11b10.*g2201 - g11b11.*g2200;
eq102 = g1100.*g22b02 + g1101.*g22b01 + g1102.*g22b00 - g11b00.*g2202 - g11b01.*g2201 - g11b02.*g2200;
eq110 = g1100.*g22b10 + g1110.*g22b00 - g11b00.*g2210 - g11b10.*g2200;
eq101 = g1100.*g22b01 + g1101.*g22b00 - g11b00.*g2201 - g11b01.*g2200;
eq100 = g1100.*g22b00 - g11b00.*g2200;
%eq2 = g12*g22b - g12b*g22
eq230 = g1210.*g22b20 + g1220.*g22b10 - g12b10.*g2220 - g12b20.*g2210;
eq221 = g1201.*g22b20 + g1210.*g22b11 + g1211.*g22b10 + g1220.*g22b01 - g12b01.*g2220 - g12b10.*g2211 - g12b11.*g2210 - g12b20.*g2201;
eq212 = g1201.*g22b11 + g1202.*g22b10 + g1210.*g22b02 + g1211.*g22b01 - g12b01.*g2211 - g12b02.*g2210 - g12b10.*g2202 - g12b11.*g2201;
eq203 = g1201.*g22b02 + g1202.*g22b01 - g12b01.*g2202 - g12b02.*g2201;
eq220 = g1200.*g22b20 + g1210.*g22b10 + g1220.*g22b00 - g12b00.*g2220 - g12b10.*g2210 - g12b20.*g2200;
eq211 = g1200.*g22b11 + g1201.*g22b10 + g1210.*g22b01 + g1211.*g22b00 - g12b00.*g2211 - g12b01.*g2210 - g12b10.*g2201 - g12b11.*g2200;
eq202 = g1200.*g22b02 + g1201.*g22b01 + g1202.*g22b00 - g12b00.*g2202 - g12b01.*g2201 - g12b02.*g2200;
eq210 = g1200.*g22b10 + g1210.*g22b00 - g12b00.*g2210 - g12b10.*g2200;
eq201 = g1200.*g22b01 + g1201.*g22b00 - g12b00.*g2201 - g12b01.*g2200;
eq200 = g1200.*g22b00 - g12b00.*g2200;
eq_unsquared = [eq130(:,1),...
eq121(:,1),...
eq112(:,1),...
eq103(:,1),...
eq120(:,1),...
eq111(:,1),...
eq102(:,1),...
eq110(:,1),...
eq101(:,1),...
eq100(:,1),...
eq230(:,1),...
eq221(:,1),...
eq212(:,1),...
eq203(:,1),...
eq220(:,1),...
eq211(:,1),...
eq202(:,1),...
eq210(:,1),...
eq201(:,1),...
eq200(:,1)];
% eq1^2
eq1_60 = eq130.^2;
eq1_51 = 2*(eq121.*eq130);
eq1_42 = 2*(eq112.*eq130) + eq121.^2;
eq1_33 = 2*(eq103.*eq130 + eq112.*eq121);
eq1_24 = 2*(eq103.*eq121) + eq112.^2;
eq1_15 = 2*(eq103.*eq112);
eq1_06 = eq103.^2;
eq1_50 = 2*(eq120.*eq130);
eq1_41 = 2*(eq111.*eq130 + eq120.*eq121);
eq1_32 = 2*(eq102.*eq130 + eq111.*eq121 + eq112.*eq120);
eq1_23 = 2*(eq102.*eq121 + eq103.*eq120 + eq111.*eq112);
eq1_14 = 2*(eq102.*eq112 + eq103.*eq111);
eq1_05 = 2*(eq102.*eq103);
eq1_40 = 2*(eq110.*eq130) + eq120.^2;
eq1_31 = 2*(eq101.*eq130 + eq110.*eq121 + eq111.*eq120);
eq1_22 = 2*(eq101.*eq121 + eq102.*eq120 + eq110.*eq112) + eq111.^2;
eq1_13 = 2*(eq101.*eq112 + eq102.*eq111 + eq103.*eq110);
eq1_04 = 2*(eq101.*eq103) + eq102.^2;
eq1_30 = 2*(eq100.*eq130 + eq110.*eq120);
eq1_21 = 2*(eq100.*eq121 + eq101.*eq120 + eq110.*eq111);
eq1_12 = 2*(eq100.*eq112 + eq101.*eq111 + eq102.*eq110);
eq1_03 = 2*(eq100.*eq103 + eq101.*eq102);
eq1_20 = 2*(eq100.*eq120) + eq110.^2;
eq1_11 = 2*(eq100.*eq111 + eq101.*eq110);
eq1_02 = 2*(eq100.*eq102) + eq101.^2;
eq1_10 = 2*(eq100.*eq110);
eq1_01 = 2*(eq100.*eq101);
eq1_00 = eq100.^2;
% eq2^2
eq2_60 = eq230.^2;
eq2_51 = 2*(eq221.*eq230);
eq2_42 = 2*(eq212.*eq230) + eq221.^2;
eq2_33 = 2*(eq203.*eq230 + eq212.*eq221);
eq2_24 = 2*(eq203.*eq221) + eq212.^2;
eq2_15 = 2*(eq203.*eq212);
eq2_06 = eq203.^2;
eq2_50 = 2*(eq220.*eq230);
eq2_41 = 2*(eq211.*eq230 + eq220.*eq221);
eq2_32 = 2*(eq202.*eq230 + eq211.*eq221 + eq212.*eq220);
eq2_23 = 2*(eq202.*eq221 + eq203.*eq220 + eq211.*eq212);
eq2_14 = 2*(eq202.*eq212 + eq203.*eq211);
eq2_05 = 2*(eq202.*eq203);
eq2_40 = 2*(eq210.*eq230) + eq220.^2;
eq2_31 = 2*(eq201.*eq230 + eq210.*eq221 + eq211.*eq220);
eq2_22 = 2*(eq201.*eq221 + eq202.*eq220 + eq210.*eq212) + eq211.^2;
eq2_13 = 2*(eq201.*eq212 + eq202.*eq211 + eq203.*eq210);
eq2_04 = 2*(eq201.*eq203) + eq202.^2;
eq2_30 = 2*(eq200.*eq230 + eq210.*eq220);
eq2_21 = 2*(eq200.*eq221 + eq201.*eq220 + eq210.*eq211);
eq2_12 = 2*(eq200.*eq212 + eq201.*eq211 + eq202.*eq210);
eq2_03 = 2*(eq200.*eq203 + eq201.*eq202);
eq2_20 = 2*(eq200.*eq220) + eq210.^2;
eq2_11 = 2*(eq200.*eq211 + eq201.*eq210);
eq2_02 = 2*(eq200.*eq202) + eq201.^2;
eq2_10 = 2*(eq200.*eq210);
eq2_01 = 2*(eq200.*eq201);
eq2_00 = eq200.^2;
eq = [sum(eq1_60+eq2_60);sum(eq1_51+eq2_51);sum(eq1_42+eq2_42);sum(eq1_33+eq2_33);sum(eq1_24+eq2_24);sum(eq1_15+eq2_15);sum(eq1_06+eq2_06);...
sum(eq1_50+eq2_50);sum(eq1_41+eq2_41);sum(eq1_32+eq2_32);sum(eq1_23+eq2_23);sum(eq1_14+eq2_14);sum(eq1_05+eq2_05);...
sum(eq1_40+eq2_40);sum(eq1_31+eq2_31);sum(eq1_22+eq2_22);sum(eq1_13+eq2_13);sum(eq1_04+eq2_04);...
sum(eq1_30+eq2_30);sum(eq1_21+eq2_21);sum(eq1_12+eq2_12);sum(eq1_03+eq2_03);...
sum(eq1_20+eq2_20);sum(eq1_11+eq2_11);sum(eq1_02+eq2_02);...
sum(eq1_10+eq2_10);sum(eq1_01+eq2_01);sum(eq1_00+eq2_00)];