Rank: 1920 based on 38 downloads (last 30 days) and 3 files submitted
photo

Lauri Tamminen

E-mail
Company/University
Pohjola Bank PLC

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Lauri 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: Lauri Tamminen data import, finance, mex, str2double, str2doubleq, parsing 23 15
  • 4.66667
4.7 | 7 ratings
23 Mar 2011 Screenshot Extrimely fast general n-dimensional interpolators Mex C++ interpolator routines for general pp-forms in any dimension. Multithreaded. Author: Lauri Tamminen interpolation, ppform, mex, parallel, multi thread 11 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: Lauri Tamminen data export, data import, mex 4 0
Comments and Ratings by Lauri 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: Lauri Tamminen

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 Lauri's Files View all
Updated File Comment by Comments Rating
22 Apr 2013 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Lauri Tamminen Simon, Jan

The idea is very good, but the results are not reliable. I cannot suggest to use this for productive work. A fair rating is not easy in this case, therefore I've hesitated for some years now.

07 Feb 2013 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Lauri Tamminen Matthias

Hello Lauri,
there are still some differences
isreal(str2doubleq('1')) % 0 instead of 1
str2double('2.236')-str2doubleq('2.236') % is not 0 ('2.235' is fine)
str2double('1,1')-str2doubleq('1,1') % 9,9 instead 0

29 Jan 2013 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Lauri Tamminen Matthias

@Lauri, good work...
Some fine tuning is still required in your function:
str2doubleq('') % NaN instead of 0

31 Oct 2012 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Lauri Tamminen Zhibo

It'd be superb if you could fix the memory leak problem mentioned by Rob, caused by invoking 'mxArrayToString' without calling 'mxFree' to free the memory later on.

09 Oct 2012 Fast String to Double Conversion str2doubleq converts text to double like Matlab's str2double,but up to 400x faster! multithreaded. Author: Lauri Tamminen Simon, Jan

@Lauri: An excellent speedup! Thanks for this update.
The main time of my suggested one-liner in pure M (which looks less cryptic when it is expanded 3 lines) is wasted by SPRINTF. Using CStr2String (see my FEX page) a smarter pre-allocation allows a faster creation of the long string. This is 20% slower than your str2doubleq.

Isn't it surprising, that your parsing is so much faster than ATOF or STRTOD? What could the compiler manufacturers hide in their implementations? The excellent and fast parsing of Google's V8 engine is worth to be inspected: http://code.google.com/p/double-conversion . Rounding problems are handled smart and reliable, what is a very hard and complicated job.

Some fine tuning is required in your function:
str2doubleq('Inf') % NaN instead of Inf
str2doubleq('.i5') % 5 instead of NaN
str2doubleq('i') % 0 instead of 0 + 1i
str2doubleq('1e1.4') % 0.4 instead of NaN
str2doubleq('--1') % -1 instead of NaN
s = '12345678901234567890';
str2doubleq(s) - str2double(s) % 2048
s = '123.123e40';
str2doubleq(s) - str2double(s) % 1.547e26

Mal-formed input is an evil test, I know. But it would be very fine, if your very efficient implementation would be as reliable as Matlab's STR2DOUBLE.

Top Tags Applied by Lauri
mex, data import, data export, finance, interpolation
Files Tagged by Lauri 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: Lauri Tamminen data import, finance, mex, str2double, str2doubleq, parsing 23 15
  • 4.66667
4.7 | 7 ratings
23 Mar 2011 Screenshot Extrimely fast general n-dimensional interpolators Mex C++ interpolator routines for general pp-forms in any dimension. Multithreaded. Author: Lauri Tamminen interpolation, ppform, mex, parallel, multi thread 11 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: Lauri Tamminen data export, data import, mex 4 0

Contact us