Skip to content

Commit

Permalink
Use unique quadrature grid in nfft in case of Gauss-Legendre quadrature
Browse files Browse the repository at this point in the history
  • Loading branch information
num3RIK committed Sep 5, 2023
1 parent 70974cd commit bdc11a7
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions SO3Fun/@SO3FunHarmonic/adjoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,24 @@
rot = orientation(rot,SRight,SLeft);
end

if isa(rot,'quadratureSO3Grid')
if isa(rot,'quadratureSO3Grid')
N = rot.bandwidth;
values = values(rot.iuniqueGrid);
W = rot.weights;
if strcmp(rot.scheme,'ClenshawCurtis')
values = values(rot.iuniqueGrid);
W = rot.weights;
else % use unique grid in NFFT in case of Gauss-Legendre quadrature
if SRight.multiplicityPerpZ*SLeft.multiplicityPerpZ == 1
GC = 1;
else
GC = groupcounts(rot.iuniqueGrid(:));
end
W = rot.weights(rot.ifullGrid).*GC;
end
else
N = get_option(varargin,'bandwidth', getMTEXpref('maxSO3Bandwidth'));
W = get_option(varargin,'weights',1);
end

% use full grid in case of Gauss-Legendre Quadrature grid
if isa(rot,'quadratureSO3Grid') && ~strcmp(rot.scheme,'ClenshawCurtis')
rot = rot.fullGrid;
end

% check for Inf-values (quadrature fails)
if any(isinf(values))
error('There are poles at some quadrature nodes.')
Expand Down Expand Up @@ -173,8 +177,8 @@
sym = [min(SRight.multiplicityPerpZ,2),SRight.multiplicityZ,...
min(SLeft.multiplicityPerpZ,2),SLeft.multiplicityZ];
% if random samples the symmetry properties do not fit
if ~isa(rot,'quadratureSO3Grid')
sym([1,3])=1;
if ~isa(rot,'quadratureSO3Grid') || strcmp(rot.scheme,'GaussLegendre')
sym([1,3]) = 1;
end
% use adjoint representation based coefficient transform
fhat = adjoint_representationbased_coefficient_transform(N,ghat,flags,sym);
Expand Down

0 comments on commit bdc11a7

Please sign in to comment.