Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorize chebfun3/feval in the case of unstructured evaluation points #2442

Merged
merged 1 commit into from
Aug 3, 2023

Conversation

danfortunato
Copy link
Contributor

This pull request significantly speeds up chebfun3's feval when the evaluation points are unstructured (i.e. not a tensor-product grid). See below for a comparison:

f = chebfun3(@(x,y,z) sin(x.*y.*z));

n = 50000;
x = 2*rand(n,1)-1;
y = 2*rand(n,1)-1;
z = 2*rand(n,1)-1;

tic
ff = f(x,y,z);
toc

% Before this PR: 2.247853s
% After this PR:  0.028487s

@bhashemi bhashemi self-assigned this Jul 31, 2023
@bhashemi
Copy link
Contributor

bhashemi commented Aug 2, 2023

All test pass and I am, in principle, happy to merge this. The only thing I am not sure about is the fact that the new code will not work on MATLAB versions earlier than 2020b because pagemtimes was introduced then. Can someone please remind me of our procedure in such situations? Do we normally add something as follows:

 if ~isMATLABReleaseOlderThan("R2022a"). % Check if `pagemtimes' is available 

     "then use pagemtimes like this pull request"
else
     "use old lines which are removed in this pull request"
end

or we should not worry about backward compatibility? Perhaps @trefethen or @nickhale can comment on this?

@trefethen
Copy link
Contributor

My feeling is that 2020b would be a big concern if this were a core part of Chebfun, but since other things don't depend so much on Chebfun3, it's ok.

@bhashemi bhashemi merged commit b4da331 into master Aug 3, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants