views:

58

answers:

4

There is a program I would like to understand a bit more of, but most of it is in ASM. MatrixMultiply

The reference page is here.

I understand C++, but the ASM part is a bit vague. Can someone explain?

A: 

I don't know any programs who convert ASM to PHP.

But there are a good question about converting ASM to C in the stack.

Dorian
excellent. Yeah I was wondering if someone was going to laugh too.
Talvi Watia
In theory, all is possible but, yes, I was laughting too when I read the title :D.
Dorian
+1  A: 

The search keyword you are looking for is decompiler. AFAIK, You may not be able to convert x86 assembly to PHP decompiler because no one might not found need for it.

If your purpose is to understand the assembly code. There are lot of decompilers for C. You can understand reading the C code.

claws
+3  A: 

This program uses SIMD (i.e. SSE) instructions to optimize matrix multiplication. There is no sense in thinking of a way to convert this to PHP, as it is an interpreted language - you don't have access to the CPU in that way, heck, PHP might run on a CPU who does not even provide these instructions.

If you want to do this in PHP, you can either create a simple, non-optimized routine for matrix multiplication or develop an extension. In the latter case, I'd suggest using one of the canonical BLAS implementations, though, instead of some random code snippet from the web. See http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms

Jim Brissom
A: 

There is a PHP port of the JAMA standard matrix class for Java over on PHPMath, which provides a suite of methods for martix addition, subtraction, multiplication, division, transform, etc. It's coded in PHP4, but doesn't take a lot of work to convert to PHP5.

While not directly answering your question about ASM to PHP, it may be useful to give you a ready-built PHP MatrixMultiply

Mark Baker