1 #ifndef VIENNACL_LINALG_LU_HPP
2 #define VIENNACL_LINALG_LU_HPP
41 template<
typename SCALARTYPE>
48 std::vector<SCALARTYPE> temp_buffer(A.
internal_size2() * max_block_size);
51 for (
vcl_size_t panel_id = 0; panel_id < num_blocks; ++panel_id)
53 vcl_size_t row_start = panel_id * max_block_size;
54 vcl_size_t current_block_size = std::min<vcl_size_t>(A.
size1() - row_start, max_block_size);
71 for (
vcl_size_t k=0; k < current_block_size - 1; ++k)
73 for (
vcl_size_t i=k+1; i < current_block_size; ++i)
77 SCALARTYPE l_ik = temp_buffer[row_start + i * A.
internal_size2() + k];
90 if (remainder_range.size() > 0)
117 template<
typename SCALARTYPE>
124 std::vector<SCALARTYPE> temp_buffer(A.
internal_size1() * max_block_size);
127 for (
vcl_size_t panel_id = 0; panel_id < num_blocks; ++panel_id)
129 vcl_size_t col_start = panel_id * max_block_size;
130 vcl_size_t current_block_size = std::min<vcl_size_t>(A.
size1() - col_start, max_block_size);
132 viennacl::range block_range(col_start, col_start + current_block_size);
147 for (
vcl_size_t k=0; k < current_block_size; ++k)
149 SCALARTYPE a_kk = temp_buffer[col_start + k + k * A.
internal_size1()];
153 for (
vcl_size_t j=k+1; j < current_block_size; ++j)
155 SCALARTYPE a_kj = temp_buffer[col_start + k + j * A.
internal_size1()];
167 if (remainder_range.size() > 0)
200 template<
typename SCALARTYPE,
typename F1,
typename F2,
unsigned int ALIGNMENT_A,
unsigned int ALIGNMENT_B>
204 assert(A.
size1() == A.
size2() && bool(
"Matrix must be square"));
205 assert(A.
size1() == B.
size1() && bool(
"Matrix must be square"));
215 template<
typename SCALARTYPE,
typename F,
unsigned int ALIGNMENT,
unsigned int VEC_ALIGNMENT>
219 assert(A.
size1() == A.
size2() && bool(
"Matrix must be square"));
size_type size1() const
Returns the number of rows.
Definition: matrix.hpp:625
std::size_t vcl_size_t
Definition: forwards.h:58
void memory_write(mem_handle &dst_buffer, vcl_size_t dst_offset, vcl_size_t bytes_to_write, const void *ptr, bool async=false)
Writes data from main RAM identified by 'ptr' to the buffer identified by 'dst_buffer'.
Definition: memory.hpp:220
viennacl::enable_if< viennacl::is_any_sparse_matrix< M1 >::value, matrix_expression< const M1, const M1, op_trans > >::type trans(const M1 &mat)
Returns an expression template class representing a transposed matrix.
Definition: sparse_matrix_operations.hpp:330
void inplace_solve(const matrix_base< NumericT, F1 > &A, matrix_base< NumericT, F2 > &B, SOLVERTAG)
Direct inplace solver for dense triangular systems. Matlab notation: A \ B.
Definition: direct_solve.hpp:54
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
Implementation of the dense matrix class.
A tag class representing a lower triangular matrix.
Definition: forwards.h:703
size_type internal_size1() const
Returns the internal number of rows. Usually required for launching OpenCL kernels only...
Definition: matrix.hpp:647
A dense matrix class.
Definition: forwards.h:293
void memory_read(mem_handle const &src_buffer, vcl_size_t src_offset, vcl_size_t bytes_to_read, void *ptr, bool async=false)
Reads data from a buffer back to main RAM.
Definition: memory.hpp:261
size_type size2() const
Returns the number of columns.
Definition: matrix.hpp:627
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
Definition: prod.hpp:91
void lu_factorize(matrix< SCALARTYPE, viennacl::row_major > &A)
LU factorization of a row-major dense matrix.
Definition: lu.hpp:42
A tag class representing an upper triangular matrix.
Definition: forwards.h:708
void lu_substitute(matrix< SCALARTYPE, F1, ALIGNMENT_A > const &A, matrix< SCALARTYPE, F2, ALIGNMENT_B > &B)
LU substitution for the system LU = rhs.
Definition: lu.hpp:201
A vector class representing a linear memory sequence on the GPU. Inspired by boost::numeric::ublas::v...
Definition: forwards.h:208
Implementations of dense direct solvers are found here.
Proxy classes for matrices.
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Definition: forwards.h:339
A tag class representing a lower triangular matrix with unit diagonal.
Definition: forwards.h:713
handle_type & handle()
Returns the OpenCL handle, non-const-version.
Definition: matrix.hpp:654
Class for representing non-strided submatrices of a bigger matrix A.
Definition: forwards.h:355
size_type internal_size2() const
Returns the internal number of columns. Usually required for launching OpenCL kernels only...
Definition: matrix.hpp:649