-
Notifications
You must be signed in to change notification settings - Fork 1
/
normal_time_optims.m
190 lines (188 loc) · 8.69 KB
/
normal_time_optims.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
184
185
186
187
188
189
190
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% AUXILIARY FUNCTIONS FOR NOISE MODELS %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = normal_time(T,Tm,R,Sigma,ind)
varargout = cell(nargout,1); % whyever that is necessary ...
if nargout >=1
% J_T
varargout{1} = sum(0.5*((T(ind) - Tm(ind))./Sigma(ind)).^2 + 0.5*((R(ind))./Sigma(ind)).^2 + log(2*pi*Sigma(ind).^2));
if nargout >= 2
% dJ_TdT
varargout{2} = transpose((T(ind) - Tm(ind))./(Sigma(ind).^2));
if(isempty(varargout{2}))
varargout{2} = zeros(1,0);
end
% dJ_TdR
varargout{3} = transpose(R(ind)./(Sigma(ind).^2));
if(isempty(varargout{3}))
varargout{3} = zeros(1,0);
end
% dJ_TdSigma
varargout{4} = transpose(- (((T(ind) - Tm(ind)).^2)./(Sigma(ind).^3)) - (((R(ind)).^2)./(Sigma(ind).^3)) + 2./Sigma(ind));
if(isempty(varargout{4}))
varargout{4} = zeros(1,0);
end
if nargout >= 5
%ddJ_TdTdT
varargout{5} = transpose(1./(Sigma(ind).^2));
if(isempty(varargout{5}))
varargout{5} = zeros(1,0);
end
%ddJ_TdTdR
varargout{6} = transpose(zeros(size(T(ind))));
if(isempty(varargout{6}))
varargout{6} = zeros(1,0);
end
%ddJ_TdRdR
varargout{7} = transpose(1./(Sigma(ind).^2));
if(isempty(varargout{7}))
varargout{7} = zeros(1,0);
end
%ddJ_TdTdSigma
varargout{8} = transpose(-2*(T(ind) - Tm(ind))./(Sigma(ind).^3));
if(isempty(varargout{8}))
varargout{8} = zeros(1,0);
end
%ddJ_TdRdSigma
varargout{9} = transpose(-2*(R(ind))./(Sigma(ind).^3));
if(isempty(varargout{9}))
varargout{9} = zeros(1,0);
end
%ddJ_TdSigmadSigma
varargout{10} = transpose(3*(((T(ind) - Tm(ind)).^2)./(Sigma(ind).^4)) + 3*(((R(ind)).^2)./(Sigma(ind).^4)) - 2./(Sigma(ind).^2));
if(isempty(varargout{10}))
varargout{10} = zeros(1,0);
end
if nargout >= 11
%dddJ_TdTdTdT
varargout{11} = transpose(zeros(size(T(ind))));
if(isempty(varargout{11}))
varargout{11} = zeros(1,0);
end
%dddJ_TdTdTdR
varargout{12} = transpose(zeros(size(T(ind))));
if(isempty(varargout{12}))
varargout{12} = zeros(1,0);
end
%dddJ_TdTdRdR
varargout{13} = transpose(zeros(size(T(ind))));
if(isempty(varargout{13}))
varargout{13} = zeros(1,0);
end
%dddJ_TdRdRdR
varargout{14} = transpose(zeros(size(T(ind))));
if(isempty(varargout{14}))
varargout{14} = zeros(1,0);
end
%dddJ_TdTdTdSigma
varargout{15} = transpose(- 2./(Sigma(ind).^3));
if(isempty(varargout{15}))
varargout{15} = zeros(1,0);
end
%dddJ_TdTdRdSigma
varargout{16} = transpose(zeros(size(T(ind))));
if(isempty(varargout{16}))
varargout{16} = zeros(1,0);
end
%dddJ_TdRdRdSigma
varargout{17} = transpose(- 2./(Sigma(ind).^3));
if(isempty(varargout{17}))
varargout{17} = zeros(1,0);
end
%dddJ_TdTdSigmadSigma
varargout{18} = transpose(6*(T(ind) - Tm(ind))./(Sigma(ind).^4));
if(isempty(varargout{18}))
varargout{18} = zeros(1,0);
end
%dddJ_TdRdSigmadSigma
varargout{19} = transpose(6*(R(ind))./(Sigma(ind).^4));
if(isempty(varargout{19}))
varargout{19} = zeros(1,0);
end
%dddJ_TdSigmadSigmadSigma
varargout{20} = transpose(- 12*(((T(ind) - Tm(ind)).^2)./(Sigma(ind).^5)) - 12*(((R(ind)).^2)./(Sigma(ind).^5)) + 4./(Sigma(ind).^3));
if(isempty(varargout{20}))
varargout{20} = zeros(1,0);
end
if nargout >= 20
%ddddJ_TdTdTdTdT
varargout{21} = transpose(zeros(size(T(ind))));
if(isempty(varargout{21}))
varargout{21} = zeros(1,0);
end
%ddddJ_TdTdTdTdR
varargout{22} = transpose(zeros(size(T(ind))));
if(isempty(varargout{22}))
varargout{22} = zeros(1,0);
end
%ddddJ_TdTdTdRdR
varargout{23} = transpose(zeros(size(T(ind))));
if(isempty(varargout{23}))
varargout{23} = zeros(1,0);
end
%ddddJ_TdTdRdRdR
varargout{24} = transpose(zeros(size(T(ind))));
if(isempty(varargout{24}))
varargout{24} = zeros(1,0);
end
%ddddJ_TdRdRdRdR
varargout{25} = transpose(zeros(size(T(ind))));
if(isempty(varargout{25}))
varargout{25} = zeros(1,0);
end
%ddddJ_TdTdTdTdSigma
varargout{26} = transpose(zeros(size(T(ind))));
if(isempty(varargout{26}))
varargout{26} = zeros(1,0);
end
%ddddJ_TdTdTdRdSigma
varargout{27} = transpose(zeros(size(T(ind))));
if(isempty(varargout{27}))
varargout{27} = zeros(1,0);
end
%ddddJ_TdTdRdRdSigma
varargout{28} = transpose(zeros(size(T(ind))));
if(isempty(varargout{28}))
varargout{28} = zeros(1,0);
end
%ddddJ_TdRdRdRdSigma
varargout{29} = transpose(zeros(size(T(ind))));
if(isempty(varargout{29}))
varargout{29} = zeros(1,0);
end
%ddddJ_TdTdTdSigmadSigma
varargout{30} = transpose(6./(Sigma(ind).^4));
if(isempty(varargout{30}))
varargout{30} = zeros(1,0);
end
%ddddJ_TdTdRdSigmadSigma
varargout{31} = transpose(zeros(size(T(ind))));
if(isempty(varargout{31}))
varargout{31} = zeros(1,0);
end
%ddddJ_TdRdRdSigmadSigma
varargout{32} = transpose(6./(Sigma(ind).^4));
if(isempty(varargout{32}))
varargout{32} = zeros(1,0);
end
%ddddJ_TdTdSigmadSigmadSigma
varargout{33} = transpose(- 24*((T(ind) - Tm(ind))./(Sigma(ind).^5)));
if(isempty(varargout{33}))
varargout{33} = zeros(1,0);
end
%ddddJ_TdRdSigmadSigmadSigma
varargout{34} = transpose(- 24*((R(ind))./(Sigma(ind).^5)));
if(isempty(varargout{34}))
varargout{34} = zeros(1,0);
end
%ddddJ_TdSigmadSigmadSigmadSigma
varargout{35} = transpose(60*(((T(ind) - Tm(ind)).^2)./(Sigma(ind).^6)) + 60*(((R(ind)).^2)./(Sigma(ind).^6)) - 12./(Sigma(ind).^4));
if(isempty(varargout{35}))
varargout{35} = zeros(1,0);
end
end
end
end
end
end
end