"Zhang Le" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > I did a small benchmark of matrix-vector multiply operation using > Numeric module. I'm a bit suprised to find matrix*col-vector is much > faster than row-vector*matrix. I wonder whether other people have > observed this fact too,
Yes, common knowledge in numerical analysis community. Using the faster direction for a particular system as much as possible is part of tuning linear algebra software. > and why? I presume that Numeric, like Python, stores matrices by row. So M*v multiplies contiguous rows by a contiguous vector. Multiplying a vector by non-contiguous columns requires requires skipping thru the matrix, which may require more computation and generate more cache misses and page faults. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list