Quantcast
Channel: Comparing BSXFUN and REPMAT - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Comparing BSXFUN and REPMAT

$
0
0

Few questions were asked before on comparisons between bsxfun and repmat for performance.

  • One of them was: Matlab - bsxfun no longer faster than repmat?. This one tried to investigate performance comparisons between repmat and bsxfun, specific to performing subtraction of an input array's mean along the columns from the input array itself and as such would explore only the @minus part of bsxfun against its repmat equivalent.
  • Another was : In Matlab, when is it optimal to use bsxfun?. That one tried to do the same operation of subtraction by the mean along columns and didn't expand onto other built-in operations either.

With this post, I am trying to investigate the performance numbers between bsxfun and repmat to cover all the bsxfun built-ins to sort of give it a wider perspective as both of these present good vectorized solutions.

Specifically, my questions with this post are:

  1. How do the various built-in operations with bsxfun perform against repmat equivalents? bsxfun supports floating point operations like @plus, @minus, @times, etc. and also relational and logical operations like @ge, @and, etc. So, are there specific built-ins that would give me noticeable speedups with bsxfun than using their repmat equivalents?

  2. Loren in her blog post has benchmarked repmat against bsxfun with timing @() A - repmat(mean(A),size(A,1),1) against @() bsxfun(@minus,A,mean(A)) respectively. If I need to cover benchmarking for all the built-ins, can I use some other comparison model that would work with floating point, relational and logical operations?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images