All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
ublas_traits.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
15 #ifndef PAAL_UBLAS_TRAITS_HPP
16 #define PAAL_UBLAS_TRAITS_HPP
17 
19 
20 #include <boost/numeric/bindings/traits/traits.hpp>
21 #include <boost/numeric/bindings/traits/ublas_matrix.hpp>
22 #include <boost/numeric/ublas/banded.hpp>
23 #include <boost/numeric/ublas/matrix_proxy.hpp>
24 #include <boost/numeric/ublas/traits.hpp>
25 #include <boost/numeric/ublas/vector.hpp>
26 
27 namespace paal {
28 namespace data_structures {
29 
30 template <typename RowType,
31  typename Enable = void>
32 struct is_sparse_row : public std::false_type {};
33 
34 template <typename RowType>
35 struct is_sparse_row<RowType,
36  typename std::enable_if<
37  std::is_same<typename paal::decay_t<RowType>::container_type::storage_category,
38  boost::numeric::ublas::sparse_tag>::value>::type> :
39  public std::true_type {};
40 
42 template <typename Matrix>
44 
46 template <typename T>
47 struct matrix_type_traits<boost::numeric::ublas::matrix<T>> {
48  using coordinate_t = T;
49  using matrix_row_t = boost::numeric::ublas::matrix_row<boost::numeric::ublas::matrix<T>>;
50  using vector_t = boost::numeric::ublas::vector<T>;
51  using matrix_column_major_t = boost::numeric::ublas::matrix<T, boost::numeric::ublas::column_major>;
52  using matrix_diagonal_t = boost::numeric::ublas::banded_matrix<T>;
54  static std::size_t num_rows (boost::numeric::ublas::matrix<T> &m) { return m.size1(); }
56  static std::size_t num_columns (boost::numeric::ublas::matrix<T> &m) { return m.size2(); }
57 };
58 
59 } // data_structures
60 } // paal
61 
62 #endif // PAAL_UBLAS_TRAITS_HPP
static std::size_t num_columns(boost::numeric::ublas::matrix< T > &m)
Return the number of columns of the matrix.
Traits class for matrix related types.
static std::size_t num_rows(boost::numeric::ublas::matrix< T > &m)
Return the number of rows of the matrix.