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_;
const vcl_size_t & size2() const
Returns the number of columns.
const vcl_size_t & size1() const
Returns the number of rows.
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
void sparse_transpose(MatrixT const &A_in, MatrixT &A)
Transposition of sparse matrix.
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.)
void computeSPAI(MatrixT const &A, MatrixT &M, spai_tag &tag)
Construction of SPAI preconditioner on CPU.
Manages an OpenCL context and provides the respective convenience functions for creating buffers...
Main implementation of SPAI (not FSPAI). Experimental.
Implementation of a helper sparse vector class for SPAI. Experimental.
void apply(VectorType &vec) const
Application of current preconditioner, multiplication on the right-hand side vector.
Represents a generic 'context' similar to an OpenCL context, but is backend-agnostic and thus also su...
void apply(VectorType &vec) const
Application of current preconditioner, multiplication on the right-hand side vector.
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
A tag for FSPAI. Experimental.
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.
spai_precond(const MatrixType &A, const spai_tag &tag)
Constructor.
Implementation of a static SPAI. Experimental.
viennacl::linalg::detail::spai::fspai_tag fspai_tag
Implementation of a bunch of vectors on GPU. Experimental.
Implementation of the SParse Approximate Inverse Algorithm for a generic, uBLAS-compatible matrix typ...
Provides a QR factorization using a block-based approach.
Implementation of the spai tag holding SPAI configuration parameters. Experimental.
spai_precond(const MatrixType &A, const spai_tag &tag)
Constructor.
MatrixType::value_type ScalarType
fspai_precond(const MatrixType &A, const fspai_tag &tag)
Constructor.
boost::numeric::ublas::vector< ScalarType > VectorType
viennacl::context context(T const &t)
Returns an ID for the currently active memory domain of an object.
fspai_precond(const MatrixType &A, const fspai_tag &tag)
Constructor.
void copy(std::vector< NumericT > &cpu_vec, circulant_matrix< NumericT, AlignmentV > &gpu_mat)
Copies a circulant matrix from the std::vector to the OpenCL device (either GPU or multi-core CPU) ...
void apply(VectorType &vec) const
Application of current preconditioner, multiplication on the right-hand side vector.
static void init(viennacl::ocl::context &ctx)
void computeFSPAI(MatrixT const &A, MatrixT const &PatternA, MatrixT &L, MatrixT &L_trans, fspai_tag)
A sparse square matrix in compressed sparse rows format.
void apply(VectorType &vec) const
Application of current preconditioner, multiplication on the right-hand side vector.
void initPreconditioner(SparseMatrixT const &A, SparseMatrixT &M)
Initialize preconditioner with sparcity pattern = p(A)
Implementation of a dynamic SPAI. Provides the routines for automatic pattern updates Experimental...
viennacl::linalg::detail::spai::spai_tag spai_tag