From: Peter Vanroose <Peter.V<anroose@es...>  20030203 17:10:20

> does anyone know, or has anyone realized a functionoperator to make the > same elementbyelement operations between matrices (i.e. multiplication, > division,...), as efficient in terms of velocity of execution as in Matlab? > I used a functionoperator based on two forcicles: > > inline void mul_dot(vnl_matrix<double> &A, vnl_matrix<double> &B, > vnl_matrix<double> &temp,const int &dim){ > unsigned int j; > for(unsigned int i=0; i<dim; i++){ > for(j=0; j<dim; j++) temp(i,j)=A(i,j)*B(i,j); > } > } I would expect the following to work considerably faster: (not tested, though) T const* a = A.data_block(); T const* b = B.data_block(); T * t = temp.data_block(); for(int i=dim*dim1; i>=0; i) t[i]=a[i]*b[i];  Peter. 