Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
brudfors committed Nov 15, 2019
1 parent 47dbdea commit 1ba210d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified spm_multireg.m
100644 → 100755
Empty file.
14 changes: 11 additions & 3 deletions spm_multireg_par.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,17 @@
if ~isfield(sett,'optim')
sett.optim = struct;
end
if ~isfield(sett.model,'scal')
% Scaling of GN updates
sett.optim.scal = 1.0;
if ~isfield(sett.optim,'nls_bf')
% Scaling of q GN updates
sett.optim.nls_bf = 6;
end
if ~isfield(sett.optim,'scal_q')
% Scaling of q GN updates
sett.optim.scal_q = 1.0;
end
if ~isfield(sett.optim,'scal_v')
% Scaling of v GN updates
sett.optim.scal_v = 1.0;
end

%------------------
Expand Down
6 changes: 3 additions & 3 deletions spm_multireg_updt.m
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
g = double(dM'*g);
H = dM'*H*dM;
H = H + eye(numel(q))*(norm(H)*1e-6 + 0.1);
q = q + sett.optim.scal*(H\g);
q = q + sett.optim.scal_q*(H\g);
datn.q = q;
end
%==========================================================================
Expand Down Expand Up @@ -360,7 +360,7 @@
g = double(dM'*g);
H = dM'*H*dM;
H = H + eye(numel(q))*(norm(H)*1e-6 + 0.1);
q = q + sett.optim.scal*(H\g);
q = q + sett.optim.scal_q*(H\g);
datn.q = q;
end
%==========================================================================
Expand Down Expand Up @@ -395,7 +395,7 @@
H = w.*H0;
u0 = spm_diffeo('vel2mom', v, sett.var.v_settings); % Initial momentum
datn.E(2) = 0.5*sum(u0(:).*v(:)); % Prior term
v = v - sett.optim.scal*spm_diffeo('fmg',H, g + u0, [sett.var.v_settings sett.shoot.s_settings]); % Gauss-Newton update
v = v - sett.optim.scal_v*spm_diffeo('fmg',H, g + u0, [sett.var.v_settings sett.shoot.s_settings]); % Gauss-Newton update

if sett.var.d(3)==1, v(:,:,:,3) = 0; end % If 2D
if sett.var.v_settings(1)==0 % Mean displacement should be 0
Expand Down

0 comments on commit 1ba210d

Please sign in to comment.