Skip to content
Snippets Groups Projects
Commit 83a9a49d authored by Oliver Sander's avatar Oliver Sander
Browse files

replaced explicit use of SimpleVector by member templates

[[Imported from SVN: r617]]
parent a9e1c195
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,6 @@
*/
#include <vector>
#include <dune/common/simplevector.hh>
namespace Dune {
......@@ -110,12 +109,13 @@ namespace Dune {
}
//! Multiplication of the transposed matrix times a vector
SimpleVector<T> transposedMult(const SimpleVector<T>& vec) {
template <class X, class Y>
Y transposedMult(const Y& vec) {
#ifdef DUNE_ISTL_WITH_CHECKING
if (N()!=vec.size())
DUNE_THROW(ISTLError, "Vector size doesn't match the number of matrix rows!");
#endif
SimpleVector<T> out(M());
Y out(M());
out = 0;
for (int i=0; i<out.size(); i++ ) {
......@@ -141,12 +141,13 @@ namespace Dune {
}
/// Generic matrix-vector multiplication.
friend SimpleVector<T> operator*(const Matrix<T>& m, const SimpleVector<T>& vec) {
template <class X, class Y>
friend Y operator*(const Matrix<T>& m, const X& vec) {
#ifdef DUNE_ISTL_WITH_CHECKING
if (M()!=vec.size())
DUNE_THROW(ISTLError, "Vector size doesn't match the number of matrix columns!");
#endif
SimpleVector<T> out(m.N());
Y out(m.N());
out = 0;
for (int i=0; i<out.size(); i++ ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment