30 #ifndef SHARK_LINALG_BLAS_KERNELS_DEFAULT_TRSV_HPP 31 #define SHARK_LINALG_BLAS_KERNELS_DEFAULT_TRSV_HPP 33 #include "../../matrix_proxy.hpp" 34 #include "../../vector_expression.hpp" 35 #include <boost/mpl/bool.hpp> 37 namespace shark {
namespace blas {
namespace bindings {
44 template<
bool Unit,
class TriangularA,
class V>
46 matrix_expression<TriangularA>
const& A,
47 vector_expression<V> &b,
48 boost::mpl::false_, column_major
53 typedef typename TriangularA::value_type value_type;
55 std::size_t
size = b().size();
56 for (std::size_t n = 0; n !=
size; ++ n) {
61 if (b()(n) != value_type()){
62 matrix_column<TriangularA const> col =
column(A(),n);
68 template<
bool Unit,
class TriangularA,
class V>
70 matrix_expression<TriangularA>
const& A,
71 vector_expression<V> &b,
72 boost::mpl::false_, row_major
77 typedef typename TriangularA::value_type value_type;
79 std::size_t size = b().size();
80 for (std::size_t n = 0; n <
size; ++ n) {
81 matrix_row<TriangularA const> matRow =
row(A(),n);
92 template<
bool Unit,
class TriangularA,
class V>
94 matrix_expression<TriangularA>
const& A,
95 vector_expression<V> &b,
96 boost::mpl::true_, column_major
101 typedef typename TriangularA::value_type value_type;
103 std::size_t size = b().size();
104 for (std::size_t i = 0; i <
size; ++ i) {
105 std::size_t n = size-i-1;
110 if (b()(n) != value_type()) {
111 matrix_column<TriangularA const> col =
column(A(),n);
117 template<
bool Unit,
class TriangularA,
class V>
119 matrix_expression<TriangularA>
const& A,
120 vector_expression<V> &b,
121 boost::mpl::true_, row_major
126 typedef typename TriangularA::value_type value_type;
128 std::size_t size = A().size1();
129 for (std::size_t i = 0; i <
size; ++ i) {
130 std::size_t n = size-i-1;
131 matrix_row<TriangularA const> matRow =
row(A(),n);
142 template <
bool Upper,
bool Unit,
typename TriangularA,
typename V>
144 matrix_expression<TriangularA>
const& A,
145 vector_expression<V> & b,
148 trsv_impl<Unit>(A, b, boost::mpl::bool_<Upper>(),
typename TriangularA::orientation());