Implementation of a simultaneous QR factorization of multiple matrices. Experimental. More...
#include <utility>
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cmath>
#include <sstream>
#include "viennacl/ocl/backend.hpp"
#include "boost/numeric/ublas/vector.hpp"
#include "boost/numeric/ublas/matrix.hpp"
#include "boost/numeric/ublas/matrix_proxy.hpp"
#include "boost/numeric/ublas/storage.hpp"
#include "boost/numeric/ublas/io.hpp"
#include "boost/numeric/ublas/matrix_expression.hpp"
#include "boost/numeric/ublas/detail/matrix_assign.hpp"
#include "viennacl/vector.hpp"
#include "viennacl/matrix.hpp"
#include "viennacl/linalg/detail/spai/block_matrix.hpp"
#include "viennacl/linalg/detail/spai/block_vector.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 |
Functions | |
template<typename T , typename InputIterator > | |
void | Print (std::ostream &ostr, InputIterator it_begin, InputIterator it_end) |
template<typename VectorType , typename MatrixType > | |
void | write_to_block (VectorType &con_A_I_J, unsigned int start_ind, const std::vector< unsigned int > &I, const std::vector< unsigned int > &J, MatrixType &m) |
template<typename VectorType > | |
void | print_continious_matrix (VectorType &con_A_I_J, std::vector< cl_uint > &blocks_ind, const std::vector< std::vector< unsigned int > > &g_I, const std::vector< std::vector< unsigned int > > &g_J) |
template<typename VectorType > | |
void | print_continious_vector (VectorType &con_v, std::vector< cl_uint > &block_ind, const std::vector< std::vector< unsigned int > > &g_J) |
void | compute_blocks_size (const std::vector< std::vector< unsigned int > > &g_I, const std::vector< std::vector< unsigned int > > &g_J, unsigned int &sz, std::vector< cl_uint > &blocks_ind, std::vector< cl_uint > &matrix_dims) |
**************************************** BLOCK FUNCTIONS ************************************// | |
void | get_size (const std::vector< std::vector< unsigned int > > &inds, unsigned int &size) |
Computes size of particular container of index set. | |
void | init_start_inds (const std::vector< std::vector< unsigned int > > &inds, std::vector< cl_uint > &start_inds) |
Initializes start indices of particular index set. | |
template<typename MatrixType , typename ScalarType > | |
void | dot_prod (const MatrixType &A, unsigned int beg_ind, ScalarType &res) |
Dot prod of particular column of martix A with it's self starting at a certain index beg_ind. | |
template<typename MatrixType , typename VectorType , typename ScalarType > | |
void | custom_inner_prod (const MatrixType &A, const VectorType &v, unsigned int col_ind, unsigned int start_ind, ScalarType &res) |
Dot prod of particular matrix column with arbitrary vector: A(:, col_ind). | |
template<typename MatrixType , typename VectorType > | |
void | copy_vector (const MatrixType &A, VectorType &v, const unsigned int beg_ind) |
Copying part of matrix column. | |
template<typename MatrixType , typename VectorType , typename ScalarType > | |
void | householder_vector (const MatrixType &A, unsigned int j, VectorType &v, ScalarType &b) |
Coputation of Householder vector, householder reflection c.f. Gene H. Golub, Charles F. Van Loan "Matrix Computations" 3rd edition p.210. | |
template<typename MatrixType , typename VectorType , typename ScalarType > | |
void | apply_householder_reflection (MatrixType &A, unsigned int iter_cnt, VectorType &v, ScalarType b) |
Inplace application of Householder vector to a matrix A. | |
template<typename MatrixType , typename VectorType > | |
void | store_householder_vector (MatrixType &A, unsigned int ind, VectorType &v) |
Storage of vector v in column(A, ind), starting from ind-1 index of a column. | |
template<typename MatrixType , typename VectorType > | |
void | single_qr (MatrixType &R, VectorType &b_v) |
Inplace QR factorization via Householder reflections c.f. Gene H. Golub, Charles F. Van Loan "Matrix Computations" 3rd edition p.224. | |
void | read_kernel_from_file (std::string &file_name, std::string &kernel_source) |
Reading from text file into string. | |
void | get_max_block_size (const std::vector< std::vector< unsigned int > > &inds, unsigned int &max_size) |
Getting max size of rows/columns from container of index set. | |
template<typename MatrixType , typename VectorType , typename ScalarType > | |
void | custom_dot_prod (const MatrixType &A, const VectorType &v, unsigned int ind, ScalarType &res) |
Dot_prod(column(A, ind), v) starting from index ind+1. | |
template<typename MatrixType , typename VectorType > | |
void | apply_q_trans_vec (const MatrixType &R, const VectorType &b_v, VectorType &y) |
Recovery Q from matrix R and vector of betas b_v. | |
template<typename MatrixType , typename VectorType > | |
void | apply_q_trans_mat (const MatrixType &R, const VectorType &b_v, MatrixType &A) |
Multiplication of Q'*A, where Q is in implicit for lower part of R and vector of betas - b_v. | |
template<typename ScalarType > | |
void | block_qr (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< cl_uint > &g_is_update, const unsigned int cur_iter) |
Inplace QR factorization via Householder reflections c.f. Gene H. Golub, Charles F. Van Loan "Matrix Computations" 3rd edition p.224 performed on GPU. |
Implementation of a simultaneous QR factorization of multiple matrices. Experimental.
SPAI code contributed by Nikolay Lukash