void inplace_solve(matrix_base<NumericT> const & mat, vector_base<NumericT> & vec, SolverTagT) { typedef NumericT value_type; value_type const * data_A = detail::extract_raw_pointer<value_type>(mat); value_type * data_v = detail::extract_raw_pointer<value_type>(vec); vcl_size_t A_start1 = viennacl::traits::start1(mat); vcl_size_t A_start2 = viennacl::traits::start2(mat); vcl_size_t A_inc1 = viennacl::traits::stride1(mat); vcl_size_t A_inc2 = viennacl::traits::stride2(mat); vcl_size_t A_size2 = viennacl::traits::size2(mat); vcl_size_t A_internal_size1 = viennacl::traits::internal_size1(mat); vcl_size_t A_internal_size2 = viennacl::traits::internal_size2(mat); vcl_size_t start1 = viennacl::traits::start(vec); vcl_size_t inc1 = viennacl::traits::stride(vec); if (mat.row_major()) { detail::matrix_array_wrapper<value_type const, row_major, false> wrapper_A(data_A, A_start1, A_start2, A_inc1, A_inc2, A_internal_size1, A_internal_size2); detail::vector_array_wrapper<value_type> wrapper_v(data_v, start1, inc1); detail::inplace_solve_vector(wrapper_A, wrapper_v, A_size2, SolverTagT()); } else { detail::matrix_array_wrapper<value_type const, column_major, false> wrapper_A(data_A, A_start1, A_start2, A_inc1, A_inc2, A_internal_size1, A_internal_size2); detail::vector_array_wrapper<value_type> wrapper_v(data_v, start1, inc1); detail::inplace_solve_vector(wrapper_A, wrapper_v, A_size2, SolverTagT()); } }
void inplace_solve(matrix_base<NumericT> const & A, matrix_base<NumericT> & B, SolverTagT) { typedef NumericT value_type; value_type const * data_A = detail::extract_raw_pointer<value_type>(A); value_type * data_B = detail::extract_raw_pointer<value_type>(B); vcl_size_t A_start1 = viennacl::traits::start1(A); vcl_size_t A_start2 = viennacl::traits::start2(A); vcl_size_t A_inc1 = viennacl::traits::stride1(A); vcl_size_t A_inc2 = viennacl::traits::stride2(A); //vcl_size_t A_size1 = viennacl::traits::size1(A); vcl_size_t A_size2 = viennacl::traits::size2(A); vcl_size_t A_internal_size1 = viennacl::traits::internal_size1(A); vcl_size_t A_internal_size2 = viennacl::traits::internal_size2(A); vcl_size_t B_start1 = viennacl::traits::start1(B); vcl_size_t B_start2 = viennacl::traits::start2(B); vcl_size_t B_inc1 = viennacl::traits::stride1(B); vcl_size_t B_inc2 = viennacl::traits::stride2(B); //vcl_size_t B_size1 = viennacl::traits::size1(B); vcl_size_t B_size2 = viennacl::traits::size2(B); vcl_size_t B_internal_size1 = viennacl::traits::internal_size1(B); vcl_size_t B_internal_size2 = viennacl::traits::internal_size2(B); if (A.row_major() && B.row_major()) { detail::matrix_array_wrapper<value_type const, row_major, false> wrapper_A(data_A, A_start1, A_start2, A_inc1, A_inc2, A_internal_size1, A_internal_size2); detail::matrix_array_wrapper<value_type, row_major, false> wrapper_B(data_B, B_start1, B_start2, B_inc1, B_inc2, B_internal_size1, B_internal_size2); detail::inplace_solve_matrix(wrapper_A, wrapper_B, A_size2, B_size2, SolverTagT()); } else if (A.row_major() && !B.row_major()) { detail::matrix_array_wrapper<value_type const, row_major, false> wrapper_A(data_A, A_start1, A_start2, A_inc1, A_inc2, A_internal_size1, A_internal_size2); detail::matrix_array_wrapper<value_type, column_major, false> wrapper_B(data_B, B_start1, B_start2, B_inc1, B_inc2, B_internal_size1, B_internal_size2); detail::inplace_solve_matrix(wrapper_A, wrapper_B, A_size2, B_size2, SolverTagT()); } else if (!A.row_major() && B.row_major()) { detail::matrix_array_wrapper<value_type const, column_major, false> wrapper_A(data_A, A_start1, A_start2, A_inc1, A_inc2, A_internal_size1, A_internal_size2); detail::matrix_array_wrapper<value_type, row_major, false> wrapper_B(data_B, B_start1, B_start2, B_inc1, B_inc2, B_internal_size1, B_internal_size2); detail::inplace_solve_matrix(wrapper_A, wrapper_B, A_size2, B_size2, SolverTagT()); } else { detail::matrix_array_wrapper<value_type const, column_major, false> wrapper_A(data_A, A_start1, A_start2, A_inc1, A_inc2, A_internal_size1, A_internal_size2); detail::matrix_array_wrapper<value_type, column_major, false> wrapper_B(data_B, B_start1, B_start2, B_inc1, B_inc2, B_internal_size1, B_internal_size2); detail::inplace_solve_matrix(wrapper_A, wrapper_B, A_size2, B_size2, SolverTagT()); } }
bool row_major(matrix_base<NumericT> const & A) { return A.row_major(); }
vcl_size_t nld(matrix_base<NumericT> const & mat) { if (mat.row_major()) return mat.stride2(); return mat.stride1(); }
vcl_size_t ld(matrix_base<NumericT> const & mat) { if (mat.row_major()) return mat.internal_size2(); return mat.internal_size1(); }