From d5c275da579158257187979adfc6d14610c86294 Mon Sep 17 00:00:00 2001 From: Tristan Goodwill <48371600+tristangdwl@users.noreply.github.com> Date: Thu, 17 Oct 2024 22:43:17 -0700 Subject: [PATCH 1/2] added shift eval support to kernel plus --- chunkie/@kernel/plus.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/chunkie/@kernel/plus.m b/chunkie/@kernel/plus.m index 7ccfc4d..7c56621 100644 --- a/chunkie/@kernel/plus.m +++ b/chunkie/@kernel/plus.m @@ -8,12 +8,30 @@ assert(f.opdims(1) == g.opdims(1) && f.opdims(2) == g.opdims(2), ... 'kernel dimensions must agree to add'); f.name = ['custom ',f.name,' ',g.name]; + + if(isa(f.shifted_eval, 'function_handle')) + if(isa(g.shifted_eval, 'function_handle')) + f.shifted_eval = @(varargin) f.shifted_eval(varargin{:})+g.shifted_eval(varargin{:}); + else + f.shifted_eval = @(varargin) f.shifted_eval(varargin{:})+g.eval(varargin{1:2}); + end + else + if(isa(g.shifted_eval, 'function_handle')) + f.shifted_eval = @(varargin) f.eval(varargin{1:2})+g.shifted_eval(varargin{:}); + else + f.shifted_eval = []; + end + end + + f.eval = @(varargin) g.eval(varargin{:}) + f.eval(varargin{:}); if (isa(g.fmm,'function_handle') && isa(f.fmm,'function_handle')) f.fmm = @(varargin) g.fmm(varargin{:}) + f.fmm(varargin{:}); else f.fmm = []; end + + if or(f.isnan,g.isnan) f = kernel.nans(f.opdims(1),f.opdims(2)); end From f595ea08139aac53f4fdb403b28413ca5e44ec5c Mon Sep 17 00:00:00 2001 From: Tristan Goodwill <48371600+tristangdwl@users.noreply.github.com> Date: Thu, 17 Oct 2024 22:44:38 -0700 Subject: [PATCH 2/2] fixed white space --- chunkie/@kernel/plus.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/chunkie/@kernel/plus.m b/chunkie/@kernel/plus.m index 7c56621..132a880 100644 --- a/chunkie/@kernel/plus.m +++ b/chunkie/@kernel/plus.m @@ -8,7 +8,7 @@ assert(f.opdims(1) == g.opdims(1) && f.opdims(2) == g.opdims(2), ... 'kernel dimensions must agree to add'); f.name = ['custom ',f.name,' ',g.name]; - + if(isa(f.shifted_eval, 'function_handle')) if(isa(g.shifted_eval, 'function_handle')) f.shifted_eval = @(varargin) f.shifted_eval(varargin{:})+g.shifted_eval(varargin{:}); @@ -22,8 +22,7 @@ f.shifted_eval = []; end end - - + f.eval = @(varargin) g.eval(varargin{:}) + f.eval(varargin{:}); if (isa(g.fmm,'function_handle') && isa(f.fmm,'function_handle')) f.fmm = @(varargin) g.fmm(varargin{:}) + f.fmm(varargin{:}); @@ -31,7 +30,6 @@ f.fmm = []; end - if or(f.isnan,g.isnan) f = kernel.nans(f.opdims(1),f.opdims(2)); end