I don't have any specific info for you, sorry.
I just think that a binary program (not a php script) will be much faster
at heavy mathematical calculations than PHP would be.
I think you will find a lot of information if you use a search engine like www.altavista.com
There are bound to be ready-made routines in C or C++ to do almost what you want.