Multiply Vecor by Matrix??!

Well, that´s exactly my question: How do you multiply a vector with a matrix. The result should be also a vector.
Maybe someone could post a little code please!
I was getting very confused writing it myself, because a tut on NeHe says that OpenGL handles marices ‘column-first’?!
My intention is to multiply a vector by the Modelview and ProjecionMatrix.

double v[4]; // the vector
double m[16]; // the matrix
double r[]={0, 0, 0, 0}; // result: matrix x vector

// define v and m here.
for (int i=0; i<=3; i++)
for (int j=0; j<=3; j++)
r[i] = r[i] + m[i+j*4] * v[j];

I never did that, but this should work. I remember that i read this column-first thing in the red book.Column-first means the matrix entries are stored in this order:
[ 0 4 8 12]
[ 1 5 9 13]
[ 2 6 10 14]
[ 3 7 11 15]
Am i right? Then the code above should work. Try it out.

[This message has been edited by plastichead (edited 01-16-2002).]