Boost logo

Ublas :

From: Nico Galoppo (nico_at_[hidden])
Date: 2007-03-22 11:38:37


I'm thinking that your compiler is smart enough not to do anything on the second
line, because the result isn't used. Makes sense, no?

--nico

Gross, Steve wrote:
> 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
>
>

-- 
Nico Galoppo        UNC-CH PhD. student        http://www.ngaloppo.org
                       +1-919-942-4388