From bb3b3f76aacd5e5336b36daa8bd687b957a2ed2d Mon Sep 17 00:00:00 2001 From: peter-nekrasov Date: Mon, 13 Apr 2026 15:14:49 -0500 Subject: [PATCH 1/9] chunkergraph changes --- chunkie/@chunkgraph/chunkgraph.m | 2 +- chunkie/@chunkgraph/findunbounded.m | 4 ++-- chunkie/@chunkgraph/vertextract.m | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chunkie/@chunkgraph/chunkgraph.m b/chunkie/@chunkgraph/chunkgraph.m index d719bd10..3ba6cc72 100644 --- a/chunkie/@chunkgraph/chunkgraph.m +++ b/chunkie/@chunkgraph/chunkgraph.m @@ -304,7 +304,7 @@ end vs = chunkends(chnkr,[1,chnkr.nch]); - vs = vs(:, [1,4]); + vs = real(vs(:, [1,4])); else msg = "CHUNKGRAPH:CONSTRUCTOR: invalid edge descriptor." + ... diff --git a/chunkie/@chunkgraph/findunbounded.m b/chunkie/@chunkgraph/findunbounded.m index 64765d0a..90f5c7d8 100644 --- a/chunkie/@chunkgraph/findunbounded.m +++ b/chunkie/@chunkgraph/findunbounded.m @@ -36,8 +36,8 @@ for jj =1:numel(edges) echnk = cgrph.echnks(abs(edges(jj))); [allrends,alltends] = chunkends(echnk); - ts1 = alltends(:,1,:); - ts2 = alltends(:,2,:); + ts1 = real(alltends(:,1,:)); + ts2 = real(alltends(:,2,:)); angs1 = atan2(ts1(2,:),ts1(1,:)); angs2 = atan2(ts2(2,:),ts2(1,:)); angdiffs = angs2-angs1; diff --git a/chunkie/@chunkgraph/vertextract.m b/chunkie/@chunkgraph/vertextract.m index b4c5e569..558d5719 100644 --- a/chunkie/@chunkgraph/vertextract.m +++ b/chunkie/@chunkgraph/vertextract.m @@ -56,7 +56,7 @@ end % compute the corresponding angles and sort them -ds = [deplus,deminus]; +ds = real([deplus,deminus]); angs = atan2(ds(2,:),ds(1,:)); [angs,isrtededges] = sort(angs); From 35d438aef2d1b66d21bae78744e11b2376f873bf Mon Sep 17 00:00:00 2001 From: peter-nekrasov Date: Mon, 13 Apr 2026 15:31:53 -0500 Subject: [PATCH 2/9] Update flagnear.m --- chunkie/@chunker/flagnear.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chunkie/@chunker/flagnear.m b/chunkie/@chunker/flagnear.m index 5a4ee8e1..bdaf96ca 100644 --- a/chunkie/@chunker/flagnear.m +++ b/chunkie/@chunker/flagnear.m @@ -68,7 +68,7 @@ % get all pairwise distances itarg = inbor(inbor > npt)-npt; - srcs = reshape(chnkr.rstor(:,isrc),dim,1,length(isrc)); + srcs = reshape(real(chnkr.rstor(:,isrc)),dim,1,length(isrc)); targs = reshape(pts(:,itarg),dim,length(itarg),1); dists = reshape(sqrt(sum((bsxfun(@minus,targs,srcs)).^2,1)), ... length(itarg),length(isrc)); From badd098ffd28a04dfb57d0c591b5684c009953b9 Mon Sep 17 00:00:00 2001 From: peter-nekrasov Date: Mon, 13 Apr 2026 15:48:51 -0500 Subject: [PATCH 3/9] update chunkerkerneval and complexificationTest --- chunkie/chunkerkerneval.m | 12 ++++++++++-- devtools/test/complexificationTest.m | 29 ++++++++++++++-------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/chunkie/chunkerkerneval.m b/chunkie/chunkerkerneval.m index 246f2794..326c5343 100644 --- a/chunkie/chunkerkerneval.m +++ b/chunkie/chunkerkerneval.m @@ -162,6 +162,10 @@ error("CHUNKERKERNEVAL: input 4 is not a supported type"); end +if ~isreal(chnkobj.r) && opts_use.accel + warning('WARNING: accel not supported for complex chunkers') +end + if icgrph && mk > 1 ids = chunkgraphinregion(chnkobj,targinfo.r); else @@ -282,7 +286,9 @@ if opts_use.forcepquad optsflag = []; optsflag.fac = opts_use.fac; - flag = flagnear(chnkr0,targinfo.r,optsflag); + chnkrflag = chunkerpoints(struct('r',real(chnkr0.r), ... + 'd',real(chnkr0.d),'d2',real(chnkr0.d2))); + flag = flagnear(chnkrflag,targinfo.r,optsflag); fints(irow0) = fints(irow0) + chnk.chunkerkerneval_smooth(chnkr0,kern0,opdims0,dens0,targinfo0, ... flag,opts_use); @@ -301,7 +307,9 @@ rho = 1.8; optsflag = []; optsflag.rho = rho; -flag = flagnear_rectangle(chnkr0,targinfo0.r,optsflag); +chnkrflag = chunkerpoints(struct('r',real(chnkr0.r), ... + 'd',real(chnkr0.d),'d2',real(chnkr0.d2))); +flag = flagnear_rectangle(chnkrflag,targinfo0.r,optsflag); npoly = chnkr0.k*2; nlegnew = chnk.ellipse_oversample(rho,npoly,opts_use.eps); diff --git a/devtools/test/complexificationTest.m b/devtools/test/complexificationTest.m index 276fb0d3..c020a844 100644 --- a/devtools/test/complexificationTest.m +++ b/devtools/test/complexificationTest.m @@ -16,8 +16,6 @@ function complexificationTest0() zk1 = zks(1); zk2 = zks(2); -close all - a = 3; b = 1/a/2; t0 =-5; @@ -34,6 +32,11 @@ function complexificationTest0() cparams.ifclosed = 0; chnkr = chunkerfuncuni(f, nch, cparams); +rends = chunkends(chnkr,[1,chnkr.nch]); +verts = rends(:,[1,4]); +fchnk{1} = chnkr; +cgrph = chunkgraph(real(verts),[1;2],fchnk); + ddiff = kernel('helmdiff', 'd', zks); sdiff = (-1)*kernel('helmdiff', 's', zks); @@ -43,13 +46,13 @@ function complexificationTest0() K = kernel([ddiff, sdiff; ... dpdiff, spdiff]); -n = 2*chnkr.npt; -sysmat = chunkermat(chnkr, K); +n = 2*cgrph.npt; +sysmat = chunkermat(cgrph, K); sysmat = sysmat - eye(n); %% Analytic solution test -r = chnkr.r; +r = cgrph.r; r0 = [0.1; -3]; s = []; s.r = r0; @@ -58,27 +61,23 @@ function complexificationTest0() dk1 = kernel('helm', 'd', zk1); skp1 = kernel('helm', 'sp', zk1); rhs = complex(zeros(n,1)); -rhs(1:2:end) = sk1.eval(s, chnkr); -rhs(2:2:end) = skp1.eval(s, chnkr); +rhs(1:2:end) = sk1.eval(s, cgrph); +rhs(2:2:end) = skp1.eval(s, cgrph); dens = sysmat \ rhs; -rt = [0.3; 2]; +rt = [[0.3; 2] [-0.5;0.001]]; targ = []; targ.r = rt; Keval = kernel([dk1, (-1)*sk1]); opts = []; -opts.forcesmooth = true; +% opts.forcesmooth = true; opts.accel = false; -pot = chunkerkerneval(chnkr, Keval, dens, targ, opts); +pot = chunkerkerneval(cgrph, Keval, dens, targ, opts); uex = sk1.eval(s, targ); -assert(norm(uex - pot) < 1e-10); - - - - +assert(norm(uex - pot) < 1e-12); end From 75b19a9df36cfaf7c8adde03efab9a99941caf90 Mon Sep 17 00:00:00 2001 From: peter-nekrasov Date: Mon, 13 Apr 2026 16:13:56 -0500 Subject: [PATCH 4/9] FLAM for complex sources in chunkerkerneval --- chunkie/+chnk/chunkerkerneval_smooth.m | 2 +- chunkie/chunkerkerneval.m | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/chunkie/+chnk/chunkerkerneval_smooth.m b/chunkie/+chnk/chunkerkerneval_smooth.m index 5dd487e1..23d88445 100644 --- a/chunkie/+chnk/chunkerkerneval_smooth.m +++ b/chunkie/+chnk/chunkerkerneval_smooth.m @@ -141,7 +141,7 @@ wts = wts(:); if strcmpi(imethod,'flam') - xflam1 = chnkr.r(:,:); + xflam1 = real(chnkr.r(:,:)); xflam1 = repmat(xflam1,opdims(2),1); xflam1 = reshape(xflam1,chnkr.dim,numel(xflam1)/chnkr.dim); diff --git a/chunkie/chunkerkerneval.m b/chunkie/chunkerkerneval.m index 326c5343..417b1889 100644 --- a/chunkie/chunkerkerneval.m +++ b/chunkie/chunkerkerneval.m @@ -162,8 +162,12 @@ error("CHUNKERKERNEVAL: input 4 is not a supported type"); end -if ~isreal(chnkobj.r) && opts_use.accel - warning('WARNING: accel not supported for complex chunkers') +if ~isreal(chnkobj.r) && (opts_use.accel || opts_use.forcefmm) + warning('WARNING: fmm not supported for complex chunkers') +end + +if ~isreal(targobj.r) && (opts_use.accel || opts_use.forcefmm || opts_use.flam) + warning('WARNING: accel not supported for complex targets') end if icgrph && mk > 1 From c677a5ece71eee1f384c153c36c036691b61961b Mon Sep 17 00:00:00 2001 From: peter-nekrasov Date: Mon, 13 Apr 2026 16:34:37 -0500 Subject: [PATCH 5/9] check targinfo in chunkerkerneval --- chunkie/chunkerkerneval.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chunkie/chunkerkerneval.m b/chunkie/chunkerkerneval.m index 417b1889..34d721ec 100644 --- a/chunkie/chunkerkerneval.m +++ b/chunkie/chunkerkerneval.m @@ -166,7 +166,7 @@ warning('WARNING: fmm not supported for complex chunkers') end -if ~isreal(targobj.r) && (opts_use.accel || opts_use.forcefmm || opts_use.flam) +if ~isreal(targinfo.r) && (opts_use.accel || opts_use.forcefmm || opts_use.flam) warning('WARNING: accel not supported for complex targets') end From 539a08a0cc717439ae1c977f75dd4e2801681ac1 Mon Sep 17 00:00:00 2001 From: peter-nekrasov Date: Tue, 14 Apr 2026 15:57:43 -0500 Subject: [PATCH 6/9] update warning message --- chunkie/chunkerkerneval.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chunkie/chunkerkerneval.m b/chunkie/chunkerkerneval.m index 34d721ec..fdcc25a8 100644 --- a/chunkie/chunkerkerneval.m +++ b/chunkie/chunkerkerneval.m @@ -163,11 +163,11 @@ end if ~isreal(chnkobj.r) && (opts_use.accel || opts_use.forcefmm) - warning('WARNING: fmm not supported for complex chunkers') + warning('fmm not supported for complex chunkers') end if ~isreal(targinfo.r) && (opts_use.accel || opts_use.forcefmm || opts_use.flam) - warning('WARNING: accel not supported for complex targets') + warning('accel not supported for complex targets') end if icgrph && mk > 1 From 11b8a7d809dee7301d147a18ded3b75afc2ad56d Mon Sep 17 00:00:00 2001 From: peter-nekrasov Date: Fri, 24 Apr 2026 15:24:29 -0500 Subject: [PATCH 7/9] updated flagging in chunkerkernevalmat --- chunkie/@chunker/flagnear.m | 2 +- chunkie/chunkerkernevalmat.m | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/chunkie/@chunker/flagnear.m b/chunkie/@chunker/flagnear.m index bdaf96ca..a8b243f8 100644 --- a/chunkie/@chunker/flagnear.m +++ b/chunkie/@chunker/flagnear.m @@ -69,7 +69,7 @@ % get all pairwise distances itarg = inbor(inbor > npt)-npt; srcs = reshape(real(chnkr.rstor(:,isrc)),dim,1,length(isrc)); - targs = reshape(pts(:,itarg),dim,length(itarg),1); + targs = reshape(real(pts(:,itarg)),dim,length(itarg),1); dists = reshape(sqrt(sum((bsxfun(@minus,targs,srcs)).^2,1)), ... length(itarg),length(isrc)); diff --git a/chunkie/chunkerkernevalmat.m b/chunkie/chunkerkernevalmat.m index 2ec293f3..7c27697a 100644 --- a/chunkie/chunkerkernevalmat.m +++ b/chunkie/chunkerkernevalmat.m @@ -212,7 +212,7 @@ optsadap = []; optsadap.eps = eps; -if corrections +if corrections || nonsmoothonly mat = sparse(nout,icollocs(end)-1); else mat = zeros(nout,icollocs(end)-1); @@ -267,7 +267,9 @@ % TODO: switch to oversampling version with bounding ellipse like chunkerkerneval optsflag = []; optsflag.fac = fac; -flag = flagnear(chnkr0,targinfo0.r,optsflag); +chnkrflag = chunkerpoints(struct('r',real(chnkr0.r), ... + 'd',real(chnkr0.d),'d2',real(chnkr0.d2))); +flag = flagnear(chnkrflag,targinfo0.r,optsflag); if forcepquad spmat = chunkerkernevalmat_pquad(chnkr0,kern0,opdims0, ... From e45233da09e86c385dddd44fbbce2f6ed7242ae7 Mon Sep 17 00:00:00 2001 From: peter-nekrasov Date: Fri, 24 Apr 2026 18:19:55 -0500 Subject: [PATCH 8/9] chunkerkernevalmat still doing weird stuff --- chunkie/chunkerkernevalmat.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chunkie/chunkerkernevalmat.m b/chunkie/chunkerkernevalmat.m index 7c27697a..1b442d9b 100644 --- a/chunkie/chunkerkernevalmat.m +++ b/chunkie/chunkerkernevalmat.m @@ -269,7 +269,7 @@ optsflag = []; optsflag.fac = fac; chnkrflag = chunkerpoints(struct('r',real(chnkr0.r), ... 'd',real(chnkr0.d),'d2',real(chnkr0.d2))); -flag = flagnear(chnkrflag,targinfo0.r,optsflag); +flag = flagnear(chnkrflag,real(targinfo0.r),optsflag); if forcepquad spmat = chunkerkernevalmat_pquad(chnkr0,kern0,opdims0, ... From bf1f3282a5e2b675a7cfd643835b4e633cd028cd Mon Sep 17 00:00:00 2001 From: peter-nekrasov Date: Mon, 27 Apr 2026 16:23:38 -0500 Subject: [PATCH 9/9] Update chunkerkerneval_smooth.m --- chunkie/+chnk/chunkerkerneval_smooth.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chunkie/+chnk/chunkerkerneval_smooth.m b/chunkie/+chnk/chunkerkerneval_smooth.m index 23d88445..ff611b19 100644 --- a/chunkie/+chnk/chunkerkerneval_smooth.m +++ b/chunkie/+chnk/chunkerkerneval_smooth.m @@ -62,7 +62,7 @@ % these are automatically ignored by the fmm and % in chunkermat corrections if ~(strcmpi(imethod,'fmm') && isempty(flag)) - flagslf = chnk.flagself(targinfo.r, chnkr.r, 1e-14*diam); + flagslf = chnk.flagself(real(targinfo.r), real(chnkr.r), 1e-14*diam); if isempty(flagslf) selfzero = sparse(opdims(1)*size(targinfo.r(:,:),2), ... opdims(2)*chnkr.npt);