Main implementation of SPAI (not FSPAI). 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/compressed_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/kernels/spai_source.h"
#include "viennacl/linalg/kernels/spai_kernels.h"
Go to the source code of this file.
Namespaces | |
namespace | viennacl |
namespace | viennacl::linalg |
namespace | viennacl::linalg::detail |
namespace | viennacl::linalg::detail::spai |
Defines | |
#define | VIENNACL_SPAI_K_b 20 |
Functions | |
template<typename SparseVectorType > | |
void | print_sparse_vector (const SparseVectorType &v) |
template<typename DenseMatrixType > | |
void | print_matrix (DenseMatrixType &m) |
template<typename SparseVectorType , typename ScalarType > | |
void | add_sparse_vectors (const SparseVectorType &v, const ScalarType b, SparseVectorType &res_v) |
Add two sparse vectors res_v = b*v. | |
template<typename SparseVectorType , typename ScalarType > | |
void | compute_spai_residual (const std::vector< SparseVectorType > &A_v_c, const SparseVectorType &v, const unsigned int ind, SparseVectorType &res) |
Computation of residual res = A*v - e. | |
template<typename SparseVectorType > | |
void | build_index_set (const std::vector< SparseVectorType > &A_v_c, const SparseVectorType &v, std::vector< unsigned int > &J, std::vector< unsigned int > &I) |
Setting up index set of columns and rows for certain column. | |
template<typename SparseMatrixType , typename DenseMatrixType , typename SparseVectorType , typename VectorType > | |
void | block_set_up (const SparseMatrixType &A, const std::vector< SparseVectorType > &A_v_c, const std::vector< SparseVectorType > &M_v, std::vector< std::vector< unsigned int > > &g_I, std::vector< std::vector< unsigned int > > &g_J, std::vector< DenseMatrixType > &g_A_I_J, std::vector< VectorType > &g_b_v) |
Setting up blocks and QR factorizing them on CPU. | |
template<typename SparseVectorType > | |
void | index_set_up (const std::vector< SparseVectorType > &A_v_c, const std::vector< SparseVectorType > &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. | |
template<typename ScalarType , unsigned int MAT_ALIGNMENT, typename SparseVectorType > | |
void | block_set_up (const viennacl::compressed_matrix< ScalarType, MAT_ALIGNMENT > &A, const std::vector< SparseVectorType > &A_v_c, const std::vector< SparseVectorType > &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, const unsigned int cur_iter) |
Setting up blocks and QR factorizing them on GPU. | |
template<typename ScalarType , typename SparseVectorType > | |
void | custom_fan_out (const std::vector< ScalarType > &m_in, unsigned int start_m_ind, const std::vector< unsigned int > &J, SparseVectorType &m) |
Elicitation of sparse vector m for particular column from m_in - contigious vector for all columns. | |
template<typename SparseVectorType , typename ScalarType > | |
void | least_square_solve (std::vector< SparseVectorType > &A_v_c, std::vector< SparseVectorType > &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< SparseVectorType > &g_res, std::vector< cl_uint > &g_is_update, const spai_tag &tag, const unsigned int cur_iter) |
Solution of Least square problem on GPU. | |
template<typename SparseVectorType , typename DenseMatrixType , typename VectorType > | |
void | least_square_solve (const std::vector< SparseVectorType > &A_v_c, std::vector< DenseMatrixType > &g_R, std::vector< VectorType > &g_b_v, std::vector< std::vector< unsigned int > > &g_I, std::vector< std::vector< unsigned int > > &g_J, std::vector< SparseVectorType > &g_res, std::vector< bool > &g_is_update, std::vector< SparseVectorType > &M_v, const spai_tag &tag) |
Solution of Least square problem on CPU. | |
template<typename VectorType > | |
bool | is_all_update (VectorType ¶llel_is_update) |
template<typename SparseMatrixType , typename SparseVectorType > | |
void | vectorize_column_matrix (const SparseMatrixType &M_in, std::vector< SparseVectorType > &M_v) |
Solution of Least square problem on CPU. | |
template<typename SparseMatrixType , typename SparseVectorType > | |
void | vectorize_row_matrix (const SparseMatrixType &M_in, std::vector< SparseVectorType > &M_v) |
void | write_set_to_array (const std::vector< std::vector< unsigned int > > &ind_set, std::vector< cl_uint > &a) |
template<typename ScalarType , unsigned int MAT_ALIGNMENT> | |
void | block_assembly (const viennacl::compressed_matrix< ScalarType, MAT_ALIGNMENT > &A, const std::vector< std::vector< unsigned int > > &g_J, const std::vector< std::vector< unsigned int > > &g_I, block_matrix &g_A_I_J_vcl, std::vector< cl_uint > &g_is_update, bool &is_empty_block, const unsigned int cur_iter) |
Assembly of blocks on GPU by a gived set of row indices: g_I and column indices: g_J. | |
template<typename SparseMatrixType , typename SparseVectorType > | |
void | insert_sparse_columns (const std::vector< SparseVectorType > &M_v, SparseMatrixType &M, bool is_right) |
Insertion of vectorized matrix column into original sparse matrix. | |
template<typename MatrixType > | |
void | sparse_transpose (const MatrixType &A_in, MatrixType &A) |
Transposition of sparse matrix. | |
template<typename MatrixType > | |
void | computeSPAI (const MatrixType &A, MatrixType &M, spai_tag &tag) |
Construction of SPAI preconditioner on CPU. | |
template<typename ScalarType , unsigned int MAT_ALIGNMENT> | |
void | computeSPAI (const viennacl::compressed_matrix< ScalarType, MAT_ALIGNMENT > &A, const boost::numeric::ublas::compressed_matrix< ScalarType > &cpu_A, boost::numeric::ublas::compressed_matrix< ScalarType > &cpu_M, viennacl::compressed_matrix< ScalarType, MAT_ALIGNMENT > &M, const spai_tag &tag) |
Construction of SPAI preconditioner on GPU. |
Main implementation of SPAI (not FSPAI).
#define VIENNACL_SPAI_K_b 20 |