[Dune] [Dune-Commit] dune-common r5072 - trunk/common
Markus Blatt
Markus.Blatt at ipvs.uni-stuttgart.de
Tue Feb 5 18:39:57 CET 2008
Hi,
On Tue, Feb 05, 2008 at 06:26:45PM +0100, robertk at dune-project.org wrote:
>
> Modified: trunk/common/fmatrix.hh
> ===================================================================
> --- trunk/common/fmatrix.hh 2008-02-05 15:57:01 UTC (rev 5071)
> +++ trunk/common/fmatrix.hh 2008-02-05 17:26:45 UTC (rev 5072)
> @@ -241,9 +241,10 @@
> if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
> if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
> #endif
> - for (size_type i=0; i<n; i++)
> - for (size_type j=0; j<m; j++)
> - y[i] = (*this)[i][j] * x[j];
> + for (size_type i=0; i<n; ++i)
> + {
> + y[i] = (*this)[i] * x;
> + }
> }
Doesn't this create a temporary FieldVector?
Anyway I would prefer two loops and setting y[i]=0 and then adding up
the multiplication result:
for (size_type i=0; i<n; ++i){
y[i]=0;
for (size_type j=0; j<n; ++j)
y[i] += (*this)[i][j]*x[j]
}
Cheers,
Markus
More information about the Dune
mailing list