-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This involved transferinf and renaming functions from the +invert package. The README was updated accordingly. `run_inversion_d.m` was also added back to the program.
- Loading branch information
Showing
9 changed files
with
118 additions
and
10 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
|
||
% RUN_INVERSIONS_D Invert multuple times to determine CPU time. | ||
% Author: Timothy Sipkens, 2019-07-22 | ||
%=========================================================================% | ||
|
||
%% Initial guess for iterative schemes | ||
b_init = b; | ||
b_init(b_init<(1e-5*max(b_init))) = 0; | ||
x_init = interp2(grid_b.edges{2}',grid_b.edges{1}',... | ||
reshape(full(b_init)./(A*ones(size(x0))),grid_b.ne),... | ||
grid_x.elements(:,2),grid_x.elements(:,1)); | ||
x_init(isnan(x_init)) = 0; | ||
x_init(isinf(x_init)) = 0; | ||
x_init = sparse(max(0,x_init)); | ||
chi.init = norm(x0-x_init); | ||
x_init_m = grid_x.marginalize(x_init); | ||
|
||
|
||
for ii=1:20 | ||
|
||
%% Least squares | ||
disp('Performing LS inversion...'); | ||
tic; | ||
x_LSQ = invert.lsq(A,b,'interior-point'); | ||
t.LSQ(ii) = toc; | ||
disp('Inversion complete.'); | ||
disp(' '); | ||
|
||
chi.LSQ = norm(x0-x_LSQ); | ||
|
||
|
||
%% Tikhonov (0th) implementation | ||
disp('Performing Tikhonov (0th) regularization...'); | ||
tic; | ||
x_tk0 = invert.tikhonov(Lb*A,Lb*b,n_x(1),lambda_tk0,0); | ||
t.tk0(ii) = toc; | ||
disp('Inversion complete.'); | ||
disp(' '); | ||
|
||
chi.tk0(ii) = norm(x0-x_tk0); | ||
|
||
|
||
%% Tikhonov (1st) implementation | ||
disp('Performing Tikhonov (1st) regularization...'); | ||
tic; | ||
x_tk1 = invert.tikhonov(Lb*A,Lb*b,n_x(1),lambda_tk1,1); | ||
t.tk1(ii) = toc; | ||
disp('Inversion complete.'); | ||
disp(' '); | ||
|
||
chi.tk1(ii) = norm(x0-x_tk1); | ||
|
||
|
||
%% Tikhonov (2nd) implementation | ||
disp('Performing Tikhonov (2nd) regularization...'); | ||
% lambda_tk2 = 8e1; | ||
tic; | ||
x_tk2 = invert.tikhonov(Lb*A,Lb*b,n_x(1),lambda_tk2,2); | ||
t.tk2(ii) = toc; | ||
disp('Inversion complete.'); | ||
disp(' '); | ||
|
||
chi.tk2(ii) = norm(x0-x_tk2); | ||
|
||
|
||
%% MART, Maximum entropy regularized solution | ||
|
||
disp('Performing MART...'); | ||
tic; | ||
x_mart = invert.mart(A,b,x_init,299); | ||
t.mart(ii) = toc; | ||
disp('Inversion complete.'); | ||
disp(' '); | ||
|
||
chi.mart = norm(x0-x_mart); | ||
|
||
|
||
%% Twomey | ||
disp('Performing Twomey...'); | ||
tic; | ||
x_two = invert.twomey(A,b,x_init,500); | ||
t.two(ii) = toc; | ||
disp('Completed Twomey.'); | ||
disp(' '); | ||
|
||
chi.two = norm(x0-x_two); | ||
|
||
|
||
%% Twomey-Markowski-Buckley | ||
disp('Performing Twomey-Markowski...'); | ||
tic; | ||
x_two_mh = invert.twomark(A,b,Lb,n_x(1),... | ||
x_init,35,'Buckley',1/Sf_two_mh); | ||
t.two_mh(ii) = toc; | ||
disp('Completed Twomey-Markowski.'); | ||
|
||
chi.two_mh = norm(x0-x_two_mh); | ||
|
||
|
||
end | ||
|
||
|
||
|