Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59149 - in sandbox/numeric_bindings/libs/numeric/bindings/tools: . templates
From: rutger_at_[hidden]
Date: 2010-01-20 03:14:24


Author: rutger
Date: 2010-01-20 03:14:23 EST (Wed, 20 Jan 2010)
New Revision: 59149
URL: http://svn.boost.org/trac/boost/changeset/59149

Log:
updated lapack generator to support compile-time selection of data_order

Text files modified:
   sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py | 41 ++++++++++++++++++++++++++++++++++++++-
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp | 2 -
   2 files changed, 39 insertions(+), 4 deletions(-)

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-20 03:14:23 EST (Wed, 20 Jan 2010)
@@ -233,14 +233,51 @@
       typedef_list = []
 
       #
+ # Are we dealing with a transpose option here?
+ # Because CLAPACK allows to pass the order of the matrices, here we
+ # inject code that determines the default data order.
+ #
+ if 'matrix' in info_map[ subroutine ][ 'grouped_arguments' ][ 'by_type' ]:
+ has_trans = False
+ matrix_wo_trans = []
+ matrix_with_trans = []
+ for matrix_arg in info_map[ subroutine ][ 'grouped_arguments' ][ 'by_type' ][ 'matrix' ]:
+ if 'ref_trans' in info_map[ subroutine ][ 'argument_map' ][ matrix_arg ]:
+ has_trans = True
+ matrix_type = info_map[ subroutine ][ 'argument_map' ][ matrix_arg ][ 'code' ][ 'level_1_static_assert' ]
+ matrix_with_trans += [ matrix_type ]
+ else:
+ matrix_wo_trans.append( info_map[ subroutine ][ 'argument_map' ][ matrix_arg ][ 'code' ][ 'level_1_static_assert' ] )
+
+ #
+ # Matrices have trans options in this case. If there is one without,
+ # that one will determine the order of the call
+ #
+ if has_trans:
+ includes += [ '#include <boost/numeric/bindings/trans_tag.hpp>' ]
+ if len( matrix_wo_trans )>0:
+ typedef_list.insert( 0, 'typedef typename result_of::data_order< ' + matrix_wo_trans[0] + \
+ ' >::type order;' )
+ includes += [ '#include <boost/numeric/bindings/data_order.hpp>' ]
+ else:
+ typedef_list.insert( 0, 'typedef typename detail::default_order< ' + matrix_with_trans[0] + \
+ ' >::type order;' )
+ includes += [ '#include <boost/numeric/bindings/blas/detail/default_order.hpp>' ]
+ else:
+ # so, there's no trans option
+ # but, what if there's an order? (e.g., syr) -- then use `
+ if "has_clapack_order_arg" in info_map[ subroutine ]:
+ typedef_list.insert( 0, 'typedef typename result_of::data_order< ' + matrix_wo_trans[0] + \
+ ' >::type order;' )
+ includes += [ '#include <boost/numeric/bindings/data_order.hpp>' ]
+
+ #
       # Add an include in case of the uplo or diag options
       #
       if 'UPLO' in info_map[ subroutine ][ 'arguments' ]:
         includes += [ '#include <boost/numeric/bindings/uplo_tag.hpp>' ]
       if 'DIAG' in info_map[ subroutine ][ 'arguments' ]:
         includes += [ '#include <boost/numeric/bindings/diag_tag.hpp>' ]
- if 'TRANS' in info_map[ subroutine ][ 'arguments' ]:
- includes += [ '#include <boost/numeric/bindings/trans_tag.hpp>' ]
 
       #
       # Create static assertions, first by value type

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 2010-01-20 03:14:23 EST (Wed, 20 Jan 2010)
@@ -149,7 +149,6 @@
 $TEMPLATE[level1_workspace]
     typedef Value value_type;
     typedef typename remove_imaginary< Value >::type real_type;
- typedef tag::column_major order;
 
     //
     // Static member function for user-defined workspaces, that
@@ -246,7 +245,6 @@
 $TEMPLATE[level1_noworkspace]
     typedef Value value_type;
     typedef typename remove_imaginary< Value >::type real_type;
- typedef tag::column_major order;
 
     //
     // Static member function, that


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