Skip to content

Commit

Permalink
Merge pull request #2442 from chebfun/feature-faster-chebfun3-feval
Browse files Browse the repository at this point in the history
Vectorize chebfun3/feval in the case of unstructured evaluation points
  • Loading branch information
bhashemi committed Aug 3, 2023
2 parents 859a50c + 1d84774 commit b4da331
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions @chebfun3/feval.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@
zVec = zVec.';
end

outVec = zeros(size(xVec));
colsVals = f.cols(xVec); % So, colsVals(:,j) = feval(f.cols(:,j),xVec).
rowsVals = f.rows(yVec);
tubesVals = f.tubes(zVec);
for i = 1:size(xVec, 1) % TODO: How to vectorize this?
outVec(i) = chebfun3.txm(chebfun3.txm(chebfun3.txm(f.core,...
colsVals(i,:), 1), rowsVals(i,:), 2), tubesVals(i,:), 3);
end

txm1 = chebfun3.txm(f.core, colsVals, 1);
txm2 = pagemtimes(permute(txm1, [3 2 1]), permute(rowsVals, [2 3 1]));
txm3 = sum(txm2 .* permute(tubesVals, [2 3 1]), 1);
outVec = reshape(txm3, size(xVec));

if ( (m == 1) && (n > 1) )
outVec = outVec.';
Expand Down

0 comments on commit b4da331

Please sign in to comment.