num_columns.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * -*- c++ -*-
  3. *
  4. * \file num_columns.hpp
  5. *
  6. * \brief The \c num_columns operation.
  7. *
  8. * Copyright (c) 2009, Marco Guazzone
  9. *
  10. * Distributed under the Boost Software License, Version 1.0. (See
  11. * accompanying file LICENSE_1_0.txt or copy at
  12. * http://www.boost.org/LICENSE_1_0.txt)
  13. *
  14. * \author Marco Guazzone, marco.guazzone@gmail.com
  15. */
  16. #ifndef BOOST_NUMERIC_UBLAS_OPERATION_NUM_COLUMNS_HPP
  17. #define BOOST_NUMERIC_UBLAS_OPERATION_NUM_COLUMNS_HPP
  18. #include <boost/numeric/ublas/detail/config.hpp>
  19. #include <boost/numeric/ublas/expression_types.hpp>
  20. #include <boost/numeric/ublas/traits.hpp>
  21. namespace boost { namespace numeric { namespace ublas {
  22. /**
  23. * \brief Return the number of columns.
  24. * \tparam MatrixExprT A type which models the matrix expression concept.
  25. * \param m A matrix expression.
  26. * \return The number of columns.
  27. */
  28. template <typename MatrixExprT>
  29. BOOST_UBLAS_INLINE
  30. typename matrix_traits<MatrixExprT>::size_type num_columns(matrix_expression<MatrixExprT> const& me)
  31. {
  32. return me().size2();
  33. }
  34. }}} // Namespace boost::numeric::ublas
  35. #endif // BOOST_NUMERIC_UBLAS_OPERATION_NUM_COLUMNS_HPP