|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52052 - in sandbox/numeric_bindings/libs/numeric/bindings/tools: . templates templates/driver templates/level2
From: rutger_at_[hidden]
Date: 2009-03-30 02:34:51
Author: rutger
Date: 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
New Revision: 52052
URL: http://svn.boost.org/trac/boost/changeset/52052
Log:
Added support for include templates in BLAS generator; updates to lapack include naming
Added:
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas_transform.hpp (contents, props changed)
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/level2/gemv.hpp (contents, props changed)
Text files modified:
sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py | 20 +++++++++++++++++++-
sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py | 3 ++-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas.hpp | 1 +
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gbsv.hpp | 4 +++-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gesv.hpp | 4 +++-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gtsv.hpp | 2 +-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/hesv.hpp | 2 +-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/hpsv.hpp | 2 +-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/pbsv.hpp | 2 +-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/posv.hpp | 2 +-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/ppsv.hpp | 2 +-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/ptsv.hpp | 2 +-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/spsv.hpp | 2 +-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/sysv.hpp | 2 +-
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack_solve.hpp | 20 ++++++++++++++++++--
15 files changed, 55 insertions(+), 15 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 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -20,7 +20,7 @@
#
# Group subroutines on their name, with the first character removed. This will
# group them in the same .hpp file as well. Sort these subroutines based on
-# routine_cmp from bindings.py.
+# routine_cmp above.
#
def group_by_value_type( global_info_map ):
group_map = {}
@@ -35,6 +35,7 @@
+
#
# Write the (many) driver routine file(s).
@@ -51,6 +52,7 @@
'#include <boost/numeric/bindings/traits/traits.hpp>',
'#include <boost/numeric/bindings/traits/type_traits.hpp>',
'#include <boost/numeric/bindings/blas/detail/blas.h>',
+ '#include <boost/mpl/bool.hpp>',
'#include <boost/type_traits/is_same.hpp>',
'#include <boost/static_assert.hpp>' ]
@@ -105,6 +107,20 @@
level1_template = template_map[ 'blas_level1' ]
level2_template = template_map[ 'blas_level2' ]
+ # include templates come before anything else; they can hold any
+ # $ID
+ my_include_key = group_name.lower() + '.' + value_type + '.include_templates'
+ if netlib.my_has_key( my_include_key, template_map ):
+ include_template_list = template_map[ netlib.my_has_key( my_include_key, template_map ) ].strip().replace(' ','').split(",")
+ include_templates = ''
+ for template in include_template_list:
+ include_templates += template_map[ 'template_' + template ]
+ level1_template = level1_template.replace( '$INCLUDE_TEMPLATES', bindings.proper_indent(include_templates) )
+ level2_template = level2_template.replace( '$INCLUDE_TEMPLATES', bindings.proper_indent(include_templates) )
+ else:
+ level1_template = level1_template.replace( '\n$INCLUDE_TEMPLATES', '' )
+ level2_template = level2_template.replace( '\n$INCLUDE_TEMPLATES', '' )
+
level0_arg_list = []
level1_arg_list = []
level2_arg_list = []
@@ -112,6 +128,7 @@
level1_type_arg_list = []
level1_assert_list = []
level1_static_assert_list = []
+ keyword_type_list = []
#
# Create static assertions, first by value type
@@ -155,6 +172,7 @@
level1_template = level1_template.replace( "$ASSERTS", "\n ".join( level1_assert_list ) )
level1_template = level1_template.replace( '$RETURN_TYPE', info_map[ subroutine ][ 'level1_return_type' ] )
level1_template = level1_template.replace( '$RETURN_STATEMENT', info_map[ subroutine ][ 'return_statement' ] )
+ level1_template = level1_template.replace( "$KEYWORDS", ", ".join( keyword_type_list ) )
if len( level1_static_assert_list ) > 0:
level1_template = level1_template.replace( "$STATIC_ASSERTS", "\n ".join( level1_static_assert_list ) )
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-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -59,6 +59,7 @@
'#include <boost/numeric/bindings/traits/traits.hpp>',
'#include <boost/numeric/bindings/traits/type_traits.hpp>',
'#include <boost/numeric/bindings/lapack/detail/lapack.h>',
+ '#include <boost/mpl/bool.hpp>',
'#include <boost/type_traits/is_same.hpp>',
'#include <boost/static_assert.hpp>' ]
@@ -430,7 +431,7 @@
result[ split_templates[ index*2 ] ] = split_templates[ index*2 + 1 ]
return result
-lapack_src_path = './lapack-3.1.1/SRC'
+lapack_src_path = './lapack-3.2.0/SRC'
template_src_path = './templates'
bindings_target_path = '../../../../boost/numeric/bindings/lapack/'
test_target_path = '../test/lapack/'
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-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -45,6 +45,7 @@
typedef typename traits::type_traits<ValueType>::real_type real_type;
typedef $RETURN_TYPE return_type;
+$INCLUDE_TEMPLATES
// templated specialization
template< $TYPES >
static return_type invoke( $LEVEL1 ) {
Added: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas_transform.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas_transform.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -0,0 +1,7 @@
+$TEMPLATE[template_blas_transform]
+ // high-level transform typedefs and functions
+ template< typename MatrixA, typename VectorX, typename VectorY >
+ static return_type transform( MatrixA& A, VectorX& x, VectorY& y, const value_type alpha, const value_type beta ) {
+ invoke( $KEYWORDS );
+ }
+$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gbsv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gbsv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gbsv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -1,5 +1,7 @@
$TEMPLATE[gbsv.all.N.trait_of]
AB
$TEMPLATE[gbsv.all.include_templates]
-lapack_solve
+lapack_solve_pivot1
+$TEMPLATE[gbsv.includes]
+#include <boost/numeric/bindings/traits/detail/array.hpp>
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gesv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gesv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gesv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -1,3 +1,5 @@
$TEMPLATE[gesv.all.include_templates]
-lapack_solve
+lapack_solve_pivot1
+$TEMPLATE[gesv.includes]
+#include <boost/numeric/bindings/traits/detail/array.hpp>
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gtsv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gtsv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gtsv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -1,3 +1,3 @@
$TEMPLATE[gtsv.all.include_templates]
-lapack_solve
+lapack_solve_pivot0
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/hesv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/hesv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/hesv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -2,5 +2,5 @@
$TEMPLATE[hesv.complex.min_size_work]
return 1;
$TEMPLATE[hesv.all.include_templates]
-lapack_solve
+lapack_solve_pivot1
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/hpsv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/hpsv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/hpsv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -3,5 +3,5 @@
$TEMPLATE[hpsv.all.UPLO.trait_of]
AP
$TEMPLATE[hpsv.all.include_templates]
-lapack_solve
+lapack_solve_pivot1
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/pbsv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/pbsv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/pbsv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -3,5 +3,5 @@
$TEMPLATE[pbsv.all.UPLO.trait_of]
AB
$TEMPLATE[pbsv.all.include_templates]
-lapack_solve
+lapack_solve_pivot0
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/posv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/posv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/posv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -1,3 +1,3 @@
$TEMPLATE[posv.all.include_templates]
-lapack_solve
+lapack_solve_pivot0
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/ppsv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/ppsv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/ppsv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -3,5 +3,5 @@
$TEMPLATE[ppsv.all.UPLO.trait_of]
AP
$TEMPLATE[ppsv.all.include_templates]
-lapack_solve
+lapack_solve_pivot0
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/ptsv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/ptsv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/ptsv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -1,3 +1,3 @@
$TEMPLATE[ptsv.all.include_templates]
-lapack_solve
+lapack_solve_pivot0
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/spsv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/spsv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/spsv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -3,5 +3,5 @@
$TEMPLATE[spsv.all.UPLO.trait_of]
AP
$TEMPLATE[spsv.all.include_templates]
-lapack_solve
+lapack_solve_pivot1
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/sysv.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/sysv.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/sysv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -2,5 +2,5 @@
$TEMPLATE[sysv.all.min_size_work]
return 1;
$TEMPLATE[sysv.all.include_templates]
-lapack_solve
+lapack_solve_pivot1
$TEMPLATE[end]
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack_solve.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack_solve.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack_solve.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -1,7 +1,23 @@
-$TEMPLATE[template_lapack_solve]
- // uniform high-level dispatching-function
+$TEMPLATE[template_lapack_solve_pivot0]
+ // high-level solve typedefs and functions
+ typedef boost::mpl::bool_<false> has_pivot;
+
+ template< typename MatrixA, typename MatrixB, typename VectorP >
+ static void solve( MatrixA& A, MatrixB& B, VectorP const&, integer_t& info ) {
+ invoke( $KEYWORDS );
+ }
+$TEMPLATE[template_lapack_solve_pivot1]
+ // high-level solve typedefs and functions
+ typedef boost::mpl::bool_<true> has_pivot;
+
template< typename MatrixA, typename MatrixB, typename VectorP >
static void solve( MatrixA& A, MatrixB& B, VectorP& pivot, integer_t& info ) {
invoke( $KEYWORDS );
}
+
+ template< typename MatrixA, typename MatrixB, typename VectorP >
+ static void solve( MatrixA& A, MatrixB& B, VectorP const&, integer_t& info ) {
+ traits::detail::array< integer_t > pivot( traits::matrix_num_columns(A) );
+ invoke( $KEYWORDS );
+ }
$TEMPLATE[end]
Added: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/level2/gemv.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/level2/gemv.hpp 2009-03-30 02:34:48 EDT (Mon, 30 Mar 2009)
@@ -0,0 +1,3 @@
+$TEMPLATE[gemv.all.include_templates]
+blas_transform
+$TEMPLATE[end]
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