Problem 1259. It's race time again! Write a function that is at least twice as fast as the test suite call of repmat().
Given an input element x, and the dimensions, (m, n) return a matrix of size m x n filled with element x. This must be done in less than half the time that repmat(x, m, n) takes. This is the sequel to http://www.mathworks.com/matlabcentral/cody/problems/1237-it-s-race-time-write-a-faster-function-than-the-test-suite-call-of-unique.
Example: Input: repl_mat(2, 2, 5) Output: [2, 2, 2, 2, 2; 2, 2, 2, 2, 2];
Solution Stats
Problem Comments
-
2 Comments
This doesn't seem to be possible anymore: http://stackoverflow.com/questions/28722723/matlab-bsxfun-no-longer-faster-than-repmat. Any chance of updating the problem with looser time tolerances?
This problem is meanless!
The solutions passed are not always fast than repmat, or just cheat(ex. using "tic")
Solution Comments
Show commentsProblem Recent Solvers21
Suggested Problems
-
Swap the first and last columns
20450 Solvers
-
Sort a list of complex numbers based on far they are from the origin.
5637 Solvers
-
2586 Solvers
-
3284 Solvers
-
Deleting an element in a matrix
467 Solvers
More from this Author7
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!