Boost logo

Ublas :

Subject: [ublas] Layout type
From: Andrea Arteaga (andyspiros_at_[hidden])
Date: 2010-05-03 07:45:34


How can I know whether a matrix is storing its elements with column-major
storage or with row-major?

I'm writing a template function which takes as argument a
boost::numeric::ublas::matrix and performs some computation. I have to know
whether I must transpose the data or not:

template<class MatrixType>
void my_func(const MatrixType& matrix)
{
    const char * data =
             reinterpret_cast<const char *>(&matrix(0, 0));

    /* ... */
}

I tried with typename MatrixType::layout_type, but this typedef is private.

Thank you in advance.

Andrea Arteaga