PARALUTION  1.0.0
PARALUTION
host_matrix_ell.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_HOST_MATRIX_ELL_HPP_
2 #define PARALUTION_HOST_MATRIX_ELL_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 HostMatrixELL : public HostMatrix<ValueType> {
12 
13 public:
14 
15  HostMatrixELL();
16  HostMatrixELL(const Paralution_Backend_Descriptor local_backend);
17  virtual ~HostMatrixELL();
18 
19  inline int get_max_row(void) const { return mat_.max_row; }
20 
21  virtual void info(void) const;
22  virtual unsigned int get_mat_format(void) const { return ELL; }
23 
24  virtual void Clear(void);
25  virtual void AllocateELL(const int nnz, const int nrow, const int ncol, const int max_row);
26  virtual void SetDataPtrELL(int **col, ValueType **val,
27  const int nnz, const int nrow, const int ncol, const int max_row);
28  virtual void LeaveDataPtrELL(int **col, ValueType **val, int &max_row);
29 
30 
31  virtual bool ConvertFrom(const BaseMatrix<ValueType> &mat);
32 
33  virtual void CopyFrom(const BaseMatrix<ValueType> &mat);
34  virtual void CopyTo(BaseMatrix<ValueType> *mat) const;
35 
36  virtual void Apply(const BaseVector<ValueType> &in, BaseVector<ValueType> *out) const;
37  virtual void ApplyAdd(const BaseVector<ValueType> &in, const ValueType scalar,
38  BaseVector<ValueType> *out) const;
39 
40 private:
41 
43 
44  friend class BaseVector<ValueType>;
45  friend class HostVector<ValueType>;
46  friend class HostMatrixCSR<ValueType>;
47  friend class HostMatrixCOO<ValueType>;
48  friend class HostMatrixHYB<ValueType>;
49  friend class HostMatrixDENSE<ValueType>;
50 
51  friend class GPUAcceleratorMatrixELL<ValueType>;
52  friend class OCLAcceleratorMatrixELL<ValueType>;
53  friend class MICAcceleratorMatrixELL<ValueType>;
54 
55 };
56 
57 
58 }
59 
60 #endif // PARALUTION_HOST_MATRIX_ELL_HPP_
virtual unsigned int get_mat_format(void) const
Return the matrix format id (see matrix_formats.hpp)
Definition: host_matrix_ell.hpp:22
virtual void SetDataPtrELL(int **col, ValueType **val, const int nnz, const int nrow, const int ncol, const int max_row)
Initialize an ELL matrix on the Host with externally allocated data.
Definition: host_matrix_ell.cpp:107
Definition: base_matrix.hpp:24
virtual void info(void) const
Shows simple info about the object.
Definition: host_matrix_ell.cpp:54
Definition: base_matrix.hpp:14
Definition: base_matrix.hpp:65
virtual void LeaveDataPtrELL(int **col, ValueType **val, int &max_row)
Leave an ELL matrix to Host pointers.
Definition: host_matrix_ell.cpp:131
Index max_row
Maximal elements per row.
Definition: matrix_formats.hpp:98
nnz
Definition: pcg_example.m:8
const IndexType const IndexType const IndexType const ValueType const ValueType scalar
Definition: cuda_kernels_coo.hpp:91
virtual void CopyTo(BaseMatrix< ValueType > *mat) const
Copy to another matrix.
Definition: host_matrix_ell.cpp:196
HostMatrixELL()
Definition: host_matrix_ell.cpp:21
Definition: base_vector.hpp:10
virtual void AllocateELL(const int nnz, const int nrow, const int ncol, const int max_row)
Allocate ELL Matrix.
Definition: host_matrix_ell.cpp:77
virtual void CopyFrom(const BaseMatrix< ValueType > &mat)
Copy from another matrix.
Definition: host_matrix_ell.cpp:156
MatrixELL< ValueType, int > mat_
Definition: host_matrix_ell.hpp:42
Definition: base_matrix.hpp:22
Base class for all host/accelerator matrices.
Definition: base_matrix.hpp:92
virtual ~HostMatrixELL()
Definition: host_matrix_ell.cpp:44
Definition: base_matrix.hpp:16
Definition: backend_manager.cpp:43
int get_max_row(void) const
Definition: host_matrix_ell.hpp:19
Definition: matrix_formats.hpp:26
Definition: base_matrix.hpp:46
Base class for all host/accelerator vectors.
Definition: base_vector.hpp:26
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_ell.cpp:282
virtual bool ConvertFrom(const BaseMatrix< ValueType > &mat)
Convert the matrix from another matrix (with different structure)
Definition: host_matrix_ell.cpp:203
virtual void Apply(const BaseVector< ValueType > &in, BaseVector< ValueType > *out) const
Apply the matrix to vector, out = this*in;.
Definition: host_matrix_ell.cpp:240
Definition: base_matrix.hpp:84
virtual void Clear(void)
Clear (free) the matrix.
Definition: host_matrix_ell.cpp:61