/* * * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * KF acknowledges the support of the Faculty of Civil Engineering, * University of Zagreb, Croatia. * */ #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_MATRIX_HPP #define BOOST_NUMERIC_BINDINGS_TRAITS_MATRIX_HPP #include #include #include namespace boost { namespace numeric { namespace bindings { namespace traits { // Matrix traits free functions template inline typename boost::enable_if< is_bindable_matrix, typename matrix_traits::pointer >::type matrix_storage (M& m) { return matrix_traits::storage (m); } template inline typename boost::enable_if< is_bindable_matrix, std::ptrdiff_t >::type matrix_num_rows (M& m) { return matrix_traits::num_rows (m); } template inline typename boost::enable_if< is_bindable_matrix, std::ptrdiff_t >::type matrix_num_columns (M& m) { return matrix_traits::num_columns (m); } template inline typename boost::enable_if< is_bindable_matrix, std::ptrdiff_t >::type matrix_stride1 (M& m) { return matrix_traits::stride1 (m); } template inline typename boost::enable_if< is_bindable_matrix, std::ptrdiff_t >::type matrix_stride2 (M& m) { return matrix_traits::stride2 (m); } template inline typename boost::enable_if< is_bindable_matrix, std::ptrdiff_t >::type matrix_upper_bandwidth (M& m) { return matrix_traits::upper_bandwidth (m); } template inline typename boost::enable_if< is_bindable_matrix, std::ptrdiff_t >::type matrix_lower_bandwidth (M& m) { return matrix_traits::lower_bandwidth (m); } template inline typename boost::enable_if< is_bindable_matrix, std::ptrdiff_t >::type leading_dimension (M& m) { return matrix_traits::leading_dimension (m); } // vector-as-matrix free functions template inline typename boost::enable_if< is_bindable_vector, typename vector_traits::pointer >::type matrix_storage (V& v) { return vector_traits::storage (v); } template inline typename boost::enable_if< is_bindable_vector, std::ptrdiff_t >::type matrix_num_rows (V& v) { return vector_traits::size (v); } template inline typename boost::enable_if< is_bindable_vector, std::ptrdiff_t >::type matrix_num_columns (V& v) { return 1; } template inline typename boost::enable_if< is_bindable_vector, std::ptrdiff_t >::type leading_dimension (V& v) { return vector_traits::size (v); } }}}} #endif