Version (8.66 KB) by Luca Citi
Matlab versions of the c/c++ operators +=, *= (plus circshift) working in-place and avoiding unneces
Updated 13 Oct 2006

View License

To date I implemented a few functions I needed, i.e. some C-like operators and circshift:
inplace(x, y, '+=');
inplace(x, y, '.*=');
inplace(x, ns, 'circshift');
that do not allocate memory and compared to the matlab equivalent
x = x + y;
x = x .* y;
x = circshift(x, ns);
are (when working with arrays above 300-400 MB) much faster (tenths of second instead of a few minutes) because the pc does not start swapping to the disk.
The matlab equivalents are currently optimized (performed in-place) only in M-code, but not at the command line.
See for a discussion about it.
IMPORTANT: this piece of code infringes the recommendation that mex files should not overwrite input data.

Cite As

Luca Citi (2024). inplace_ (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP2
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Dates and Time in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes