Hi Heikko,
did you check if you have nested products? (those may be hidden sometimes if you pass expressions around) Take a look at the very last item in http://www.boost.org/doc/libs/1_42_0/libs/numeric/ublas/doc/index.htm.

The indexing_matrix_assign is the main function that is called when you assign an expression to a matrix in ublas, so everything passes through that. And remember in ublas A+B (with A and B matrices) is an expression in ublas, not a matrix, it becomes a matrix when you assign it to something.

Also try to play with -DBOOST_UBLAS_MOVE_SEMANTICS (http://www.boost.org/doc/libs/1_42_0/libs/numeric/ublas/doc/options.htm) and noalias() (http://www.boost.org/doc/libs/1_41_0/libs/numeric/ublas/doc/operations_overview.htm) , to see if those help.

Best regards

> From: heiko@physcip.uni-stuttgart.de
> To: ublas@lists.boost.org
> Date: Fri, 9 Apr 2010 18:20:41 +0200
> Subject: [ublas] profiling shows most time is consumed by indexing_matrix_assign
> Dear all,
> I have just recently begun to use uBLAS to do some numerics, solving a
> system of ordinary linear differential equations. The ODE solver
> repeatedly invokes a function that computes the right hand side of the
> ODE, and that contains almost the whole computational effort. In this
> function, I have about 8 matrix-matrix multiplications (with prod()) and
> about the same number of additions/subtractions of matrices or
> multiplications with a scalar. The involved matrices are dense with
> std::complex<double> entries and are of dimension 800x800.
> The program, especially the evaluation of the rhs function, seems to be
> running fairly slow and profiling with gprof shows that the rhs
> evaluation takes 95%
> of the computation time. Deeper inspection shows that two
> versions of indexing_matrix_assign() account for almost all
> of the time needed. Now comes my question: Is this the expected
> behaviour for the described situation?
> Some additional information: I am using uBLAS 1.41.0 with NDEBUG set to
> 1.
> Any help is appreciated.
> Best regards,
> Heiko Schröder
> _______________________________________________
> ublas mailing list
> ublas@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: nasos_i@hotmail.com

The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. Get busy.