Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-03-22 16:37:23

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

> Ublas::Prod(m1, m1)
This only creates a small object that contains information about the
parameters and the requested operation. It does not compute anything
> c = ublas::prod(m1, m1)

the assignment executes the stored operation and thus takes some time.
This behavior is the key idea of expression templates: collect all
information about the expression to be computed and defer the execution
as much as possible (here until assignment). So the assignment can
(automatically) choose the best algorithm and the computation is only
done for the part of the results which is actually used.