
Hello everyone, I am try to use Ublas library and have some questions. I am want to write next code: template<class Matrix> void ProcessRecursive(Matrix& m) { typedef matrix_range<typename Matrix::matrix_type> MatrixRange; ... MatrixRange mr = project(m, range(...), range(...)); ... ProcessRecursive(mr); ... } void StartProcess() { ... matrix<double> m; ... ProcessRecursive(m); } But I have not enough type matrix_type in class matrix<...> and function template<class M> matrix_range<M> project(matrix_range<M>& data, const range& r1, const range& r2); There is almost the same function project but reciving const referens to matrix_range and compiler can't find it even using partial template ordering. Do somebody help my to write this code correctly? Or fix library? Regards, Alexey.

Hi Alexey, you wrote:
Interesting problem: the naive solution
----------
#include
This one terminates compiling (and running ;-) under GCC 3.2.1:
----------
#include
Which compiler are you using?
Do somebody help my to write this code correctly? Or fix library?
How? Best, Joerg

Hi Joerg, you wrote:
I'll try to write the code like I want to see:
----------
#include
Which compiler are you using?
VC++ 7.1
Do somebody help my to write this code correctly? Or fix library?
How?
1. Add "typedef self_type matrix_type;" in definition of class matrix 2. Add template<class M> BOOST_UBLAS_INLINE matrix_range<M> project (matrix_range<M> &data, const range &r1, const range &r2) { return data.project (r1, r2); } in matix_proxy.hpp (ver. 1.12) on line 3585. It may be need to add the same code for other proxy types . After those changes my code shown above compiles correctly and even runs. ;) Thanks, Alexey.

Hi Alexey, you wrote: [snip]
Which compiler are you using?
VC++ 7.1
Sorry, I should have concluded that from one of your earlier postings.
I'm unsure about this one: matrix_type currently describes the type of a referenced matrix for matrix proxies. What should the new definition be?
Added that one (the omission is probably a bug).
It may be need to add the same code for other proxy types .
And these.
After those changes my code shown above compiles correctly and even runs. ;)
My current iteration is:
----------
#include

:)
The general idea is not differ the matrix and matrix proxies in code where that differ is not nessesory. The new definition should be next: matrix_type describes the type of a referenced matrix for matrix proxies or the type of matrix if it is not proxy. At addition, if client want to public inherit from class matrix he must redefine matrix_type as type of new class.
Thank you :)
And once agane thank you :)
Yes, it is work... but I like my code more ;) Thanks, Alexey.
participants (2)
-
Alexey Nikitin
-
jhr.walter@t-online.de