I often optimize some matlab routines by implementing them in mex.
This works fine so far - but whenever creating the return mxArray, it gets preinitialized as I build it with mxCreateNumericArray.
In most of my work, I do not need the memory to be preallocated (zeroed). So sad - I can not find a matching command for that purpose (allocating memory without zeroing).
So my question could be answered in two ways:
mxArray without zeroing the contents?mxArray without allocating memory for Pr (and Pi)-field, which I would later allocate by mxMalloc.One idea is building the Array with size (0,0) - but is this the ultimate solution?
I guess, building a size (0,0) matrix is as close as it gets to a kind of "empty" constructor.
Afterwards you'll have to resize the array using mxMalloc or mxRealloc.
I doubt this will result in a noticable performance gain though, unless you're handling really large arrays.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With