Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58701 - sandbox/numeric_bindings/libs/numeric/bindings/tools
From: rutger_at_[hidden]
Date: 2010-01-05 03:41:04


Author: rutger
Date: 2010-01-05 03:41:00 EST (Tue, 05 Jan 2010)
New Revision: 58701
URL: http://svn.boost.org/trac/boost/changeset/58701

Log:
added asserts to all matrix types: size_minor or stride_minor should equal 1, because BLAS and LAPACK don't support matrices with more than 1 stride.

Text files modified:
   sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py | 4 ++--
   sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py | 4 ++--
   sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py | 27 +++++++++++++++++----------
   3 files changed, 21 insertions(+), 14 deletions(-)

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 2010-01-05 03:41:00 EST (Tue, 05 Jan 2010)
@@ -280,8 +280,8 @@
         if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_type' ] != None and \
           info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_type' ] not in level1_type_arg_list:
           level1_type_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_type' ] ]
- if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_assert' ] != None:
- level1_assert_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_assert' ] ]
+ if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_assert' ] != []:
+ level1_assert_list += info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_assert' ]
         if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'typedef' ] != None:
           typedef_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'typedef' ] ]
         if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_2' ] != None:

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 2010-01-05 03:41:00 EST (Tue, 05 Jan 2010)
@@ -228,8 +228,8 @@
         if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_type' ] != None and \
           info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_type' ] not in level1_type_arg_list:
           level1_type_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_type' ] ]
- if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_assert' ] != None:
- level1_assert_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_assert' ] ]
+ if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_assert' ] != []:
+ level1_assert_list += info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'level_1_assert' ]
         if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'call_level_1' ] != None:
           call_level1_arg_list += [ info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'call_level_1' ] ]
         if info_map[ subroutine ][ 'argument_map' ][ arg ][ 'code' ][ 'opt_workspace_query' ] != None:

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 2010-01-05 03:41:00 EST (Tue, 05 Jan 2010)
@@ -399,19 +399,20 @@
 #
 #
 def level1_assert( name, properties, arg_map ):
- result = None
+ result = []
   
   if properties.has_key( 'assert_char' ) and \
         name not in [ 'TRANS', 'TRANSA', 'TRANSB', 'TRANSR', 'UPLO', 'DIAG' ]:
- result = "BOOST_ASSERT( "
+ assert_line = "BOOST_ASSERT( "
     result_array = []
     for char in properties[ 'assert_char' ]:
       result_array += [ call_level0_type( name, properties, arg_map ) + ' == \'' + char + '\'' ]
- result += " || ".join( result_array )
- result += " );"
-
+ assert_line += " || ".join( result_array )
+ assert_line += " );"
+ result += [ assert_line ]
+
   if properties.has_key( 'assert_ge' ) and not properties.has_key( 'workspace_query_for' ):
- result = "BOOST_ASSERT( " + call_level0_type( name, properties, arg_map ) + " >= " + expand_nested_list( properties[ 'assert_ge' ], arg_map ) + ' );'
+ result += [ "BOOST_ASSERT( " + call_level0_type( name, properties, arg_map ) + " >= " + expand_nested_list( properties[ 'assert_ge' ], arg_map ) + ' );' ]
 
   #if properties[ 'type' ] == 'vector' and properties[ 'call_level1' ] != None:
     #result = "BOOST_ASSERT( min_tensor_rank( " + call_level1_type( name, properties ) + \
@@ -425,13 +426,19 @@
     min_workspace_call = min_workspace_call_type( name, properties, arg_map )
     if min_workspace_call == None:
       min_workspace_call = '$CALL_MIN_SIZE'
- result = 'BOOST_ASSERT( size(work.select(' + workspace_type( name, properties ) + '())) >= ' + \
- 'min_size_' + name.lower() + '( ' + min_workspace_call + ' ));'
+ result += [ 'BOOST_ASSERT( size(work.select(' + workspace_type( name, properties ) + '())) >= ' + \
+ 'min_size_' + name.lower() + '( ' + min_workspace_call + ' ));' ]
 
   # assert_size is vector-type specific
   elif properties.has_key( 'assert_size' ):
- result = "BOOST_ASSERT( size(" + call_level1_type( name, properties ) + ") >= " + \
- expand_nested_list( properties[ 'assert_size' ], arg_map ) + ' );'
+ result += [ "BOOST_ASSERT( size(" + call_level1_type( name, properties ) + ") >= " + \
+ expand_nested_list( properties[ 'assert_size' ], arg_map ) + ' );' ]
+
+ if properties[ 'type' ] == 'matrix' and call_level1_type( name, properties ) != None:
+ result += [ "BOOST_ASSERT( " + \
+ "size_minor( " + call_level1_type( name, properties ) +" ) == 1 || " + \
+ "stride_minor( " + call_level1_type( name, properties ) +" ) == 1 );"
+ ]
 
   return result
 


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