mgcpp
A C++ Math Library Based on CUDA
column_view.hpp
Go to the documentation of this file.
1 
2 // Copyright RedPortal, mujjingun 2017 - 2018.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef _MGCPP_MATRIX_COLUMN_VIEW_HPP_
8 #define _MGCPP_MATRIX_COLUMN_VIEW_HPP_
9 
13 
14 #include <cstdlib>
15 #include <initializer_list>
16 
17 namespace mgcpp {
18 template <typename DenseMat, typename Type>
19 class column_view : public dense_vector<column_view<DenseMat, Type>, Type> {
20  public:
22  using value_type = Type;
24  using allocator_type = typename DenseMat::allocator_type;
25 
26  private:
27  DenseMat* _matrix;
28  size_t _column_idx;
29  allocator_type _allocator;
30 
31  public:
32  inline column_view() = delete;
33 
34  inline ~column_view() = default;
35 
36  inline column_view(dense_matrix<DenseMat, Type>& mat, size_t i) noexcept;
37 
38  inline column_view(column_view<DenseMat, Type> const& other) = delete;
39 
40  inline column_view(column_view<DenseMat, Type>&& other) noexcept;
41 
43  column_view<DenseMat, Type> const& other);
44 
46  column_view<DenseMat, Type>&& other) noexcept;
47 
49  std::initializer_list<Type> const& init);
50 
51  template <typename DenseVec>
53  dense_vector<DenseVec, Type> const& vec);
54 
55  inline void copy_to_host(Type* host_p) const;
56 
57  inline Type check_value(size_t i) const;
58 
59  inline Type const* data() const noexcept;
60 
61  inline Type* data_mutable() noexcept;
62 
63  inline thread_context* context() const noexcept;
64 
65  inline size_t shape() const noexcept;
66 };
67 } // namespace mgcpp
68 
69 #include <mgcpp/matrix/column_view.tpp>
70 #endif
Definition: adapter_base.hpp:12
Definition: thread_context.hpp:20
Type check_value(size_t i) const
~column_view()=default
Definition: column_view.hpp:19
Definition: dense_vector.hpp:15
Definition: shape.hpp:10
column_view< DenseMat, Type > this_type
Definition: column_view.hpp:21
thread_context * context() const noexcept
Type const * data() const noexcept
Definition: dense_matrix.hpp:15
Type value_type
Definition: column_view.hpp:22
void copy_to_host(Type *host_p) const
column_view< DenseMat, Type > & operator=(column_view< DenseMat, Type > const &other)
typename DenseMat::allocator_type allocator_type
Definition: column_view.hpp:24
void init(bool print_system_info=true)
Type * data_mutable() noexcept