Skip to content

Commit

Permalink
add support for quadrature weights
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfHielscher committed Feb 2, 2018
1 parent 1fdaf92 commit f3b732c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions PoleFigureAnalysis/@MLSSolver/MLSSolver.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@
solver.ghostCorrection = ~check_option(varargin,'noGhostCorrection');

% compute quadrature weights
solver.weights = cellfun(@(r) calcQuadratureWeights(r),solver.pf.allR,'UniformOutput',false);

if length(solver.SS) == 1
solver.weights = cellfun(@(r) calcQuadratureWeights(r),solver.pf.allR,'UniformOutput',false);
else
solver.weights = num2cell(1./length(pf,[]));
end
end

function delete(solver)
Expand Down
2 changes: 1 addition & 1 deletion PoleFigureAnalysis/@MLSSolver/calcODF.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

% compute residual error
for i = 1:solver.pf.numPF
err(i) = norm(solver.u{i}) ./ norm(solver.pf.allI{i}(:));
err(i) = norm(solver.u{i}) ./ norm(solver.pf.allI{i}(:) .*solver.weights{i} );
end
fprintf(format,xnum2str(iter,[],2),err);
if (lasterr-err)/err < 0.05, break; end
Expand Down
4 changes: 2 additions & 2 deletions PoleFigureAnalysis/@MLSSolver/doIter.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function doIter(solver)
v = zeros(size(c));
for i = 1:n
% step 9 - vt_i = alpha_i * \Psi_i (u_i odot w_i)
vti = alpha(i) * solver.Mtv(u{i},i);
vti = alpha(i) * solver.Mtv(u{i}.*solver.weights{i},i);

% step 10 - v = vt - alpha_i * <vt,c> * a_i
v = v - vti + alpha(i) * (vti.' * c) * solver.a{i};
Expand All @@ -38,7 +38,7 @@ function doIter(solver)

% step 14 tu_i = talpha_i Psi_i tc - I_i
for i = 1:n
tu{i} = (talpha(i) * solver.Mv(tc,i) - solver.pf.allI{i}(:));% .* solver.weights{i};
tu{i} = (talpha(i) * solver.Mv(tc,i) - solver.pf.allI{i}(:)) .* solver.weights{i};
end

% step 15 - maximum stepsize
Expand Down
2 changes: 1 addition & 1 deletion PoleFigureAnalysis/@MLSSolver/initIter.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function initIter(solver)
% todo: regularization

% step 5 u_i = (alpha_i Psi_i c - I_i) .* weights
solver.u{i} = (solver.Mv(solver.c,i) * solver.alpha(i) - I_i);% .* solver.weights{i};
solver.u{i} = (solver.Mv(solver.c,i) * solver.alpha(i) - I_i) .* solver.weights{i};

end

Expand Down

0 comments on commit f3b732c

Please sign in to comment.