 # Ublas :

From: Alion Sci (alionsci_at_[hidden])
Date: 2006-03-15 10:03:29

I am attempting to understand how some of the UBLAS libraries work.
Currently I am looking at the implementation described in
matrix_expression.hpp and specifically a small section of code that computes
the outer product of a matrix. However, I am having some dificulty
comprehending all of the code. I have read through the online documentation,
and it has helped, but I am still unclear on many parts. So, if anyone could
help me out by explaining to me how this operates I would be most grateful.

Below is the code I need help understanding. It is a function template that
computes a product. What is confusing me is that I don't know what
vector_matrix_binary_traits() and scalar_multiplies() do. I also don't
understand, what BOOST_UBLAS_INLINE is supposed to accomplish. And lastly,
what is value_type and expression_type ?

matrix_expression.hpp
.
.
.
.
.
// (outer_prod (v1, v2)) [i] [j] = v1 [i] * v2 [j]
template<class E1, class E2>

BOOST_UBLAS_INLINE
typename vector_matrix_binary_traits<E1, E2, scalar_multiplies<typename
E1::value_type, typename E2::value_type> >::result_type

outer_prod (const vector_expression<E1> &e1,
const vector_expression<E2> &e2) {

BOOST_STATIC_ASSERT (E1::complexity == 0 && E2::complexity == 0);
typedef typename vector_matrix_binary_traits<E1, E2,
scalar_multiplies<typename E1::value_type, typename E2::value_type>
>::expression_type expression_type;

return expression_type (e1 (), e2 ());
}
.
.
.
.
.