I’ve been testing the performance of ublas’s matrix multiplication. I encountered a behavior that I don’t quite understand. Consider the following code snippet:

 

Ublas::matrix<double> m1(100, 100), C(100, 100);

Ublas::Prod(m1, m1)

c = ublas::prod(m1, m1)

 

The second line and the third line are identical, except that in the third line I assign the result of the product operation to a pre-sized matrix. The second line appears to take almost no time to execute (0 millisecs, that is). The third line takes a non-zero amount of time to execute, however.

 

What’s going on here? Is the product operation super crazy fast, but the matrix assignment part slow?

 

--Steve