1 #ifndef VIENNACL_LINALG_DIRECT_SOLVE_HPP_
2 #define VIENNACL_LINALG_DIRECT_SOLVE_HPP_
34 #ifdef VIENNACL_WITH_OPENCL
38 #ifdef VIENNACL_WITH_CUDA
42 #define VIENNACL_DIRECT_SOLVE_BLOCKSIZE 64
61 template<
typename NumericT,
typename SolverTagT>
71 #ifdef VIENNACL_WITH_OPENCL
76 #ifdef VIENNACL_WITH_CUDA
93 template<
typename NumericT,
typename SolverTagT>
106 #ifdef VIENNACL_WITH_OPENCL
111 #ifdef VIENNACL_WITH_CUDA
129 template<
typename NumericT,
typename SolverTagT>
142 #ifdef VIENNACL_WITH_OPENCL
147 #ifdef VIENNACL_WITH_CUDA
164 template<
typename NumericT,
typename SolverTagT>
179 #ifdef VIENNACL_WITH_OPENCL
185 #ifdef VIENNACL_WITH_CUDA
202 template<
typename NumericT,
typename SolverTagT>
207 assert( (mat.
size1() == vec.
size()) &&
bool(
"Size check failed in inplace_solve(): size1(A) != size(b)"));
208 assert( (mat.
size2() == vec.
size()) &&
bool(
"Size check failed in inplace_solve(): size2(A) != size(b)"));
215 #ifdef VIENNACL_WITH_OPENCL
220 #ifdef VIENNACL_WITH_CUDA
237 template<
typename NumericT,
typename SolverTagT>
242 assert( (proxy.lhs().size1() == vec.
size()) &&
bool(
"Size check failed in inplace_solve(): size1(A) != size(b)"));
243 assert( (proxy.lhs().size2() == vec.
size()) &&
bool(
"Size check failed in inplace_solve(): size2(A) != size(b)"));
250 #ifdef VIENNACL_WITH_OPENCL
255 #ifdef VIENNACL_WITH_CUDA
268 template<
typename MatrixT1,
typename MatrixT2,
typename SolverTagT>
272 if (A.size1() <= blockSize)
276 for (
vcl_size_t i = 0; i < A.size1(); i = i + blockSize)
281 if (Apos2 > A.size1())
291 if (Apos2 < A.size1())
301 template<
typename MatrixT1,
typename MatrixT2>
307 template<
typename MatrixT1,
typename MatrixT2>
313 template<
typename MatrixT1,
typename MatrixT2,
typename SolverTagT>
317 if (static_cast<int>(A.size1()) <= blockSize)
321 for (
int i = static_cast<int>(A.size1()); i > 0; i = i - blockSize)
323 int Apos1 = i - blockSize;
346 template<
typename MatrixT1,
typename MatrixT2>
352 template<
typename MatrixT1,
typename MatrixT2>
365 template<
typename NumericT,
typename SolverTagT>
378 template<
typename NumericT,
typename SolverTagT>
395 template<
typename NumericT,
typename SolverTagT>
409 template<
typename NumericT,
typename SolverTagT>
431 template<
typename NumericT,
typename SolverTagT>
448 template<
typename NumericT,
typename SolverTagT>
465 template<
typename NumericT,
typename SolverTagT>
482 template<
typename NumericT,
typename SolverTagT>
499 template<
typename MatrixT1,
typename VectorT,
typename SolverTagT>
503 if (A.size1() < blockSize)
507 for (
vcl_size_t i = 0; i < A.size1(); i = i + blockSize)
521 if (Apos2 < A.size1())
531 template<
typename MatrixT1,
typename VectorT>
537 template<
typename MatrixT1,
typename VectorT>
543 template<
typename MatrixT1,
typename VectorT,
typename SolverTagT>
547 if (static_cast<int>(A.size1()) < blockSize)
551 for (
int i = static_cast<int>(A.size1()); i > 0; i = i - blockSize)
553 int Apos1 = i - blockSize;
575 template<
typename MatrixT1,
typename VectorT>
581 template<
typename MatrixT1,
typename VectorT>
595 template<
typename NumericT,
typename SolverTagT>
598 SolverTagT
const & tag)
610 template<
typename NumericT,
typename SolverTagT>
613 SolverTagT
const & tag)
628 template<
typename NumericT>
647 template<
typename NumericT>
666 template<
typename NumericT>
685 template<
typename NumericT>
702 template<
typename NumericT,
typename SolverTagT>
705 SolverTagT
const & tag)
Implementations of dense direct triangular solvers are found here.
void inplace_solve(const matrix_base< NumericT > &A, matrix_base< NumericT > &B, SolverTagT)
Direct inplace solver for triangular systems with multiple right hand sides, i.e. A \ B (MATLAB notat...
void inplace_solve_upper_impl(MatrixT1 const &A, MatrixT2 &B, SolverTagT)
Exception class in case of memory errors.
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
Implementation of the dense matrix class.
vcl_size_t size1(MatrixType const &mat)
Generic routine for obtaining the number of rows of a matrix (ViennaCL, uBLAS, etc.)
A tag class representing a lower triangular matrix.
void inplace_solve(const matrix_base< NumericT > &A, bool trans_A, matrix_base< NumericT > &B, bool trans_B, SolverTagT)
Direct inplace solver for triangular systems with multiple right hand sides, i.e. A \ B (MATLAB notat...
Expression template class for representing a tree of expressions which ultimately result in a matrix...
This file provides the forward declarations for the main types used within ViennaCL.
void inplace_solve_upper_vec_impl(MatrixT1 const &A, VectorT &B, SolverTagT)
result_of::size_type< MatrixType >::type size2(MatrixType const &mat)
Generic routine for obtaining the number of columns of a matrix (ViennaCL, uBLAS, etc...
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
void inplace_solve_vec_impl(MatrixT1 const &A, VectorT &B, viennacl::linalg::lower_tag)
A tag class representing an upper triangular matrix.
void inplace_solve_lower_vec_impl(MatrixT1 const &A, VectorT &B, SolverTagT)
void inplace_solve(const matrix_base< NumericT > &A, bool trans_A, matrix_base< NumericT > &B, bool trans_B, SolverTagT tag)
Direct inplace solver for triangular systems with multiple right hand sides, i.e. A \ B (MATLAB notat...
void inplace_solve(const matrix_base< NumericT > &A, bool A_trans, matrix_base< NumericT > &B, bool B_trans, SolverTagT)
Direct inplace solver for dense triangular systems. Matlab notation: A \ B.
void inplace_solve_kernel(const matrix_base< NumericT > &A, const matrix_base< NumericT > &B, SolverTagT)
Direct inplace solver for dense triangular systems using a single kernel launch. Matlab notation: A \...
matrix_range< MatrixType > project(MatrixType const &A, viennacl::range const &r1, viennacl::range const &r2)
size_type size2() const
Returns the number of columns.
void trans(const matrix_expression< const matrix_base< NumericT, SizeT, DistanceT >, const matrix_base< NumericT, SizeT, DistanceT >, op_trans > &proxy, matrix_base< NumericT > &temp_trans)
void inplace_solve_impl(MatrixT1 const &A, MatrixT2 &B, viennacl::linalg::lower_tag)
size_type size1() const
Returns the number of rows.
Proxy classes for vectors.
#define VIENNACL_DIRECT_SOLVE_BLOCKSIZE
Proxy classes for matrices.
void inplace_solve_lower_impl(MatrixT1 const &A, MatrixT2 &B, SolverTagT)
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
size_type size() const
Returns the length of the vector (cf. std::vector)
Implementations of dense direct solvers using CUDA are found here.
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
A tag class representing a lower triangular matrix with unit diagonal.
A tag class representing transposed matrices.
viennacl::backend::mem_handle & handle(T &obj)
Returns the generic memory handle of an object. Non-const version.
void inplace_solve_vec_kernel(const matrix_base< NumericT > &mat, const vector_base< NumericT > &vec, SolverTagT)
Implementations of dense direct solvers are found here.
Simple enable-if variant that uses the SFINAE pattern.
A tag class representing an upper triangular matrix with unit diagonal.
viennacl::vector< NumericT > solve(MatrixT const &A, viennacl::vector_base< NumericT > const &rhs, bicgstab_tag const &tag, viennacl::linalg::no_precond)
Implementation of a pipelined stabilized Bi-conjugate gradient solver.
memory_types get_active_handle_id() const
Returns an ID for the currently active memory buffer. Other memory buffers might contain old or no da...