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 17 18 #ifndef BOOST_NUMERIC_UBLAS_OPERATION_NUM_COLUMNS_HPP 19 #define BOOST_NUMERIC_UBLAS_OPERATION_NUM_COLUMNS_HPP 20 21 22 #include <boost/numeric/ublas/detail/config.hpp> 23 #include <boost/numeric/ublas/expression_types.hpp> 24 #include <boost/numeric/ublas/traits.hpp> 25 26 27 namespace boost { namespace numeric { namespace ublas { 28 29 /** 30 * \brief Return the number of columns. 31 * \tparam MatrixExprT A type which models the matrix expression concept. 32 * \param m A matrix expression. 33 * \return The number of columns. 34 */ 35 template <typename MatrixExprT> 36 BOOST_UBLAS_INLINE num_columns(matrix_expression<MatrixExprT> const & me)37 typename matrix_traits<MatrixExprT>::size_type num_columns(matrix_expression<MatrixExprT> const& me) 38 { 39 return me().size2(); 40 } 41 42 }}} // Namespace boost::numeric::ublas 43 44 45 #endif // BOOST_NUMERIC_UBLAS_OPERATION_NUM_COLUMNS_HPP 46