MTLDenseVector.hpp 1.03 KB
Newer Older
1
2
3
4
5
#pragma once


#include <boost/numeric/mtl/vector/dense_vector.hpp>

6
#include <amdis/linear_algebra/LinearAlgebraBase.hpp>
7
8
9
10
11

namespace AMDiS
{
  template <class Value>
  using MTLDenseVector = mtl::vec::dense_vector<Value>;
12

13
14
15
16
17
18
19
  namespace Impl
  {
    template <class Vector>
    class MTLWrapper
      : public BaseWrapper<Vector>
    {
      using Super = BaseWrapper<Vector>;
20

21
22
23
    public:
      using value_type = typename Super::value_type;
      using size_type = typename Super::size_type;
24

25
      template <class Vector_>
26
      explicit MTLWrapper(Vector_&& vec)
27
        : Super(std::forward<Vector_>(vec))
28
      {}
29

30
31
32
33
      void resize(size_type s)
      {
        this->vec.change_dim(s);
      }
34

35
36
37
38
39
      size_type size() const
      {
        return num_rows(this->vec);
      }
    };
40

41
  } // end namespace Impl
42

43
  /// wrap the mtl dense_vector class to provide resize and size member-functions
44
45
46
47
48
  template <class Value>
  Impl::MTLWrapper<MTLDenseVector<Value>> wrapper(MTLDenseVector<Value>& vec)
  {
    return {vec};
  }
49
50

} // end namespace AMDiS