|
Ublas : |
From: Stefan Heinzmann (stefan_heinzmann_at_[hidden])
Date: 2006-10-31 11:55:53
Hi Gunter
--- Gunter Winkler <guwi17_at_[hidden]> wrote:
> Please have a look at:
>
> http://freshmeat.net/projects/tvmet/ (fixed size lin.alg.)
>
http://www.bauv.unibw-muenchen.de/~winkler/ublas/examples/index.html
> (Ex3)
The second one seemed to be precisely what I need. There's a
problem with it, however. Here's my code:
static const double data[3][3] = {
{65.481 , 128.553, 24.966 },
{-37.797, -74.203, 112. },
{112. , -93.786, -18.214}
};
{
boost::numeric::ublas::matrix<double> xfm(3, 3);
xfm = boost::numeric::ublas::make_matrix_from_pointer
(3, 3, data[0]);
}
This produces a compiler error with VC++ 7.1:
error C2039: 'orientation_category' : is not a member of
'boost::numeric::ublas::readonly_array_adaptor<T>
> Can you create a small example which demonstrates this?
See above.
I've got an addition to propose to make storage adapters even
more convenient with C-style arrays:
/** \brief converts a C-style 2D array into a (readonly)
usable dense matrix.
*
* <code>
* double data[5][10];
* vector<double> v(5);
* vector<double> x(10);
* matrix<double> m(5,10);
* v = prod(make_matrix_from_array(data), x);
* </code>
*/
template <class T, size_t M, size_t N>
matrix<const T, readonly_array_adaptor<T> >
make_matrix_from_array(const T (&array)[M][N])
{
typedef readonly_array_adaptor<T> a_t;
typedef matrix<const T, a_t> m_t;
return m_t(M, N, a_t(M*N, array[0]));
}
As you can see, the matrix size is inferred from the C-style
array.
Cheers
Stefan
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de