Boost logo

Ublas :

From: Paul C. Leopardi (leopardi_at_[hidden])
Date: 2005-11-28 07:23:23

Hi Thomas,
I notice that below, you include operation.hpp before matrix_proxy.hpp, yet
operation.hpp in Boost 1.33 has:
#include <boost/numeric/ublas/matrix_proxy.hpp>
but the same file in Boost 1.32 does not include matrix_proxy.hpp.

In Boost 1.32, matrix_proxy.hpp has:
#include <boost/numeric/ublas/config.hpp>
#include <boost/numeric/ublas/vector_expression.hpp>
#include <boost/numeric/ublas/matrix_expression.hpp>

and config.hpp has:
#define BOOST_UBLAS_INLINE inline

so by including operation.hpp before matrix_proxy.hpp, if you use Boost 1.32,
you make the preprocessor see BOOST_UBLAS_INLINE on line 31 of operation.hpp
before it sees the #define in config.hpp. Consequently, the compiler sees
BOOST_UBLAS_INLINE and takes it to be an identifier. This explains why it
complains about the template parameter V on line 32.

In Boost 1.33, matrix_proxy.hpp has:
#include <boost/numeric/ublas/matrix_expression.hpp>
#include <boost/numeric/ublas/detail/vector_assign.hpp>
#include <boost/numeric/ublas/detail/matrix_assign.hpp>
#include <boost/numeric/ublas/detail/temporary.hpp>

matrix_expression.hpp has:
#include <boost/numeric/ublas/vector_expression.hpp>

vector_expression.hpp has:
#include <boost/numeric/ublas/expression_types.hpp>

expression_types.hpp has:
#include <boost/numeric/ublas/exception.hpp>

exception.hpp has:
#include <boost/numeric/ublas/detail/config.hpp>

and detail/config.hpp has:
#define BOOST_UBLAS_INLINE inline

so, with Boost 1.33 even if you include operation.hpp before matrix_proxy.hpp,
the preprocessor sees the #define in config.hpp before it sees
BOOST_UBLAS_INLINE on line 33 of operation.hpp.

I could be wrong, since the include structure of uBLAS is complicated, but I
think this is the cause of the difference between Boost 1.32 and Boost 1.33
which you are seeing.

Glucat 0.1.9 has its includes in the following order.

#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/operation_sparse.hpp>
#include <boost/numeric/ublas/operation.hpp>
#include <boost/numeric/ublas/lu.hpp>

You may not need matrix_sparse.hpp or operation_sparse.hpp, but try the others
in the order given, and see if that fixes your problem.

Best regards, Paul Leopardi

On Monday 28 November 2005 19:04, Thomas Lemaire wrote:
> Dear list,
> I am trying to use lu operations defined in lu.hpp. As adviced recently on
> this list, I added the following includes which should already be in
> lu.hpp:
> #if BOOST_VERSION < 103301 // missing includes in lu.hpp
> #include <boost/numeric/ublas/operation.hpp>
> #include <boost/numeric/ublas/vector_proxy.hpp>
> #include <boost/numeric/ublas/matrix_proxy.hpp>
> #include <boost/numeric/ublas/vector.hpp>
> #include <boost/numeric/ublas/triangular.hpp>
> #endif
> On a Fedora core 3 or core 4 (both using boost 1.32), I got the following
> compilation error in operation.hpp (only the first error):
> /usr/include/boost/numeric/ublas/operation.hpp:32: error: expected
> constructor, destructor, or type conversion before 'V'
> FC3: gcc (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2)
> FC4: gcc (GCC) 4.0.1 20050727 (Red Hat 4.0.1-5)
> On the other hand, it compiles fine on a debian/sid with boost 1.33 and
> gcc (GCC) 4.0.3 20051023 (prerelease) (Debian 4.0.2-3)
> I checked in the code, there is no difference in the faulty lines between
> 1.32 and 1.33, so it comes from gcc... I can understand that gcc 4.0 is not
> mature enough so that ublas compilation may fails, but with gcc 3.4 it
> seems weird.
> Does anybody experience the same problems ? Am I missing something ? How
> can I fix it ?
> If I can help with more testing, let me know !