1 #ifndef VIENNACL_LINALG_HOST_BASED_DIRECT_SOLVE_HPP
2 #define VIENNACL_LINALG_HOST_BASED_DIRECT_SOLVE_HPP
42 template <
typename MatrixType1,
typename MatrixType2>
45 typedef typename MatrixType2::value_type value_type;
51 for (
vcl_size_t j = current_row + 1; j < A_size; ++j)
53 value_type A_element = A(current_row, j);
55 B(current_row, k) -= A_element * B(j, k);
60 value_type A_diag = A(current_row, current_row);
62 B(current_row, k) /= A_diag;
67 template <
typename MatrixType1,
typename MatrixType2>
73 template <
typename MatrixType1,
typename MatrixType2>
82 template <
typename MatrixType1,
typename MatrixType2>
85 typedef typename MatrixType2::value_type value_type;
91 value_type A_element = A(i, j);
93 B(i, k) -= A_element * B(j, k);
98 value_type A_diag = A(i, i);
105 template <
typename MatrixType1,
typename MatrixType2>
111 template <
typename MatrixType1,
typename MatrixType2>
129 template <
typename NumericT,
typename F1,
typename F2,
typename SOLVERTAG>
132 typedef NumericT value_type;
134 value_type
const * data_A = detail::extract_raw_pointer<value_type>(A);
135 value_type * data_B = detail::extract_raw_pointer<value_type>(B);
165 template <
typename NumericT,
typename F1,
typename F2,
typename SOLVERTAG>
170 typedef NumericT value_type;
172 value_type
const * data_A = detail::extract_raw_pointer<value_type>(A);
173 value_type * data_B =
const_cast<value_type *
>(detail::extract_raw_pointer<value_type>(proxy_B.lhs()));
204 template <
typename NumericT,
typename F1,
typename F2,
typename SOLVERTAG>
209 typedef NumericT value_type;
211 value_type
const * data_A = detail::extract_raw_pointer<value_type>(proxy_A.lhs());
212 value_type * data_B =
const_cast<value_type *
>(detail::extract_raw_pointer<value_type>(B));
242 template <
typename NumericT,
typename F1,
typename F2,
typename SOLVERTAG>
247 typedef NumericT value_type;
249 value_type
const * data_A = detail::extract_raw_pointer<value_type>(proxy_A.lhs());
250 value_type * data_B =
const_cast<value_type *
>(detail::extract_raw_pointer<value_type>(proxy_B.lhs()));
284 template <
typename MatrixType,
typename VectorType>
287 typedef typename VectorType::value_type value_type;
293 for (
vcl_size_t j = current_row + 1; j < A_size; ++j)
295 value_type A_element = A(current_row, j);
296 b(current_row) -= A_element * b(j);
300 b(current_row) /= A(current_row, current_row);
304 template <
typename MatrixType,
typename VectorType>
310 template <
typename MatrixType,
typename VectorType>
319 template <
typename MatrixType,
typename VectorType>
322 typedef typename VectorType::value_type value_type;
328 value_type A_element = A(i, j);
329 b(i) -= A_element * b(j);
337 template <
typename MatrixType,
typename VectorType>
343 template <
typename MatrixType,
typename VectorType>
351 template <
typename NumericT,
typename F,
typename SOLVERTAG>
356 typedef NumericT value_type;
358 value_type
const * data_A = detail::extract_raw_pointer<value_type>(mat);
359 value_type * data_v = detail::extract_raw_pointer<value_type>(vec);
385 template <
typename NumericT,
typename F,
typename SOLVERTAG>
390 typedef NumericT value_type;
392 value_type
const * data_A = detail::extract_raw_pointer<value_type>(proxy.lhs());
393 value_type * data_v = detail::extract_raw_pointer<value_type>(vec);
Helper class for accessing a strided subvector of a larger vector.
Definition: common.hpp:49
std::size_t vcl_size_t
Definition: forwards.h:58
result_of::size_type< matrix_base< NumericT, F > >::type stride2(matrix_base< NumericT, F > const &s)
Definition: stride.hpp:68
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.)
Definition: size.hpp:216
A tag class representing a lower triangular matrix.
Definition: forwards.h:703
void inplace_solve_vector(MatrixType &A, VectorType &b, vcl_size_t A_size, viennacl::linalg::unit_upper_tag)
Definition: direct_solve.hpp:305
A dense matrix class.
Definition: forwards.h:290
Expression template class for representing a tree of expressions which ultimately result in a matrix...
Definition: forwards.h:283
result_of::size_type< viennacl::vector_base< T > >::type stride(viennacl::vector_base< T > const &s)
Definition: stride.hpp:46
result_of::size_type< T >::type start1(T const &obj)
Definition: start.hpp:64
result_of::size_type< MatrixType >::type size2(MatrixType const &mat)
Generic routine for obtaining the number of columns of a matrix (ViennaCL, uBLAS, etc...
Definition: size.hpp:245
void inplace_solve(const matrix_base< NumericT, F1 > &A, matrix_base< NumericT, F2 > &B, SOLVERTAG)
Direct inplace solver for triangular systems with multiple right hand sides, i.e. A \ B (MATLAB notat...
Definition: direct_solve.hpp:130
result_of::size_type< matrix_base< NumericT, F > >::type stride1(matrix_base< NumericT, F > const &s)
Definition: stride.hpp:57
result_of::size_type< T >::type start2(T const &obj)
Definition: start.hpp:83
Helper array for accessing a strided submatrix embedded in a larger matrix.
Definition: common.hpp:100
A tag class representing an upper triangular matrix.
Definition: forwards.h:708
result_of::size_type< T >::type start(T const &obj)
Definition: start.hpp:43
Common base class for dense vectors, vector ranges, and vector slices.
Definition: forwards.h:205
vcl_size_t internal_size2(matrix_base< NumericT, F > const &mat)
Helper routine for obtaining the internal number of entries per column of a ViennaCL matrix...
Definition: size.hpp:287
void inplace_solve_matrix(MatrixType1 &A, MatrixType2 &B, vcl_size_t A_size, vcl_size_t B_size, viennacl::linalg::unit_upper_tag)
Definition: direct_solve.hpp:68
Common routines for single-threaded or OpenMP-enabled execution on CPU.
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
A tag class representing a lower triangular matrix with unit diagonal.
Definition: forwards.h:713
void lower_inplace_solve_matrix(MatrixType1 &A, MatrixType2 &B, vcl_size_t A_size, vcl_size_t B_size, bool unit_diagonal)
Definition: direct_solve.hpp:83
A tag class representing transposed matrices.
Definition: forwards.h:165
void lower_inplace_solve_vector(MatrixType &A, VectorType &b, vcl_size_t A_size, bool unit_diagonal)
Definition: direct_solve.hpp:320
vcl_size_t internal_size1(matrix_base< NumericT, F > const &mat)
Helper routine for obtaining the internal number of entries per row of a ViennaCL matrix...
Definition: size.hpp:279
void upper_inplace_solve_matrix(MatrixType1 &A, MatrixType2 &B, vcl_size_t A_size, vcl_size_t B_size, bool unit_diagonal)
Definition: direct_solve.hpp:43
void upper_inplace_solve_vector(MatrixType &A, VectorType &b, vcl_size_t A_size, bool unit_diagonal)
Definition: direct_solve.hpp:285
A tag class representing an upper triangular matrix with unit diagonal.
Definition: forwards.h:718