1 #ifndef VIENNACL_LINALG_SPAI_HPP
2 #define VIENNACL_LINALG_SPAI_HPP
50 #include "boost/numeric/ublas/vector.hpp"
51 #include "boost/numeric/ublas/matrix.hpp"
52 #include "boost/numeric/ublas/matrix_proxy.hpp"
53 #include "boost/numeric/ublas/vector_proxy.hpp"
54 #include "boost/numeric/ublas/storage.hpp"
55 #include "boost/numeric/ublas/io.hpp"
56 #include "boost/numeric/ublas/lu.hpp"
57 #include "boost/numeric/ublas/triangular.hpp"
58 #include "boost/numeric/ublas/matrix_expression.hpp"
74 template <
typename MatrixType>
79 typedef typename boost::numeric::ublas::vector<ScalarType>
VectorType;
90 MatrixType pA(A.size1(), A.size2());
123 template <
typename ScalarType,
unsigned int MAT_ALIGNMENT>
127 typedef boost::numeric::ublas::compressed_matrix<ScalarType> UBLASSparseMatrixType;
131 typedef boost::numeric::ublas::vector<ScalarType> UBLASVectorType;
145 UBLASSparseMatrixType ubls_A(A.
size1(), A.
size2()), ubls_spai_m;
146 UBLASSparseMatrixType ubls_At;
188 template <
typename MatrixType>
191 typedef typename MatrixType::value_type ScalarType;
192 typedef typename boost::numeric::ublas::vector<ScalarType> VectorType;
193 typedef typename boost::numeric::ublas::matrix<ScalarType> UBLASDenseMatrixType;
236 template <
typename ScalarType,
unsigned int MAT_ALIGNMENT>
242 typedef boost::numeric::ublas::compressed_matrix<ScalarType> UBLASSparseMatrixType;
243 typedef boost::numeric::ublas::vector<ScalarType> UBLASVectorType;
254 UBLASSparseMatrixType ublas_A(A.
size1(), A.
size2());
255 UBLASSparseMatrixType pA(A.
size1(), A.
size2());
256 UBLASSparseMatrixType ublas_L(A.
size1(), A.
size2());
257 UBLASSparseMatrixType ublas_L_trans(A.
size1(), A.
size2());
286 mutable VectorType temp_apply_vec_;
boost::numeric::ublas::vector< ScalarType > VectorType
Definition: spai.hpp:79
void apply(VectorType &vec) const
Application of current preconditioner, multiplication on the right-hand side vector.
Definition: spai.hpp:108
MatrixType::value_type ScalarType
Definition: spai.hpp:78
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
Implementation of FSPAI. Experimental.
vcl_size_t size1(MatrixType const &mat)
Generic routine for obtaining the number of rows of a matrix (ViennaCL, uBLAS, etc.)
Definition: size.hpp:216
void apply(VectorType &vec) const
Application of current preconditioner, multiplication on the right-hand side vector.
Definition: spai.hpp:166
void apply(VectorType &vec) const
Application of current preconditioner, multiplication on the right-hand side vector.
Definition: spai.hpp:275
Manages an OpenCL context and provides the respective convenience functions for creating buffers...
Definition: context.hpp:51
A dense matrix class.
Definition: forwards.h:293
Main implementation of SPAI (not FSPAI). Experimental.
A tag for SPAI Contains values for the algorithm. Must be passed to spai_precond constructor.
Definition: spai_tag.hpp:63
Implementation of a helper sparse vector class for SPAI. Experimental.
void computeSPAI(const MatrixType &A, MatrixType &M, spai_tag &tag)
Construction of SPAI preconditioner on CPU.
Definition: spai.hpp:642
const vcl_size_t & size2() const
Returns the number of columns.
Definition: compressed_matrix.hpp:694
Represents a generic 'context' similar to an OpenCL context, but is backend-agnostic and thus also su...
Definition: context.hpp:39
void computeFSPAI(MatrixType const &A, MatrixType const &PatternA, MatrixType &L, MatrixType &L_trans, fspai_tag)
Definition: fspai.hpp:316
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
Definition: prod.hpp:91
A tag for FSPAI. Experimental. Contains values for the algorithm. Must be passed to spai_precond cons...
Definition: fspai.hpp:70
Implementation of a bunch of (small) matrices on GPU. Experimental.
Implementation of the Factored SParse Approximate Inverse Algorithm for a generic, uBLAS-compatible matrix type.
Definition: spai.hpp:189
spai_precond(const MatrixType &A, const spai_tag &tag)
Constructor.
Definition: spai.hpp:138
Implementation of a static SPAI. Experimental.
Implementation of a bunch of vectors on GPU. Experimental.
viennacl::linalg::detail::spai::fspai_tag fspai_tag
Definition: spai.hpp:67
Implementation of the SParse Approximate Inverse Algorithm for a generic, uBLAS-compatible matrix typ...
Definition: spai.hpp:75
void copy(std::vector< SCALARTYPE > &cpu_vec, circulant_matrix< SCALARTYPE, ALIGNMENT > &gpu_mat)
Copies a circulant matrix from the std::vector to the OpenCL device (either GPU or multi-core CPU) ...
Definition: circulant_matrix.hpp:150
Provides a QR factorization using a block-based approach.
fspai_precond(const MatrixType &A, const fspai_tag &tag)
Constructor.
Definition: spai.hpp:250
Implementation of the spai tag holding SPAI configuration parameters. Experimental.
const vcl_size_t & size1() const
Returns the number of rows.
Definition: compressed_matrix.hpp:692
viennacl::linalg::detail::spai::spai_tag spai_tag
Definition: spai.hpp:66
bool getIsRight() const
Definition: spai_tag.hpp:97
spai_precond(const MatrixType &A, const spai_tag &tag)
Constructor.
Definition: spai.hpp:84
fspai_precond(const MatrixType &A, const fspai_tag &tag)
Constructor.
Definition: spai.hpp:201
viennacl::context context(T const &t)
Returns an ID for the currently active memory domain of an object.
Definition: context.hpp:41
void apply(VectorType &vec) const
Application of current preconditioner, multiplication on the right-hand side vector.
Definition: spai.hpp:211
void initPreconditioner(const SparseMatrixType &A, SparseMatrixType &M)
Initialize preconditioner with sparcity pattern = p(A)
Definition: spai-static.hpp:149
A sparse square matrix in compressed sparse rows format.
Definition: compressed_matrix.hpp:428
static void init(viennacl::ocl::context &ctx)
Definition: spai.hpp:577
void sparse_transpose(const MatrixType &A_in, MatrixType &A)
Transposition of sparse matrix.
Definition: spai.hpp:599
Implementation of a dynamic SPAI. Provides the routines for automatic pattern updates Experimental...