PARALUTION  1.0.0
PARALUTION
host_matrix_hyb.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_HOST_MATRIX_HYB_HPP_
2 #define PARALUTION_HOST_MATRIX_HYB_HPP_
3 
4 #include "../base_vector.hpp"
5 #include "../base_matrix.hpp"
6 #include "../matrix_formats.hpp"
7 
8 namespace paralution {
9 
10 template <typename ValueType>
11 class HostMatrixHYB : public HostMatrix<ValueType> {
12 
13 public:
14 
15  HostMatrixHYB();
16  HostMatrixHYB(const Paralution_Backend_Descriptor local_backend);
17  virtual ~HostMatrixHYB();
18 
19  inline int get_ell_max_row(void) const { return this->mat_.ELL.max_row; }
20  inline int get_ell_nnz(void) const { return this->ell_nnz_; }
21  inline int get_coo_nnz(void) const { return this->coo_nnz_; }
22 
23  virtual void info(void) const;
24  virtual unsigned int get_mat_format(void) const { return HYB; }
25 
26  virtual void Clear(void);
27  virtual void AllocateHYB(const int ell_nnz, const int coo_nnz, const int ell_max_row,
28  const int nrow, const int ncol);
29 
30  virtual bool ConvertFrom(const BaseMatrix<ValueType> &mat);
31 
32  virtual void CopyFrom(const BaseMatrix<ValueType> &mat);
33  virtual void CopyTo(BaseMatrix<ValueType> *mat) const;
34 
35  virtual void Apply(const BaseVector<ValueType> &in, BaseVector<ValueType> *out) const;
36  virtual void ApplyAdd(const BaseVector<ValueType> &in, const ValueType scalar,
37  BaseVector<ValueType> *out) const;
38 
39 private:
40 
42  int ell_nnz_;
43  int coo_nnz_;
44 
45  friend class BaseVector<ValueType>;
46  friend class HostVector<ValueType>;
47  friend class HostMatrixCSR<ValueType>;
48  friend class HostMatrixCOO<ValueType>;
49  friend class HostMatrixELL<ValueType>;
50  friend class HostMatrixDENSE<ValueType>;
51 
52  friend class GPUAcceleratorMatrixHYB<ValueType>;
53  friend class OCLAcceleratorMatrixHYB<ValueType>;
54  friend class MICAcceleratorMatrixHYB<ValueType>;
55 
56 };
57 
58 
59 }
60 
61 #endif // PARALUTION_HOST_MATRIX_HYB_HPP_
virtual ~HostMatrixHYB()
Definition: host_matrix_hyb.cpp:51
Definition: base_matrix.hpp:86
Definition: base_matrix.hpp:24
Definition: matrix_formats.hpp:27
Definition: base_matrix.hpp:67
int get_ell_nnz(void) const
Definition: host_matrix_hyb.hpp:20
Definition: base_matrix.hpp:14
Index max_row
Maximal elements per row.
Definition: matrix_formats.hpp:98
int ell_nnz_
Definition: host_matrix_hyb.hpp:42
const IndexType const IndexType const IndexType const ValueType const ValueType scalar
Definition: cuda_kernels_coo.hpp:91
Definition: base_vector.hpp:10
HostMatrixHYB()
Definition: host_matrix_hyb.cpp:21
virtual void info(void) const
Shows simple info about the object.
Definition: host_matrix_hyb.cpp:61
virtual void ApplyAdd(const BaseVector< ValueType > &in, const ValueType scalar, BaseVector< ValueType > *out) const
Apply and add the matrix to vector, out = out + scalar*this*in;.
Definition: host_matrix_hyb.cpp:295
virtual void CopyFrom(const BaseMatrix< ValueType > &mat)
Copy from another matrix.
Definition: host_matrix_hyb.cpp:141
virtual void CopyTo(BaseMatrix< ValueType > *mat) const
Copy to another matrix.
Definition: host_matrix_hyb.cpp:194
Definition: base_matrix.hpp:20
int get_coo_nnz(void) const
Definition: host_matrix_hyb.hpp:21
Base class for all host/accelerator matrices.
Definition: base_matrix.hpp:92
virtual void Apply(const BaseVector< ValueType > &in, BaseVector< ValueType > *out) const
Apply the matrix to vector, out = this*in;.
Definition: host_matrix_hyb.cpp:245
Definition: base_matrix.hpp:16
Definition: backend_manager.cpp:43
virtual unsigned int get_mat_format(void) const
Return the matrix format id (see matrix_formats.hpp)
Definition: host_matrix_hyb.hpp:24
virtual bool ConvertFrom(const BaseMatrix< ValueType > &mat)
Convert the matrix from another matrix (with different structure)
Definition: host_matrix_hyb.cpp:201
virtual void Clear(void)
Clear (free) the matrix.
Definition: host_matrix_hyb.cpp:71
virtual void AllocateHYB(const int ell_nnz, const int coo_nnz, const int ell_max_row, const int nrow, const int ncol)
Allocate HYB Matrix.
Definition: host_matrix_hyb.cpp:95
int coo_nnz_
Definition: host_matrix_hyb.hpp:43
Base class for all host/accelerator vectors.
Definition: base_vector.hpp:26
MatrixELL< ValueType, IndexType, Index > ELL
Definition: matrix_formats.hpp:111
Definition: base_matrix.hpp:48
int get_ell_max_row(void) const
Definition: host_matrix_hyb.hpp:19
MatrixHYB< ValueType, int > mat_
Definition: host_matrix_hyb.hpp:41