[densematrix] use the correct scaling parameter for usmv and friends
In the current state the scaling parameter for matrix-vector products (e.g. the alpha parameter for DenseMatrix<...>::usmv) is the field_type of the matrix. I you consider mixed precision, like in the xblas library, you would actually want the scaling to be of the same accuracy as the output vector; an other reason is vectorization for one matrix and multiple vectors. The patch contains two changes: a) the FieldTraits are extended, so that the contain specializations for C and C++ vectors b) the thre matrix implementations are changed, such that they deduce the type as FieldTraits<Y>::field_type, where Y is the type of the result vector. In the case of identity matrix the old implementation was laso completely wrong, as it used Y::axpy to implement usmv and Y::axpy expects alpha to be Y::value_type, so that we already had a type clash, which just went unnoticed, as we never used mixed-types.
parent
d33190bc
No related branches found
No related tags found
Showing
- dune/common/densematrix.hh 6 additions, 3 deletionsdune/common/densematrix.hh
- dune/common/diagonalmatrix.hh 6 additions, 3 deletionsdune/common/diagonalmatrix.hh
- dune/common/ftraits.hh 15 additions, 0 deletionsdune/common/ftraits.hh
- dune/common/identitymatrix.hh 6 additions, 3 deletionsdune/common/identitymatrix.hh
Loading