# Ublas :

From: eeitan_at_[hidden]
Date: 2006-05-25 02:24:14

thanks again for your fast answear.
now i have problem with slow acces to dense matrix element:
typedef ublas::matrix<double, boost::numeric::ublas::row_major> Matrix;
doing this :
// prototype of operator (matrix-vector multiplication routine used by fortran)
inline void matrix_vector_mult(int *nrow, int *ncol, double *xin, int *ldx,
double *yout,int *ldy) {

double *xtmp, *ytmp;
for (int k=0; k<*ncol; ++k) {
ytmp = yout + *ldy * k;
xtmp = xin + *ldx * k;
//std::cerr<<"*nrow=="<<*nrow<<" *ncol=="<<*ncol<<" *ldx=="<<*ldx<<"
*ldy=="<<*ldy<<"\n";
for (int i=0; i<*nrow; ++i){
ytmp[i]=0;
for (int j=0; j<*nrow; ++j){
ytmp[i] += xtmp[j] * tmp_mat[i*(*nrow)+j];
}
}
}
};
while tmp_mat is a (double *) array, works 100+ times faster than....
// prototype of operator (matrix-vector multiplication routine used by fortran)
inline void matrix_vector_mult(int *nrow, int *ncol, double *xin, int *ldx,
double *yout,int *ldy) {

double *xtmp, *ytmp;
for (int k=0; k<*ncol; ++k) {
ytmp = yout + *ldy * k;
xtmp = xin + *ldx * k;
//std::cerr<<"*nrow=="<<*nrow<<" *ncol=="<<*ncol<<" *ldx=="<<*ldx<<"
*ldy=="<<*ldy<<"\n";
for (int i=0; i<*nrow; ++i){
ytmp[i]=0;
for (int j=0; j<*nrow; ++j){
ytmp[i] += xtmp[j] * (*Mat)(i,j);
}
}
}
};
while Mat is a (Matrix *). how shell i boost it up???
eitan

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.