Boost logo

Ublas :

From: Nico Galoppo (nico_at_[hidden])
Date: 2005-11-26 16:57:27


Michael Stevens wrote:
> E will NOT in general be a concrete Matrix class. In fact it will only be a
> concrete matrix class in the case where 'determinant' is called with a
> concrete matrix argument. This is because a Matrix class must be dervived
> thus
> class matrix : public matrix_container<matrix>
> and
> template <class C>
> class matrix_container : public matrix_expression<C>
>

I was wondering what the performance implications of this are, eg. I have a
templated function:

template <typename Mat> func(Mat& M)

versus

template <typename C> func(matrix_container<C>& M)

In the second example, to perform operations on the data, it seems that I need
to apply the operator() on M every time, like

size_type n = M().size1();
or
atlas::gemm(M(), ...);

What is the performance hit of applying operator() in this case? I was looking
at the second approach such that the compiler can distinguish between

template <typename C> func(matrix_container<C>& M)
template <typename C> func(vector_container<C>& V)

I couldn't do that with the first appraoch...

Thanks,

--nico

-- 
nico galoppo von borries     @  address: 105 creel st., chapel hill
comp. graphics phd. student  @           north carolina, 27516 USA
UNC, chapel hill             @  phone: +1 (919) 962-1898 (office)
                              @         +1 (919) 942-7609 (home)
                              @  email: nico at cs dot unc dot edu
                              @  homepage: http://www.cs.unc.edu/~nico
--- debian linux :: vim powered