Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58944 - sandbox/numeric_bindings/libs/numeric/bindings/tools
From: rutger_at_[hidden]
Date: 2010-01-12 11:21:41


Author: rutger
Date: 2010-01-12 11:21:40 EST (Tue, 12 Jan 2010)
New Revision: 58944
URL: http://svn.boost.org/trac/boost/changeset/58944

Log:
Improved detection of num_columns() of banded/packed matrices (no need for filling the templates for all those cases where the docs refer to matrix A and the code to either matrix AB or AP.)

Text files modified:
   sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py | 28 ++++++++++++++++++++++------
   1 files changed, 22 insertions(+), 6 deletions(-)

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-12 11:21:40 EST (Tue, 12 Jan 2010)
@@ -1204,22 +1204,38 @@
               return subroutine_name, None
               # TODO
               # TODO
- elif match_matrix_traits[0][3] in grouped_arguments[ 'by_type' ][ 'matrix' ]:
- # because it is both #rows and #columns, we have to choose one
- argument_properties[ 'trait_type' ] = 'num_columns'
- argument_properties[ 'trait_of' ] = [ match_matrix_traits[0][3].strip() ]
+ else:
+ references = match_matrix_traits[0][3].split( 'and' )
+ for matrix_name in references:
+ try_names = [ matrix_name.strip(),
+ matrix_name.strip() + 'B',
+ matrix_name.strip() + 'P' ]
+ for try_name in try_names:
+ if try_name in grouped_arguments[ 'by_type' ][ 'matrix' ] and \
+ 'trait_of' not in argument_properties:
+ argument_properties[ 'trait_type' ] = 'num_columns'
+ argument_properties[ 'trait_of' ] = [ try_name.strip() ]
+
+ #elif match_matrix_traits[0][3] in grouped_arguments[ 'by_type' ][ 'matrix' ]:
+ ## because it is both #rows and #columns, we have to choose one
+ #argument_properties[ 'trait_type' ] = 'num_columns'
+ #argument_properties[ 'trait_of' ] = [ match_matrix_traits[0][3].strip() ]
 
           # if we're not dealing with order
           else:
             references = match_matrix_traits[0][3].split( 'and' )
             for matrix_name in references:
- try_names = [ matrix_name.strip(), matrix_name.strip() + 'B' ]
+ try_names = [ matrix_name.strip(),
+ matrix_name.strip() + 'B',
+ matrix_name.strip() + 'P' ]
               for try_name in try_names:
- if try_name in grouped_arguments[ 'by_type' ][ 'matrix' ]:
+ if try_name in grouped_arguments[ 'by_type' ][ 'matrix' ] and \
+ 'trait_of' not in argument_properties:
                   if len( match_banded_uplo ) == 0:
                     argument_properties[ 'trait_type' ] = 'num_' + match_matrix_traits[0][0]
                   else:
                     argument_properties[ 'trait_type' ] = 'num_' + match_matrix_traits[0][0] + '_uplo'
+ # only store the first matrix found (usually A)
                   argument_properties[ 'trait_of' ] = [ try_name.strip() ]
 
         #


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