MTL: How to pass MTL Matrix iterators to CBLAS routine "cblas_ddot"
"König, Oliver" <[email protected]>
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
We are currently trying to improve solver performance of our Finite Element library FELyX (http://felyx.sourceforge.net) that uses MTL for all matrix operations.
We implemented a direct skyline solver that takes advantage of the MTL envelope matrix format. Replacing the most inner loop of this solver with a cblas dot product we can speed up the solution process by 35%. This cblas routine takes the following arguments:
double cblas_ddot(const int N, const double *X, const int incX,
const double *Y, const int incY);
That means, two double pointers define the begin of the two vectors to multiply. But within our solver I'm dealing with iterators of the type Matrix::OneD::iterator .
How can I transform these iterators to double pointers ? Since the envelope matrix format finally stores its values in a dense1D vector, a transformation of the iterators to ordinary pointers works correctly.
The code works with the following, rather ugly hack:
Matrix::OneD::iterate oneDitX = ...... ;
double* pX = &( * oneDitX );
Does anybody know, how this transformation could be done in a more elegant way ? It seems that dense1D iterators can implicitely be converted to double pointers, but not the matrix iterators ?
Sincerely
ok
----------------------------------------------------
Oliver Koenig
Center of Structure Technologies
Institute of Mechanical Systems
LEO C12
ETH Zurich
CH-8092 Zurich
Phone : +41 1 632 23 28
Fax : +41 1 632 17 02
Mail : [email protected]
WWW : http://www.imes.ethz.ch/st/
----------------------------------------------------