PARALUTION  1.0.0
PARALUTION
host_matrix_dia.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_HOST_MATRIX_DIA_HPP_
2 #define PARALUTION_HOST_MATRIX_DIA_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 HostMatrixDIA : public HostMatrix<ValueType> {
12 
13 public:
14 
15  HostMatrixDIA();
16  HostMatrixDIA(const Paralution_Backend_Descriptor local_backend);
17  virtual ~HostMatrixDIA();
18 
19  inline int get_ndiag(void) const { return mat_.num_diag; }
20 
21  virtual void info(void) const;
22  virtual unsigned int get_mat_format(void) const { return DIA; }
23 
24  virtual void Clear(void);
25  virtual void AllocateDIA(const int nnz, const int nrow, const int ncol, const int ndiag);
26  virtual void SetDataPtrDIA(int **offset, ValueType **val,
27  const int nnz, const int nrow, const int ncol, const int num_diag);
28  virtual void LeaveDataPtrDIA(int **offset, ValueType **val, int &num_diag);
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 
43  friend class BaseVector<ValueType>;
44  friend class HostVector<ValueType>;
45  friend class HostMatrixCSR<ValueType>;
46  friend class HostMatrixCOO<ValueType>;
47  friend class HostMatrixELL<ValueType>;
48  friend class HostMatrixHYB<ValueType>;
49  friend class HostMatrixDENSE<ValueType>;
50 
51  friend class GPUAcceleratorMatrixDIA<ValueType>;
52  friend class OCLAcceleratorMatrixDIA<ValueType>;
53  friend class MICAcceleratorMatrixDIA<ValueType>;
54 
55 };
56 
57 
58 }
59 
60 #endif // PARALUTION_HOST_MATRIX_DIA_HPP_
virtual void CopyFrom(const BaseMatrix< ValueType > &mat)
Copy from another matrix.
Definition: host_matrix_dia.cpp:170
Definition: matrix_formats.hpp:25
Definition: base_matrix.hpp:24
virtual ~HostMatrixDIA()
Definition: host_matrix_dia.cpp:48
Definition: base_matrix.hpp:44
virtual void AllocateDIA(const int nnz, const int nrow, const int ncol, const int ndiag)
Allocate DIA Matrix.
Definition: host_matrix_dia.cpp:82
virtual bool ConvertFrom(const BaseMatrix< ValueType > &mat)
Convert the matrix from another matrix (with different structure)
Definition: host_matrix_dia.cpp:214
Definition: base_matrix.hpp:14
int get_ndiag(void) const
Definition: host_matrix_dia.hpp:19
Index num_diag
Number of diagonal.
Definition: matrix_formats.hpp:84
MatrixDIA< ValueType, int > mat_
Definition: host_matrix_dia.hpp:41
nnz
Definition: pcg_example.m:8
virtual void SetDataPtrDIA(int **offset, ValueType **val, const int nnz, const int nrow, const int ncol, const int num_diag)
Initialize a DIA matrix on the Host with externally allocated data.
Definition: host_matrix_dia.cpp:111
const IndexType const IndexType const IndexType const ValueType const ValueType scalar
Definition: cuda_kernels_coo.hpp:91
Definition: base_vector.hpp:10
virtual void Clear(void)
Clear (free) the matrix.
Definition: host_matrix_dia.cpp:65
virtual void Apply(const BaseVector< ValueType > &in, BaseVector< ValueType > *out) const
Apply the matrix to vector, out = this*in;.
Definition: host_matrix_dia.cpp:251
Definition: base_matrix.hpp:20
Definition: base_matrix.hpp:22
Definition: base_matrix.hpp:82
HostMatrixDIA()
Definition: host_matrix_dia.cpp:26
Base class for all host/accelerator matrices.
Definition: base_matrix.hpp:92
Definition: base_matrix.hpp:16
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_dia.cpp:305
Definition: backend_manager.cpp:43
virtual void info(void) const
Shows simple info about the object.
Definition: host_matrix_dia.cpp:58
Definition: base_matrix.hpp:63
virtual void CopyTo(BaseMatrix< ValueType > *mat) const
Copy to another matrix.
Definition: host_matrix_dia.cpp:207
virtual unsigned int get_mat_format(void) const
Return the matrix format id (see matrix_formats.hpp)
Definition: host_matrix_dia.hpp:22
Base class for all host/accelerator vectors.
Definition: base_vector.hpp:26
virtual void LeaveDataPtrDIA(int **offset, ValueType **val, int &num_diag)
Leave a DIA matrix to Host pointers.
Definition: host_matrix_dia.cpp:140