Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59093 - sandbox/numeric_bindings/boost/numeric/bindings/blas/level1
From: rutger_at_[hidden]
Date: 2010-01-17 08:41:08


Author: rutger
Date: 2010-01-17 08:41:07 EST (Sun, 17 Jan 2010)
New Revision: 59093
URL: http://svn.boost.org/trac/boost/changeset/59093

Log:
finalized iamax

Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/iamax.hpp | 32 ++++++++++++++++++++++++++++++++
   1 files changed, 32 insertions(+), 0 deletions(-)

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/iamax.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/iamax.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/iamax.hpp 2010-01-17 08:41:07 EST (Sun, 17 Jan 2010)
@@ -179,6 +179,29 @@
 
 } // namespace detail
 
+//
+// Value-type based template class. Use this class if you need a type
+// for dispatching to iamax.
+//
+template< typename Value >
+struct iamax_impl {
+
+ typedef Value value_type;
+ typedef typename remove_imaginary< Value >::type real_type;
+ typedef std::ptrdiff_t return_type;
+
+ //
+ // Static member function that
+ // * Deduces the required arguments for dispatching to BLAS, and
+ // * Asserts that most arguments make sense.
+ //
+ template< typename VectorX >
+ static return_type invoke( const VectorX& x ) {
+ namespace bindings = ::boost::numeric::bindings;
+ return detail::iamax( bindings::size(x),
+ bindings::begin_value(x), bindings::stride(x) );
+ }
+};
 
 //
 // Functions for direct use. These functions are overloaded for temporaries,
@@ -188,6 +211,15 @@
 // prototypes which are very similar.
 //
 
+//
+// Overloaded function for iamax. Its overload differs for
+//
+template< typename VectorX >
+inline typename iamax_impl< typename value< VectorX >::type >::return_type
+iamax( const VectorX& x ) {
+ return iamax_impl< typename value< VectorX >::type >::invoke( x );
+}
+
 } // namespace blas
 } // namespace bindings
 } // namespace numeric


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk