Main implementation of SPAI (not FSPAI). Experimental. More...
#include <utility>
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include "viennacl/linalg/detail/spai/spai_tag.hpp"
#include "viennacl/linalg/qr.hpp"
#include "viennacl/linalg/detail/spai/spai-dynamic.hpp"
#include "viennacl/linalg/detail/spai/spai-static.hpp"
#include "viennacl/linalg/detail/spai/sparse_vector.hpp"
#include "viennacl/linalg/detail/spai/block_matrix.hpp"
#include "viennacl/linalg/detail/spai/block_vector.hpp"
#include "boost/numeric/ublas/vector.hpp"
#include "boost/numeric/ublas/matrix.hpp"
#include "boost/numeric/ublas/matrix_proxy.hpp"
#include "boost/numeric/ublas/vector_proxy.hpp"
#include "boost/numeric/ublas/storage.hpp"
#include "boost/numeric/ublas/io.hpp"
#include "boost/numeric/ublas/lu.hpp"
#include "boost/numeric/ublas/triangular.hpp"
#include "boost/numeric/ublas/matrix_expression.hpp"
#include "viennacl/linalg/prod.hpp"
#include "viennacl/matrix.hpp"
#include "viennacl/compressed_matrix.hpp"
#include "viennacl/linalg/sparse_matrix_operations.hpp"
#include "viennacl/linalg/matrix_operations.hpp"
#include "viennacl/scalar.hpp"
#include "viennacl/linalg/inner_prod.hpp"
#include "viennacl/linalg/ilu.hpp"
#include "viennacl/ocl/backend.hpp"
#include "viennacl/linalg/opencl/kernels/spai.hpp"
Go to the source code of this file.
Namespaces | |
viennacl | |
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them. | |
viennacl::linalg | |
Provides all linear algebra operations which are not covered by operator overloads. | |
viennacl::linalg::detail | |
Namespace holding implementation details for linear algebra routines. Usually not of interest for a library user. | |
viennacl::linalg::detail::spai | |
Implementation namespace for sparse approximate inverse preconditioner. | |
Macros | |
#define | VIENNACL_SPAI_K_b 20 |
Functions | |
template<typename SparseVectorT > | |
void | viennacl::linalg::detail::spai::print_sparse_vector (SparseVectorT const &v) |
template<typename DenseMatrixT > | |
void | viennacl::linalg::detail::spai::print_matrix (DenseMatrixT &m) |
template<typename SparseVectorT , typename NumericT > | |
void | viennacl::linalg::detail::spai::add_sparse_vectors (SparseVectorT const &v, NumericT b, SparseVectorT &res_v) |
Add two sparse vectors res_v = b*v. More... | |
template<typename SparseVectorT , typename NumericT > | |
void | viennacl::linalg::detail::spai::compute_spai_residual (std::vector< SparseVectorT > const &A_v_c, SparseVectorT const &v, unsigned int ind, SparseVectorT &res) |
Computation of residual res = A*v - e. More... | |
template<typename SparseVectorT > | |
void | viennacl::linalg::detail::spai::build_index_set (std::vector< SparseVectorT > const &A_v_c, SparseVectorT const &v, std::vector< unsigned int > &J, std::vector< unsigned int > &I) |
Setting up index set of columns and rows for certain column. More... | |
template<typename SparseMatrixT , typename DenseMatrixT > | |
void | viennacl::linalg::detail::spai::initProjectSubMatrix (SparseMatrixT const &A_in, std::vector< unsigned int > const &J, std::vector< unsigned int > &I, DenseMatrixT &A_out) |
Initializes a dense matrix from a sparse one. More... | |
template<typename SparseMatrixT , typename DenseMatrixT , typename SparseVectorT , typename VectorT > | |
void | viennacl::linalg::detail::spai::block_set_up (SparseMatrixT const &A, std::vector< SparseVectorT > const &A_v_c, std::vector< SparseVectorT > const &M_v, std::vector< std::vector< unsigned int > > &g_I, std::vector< std::vector< unsigned int > > &g_J, std::vector< DenseMatrixT > &g_A_I_J, std::vector< VectorT > &g_b_v) |
Setting up blocks and QR factorizing them on CPU. More... | |
template<typename SparseVectorT > | |
void | viennacl::linalg::detail::spai::index_set_up (std::vector< SparseVectorT > const &A_v_c, std::vector< SparseVectorT > const &M_v, std::vector< std::vector< unsigned int > > &g_J, std::vector< std::vector< unsigned int > > &g_I) |
Setting up index set of columns and rows for all columns. More... | |
template<typename NumericT , unsigned int AlignmentV, typename SparseVectorT > | |
void | viennacl::linalg::detail::spai::block_set_up (viennacl::compressed_matrix< NumericT, AlignmentV > const &A, std::vector< SparseVectorT > const &A_v_c, std::vector< SparseVectorT > const &M_v, std::vector< cl_uint > g_is_update, std::vector< std::vector< unsigned int > > &g_I, std::vector< std::vector< unsigned int > > &g_J, block_matrix &g_A_I_J, block_vector &g_bv) |
Setting up blocks and QR factorizing them on GPU. More... | |
template<typename NumericT , typename SparseVectorT > | |
void | viennacl::linalg::detail::spai::custom_fan_out (std::vector< NumericT > const &m_in, unsigned int start_m_ind, std::vector< unsigned int > const &J, SparseVectorT &m) |
Elicitation of sparse vector m for particular column from m_in - contigious vector for all columns. More... | |
template<typename SparseVectorT , typename NumericT > | |
void | viennacl::linalg::detail::spai::least_square_solve (std::vector< SparseVectorT > &A_v_c, std::vector< SparseVectorT > &M_v, std::vector< std::vector< unsigned int > > &g_I, std::vector< std::vector< unsigned int > > &g_J, block_matrix &g_A_I_J_vcl, block_vector &g_bv_vcl, std::vector< SparseVectorT > &g_res, std::vector< cl_uint > &g_is_update, const spai_tag &tag, viennacl::context ctx) |
Solution of Least square problem on GPU. More... | |
template<typename SparseVectorT , typename DenseMatrixT , typename VectorT > | |
void | viennacl::linalg::detail::spai::least_square_solve (std::vector< SparseVectorT > const &A_v_c, std::vector< DenseMatrixT > &g_R, std::vector< VectorT > &g_b_v, std::vector< std::vector< unsigned int > > &g_I, std::vector< std::vector< unsigned int > > &g_J, std::vector< SparseVectorT > &g_res, std::vector< bool > &g_is_update, std::vector< SparseVectorT > &M_v, spai_tag const &tag) |
Solution of Least square problem on CPU. More... | |
template<typename VectorType > | |
bool | viennacl::linalg::detail::spai::is_all_update (VectorType ¶llel_is_update) |
template<typename SparseMatrixT , typename SparseVectorT > | |
void | viennacl::linalg::detail::spai::vectorize_column_matrix (SparseMatrixT const &M_in, std::vector< SparseVectorT > &M_v) |
Solution of Least square problem on CPU. More... | |
template<typename SparseMatrixT , typename SparseVectorT > | |
void | viennacl::linalg::detail::spai::vectorize_row_matrix (SparseMatrixT const &M_in, std::vector< SparseVectorT > &M_v) |
template<typename SizeT > | |
void | viennacl::linalg::detail::spai::write_set_to_array (std::vector< std::vector< SizeT > > const &ind_set, std::vector< cl_uint > &a) |
template<typename NumericT , unsigned int AlignmentV> | |
void | viennacl::linalg::detail::spai::block_assembly (viennacl::compressed_matrix< NumericT, AlignmentV > const &A, std::vector< std::vector< unsigned int > > const &g_J, std::vector< std::vector< unsigned int > > const &g_I, block_matrix &g_A_I_J_vcl, std::vector< cl_uint > &g_is_update, bool &is_empty_block) |
Assembly of blocks on GPU by a gived set of row indices: g_I and column indices: g_J. More... | |
template<typename SparseMatrixT , typename SparseVectorT > | |
void | viennacl::linalg::detail::spai::insert_sparse_columns (std::vector< SparseVectorT > const &M_v, SparseMatrixT &M, bool is_right) |
Insertion of vectorized matrix column into original sparse matrix. More... | |
template<typename MatrixT > | |
void | viennacl::linalg::detail::spai::sparse_transpose (MatrixT const &A_in, MatrixT &A) |
Transposition of sparse matrix. More... | |
template<typename MatrixT > | |
void | viennacl::linalg::detail::spai::computeSPAI (MatrixT const &A, MatrixT &M, spai_tag &tag) |
Construction of SPAI preconditioner on CPU. More... | |
template<typename NumericT , unsigned int AlignmentV> | |
void | viennacl::linalg::detail::spai::computeSPAI (viennacl::compressed_matrix< NumericT, AlignmentV > const &A, boost::numeric::ublas::compressed_matrix< NumericT > const &cpu_A, boost::numeric::ublas::compressed_matrix< NumericT > &cpu_M, viennacl::compressed_matrix< NumericT, AlignmentV > &M, spai_tag const &tag) |
Construction of SPAI preconditioner on GPU. More... | |
Main implementation of SPAI (not FSPAI). Experimental.
Definition in file spai.hpp.