Rank: 1765 based on 84 downloads (last 30 days) and 3 files submitted
photo

Quant Guy

E-mail

Personal Profile:

 

Watch this Author's files

 

Files Posted by Quant Guy View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
10 Oct 2012 Screenshot Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Quant Guy data import, finance, mex, str2double, str2doubleq, parsing 55 20
  • 4.375
4.4 | 10 ratings
23 Mar 2011 Screenshot Extrimely fast general n-dimensional interpolators Mex C++ interpolator routines for general pp-forms in any dimension. Multithreaded. Author: Quant Guy interpolation, ppform, mex, parallel, multi thread 19 3
  • 4.0
4.0 | 1 rating
15 Oct 2010 API to transfer references of C-classes to Matlab and back Interface to provide a way to transfer custom C/C++ class instance references to Matlab and to Mex Author: Quant Guy data export, data import, mex 10 0
Comments and Ratings by Quant Guy View all
Updated File Comments Rating
06 Oct 2012 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Quant Guy

I submitted the new version of the function with much more efficient algorithm and more neater code.

I think that the new version (after review process) is the most optimal way string to double conversion can be done in any circumstances. Performance gains have risen from about 20x to about 80x-100x!

Also for Jan: New version is much faster than your (cryptic) one liner!

01 Oct 2010 Cell2Vec Concatenate cell elements to a vector - fast C-Mex Author: Jan Simon

This is very useful tool and important submission. I was able trivially to reimplement the out of the box implementation of cell2mat which is very slow and got huge increases in overall speed!!

Comments and Ratings on Quant Guy 's Files View all
Updated File Comment by Comments Rating
23 Oct 2014 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Quant Guy Matthew Gunn

@Jonathan
I think you're right. A hacky fix is to change the call to mxArrayToString.

char *freeme = mxArrayToString(mxStr);
const char *s = freeme;
...
mxFree(freeme)

the code modifies the pointer s, so calling mxFree on s causes a segfault! This little dance gets around it.

23 Oct 2014 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Quant Guy Matthew Gunn

For anyone that requires str2doubleq to return NaN rather than 0 when called on a blank string (eg. str2doubleq('')), you can add the line:
if (!(*s)) return false;

in the function parse_to_double right after the line "if (!s) return false;"

01 Jul 2014 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Quant Guy Jonathan

Upon further testing, this function leaks tons of memory. The function calls mxArrayToString() but does not call mxFree(), as required to release memory allocated to the array. In no time at all, repeated calls quickly exceed my machine's 72GB of RAM.

23 Jun 2014 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Quant Guy Jonathan

When Quant Guy said it was faster than Matlab's str2double, he wasn't joking!!!

28 Jan 2014 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Quant Guy Christophe Trefois

@Matthias,

This is by design of the isreal function.

From the doc,:
If A has a stored imaginary part of value 0, isreal(A) returns logical 0 (false).

You may however expect that the returned number is not complex when the imaginary part is 0.

Contact us