Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58496 - in sandbox/numeric_bindings/libs/numeric/bindings/tools: . templates
From: rutger_at_[hidden]
Date: 2009-12-22 14:21:55


Author: rutger
Date: 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
New Revision: 58496
URL: http://svn.boost.org/trac/boost/changeset/58496

Log:
Sync of latest work on numeric_bindings

Text files modified:
   sandbox/numeric_bindings/libs/numeric/bindings/tools/bindings.py | 27 ++-----
   sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py | 138 +++++++++++++++++++++++++--------------
   sandbox/numeric_bindings/libs/numeric/bindings/tools/cblas.py | 8 +-
   sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py | 9 ++
   sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py | 51 ++++++++++++--
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas.hpp | 73 +++++++++++++++-----
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp | 34 +++++++--
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_blas.hpp | 2
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_lapack.hpp | 2
   9 files changed, 238 insertions(+), 106 deletions(-)

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/bindings.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/bindings.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/bindings.py 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
@@ -244,7 +244,7 @@
     print "Generating const variants for ", argument_list
     permute_indices = []
     result = []
- static_asserts = []
+ comments = []
 
     for i in range( 0, len(argument_list) ):
         argument = argument_list[i]
@@ -257,27 +257,27 @@
         #print "i: ", i
         new_arg_list = []
         new_arg_list += argument_list
- new_asserts = []
+ new_comments = []
         for j in range( 0, len( permute_indices ) ):
             if ( i & (1<<j) ):
                 #print permute_indices[j], ": const " + argument_list[ permute_indices[ j ] ]
                 new_arg_list[ permute_indices[ j ] ] = "const " + argument_list[ permute_indices[ j ] ]
                 arg = new_arg_list[ permute_indices[ j ] ]
- new_asserts.append( "BOOST_STATIC_ASSERT( (is_mutable< " +
- arg[ :arg.find("&" ) ] + " >::value) );" )
+ new_comments.append( "// * " +
+ arg[ :arg.find("&" ) ] + "&" )
             else:
                 arg = new_arg_list[ permute_indices[ j ] ]
- new_asserts.append( "BOOST_STATIC_ASSERT( (is_mutable< " +
- arg[ :arg.find("&" ) ] + " >::value) );" )
+ new_comments.append( "// * " +
+ arg[ :arg.find("&" ) ] + "&" )
 
            # else:
                 #print permute_indices[j], "don't add const"
         result.append( new_arg_list )
- static_asserts.append( new_asserts )
+ comments.append( new_comments )
         #new_arg_list = []
 
     #print "result: ", result
- return result, static_asserts
+ return result, comments
 
 #
 # Generate the call to the value_tye meta-func
@@ -286,14 +286,3 @@
     return 'typename value< ' + arg + ' >::type'
 
 
-
-
-
-
-
-
-
-
-
-
-

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
@@ -69,55 +69,75 @@
 
     #
     # LEVEL 0 HANDLING
- #
- overloads = ''
- for subroutine in subroutines:
- sub_template = template_map[ 'blas_overloads' ]
- # add the argument list here
- arg_list = []
- lapack_arg_list = []
- cblas_arg_list = []
- cublas_arg_list = []
-
- if info_map[ subroutine ][ "has_cblas_order_arg" ]:
- cblas_arg_list += [ "CblasColMajor" ]
-
- for arg in info_map[ subroutine ][ 'arguments' ]:
- print "Subroutine ", subroutine, " arg ", arg
- arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_0' ] ]
- lapack_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'call_blas_header' ] ]
- cblas_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'call_cblas_header' ] ]
-
- sub_template = sub_template.replace( "$LEVEL0", ", ".join( arg_list ) )
- sub_template = sub_template.replace( "$CALL_BLAS_HEADER", ", ".join( lapack_arg_list ) )
- sub_template = sub_template.replace( "$CALL_CBLAS_HEADER", ", ".join( cblas_arg_list ) )
- sub_template = sub_template.replace( "$SUBROUTINE", subroutine )
- sub_template = sub_template.replace( "$SPECIALIZATION", documentation.routine_value_type[ subroutine[0] ] )
-
- # CBLAS stuff
- if 'cblas_routine' in info_map[ subroutine ]:
- cblas_routine = info_map[ subroutine ][ 'cblas_routine' ]
- else:
- cblas_routine = '// TODO'
- sub_template = sub_template.replace( "$CBLAS_ROUTINE", cblas_routine )
+ #
+ overloads = template_map[ 'backend_blas_overloads' ]
+ for select_backend in [ 'blas_overloads', 'cblas_overloads', 'cublas_overloads' ]:
+ sub_overloads = ''
+ for subroutine in subroutines:
+ sub_template = template_map[ select_backend ]
+ # add the argument list here
+ arg_list = []
+ typename_list = []
+ blas_arg_list = []
+ cblas_arg_list = []
+ cublas_arg_list = []
+ level0_static_asserts = []
 
- # CUBLAS stuff
- if 'cublas_routine' in info_map[ subroutine ]:
- cublas_routine = info_map[ subroutine ][ 'cublas_routine' ]
         for arg in info_map[ subroutine ][ 'arguments' ]:
- cublas_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'call_cublas_header' ] ]
- else:
- cublas_routine = '// NOT FOUND'
+ print "Subroutine ", subroutine, " arg ", arg
+ arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_0' ] ]
+ blas_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'call_blas_header' ] ]
+ cblas_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'call_cblas_header' ] ]
+
+ if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_0_typename' ] != None:
+ typename_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_0_typename' ] ]
+
+ if info_map[ subroutine ][ "has_cblas_order_arg" ]:
+ arg_list.insert( 0, "Order" )
+ cblas_arg_list.insert( 0, "cblas_option< Order >::value" )
+ typename_list.insert( 0, "typename Order" )
+ level0_static_asserts.append( "BOOST_STATIC_ASSERT( (is_column_major<Order>::value) );" )
+ includes += [ "#include <boost/numeric/bindings/is_column_major.hpp>" ]
+
+ sub_template = sub_template.replace( "$TYPES", ", ".join( typename_list ) )
+ sub_template = sub_template.replace( "template< >\n", "" )
+ sub_template = sub_template.replace( "$LEVEL0", ", ".join( arg_list ) )
+ sub_template = sub_template.replace( "$CALL_BLAS_HEADER", ", ".join( blas_arg_list ) )
+ sub_template = sub_template.replace( "$CALL_CBLAS_HEADER", ", ".join( cblas_arg_list ) )
+ sub_template = sub_template.replace( "$SUBROUTINE", subroutine )
+ sub_template = sub_template.replace( "$SPECIALIZATION", documentation.routine_value_type[ subroutine[0] ] )
+ sub_template = sub_template.replace( '$STATIC_ASSERTS', "\n ".join( level0_static_asserts ) )
+
+ # CBLAS stuff
+ if 'cblas_routine' in info_map[ subroutine ]:
+ cblas_routine = info_map[ subroutine ][ 'cblas_routine' ]
+ else:
+ cblas_routine = '// NOT FOUND'
+ sub_template = sub_template.replace( "$CBLAS_ROUTINE", cblas_routine )
+
+ # CUBLAS stuff
+ if 'cublas_routine' in info_map[ subroutine ]:
+ cublas_routine = info_map[ subroutine ][ 'cublas_routine' ]
+ for arg in info_map[ subroutine ][ 'arguments' ]:
+ cublas_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'call_cublas_header' ] ]
+ else:
+ cublas_routine = '// NOT FOUND'
+
+ sub_template = sub_template.replace( "$CALL_CUBLAS_HEADER", ", ".join( cublas_arg_list ) )
+ sub_template = sub_template.replace( "$CUBLAS_ROUTINE", cublas_routine )
+
+ sub_template = sub_template.replace( '$groupname', group_name.lower() )
+ sub_template = sub_template.replace( '$RETURN_TYPE', info_map[ subroutine ][ 'return_value_type' ] )
+ sub_template = sub_template.replace( '$RETURN_STATEMENT', info_map[ subroutine ][ 'return_statement' ] )
 
- sub_template = sub_template.replace( "$CALL_CUBLAS_HEADER", ", ".join( cublas_arg_list ) )
- sub_template = sub_template.replace( "$CUBLAS_ROUTINE", cublas_routine )
+ sub_overloads += bindings.proper_indent( sub_template )
 
- sub_template = sub_template.replace( '$groupname', group_name.lower() )
- sub_template = sub_template.replace( '$RETURN_TYPE', info_map[ subroutine ][ 'return_value_type' ] )
- sub_template = sub_template.replace( '$RETURN_STATEMENT', info_map[ subroutine ][ 'return_statement' ] )
-
- overloads += bindings.proper_indent( sub_template )
-
+ overloads = overloads.replace( '$' + select_backend.upper(),
+ sub_overloads )
+
+ #
+ # Prepare for levels 1 and 2
+ #
     cases = {}
     # first, see what kind of functions we have
     # needed for argument check etc.
@@ -171,6 +191,7 @@
       #
       # Create static assertions, first by value type
       #
+ has_comment = False
       for value_type_tmp_key in info_map[ subroutine ][ 'grouped_arguments' ][ 'by_value_type' ].keys():
         # look up whether they are template params
         static_asserts = []
@@ -185,6 +206,17 @@
                 'typename remove_const< typename value< ' + info_map[ subroutine ][ 'argument_map' ][ arg_A ][ 'code' ][ 'level_1_static_assert' ] + ' >::type >::type, ' + \
                 'typename remove_const< typename value< ' + info_map[ subroutine ][ 'argument_map' ][ arg_B ][ 'code' ][ 'level_1_static_assert' ] + ' >::type >::type' \
                 ' >::value) );'
+ if not has_comment:
+ #level1_static_assert_list += [ '// Here, we assert... ' ]
+ has_comment = True
+ level1_static_assert_list += [ assert_line ]
+
+ # Make sure the mutable stuff is mutable
+ if 'output' in info_map[ subroutine ][ 'grouped_arguments' ][ 'by_io' ]:
+ for arg in info_map[ subroutine ][ 'grouped_arguments' ][ 'by_io' ][ 'output' ]:
+ if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_type' ] != None:
+ assert_line = 'BOOST_STATIC_ASSERT( (is_mutable< ' + \
+ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_static_assert' ] + ' >::value ) );'
             level1_static_assert_list += [ assert_line ]
 
       # import the code by argument
@@ -202,6 +234,10 @@
         if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_2' ] != None:
           level2_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_2' ] ]
 
+ # Insert the order_type() if appropriate
+ if info_map[ subroutine ][ "has_cblas_order_arg" ]:
+ level0_arg_list.insert( 0, "order_type()" )
+
       # Level 1 replacements
       level1_template = level1_template.replace( "$CALL_LEVEL0", ", ".join( level0_arg_list ) )
       level1_template = level1_template.replace( "$CALL_LEVEL1", ", ".join( call_level1_arg_list ) )
@@ -222,16 +258,17 @@
       # type-traits deduction, etc..
       # more important: all non-const and const variants of functions are written here
       level2_functions = []
- level2_arg_lists, level2_static_asserts = bindings.generate_const_variants( level2_arg_list )
+ level2_arg_lists, level2_comments = bindings.generate_const_variants( level2_arg_list )
       for level2_idx in range( 0, len( level2_arg_lists ) ):
         level2_function = level2_template.replace( "$LEVEL2", \
                 ", ".join( level2_arg_lists[ level2_idx ] ) )
- if len( "".join(level2_static_asserts[ level2_idx ] ) ) > 0:
- level2_function = level2_function.replace( "$STATIC_ASSERTS", \
- "\n ".join( level2_static_asserts[ level2_idx ] ) )
+ if len( "".join(level2_comments[ level2_idx ] ) ) > 0:
+ level2_function = level2_function.replace( "$COMMENTS", \
+ "\n ".join( level2_comments[ level2_idx ] ) )
         level2_functions.append( level2_function )
 
       level2_template = "\n".join( level2_functions )
+ level2_template = level2_template.replace( "$COMMENTS\n", "" )
 
       #level2_template = level2_template.replace( "$LEVEL2", ", ".join( level2_arg_list ) )
 
@@ -293,6 +330,9 @@
     result = result.replace( '$DIRNAME', base_dir.split("/")[-1].upper() )
     result = result.replace( '$dirname', base_dir.split("/")[-1].lower() )
     result = result.replace( '$INTEGER_TYPE', netlib.fortran_integer_type )
+ result = result.replace( '\n\n\n', '\n\n' )
+ result = result.replace( "\n \n", "\n" )
+ result = result.replace( "\n \n", "\n" )
 
     # replace the global variables as last (this is convenient)
     #result = result.replace( '$INDENT', ' ' )

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/cblas.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/cblas.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/cblas.py 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
@@ -75,16 +75,16 @@
                     print "Result: ", call_cblas_header
                     if arg == 'UPLO':
                         info_map[ blas_routine ][ "argument_map" ][ arg ][ "code" ][ "call_cblas_header" ] = \
- "( uplo == 'U' ? CblasUpper : CblasLower )"
+ "cblas_option< UpLo >::value"
                     elif arg == 'DIAG':
                         info_map[ blas_routine ][ "argument_map" ][ arg ][ "code" ][ "call_cblas_header" ] = \
- "( uplo == 'N' ? CblasNonUnit : CblasUnit )"
+ "cblas_option< Diag >::value"
                     elif arg == 'SIDE':
                         info_map[ blas_routine ][ "argument_map" ][ arg ][ "code" ][ "call_cblas_header" ] = \
- "( uplo == 'L' ? CblasLeft : CblasRight )"
+ "cblas_option< Side >::value"
                     elif arg == 'TRANS' or arg == 'TRANSA' or arg == 'TRANSB':
                         info_map[ blas_routine ][ "argument_map" ][ arg ][ "code" ][ "call_cblas_header" ] = \
- "( " + arg.lower() + " == 'N' ? CblasNoTrans : ( " + arg.lower() + " == 'T' ? CblasTrans : CblasConjTrans ) )"
+ "cblas_option< " + netlib.level0_types[ arg ] + " >::value"
                     else:
                         info_map[ blas_routine ][ "argument_map" ][ arg ][ "code" ][ "call_cblas_header" ] = call_cblas_header
                 else:

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
@@ -88,6 +88,7 @@
       sub_template = sub_template.replace( "$CALL_BLAS_HEADER", ", ".join( lapack_arg_list ) )
       sub_template = sub_template.replace( "$SUBROUTINE", subroutine )
       sub_template = sub_template.replace( '$groupname', group_name.lower() )
+ sub_template = sub_template.replace( "$SPECIALIZATION", documentation.routine_value_type[ subroutine[0] ] )
       
       overloads += bindings.proper_indent( sub_template )
   
@@ -188,6 +189,14 @@
                 ' >::value) );'
             level1_static_assert_list += [ assert_line ]
 
+ # Make sure the mutable stuff is mutable
+ if 'output' in info_map[ subroutine ][ 'grouped_arguments' ][ 'by_io' ]:
+ for arg in info_map[ subroutine ][ 'grouped_arguments' ][ 'by_io' ][ 'output' ]:
+ if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_type' ] != None:
+ assert_line = 'BOOST_STATIC_ASSERT( (is_mutable< ' + \
+ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_static_assert' ] + ' >::value ) );'
+ level1_static_assert_list += [ assert_line ]
+
       # import the code, by argument
       for arg in info_map[ subroutine ][ 'arguments' ]:
         level0_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'call_level_0' ] ]

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
@@ -89,7 +89,38 @@
   result += ' ' + name.lower()
     
   return result
-
+
+
+level0_types = {
+ 'TRANS': 'Trans',
+ 'TRANSA': 'TransA',
+ 'TRANSB': 'TransB',
+ 'UPLO' : 'UpLo'
+}
+
+
+
+def level0_type( name, properties ):
+ result = cpp_type( name, properties )
+ if 'trait_type' in properties:
+ if properties[ 'trait_type' ] in [ 'trans', 'uplo' ]:
+ result = level0_types[ name ]
+ return result
+
+def level0_typename( name, properties ):
+ result = None
+ if 'trait_type' in properties:
+ if properties[ 'trait_type' ] in [ 'trans', 'uplo' ]:
+ result = 'typename ' + level0_types[ name ]
+ return result
+
+def call_blas_header( name, properties ):
+ result = call_c_type( name, properties )
+ if 'trait_type' in properties:
+ if properties[ 'trait_type' ] in [ 'trans', 'uplo' ]:
+ result = '&blas_option< ' + level0_types[ name ] + ' >::value'
+ return result
+
 def call_c_type( name, properties ):
   result = ''
   if properties[ 'type' ] == 'vector' or properties[ 'type' ] == 'matrix':
@@ -123,12 +154,17 @@
     result = "begin_value(" + my_name + ")"
   elif properties.has_key( 'trait_type' ):
     if properties[ 'trait_type' ] == 'lda':
+ #
+ # TODO this should be stride_column or stride_row, whatever the orientation
+ # of the library is. In case of LAPACK, stride_column.
+ # Unless this matrix may be transposed, then it is stride_major
+ #
       result = "stride_major(" + properties[ 'trait_of' ].lower() + ")"
       #result = "traits::leading_dimension(" + properties[ 'trait_of' ].lower() + ")"
     if properties[ 'trait_type' ] == 'num_columns':
- result = "num_columns(" + properties[ 'trait_of' ].lower() + ")"
+ result = "size_column(" + properties[ 'trait_of' ].lower() + ")"
     if properties[ 'trait_type' ] == 'num_rows':
- result = "num_rows(" + properties[ 'trait_of' ].lower() + ")"
+ result = "size_row(" + properties[ 'trait_of' ].lower() + ")"
     if properties[ 'trait_type' ] == 'trans_num_columns':
       result = "size_major(" + properties[ 'trait_of' ][1].lower() + ")"
       #result = "(" + properties[ 'trait_of' ][0].lower() + "=='N' ? " + \
@@ -147,7 +183,7 @@
       result = "stride(" + properties[ 'trait_of' ].lower() + ")"
 
     if properties[ 'trait_type' ] == 'trans':
- result = "trans_tag()"
+ result = "trans_tag( " + properties[ 'trait_of' ].lower() + ", order_type() )"
 
   else:
     result = name.lower()
@@ -331,7 +367,7 @@
 def level1_assert( name, properties, arg_map ):
   result = None
   
- if properties.has_key( 'assert_char' ):
+ if properties.has_key( 'assert_char' ) and name not in [ 'TRANS', 'TRANSA', 'TRANSB' ]:
     result = "BOOST_ASSERT( "
     result_array = []
     for char in properties[ 'assert_char' ]:
@@ -1274,8 +1310,9 @@
   for argument_name, argument_properties in argument_map.iteritems():
     argument_properties[ 'code' ] = {}
     argument_properties[ 'code' ][ 'lapack_h' ] = c_type( argument_name, argument_properties )
- argument_properties[ 'code' ][ 'call_blas_header' ] = call_c_type( argument_name, argument_properties )
- argument_properties[ 'code' ][ 'level_0' ] = cpp_type( argument_name, argument_properties )
+ argument_properties[ 'code' ][ 'call_blas_header' ] = call_blas_header( argument_name, argument_properties )
+ argument_properties[ 'code' ][ 'level_0' ] = level0_type( argument_name, argument_properties )
+ argument_properties[ 'code' ][ 'level_0_typename' ] = level0_typename( argument_name, argument_properties )
     argument_properties[ 'code' ][ 'call_level_0' ] = call_level0_type( argument_name, argument_properties, argument_map )
     argument_properties[ 'code' ][ 'level_1' ] = level1_type( argument_name, argument_properties )
     argument_properties[ 'code' ][ 'level_1_type' ] = level1_typename( argument_name, argument_properties )

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas.hpp 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
@@ -15,17 +15,26 @@
 #ifndef BOOST_NUMERIC_BINDINGS_BLAS_$DIRNAME_$GROUPNAME_HPP
 #define BOOST_NUMERIC_BINDINGS_BLAS_$DIRNAME_$GROUPNAME_HPP
 
-// Include header of configured BLAS interface
+$INCLUDES
+
+//
+// The BLAS-backend is selected by defining a pre-processor variable,
+// which can be one of
+// * for CBLAS, define BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+// * for CUBLAS, define BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+// * netlib-compatible BLAS is the default
+//
 #if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
 #include <boost/numeric/bindings/blas/detail/cblas.h>
+#include <boost/numeric/bindings/blas/detail/cblas_option.hpp>
 #elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
 #include <boost/numeric/bindings/blas/detail/cublas.h>
+#include <boost/numeric/bindings/blas/detail/blas_option.hpp>
 #else
 #include <boost/numeric/bindings/blas/detail/blas.h>
+#include <boost/numeric/bindings/blas/detail/blas_option.hpp>
 #endif
 
-$INCLUDES
-
 namespace boost {
 namespace numeric {
 namespace bindings {
@@ -33,7 +42,7 @@
 
 //
 // The detail namespace contains value-type-overloaded functions that
-// dispatch to the appropriate back-end BLAS routine.
+// dispatch to the appropriate back-end BLAS-routine.
 //
 namespace detail {
 
@@ -45,8 +54,7 @@
 //
 // Functions for direct use. These functions are overloaded for temporaries,
 // so that wrapped types can still be passed and used for write-access.
-// In the documentation the const-overloads are collapsed. Consult the
-// static assert lists (if available) to check what kind of overload it is.
+// In the documentation, the const-overloads are collapsed.
 //
 
 $LEVEL2
@@ -56,18 +64,47 @@
 } // namespace boost
 
 #endif
+$TEMPLATE[backend_blas_overloads]
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+$CBLAS_OVERLOADS
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+$CUBLAS_OVERLOADS
+#else
+$BLAS_OVERLOADS
+#endif
 $TEMPLATE[blas_overloads]
 //
-// Overloaded function for the $SPECIALIZATION value type.
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default)
+// * $SPECIALIZATION value-type
 //
+template< $TYPES >
+inline $RETURN_TYPE $groupname( $LEVEL0 ) {
+ $STATIC_ASSERTS
+ $RETURN_STATEMENTBLAS_$SUBROUTINE( $CALL_BLAS_HEADER );
+}
+
+$TEMPLATE[cblas_overloads]
+//
+// Overloaded function for dispatching to
+// * CBLAS backend
+// * $SPECIALIZATION value-type
+//
+template< $TYPES >
 inline $RETURN_TYPE $groupname( $LEVEL0 ) {
-#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
     $RETURN_STATEMENT$CBLAS_ROUTINE( $CALL_CBLAS_HEADER );
-#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+}
+
+$TEMPLATE[cublas_overloads]
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend
+// * $SPECIALIZATION value-type
+//
+template< $TYPES >
+inline $RETURN_TYPE $groupname( $LEVEL0 ) {
+ $STATIC_ASSERTS
     $RETURN_STATEMENT$CUBLAS_ROUTINE( $CALL_CUBLAS_HEADER );
-#else
- $RETURN_STATEMENTBLAS_$SUBROUTINE( $CALL_BLAS_HEADER );
-#endif
 }
 
 $TEMPLATE[blas_level1]
@@ -85,25 +122,25 @@
 $INCLUDE_TEMPLATES
     //
     // Static member function that
- // 1) Deduces the required arguments for dispatching to BLAS, and
- // 2) Asserts that most arguments make sense.
+ // * Deduces the required arguments for dispatching to BLAS, and
+ // * Asserts that most arguments make sense.
     //
     template< $TYPES >
     static return_type invoke( $LEVEL1 ) {
         $STATIC_ASSERTS
         $ASSERTS
+ $TYPEDEFS
         $RETURN_STATEMENTdetail::$groupname( $CALL_LEVEL0 );
     }
 };
 $TEMPLATE[blas_level2]
 //
 // Overloaded function for $groupname
-//
+$COMMENTS
+//
 template< $TYPES >
 inline typename $groupname_impl< typename value< $FIRST_TYPENAME >::type >::return_type
 $groupname( $LEVEL2 ) {
- typedef typename value< $FIRST_TYPENAME >::type value_type;
- $STATIC_ASSERTS
- $RETURN_STATEMENT$groupname_impl< value_type >::invoke( $CALL_LEVEL1 );
+ $RETURN_STATEMENT$groupname_impl< typename value< $FIRST_TYPENAME >::type >::invoke( $CALL_LEVEL1 );
 }
 $TEMPLATE[end]

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
@@ -24,7 +24,7 @@
 
 //
 // The detail namespace contains value-type-overloaded functions that
-// dispatch to the appropriate back-end LAPACK routine.
+// dispatch to the appropriate back-end LAPACK-routine.
 //
 namespace detail {
 
@@ -39,9 +39,13 @@
 
 #endif
 $TEMPLATE[lapack_overloads]
+//
+// Overloaded function for the $SPECIALIZATION value-type.
+//
 inline void $groupname( $LEVEL0 ) {
     LAPACK_$SUBROUTINE( $CALL_BLAS_HEADER );
 }
+
 $TEMPLATE[lapack_include_hierarchy]
 //
 // Copyright (c) 2003--2009
@@ -62,17 +66,25 @@
 $CONTENT
 #endif
 $TEMPLATE[level1_pre_header]
-// value-type based template
+//
+// Value-type based template class. Use this class if you need a type
+// for dispatching to $groupname.
+//
 template< typename Value, typename Enable = void >
 struct $groupname_impl{};
 
 $TEMPLATE[level1_header1]
-// value-type based template
+//
+// Value-type based template class. Use this class if you need a type
+// for dispatching to $groupname.
+//
 template< typename Value >
 struct $groupname_impl {
 
 $TEMPLATE[level1_header2]
-// $SPECIALIZATION specialization
+//
+// This implementation is enabled if Value is a $SPECIALIZATION type.
+//
 template< typename Value >
 struct $groupname_impl< Value, typename boost::enable_if< is_$SPECIALIZATION< Value > >::type > {
 
@@ -116,7 +128,10 @@
 $TEMPLATE[level1_opt_workspace_is_min]
         invoke( $CALL_LEVEL1, minimal_workspace() );
 $TEMPLATE[level2_workspace]
-// template function to call $groupname
+//
+// Overloaded function for $groupname
+// * User-defined workspace
+//
 template< $TYPES, typename Workspace >
 inline integer_t $groupname( $LEVEL2, Workspace work ) {
     integer_t info(0);
@@ -124,7 +139,10 @@
     return info;
 }
 
-// template function to call $groupname, default workspace type
+//
+// Overloaded function for $groupname
+// * Default workspace-type (optimal)
+//
 template< $TYPES >
 inline integer_t $groupname( $LEVEL2 ) {
     integer_t info(0);
@@ -155,7 +173,9 @@
 };
 
 $TEMPLATE[level2_noworkspace]
-// template function to call $groupname
+//
+// Overloaded function for $groupname
+//
 template< $TYPES >
 inline integer_t $groupname( $LEVEL2 ) {
     integer_t info(0);

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_blas.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_blas.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_blas.hpp 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
@@ -42,7 +42,7 @@
 #ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_NAMES_H
 #define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_NAMES_H
 
-#include <boost/numeric/bindings/traits/fortran.h>
+#include <boost/numeric/bindings/detail/fortran.h>
 
 $CONTENT
 

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_lapack.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_lapack.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_lapack.hpp 2009-12-22 14:21:54 EST (Tue, 22 Dec 2009)
@@ -55,7 +55,7 @@
 #define BOOST_NUMERIC_BINDINGS_LAPACK_DETAIL_LAPACK_NAMES_H
 
 #ifndef BOOST_NUMERIC_BINDINGS_USE_CLAPACK
-# include <boost/numeric/bindings/traits/fortran.h>
+# include <boost/numeric/bindings/detail/fortran.h>
 #else
 # define FORTRAN_ID( id ) id##_
 #endif


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