Skip to content
Snippets Groups Projects
Commit 036f2495 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

[la.container] added mv

* only tested for eigen backend
parent f69720f1
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <dune/common/dynmatrix.hh> #include <dune/common/dynmatrix.hh>
#include <dune/stuff/common/reenable_warnings.hh> #include <dune/stuff/common/reenable_warnings.hh>
#include <dune/common/float_cmp.hh> #include <dune/common/float_cmp.hh>
#include <dune/common/typetraits.hh>
#include "interfaces.hh" #include "interfaces.hh"
...@@ -313,6 +314,7 @@ private: ...@@ -313,6 +314,7 @@ private:
backend_ = std::make_shared<BackendType>(*backend_); backend_ = std::make_shared<BackendType>(*backend_);
} // ... ensure_uniqueness(...) } // ... ensure_uniqueness(...)
friend class DuneDynamicMatrix<ScalarType>;
friend class Dune::Pymor::Operators::DuneDynamicInverse<ScalarType>; friend class Dune::Pymor::Operators::DuneDynamicInverse<ScalarType>;
friend class Dune::Pymor::Operators::DuneDynamic<ScalarType>; friend class Dune::Pymor::Operators::DuneDynamic<ScalarType>;
...@@ -477,6 +479,17 @@ public: ...@@ -477,6 +479,17 @@ public:
return backend_->cols(); return backend_->cols();
} }
template <class SourceType, class RangeType>
inline void mv(const SourceType& /*xx*/, RangeType& /*yy*/) const
{
static_assert(Dune::AlwaysFalse<SourceType>::value, "Not available for this combination of xx and yy!");
}
inline void mv(const DuneDynamicVector<ScalarType>& xx, DuneDynamicVector<ScalarType>& yy) const
{
backend_->mv(*(xx.backend_), *(yy.backend_));
}
void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value) void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value)
{ {
assert(ii < rows()); assert(ii < rows());
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/SparseCore> #include <Eigen/SparseCore>
#include <dune/common/typetraits.hh>
#include <dune/stuff/aliases.hh> #include <dune/stuff/aliases.hh>
#include <dune/stuff/common/ranges.hh> #include <dune/stuff/common/ranges.hh>
#include <dune/stuff/common/exceptions.hh> #include <dune/stuff/common/exceptions.hh>
...@@ -379,6 +381,8 @@ private: ...@@ -379,6 +381,8 @@ private:
backend_ = std::make_shared<BackendType>(*backend_); backend_ = std::make_shared<BackendType>(*backend_);
} // ... ensure_uniqueness(...) } // ... ensure_uniqueness(...)
friend class EigenDenseMatrix<ScalarType>;
friend class EigenRowMajorSparseMatrix<ScalarType>;
friend class Dune::Pymor::Operators::EigenRowMajorSparseInverse<ScalarType>; friend class Dune::Pymor::Operators::EigenRowMajorSparseInverse<ScalarType>;
friend class Dune::Pymor::Operators::EigenRowMajorSparse<ScalarType>; friend class Dune::Pymor::Operators::EigenRowMajorSparse<ScalarType>;
...@@ -690,6 +694,8 @@ private: ...@@ -690,6 +694,8 @@ private:
} }
} // ... ensure_uniqueness(...) } // ... ensure_uniqueness(...)
friend class EigenDenseMatrix<ScalarType>;
friend class EigenRowMajorSparseMatrix<ScalarType>;
friend class Dune::Pymor::Operators::EigenRowMajorSparseInverse<ScalarType>; friend class Dune::Pymor::Operators::EigenRowMajorSparseInverse<ScalarType>;
friend class Dune::Pymor::Operators::EigenRowMajorSparse<ScalarType>; friend class Dune::Pymor::Operators::EigenRowMajorSparse<ScalarType>;
...@@ -881,6 +887,32 @@ public: ...@@ -881,6 +887,32 @@ public:
return backend_->cols(); return backend_->cols();
} }
template <class SourceType, class RangeType>
inline void mv(const SourceType& /*xx*/, RangeType& /*yy*/) const
{
static_assert(Dune::AlwaysFalse<SourceType>::value, "Not available for this combination of xx and yy!");
}
inline void mv(const EigenDenseVector<ScalarType>& xx, EigenDenseVector<ScalarType>& yy) const
{
yy.backend_->transpose() = backend_->operator*(*(xx.backend_));
}
inline void mv(const EigenDenseVector<ScalarType>& xx, EigenMappedDenseVector<ScalarType>& yy) const
{
yy.backend_->transpose() = backend_->operator*(*(xx.backend_));
}
inline void mv(const EigenMappedDenseVector<ScalarType>& xx, EigenDenseVector<ScalarType>& yy) const
{
yy.backend_->transpose() = backend_->operator*(*(xx.backend_));
}
inline void mv(const EigenMappedDenseVector<ScalarType>& xx, EigenMappedDenseVector<ScalarType>& yy) const
{
yy.backend_->transpose() = backend_->operator*(*(xx.backend_));
}
void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value) void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value)
{ {
assert(ii < rows()); assert(ii < rows());
...@@ -1144,6 +1176,32 @@ public: ...@@ -1144,6 +1176,32 @@ public:
return backend_->cols(); return backend_->cols();
} }
template <class SourceType, class RangeType>
inline void mv(const SourceType& /*xx*/, RangeType& /*yy*/) const
{
static_assert(Dune::AlwaysFalse<SourceType>::value, "Not available for this combination of xx and yy!");
}
inline void mv(const EigenDenseVector<ScalarType>& xx, EigenDenseVector<ScalarType>& yy) const
{
yy.backend_->transpose() = backend_->operator*(*(xx.backend_));
}
inline void mv(const EigenDenseVector<ScalarType>& xx, EigenMappedDenseVector<ScalarType>& yy) const
{
yy.backend_->transpose() = backend_->operator*(*(xx.backend_));
}
inline void mv(const EigenMappedDenseVector<ScalarType>& xx, EigenDenseVector<ScalarType>& yy) const
{
yy.backend_->transpose() = backend_->operator*(*(xx.backend_));
}
inline void mv(const EigenMappedDenseVector<ScalarType>& xx, EigenMappedDenseVector<ScalarType>& yy) const
{
yy.backend_->transpose() = backend_->operator*(*(xx.backend_));
}
void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value) void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value)
{ {
assert(these_are_valid_indices(ii, jj)); assert(these_are_valid_indices(ii, jj));
......
...@@ -579,6 +579,12 @@ public: ...@@ -579,6 +579,12 @@ public:
return this->as_imp(*this).cols(); return this->as_imp(*this).cols();
} }
template <class SourceType, class RangeType>
inline void mv(const SourceType& xx, RangeType& yy) const
{
CHECK_AND_CALL_CRTP(this->as_imp(*this).mv(xx, yy));
}
inline void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value) inline void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value)
{ {
CHECK_AND_CALL_CRTP(this->as_imp(*this).add_to_entry(ii, jj, value)); CHECK_AND_CALL_CRTP(this->as_imp(*this).add_to_entry(ii, jj, value));
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <dune/common/fvector.hh> #include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh> #include <dune/common/fmatrix.hh>
#include <dune/common/typetraits.hh>
#include <dune/istl/bvector.hh> #include <dune/istl/bvector.hh>
#include <dune/istl/bcrsmatrix.hh> #include <dune/istl/bcrsmatrix.hh>
...@@ -314,6 +315,7 @@ private: ...@@ -314,6 +315,7 @@ private:
backend_ = std::make_shared<BackendType>(*backend_); backend_ = std::make_shared<BackendType>(*backend_);
} // ... ensure_uniqueness(...) } // ... ensure_uniqueness(...)
friend class IstlRowMajorSparseMatrix<ScalarType>;
friend class BicgstabILUTSolver<IstlRowMajorSparseMatrix<ScalarType>, ThisType>; friend class BicgstabILUTSolver<IstlRowMajorSparseMatrix<ScalarType>, ThisType>;
friend class AmgSolver<IstlRowMajorSparseMatrix<ScalarType>, ThisType>; friend class AmgSolver<IstlRowMajorSparseMatrix<ScalarType>, ThisType>;
...@@ -499,6 +501,17 @@ public: ...@@ -499,6 +501,17 @@ public:
return backend_->M(); return backend_->M();
} }
template <class SourceType, class RangeType>
inline void mv(const SourceType& /*xx*/, RangeType& /*yy*/) const
{
static_assert(Dune::AlwaysFalse<SourceType>::value, "Not available for this combination of xx and yy!");
}
inline void mv(const IstlDenseVector<ScalarType>& xx, IstlDenseVector<ScalarType>& yy) const
{
backend_->mv(*(xx.backend_), *(yy.backend_));
}
void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value) void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value)
{ {
assert(these_are_valid_indices(ii, jj)); assert(these_are_valid_indices(ii, jj));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment