Initial commit.

This commit is contained in:
2018-12-06 16:01:56 +01:00
parent 10867b60c2
commit 18eb3f6047
1011 changed files with 345688 additions and 10 deletions

27
sdk/CMakeLists.txt Normal file
View File

@@ -0,0 +1,27 @@
# This file is part of EPOCH.
# File: CMakeLists.txt
# Author: Florent Teichteil-Königsbuch
# Contact: florent.teichteil@onera.fr
#
# EPOCH is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# EPOCH is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EPOCH. If not, see <http://www.gnu.org/licenses/>.
MESSAGE (STATUS "COMPILES the Software Development Kit (additional provided dependencies)")
IF (BUILD_GUI)
INCLUDE (${wxWidgets_USE_FILE})
ADD_SUBDIRECTORY (wxscintilla)
ADD_SUBDIRECTORY (wxshapeframework)
ENDIF (BUILD_GUI)
ADD_SUBDIRECTORY(buddy-2.4)

View File

@@ -0,0 +1,74 @@
//
// Copyright (c) 2009 by Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_INDEX_HPP
#define BOOST_NUMERIC_BINDINGS_INDEX_HPP
#include <boost/mpl/if.hpp>
#include <boost/mpl/max.hpp>
#include <boost/numeric/bindings/rank.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
namespace boost {
namespace numeric {
namespace bindings {
template< typename T >
struct addressing_index_minor {
typedef typename mpl::if_<
is_column_major< T >,
tag::addressing_index<1>,
tag::addressing_index<
mpl::max< tag::matrix, rank< T > >::type::value
>
>::type type;
};
template< typename T >
struct addressing_index_major {
typedef typename mpl::if_<
is_column_major< T >,
tag::addressing_index<
mpl::max< tag::matrix, rank< T > >::type::value
>,
tag::addressing_index<1>
>::type type;
};
template< typename AddressingIndex, typename TransTag >
struct addressing_index_trans {
typedef AddressingIndex type;
};
template<>
struct addressing_index_trans< tag::addressing_index<1>, tag::transpose > {
typedef tag::addressing_index<2> type;
};
template<>
struct addressing_index_trans< tag::addressing_index<1>, tag::conjugate > {
typedef tag::addressing_index<2> type;
};
template<>
struct addressing_index_trans< tag::addressing_index<2>, tag::transpose > {
typedef tag::addressing_index<1> type;
};
template<>
struct addressing_index_trans< tag::addressing_index<2>, tag::conjugate > {
typedef tag::addressing_index<1> type;
};
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,71 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_AT_HPP
#define BOOST_NUMERIC_BINDINGS_AT_HPP
#include <boost/numeric/bindings/detail/offset.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename Enable = void >
struct at_impl {
typedef typename bindings::value_type<T>::type& result_type;
// TODO implement other array structures such as triangular, band, etc.
static result_type invoke( T& t, const std::ptrdiff_t i1, std::ptrdiff_t i2 ) {
return t( i1, i2 );
}
};
template< typename T >
struct at_impl< T, typename boost::enable_if< bindings::has_linear_array<T> >::type > {
typedef typename bindings::value_type<T>::type& result_type;
static result_type invoke( T& t, const std::ptrdiff_t i1 ) {
return *( bindings::begin_value(t) + offset(t,i1) );
}
static result_type invoke( T& t, const std::ptrdiff_t i1, std::ptrdiff_t i2 ) {
return *( bindings::begin_value(t) + offset(t,i1,i2) );
}
};
}
namespace result_of {
template< typename T >
struct at {
typedef typename detail::at_impl<T>::result_type type;
};
}
template< typename T >
typename result_of::at<T>::type at( T& t, const std::ptrdiff_t i1 ) {
return detail::at_impl<T>::invoke( t, i1 );
}
template< typename T >
typename result_of::at<T>::type at( T& t, const std::ptrdiff_t i1, const std::ptrdiff_t i2 ) {
return detail::at_impl<T>::invoke( t, i1, i2 );
}
} // bindings
} // numeric
} // boost
#endif

View File

@@ -0,0 +1,167 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BANDWIDTH_HPP
#define BOOST_NUMERIC_BINDINGS_BANDWIDTH_HPP
#include <boost/numeric/bindings/detail/generate_functions.hpp>
#include <boost/numeric/bindings/detail/get.hpp>
#include <boost/numeric/bindings/rank.hpp>
#include <boost/numeric/bindings/addressing_index.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/min.hpp>
#include <boost/mpl/greater.hpp>
#include <boost/mpl/less_equal.hpp>
#include <boost/static_assert.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename AddressingIndex, typename Enable = void >
struct bandwidth_impl {
typedef typename tag::bandwidth_type< AddressingIndex::value > key_type;
typedef typename result_of_get< T, key_type >::type result_type;
static result_type invoke( const T& t ) {
return get< key_type >( t );
}
};
template< typename T >
struct bandwidth_impl< T, tag::lower >:
bandwidth_impl< T, tag::addressing_index<1> > {};
template< typename T >
struct bandwidth_impl< T, tag::upper >:
bandwidth_impl< T, tag::addressing_index<2> > {};
template< typename T, int N >
struct bandwidth_impl< T, tag::addressing_index<N>,
typename boost::enable_if< typename mpl::and_<
mpl::greater< tag::addressing_index<N>, rank<T> >,
is_same_at< T, tag::bandwidth_type<1>, std::ptrdiff_t >
>::type >::type > {
typedef std::ptrdiff_t result_type;
static result_type invoke( const T& t ) {
return std::min< std::ptrdiff_t >( bandwidth_impl<T, tag::addressing_index<1> >::invoke(t), 1 );
}
};
template< typename T, int N >
struct bandwidth_impl< T, tag::addressing_index<N>,
typename boost::enable_if< typename mpl::and_<
mpl::greater< tag::addressing_index<N>, rank<T> >,
mpl::not_< is_same_at< T, tag::bandwidth_type<1>, std::ptrdiff_t > >
>::type >::type > {
typedef typename mpl::min<
typename detail::property_at< T, tag::bandwidth_type<1> >::type,
mpl::int_<1>
>::type result_type;
static result_type invoke( const T& t ) {
return result_type();
}
};
} // namespace detail
namespace result_of {
template< typename T, typename Tag = tag::addressing_index<1> >
struct bandwidth {
BOOST_STATIC_ASSERT( (is_tag<Tag>::value) );
typedef typename detail::bandwidth_impl< T, Tag >::result_type type;
};
} // namespace result_of
//
// Overloads for free template functions bandwidth( x, tag ),
//
template< typename T, typename Tag >
inline typename result_of::bandwidth< const T, Tag >::type
bandwidth( const T& t, Tag ) {
return detail::bandwidth_impl< const T, Tag >::invoke( t );
}
// Overloads for free template function bandwidth( x )
// Valid for types with rank <= 1 (scalars, vectors)
// In theory, we could provide overloads for matrices here, too,
// if their minimal_rank is at most 1.
// template< typename T >
// typename boost::enable_if< mpl::less< rank<T>, mpl::int_<2> >,
// typename result_of::bandwidth< const T >::type >::type
// bandwidth( const T& t ) {
// return detail::bandwidth_impl< const T, tag::addressing_index<1> >::invoke( t );
// }
#define GENERATE_BANDWIDTH_INDEX( z, which, unused ) \
GENERATE_FUNCTIONS( bandwidth, which, tag::addressing_index<which> )
BOOST_PP_REPEAT_FROM_TO(1,3,GENERATE_BANDWIDTH_INDEX,~)
GENERATE_FUNCTIONS( bandwidth, _left, tag::addressing_index<1> )
GENERATE_FUNCTIONS( bandwidth, _right, tag::addressing_index<2> )
GENERATE_FUNCTIONS( bandwidth, _lower, tag::addressing_index<1> )
GENERATE_FUNCTIONS( bandwidth, _upper, tag::addressing_index<2> )
GENERATE_FUNCTIONS( bandwidth, _major, typename addressing_index_major<T>::type )
GENERATE_FUNCTIONS( bandwidth, _minor, typename addressing_index_minor<T>::type )
//
// Overloads for free template functions bandwidth_row( x, tag ),
// Here, tag is assumed to be either one of
// tag::transpose, tag::no_transpose, or tag::conjugate
//
namespace result_of {
template< typename T, typename TransTag >
struct bandwidth_lower_op {
typedef typename bandwidth<
T,
typename addressing_index_trans< tag::addressing_index<1>, TransTag >::type
>::type type;
};
template< typename T, typename TransTag >
struct bandwidth_upper_op {
typedef typename bandwidth< T,
typename addressing_index_trans< tag::addressing_index<2>, TransTag >::type >::type type;
};
} // namespace result_of
template< typename T, typename Tag >
inline typename result_of::bandwidth_lower_op< const T, Tag >::type
bandwidth_lower_op( const T& t, Tag ) {
return bindings::bandwidth( t, typename addressing_index_trans< tag::addressing_index<1>, Tag >::type() );
}
template< typename T, typename Tag >
inline typename result_of::bandwidth_upper_op< const T, Tag >::type
bandwidth_upper_op( const T& t, Tag ) {
return bindings::bandwidth( t, typename addressing_index_trans< tag::addressing_index<2>, Tag >::type() );
}
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,145 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BEGIN_HPP
#define BOOST_NUMERIC_BINDINGS_BEGIN_HPP
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/numeric/bindings/detail/linear_iterator.hpp>
#include <boost/numeric/bindings/detail/generate_functions.hpp>
#include <boost/numeric/bindings/rank.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <iostream>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename Tag >
struct begin_impl {};
template< typename T >
struct begin_impl< T, tag::value > {
typedef typename bindings::value_type< T>::type* result_type;
static result_type invoke( T& t ) {
return adaptor_access<T>::begin_value( t );
}
};
template< typename T, int Dimension >
struct begin_impl<T, tag::addressing_index<Dimension> > {
typedef tag::addressing_index<Dimension> tag_type;
typedef linear_iterator<
typename bindings::value_type< T>::type,
typename result_of::stride< T, tag_type >::type
> result_type;
static result_type invoke( T& t ) {
return result_type( adaptor_access<T>::begin_value( t ), bindings::stride(t, tag_type() ) );
}
};
template< typename T >
struct begin_impl< T, tag::index_major > {
typedef typename detail::property_at< T, tag::index_type >::type* result_type;
static result_type invoke( T& t ) {
return adaptor_access<T>::begin_index_major( t );
}
};
template< typename T >
struct begin_impl< T, tag::compressed_index_major > {
typedef typename detail::property_at< T, tag::index_type >::type* result_type;
static result_type invoke( T& t ) {
return adaptor_access<T>::begin_compressed_index_major( t );
}
};
template< typename T >
struct begin_impl< T, tag::index_minor > {
typedef typename detail::property_at< T, tag::index_type >::type* result_type;
static result_type invoke( T& t ) {
return adaptor_access<T>::begin_index_minor( t );
}
};
} // namespace detail
namespace result_of {
template< typename T, typename Tag = tag::addressing_index<1> >
struct begin {
BOOST_STATIC_ASSERT( (is_tag<Tag>::value) );
typedef typename detail::begin_impl<T,Tag>::result_type type;
};
} // namespace result_of
//
// Free Functions
//
//
// Overloads like begin( t, tag )
//
template< typename T, typename Tag >
inline typename result_of::begin<T,Tag>::type
begin( T& t, Tag ) {
return detail::begin_impl<T,Tag>::invoke( t );
}
template< typename T, typename Tag >
inline typename result_of::begin<const T,Tag>::type
begin( const T& t, Tag ) {
return detail::begin_impl<const T,Tag>::invoke( t );
}
// Overloads for types with rank <= 1 (scalars, vectors)
// In theory, we could provide overloads for matrices here, too,
// if their minimal_rank is at most 1.
template< typename T >
typename boost::enable_if< mpl::less< rank<T>, mpl::int_<2> >,
typename result_of::begin< T >::type >::type
begin( T& t ) {
return detail::begin_impl< T, tag::addressing_index<1> >::invoke( t );
}
template< typename T >
typename boost::enable_if< mpl::less< rank<T>, mpl::int_<2> >,
typename result_of::begin< const T >::type >::type
begin( const T& t ) {
return detail::begin_impl< const T, tag::addressing_index<1> >::invoke( t );
}
#define GENERATE_BEGIN_INDEX( z, which, unused ) \
GENERATE_FUNCTIONS( begin, which, tag::addressing_index<which> )
BOOST_PP_REPEAT_FROM_TO(1,3,GENERATE_BEGIN_INDEX,~)
GENERATE_FUNCTIONS( begin, _value, tag::value )
GENERATE_FUNCTIONS( begin, _row, tag::addressing_index<1> )
GENERATE_FUNCTIONS( begin, _column, tag::addressing_index<2> )
GENERATE_FUNCTIONS( begin, _index_major, tag::index_major )
GENERATE_FUNCTIONS( begin, _compressed_index_major, tag::compressed_index_major )
GENERATE_FUNCTIONS( begin, _index_minor, tag::index_minor )
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,17 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_HPP
#include <boost/numeric/bindings/blas/level1.hpp>
#include <boost/numeric/bindings/blas/level2.hpp>
#include <boost/numeric/bindings/blas/level3.hpp>
#endif

View File

@@ -0,0 +1,574 @@
//
// Copyright (c) 2003--2009
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_H
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_H
#include <boost/numeric/bindings/blas/detail/blas_names.h>
extern "C" {
//
// BLAS level1 routines
//
// Value-type variants of asum
float BLAS_SASUM( const fortran_int_t* n, const float* x,
const fortran_int_t* incx );
double BLAS_DASUM( const fortran_int_t* n, const double* x,
const fortran_int_t* incx );
float BLAS_SCASUM( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
double BLAS_DZASUM( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
// Value-type variants of axpy
void BLAS_SAXPY( const fortran_int_t* n, const float* a, const float* x,
const fortran_int_t* incx, float* y, const fortran_int_t* incy );
void BLAS_DAXPY( const fortran_int_t* n, const double* a, const double* x,
const fortran_int_t* incx, double* y, const fortran_int_t* incy );
void BLAS_CAXPY( const fortran_int_t* n, const void* a, const void* x,
const fortran_int_t* incx, void* y, const fortran_int_t* incy );
void BLAS_ZAXPY( const fortran_int_t* n, const void* a, const void* x,
const fortran_int_t* incx, void* y, const fortran_int_t* incy );
// Value-type variants of copy
void BLAS_SCOPY( const fortran_int_t* n, const float* x,
const fortran_int_t* incx, float* y, const fortran_int_t* incy );
void BLAS_DCOPY( const fortran_int_t* n, const double* x,
const fortran_int_t* incx, double* y, const fortran_int_t* incy );
void BLAS_CCOPY( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, void* y, const fortran_int_t* incy );
void BLAS_ZCOPY( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, void* y, const fortran_int_t* incy );
// Value-type variants of dot
float BLAS_SDOT( const fortran_int_t* n, const float* x,
const fortran_int_t* incx, const float* y, const fortran_int_t* incy );
double BLAS_DDOT( const fortran_int_t* n, const double* x,
const fortran_int_t* incx, const double* y,
const fortran_int_t* incy );
std::complex<float> BLAS_CDOTU( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, const void* y, const fortran_int_t* incy );
std::complex<double> BLAS_ZDOTU( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, const void* y, const fortran_int_t* incy );
// Value-type variants of dotc
std::complex<float> BLAS_CDOTC( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, const void* y, const fortran_int_t* incy );
std::complex<double> BLAS_ZDOTC( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, const void* y, const fortran_int_t* incy );
// Value-type variants of iamax
fortran_int_t BLAS_ISAMAX( const fortran_int_t* n, const float* x,
const fortran_int_t* incx );
fortran_int_t BLAS_IDAMAX( const fortran_int_t* n, const double* x,
const fortran_int_t* incx );
fortran_int_t BLAS_ICAMAX( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
fortran_int_t BLAS_IZAMAX( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
// Value-type variants of nrm2
float BLAS_SNRM2( const fortran_int_t* n, const float* x,
const fortran_int_t* incx );
double BLAS_DNRM2( const fortran_int_t* n, const double* x,
const fortran_int_t* incx );
float BLAS_SCNRM2( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
double BLAS_DZNRM2( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
// Value-type variants of prec_dot
double BLAS_DSDOT( const fortran_int_t* n, const float* x,
const fortran_int_t* incx, const float* y, const fortran_int_t* incy );
// Value-type variants of rot
void BLAS_SROT( const fortran_int_t* n, float* x, const fortran_int_t* incx,
float* y, const fortran_int_t* incy, const float* c, const float* s );
void BLAS_DROT( const fortran_int_t* n, double* x, const fortran_int_t* incx,
double* y, const fortran_int_t* incy, const double* c,
const double* s );
void BLAS_CSROT( const fortran_int_t* n, void* x, const fortran_int_t* incx,
void* y, const fortran_int_t* incy, const float* c, const float* s );
void BLAS_ZDROT( const fortran_int_t* n, void* x, const fortran_int_t* incx,
void* y, const fortran_int_t* incy, const double* c, const double* s );
// Value-type variants of rotg
void BLAS_SROTG( float* a, float* b, float* c, float* s );
void BLAS_DROTG( double* a, double* b, double* c, double* s );
void BLAS_CROTG( void* a, void* b, float* c, void* s );
void BLAS_ZROTG( void* a, void* b, double* c, void* s );
// Value-type variants of rotm
void BLAS_SROTM( const fortran_int_t* n, float* x, const fortran_int_t* incx,
float* y, const fortran_int_t* incy, float* param );
void BLAS_DROTM( const fortran_int_t* n, double* x, const fortran_int_t* incx,
double* y, const fortran_int_t* incy, double* param );
// Value-type variants of rotmg
void BLAS_SROTMG( float* d1, float* d2, float* x1, const float* y1,
float* sparam );
void BLAS_DROTMG( double* d1, double* d2, double* x1, const double* y1,
double* dparam );
// Value-type variants of scal
void BLAS_SSCAL( const fortran_int_t* n, const float* a, float* x,
const fortran_int_t* incx );
void BLAS_DSCAL( const fortran_int_t* n, const double* a, double* x,
const fortran_int_t* incx );
void BLAS_CSSCAL( const fortran_int_t* n, const float* a, void* x,
const fortran_int_t* incx );
void BLAS_ZDSCAL( const fortran_int_t* n, const double* a, void* x,
const fortran_int_t* incx );
void BLAS_CSCAL( const fortran_int_t* n, const void* a, void* x,
const fortran_int_t* incx );
void BLAS_ZSCAL( const fortran_int_t* n, const void* a, void* x,
const fortran_int_t* incx );
// Value-type variants of swap
void BLAS_SSWAP( const fortran_int_t* n, float* x, const fortran_int_t* incx,
float* y, const fortran_int_t* incy );
void BLAS_DSWAP( const fortran_int_t* n, double* x, const fortran_int_t* incx,
double* y, const fortran_int_t* incy );
void BLAS_CSWAP( const fortran_int_t* n, void* x, const fortran_int_t* incx,
void* y, const fortran_int_t* incy );
void BLAS_ZSWAP( const fortran_int_t* n, void* x, const fortran_int_t* incx,
void* y, const fortran_int_t* incy );
//
// BLAS level2 routines
//
// Value-type variants of gbmv
void BLAS_SGBMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const fortran_int_t* kl,
const fortran_int_t* ku, const float* alpha, const float* a,
const fortran_int_t* lda, const float* x, const fortran_int_t* incx,
const float* beta, float* y, const fortran_int_t* incy );
void BLAS_DGBMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const fortran_int_t* kl,
const fortran_int_t* ku, const double* alpha, const double* a,
const fortran_int_t* lda, const double* x, const fortran_int_t* incx,
const double* beta, double* y, const fortran_int_t* incy );
void BLAS_CGBMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const fortran_int_t* kl,
const fortran_int_t* ku, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
void BLAS_ZGBMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const fortran_int_t* kl,
const fortran_int_t* ku, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
// Value-type variants of gemv
void BLAS_SGEMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const float* alpha, const float* a,
const fortran_int_t* lda, const float* x, const fortran_int_t* incx,
const float* beta, float* y, const fortran_int_t* incy );
void BLAS_DGEMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const double* alpha, const double* a,
const fortran_int_t* lda, const double* x, const fortran_int_t* incx,
const double* beta, double* y, const fortran_int_t* incy );
void BLAS_CGEMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
void BLAS_ZGEMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
// Value-type variants of ger
void BLAS_SGER( const fortran_int_t* m, const fortran_int_t* n,
const float* alpha, const float* x, const fortran_int_t* incx,
const float* y, const fortran_int_t* incy, float* a,
const fortran_int_t* lda );
void BLAS_DGER( const fortran_int_t* m, const fortran_int_t* n,
const double* alpha, const double* x, const fortran_int_t* incx,
const double* y, const fortran_int_t* incy, double* a,
const fortran_int_t* lda );
// Value-type variants of gerc
void BLAS_CGERC( const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* x, const fortran_int_t* incx,
const void* y, const fortran_int_t* incy, void* a,
const fortran_int_t* lda );
void BLAS_ZGERC( const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* x, const fortran_int_t* incx,
const void* y, const fortran_int_t* incy, void* a,
const fortran_int_t* lda );
// Value-type variants of geru
void BLAS_CGERU( const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* x, const fortran_int_t* incx,
const void* y, const fortran_int_t* incy, void* a,
const fortran_int_t* lda );
void BLAS_ZGERU( const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* x, const fortran_int_t* incx,
const void* y, const fortran_int_t* incy, void* a,
const fortran_int_t* lda );
// Value-type variants of hbmv
void BLAS_CHBMV( const char* uplo, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
void BLAS_ZHBMV( const char* uplo, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
// Value-type variants of hemv
void BLAS_CHEMV( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* a, const fortran_int_t* lda, const void* x,
const fortran_int_t* incx, const void* beta, void* y,
const fortran_int_t* incy );
void BLAS_ZHEMV( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* a, const fortran_int_t* lda, const void* x,
const fortran_int_t* incx, const void* beta, void* y,
const fortran_int_t* incy );
// Value-type variants of her
void BLAS_CHER( const char* uplo, const fortran_int_t* n, const float* alpha,
const void* x, const fortran_int_t* incx, void* a,
const fortran_int_t* lda );
void BLAS_ZHER( const char* uplo, const fortran_int_t* n, const double* alpha,
const void* x, const fortran_int_t* incx, void* a,
const fortran_int_t* lda );
// Value-type variants of her2
void BLAS_CHER2( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* x, const fortran_int_t* incx, const void* y,
const fortran_int_t* incy, void* a, const fortran_int_t* lda );
void BLAS_ZHER2( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* x, const fortran_int_t* incx, const void* y,
const fortran_int_t* incy, void* a, const fortran_int_t* lda );
// Value-type variants of hpmv
void BLAS_CHPMV( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* ap, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
void BLAS_ZHPMV( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* ap, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
// Value-type variants of hpr
void BLAS_CHPR( const char* uplo, const fortran_int_t* n, const float* alpha,
const void* x, const fortran_int_t* incx, void* ap );
void BLAS_ZHPR( const char* uplo, const fortran_int_t* n, const double* alpha,
const void* x, const fortran_int_t* incx, void* ap );
// Value-type variants of hpr2
void BLAS_CHPR2( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* x, const fortran_int_t* incx, const void* y,
const fortran_int_t* incy, void* ap );
void BLAS_ZHPR2( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* x, const fortran_int_t* incx, const void* y,
const fortran_int_t* incy, void* ap );
// Value-type variants of sbmv
void BLAS_SSBMV( const char* uplo, const fortran_int_t* n,
const fortran_int_t* k, const float* alpha, const float* a,
const fortran_int_t* lda, const float* x, const fortran_int_t* incx,
const float* beta, float* y, const fortran_int_t* incy );
void BLAS_DSBMV( const char* uplo, const fortran_int_t* n,
const fortran_int_t* k, const double* alpha, const double* a,
const fortran_int_t* lda, const double* x, const fortran_int_t* incx,
const double* beta, double* y, const fortran_int_t* incy );
// Value-type variants of spmv
void BLAS_SSPMV( const char* uplo, const fortran_int_t* n, const float* alpha,
const float* ap, const float* x, const fortran_int_t* incx,
const float* beta, float* y, const fortran_int_t* incy );
void BLAS_DSPMV( const char* uplo, const fortran_int_t* n,
const double* alpha, const double* ap, const double* x,
const fortran_int_t* incx, const double* beta, double* y,
const fortran_int_t* incy );
// Value-type variants of spr
void BLAS_SSPR( const char* uplo, const fortran_int_t* n, const float* alpha,
const float* x, const fortran_int_t* incx, float* ap );
void BLAS_DSPR( const char* uplo, const fortran_int_t* n, const double* alpha,
const double* x, const fortran_int_t* incx, double* ap );
// Value-type variants of spr2
void BLAS_SSPR2( const char* uplo, const fortran_int_t* n, const float* alpha,
const float* x, const fortran_int_t* incx, const float* y,
const fortran_int_t* incy, float* ap );
void BLAS_DSPR2( const char* uplo, const fortran_int_t* n,
const double* alpha, const double* x, const fortran_int_t* incx,
const double* y, const fortran_int_t* incy, double* ap );
// Value-type variants of symv
void BLAS_SSYMV( const char* uplo, const fortran_int_t* n, const float* alpha,
const float* a, const fortran_int_t* lda, const float* x,
const fortran_int_t* incx, const float* beta, float* y,
const fortran_int_t* incy );
void BLAS_DSYMV( const char* uplo, const fortran_int_t* n,
const double* alpha, const double* a, const fortran_int_t* lda,
const double* x, const fortran_int_t* incx, const double* beta,
double* y, const fortran_int_t* incy );
// Value-type variants of syr
void BLAS_SSYR( const char* uplo, const fortran_int_t* n, const float* alpha,
const float* x, const fortran_int_t* incx, float* a,
const fortran_int_t* lda );
void BLAS_DSYR( const char* uplo, const fortran_int_t* n, const double* alpha,
const double* x, const fortran_int_t* incx, double* a,
const fortran_int_t* lda );
// Value-type variants of syr2
void BLAS_SSYR2( const char* uplo, const fortran_int_t* n, const float* alpha,
const float* x, const fortran_int_t* incx, const float* y,
const fortran_int_t* incy, float* a, const fortran_int_t* lda );
void BLAS_DSYR2( const char* uplo, const fortran_int_t* n,
const double* alpha, const double* x, const fortran_int_t* incx,
const double* y, const fortran_int_t* incy, double* a,
const fortran_int_t* lda );
// Value-type variants of tbmv
void BLAS_STBMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const float* a,
const fortran_int_t* lda, float* x, const fortran_int_t* incx );
void BLAS_DTBMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const double* a,
const fortran_int_t* lda, double* x, const fortran_int_t* incx );
void BLAS_CTBMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const void* a,
const fortran_int_t* lda, void* x, const fortran_int_t* incx );
void BLAS_ZTBMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const void* a,
const fortran_int_t* lda, void* x, const fortran_int_t* incx );
// Value-type variants of tbsv
void BLAS_STBSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const float* a,
const fortran_int_t* lda, float* x, const fortran_int_t* incx );
void BLAS_DTBSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const double* a,
const fortran_int_t* lda, double* x, const fortran_int_t* incx );
void BLAS_CTBSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const void* a,
const fortran_int_t* lda, void* x, const fortran_int_t* incx );
void BLAS_ZTBSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const void* a,
const fortran_int_t* lda, void* x, const fortran_int_t* incx );
// Value-type variants of tpmv
void BLAS_STPMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const float* ap, float* x,
const fortran_int_t* incx );
void BLAS_DTPMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const double* ap, double* x,
const fortran_int_t* incx );
void BLAS_CTPMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* ap, void* x,
const fortran_int_t* incx );
void BLAS_ZTPMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* ap, void* x,
const fortran_int_t* incx );
// Value-type variants of tpsv
void BLAS_STPSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const float* ap, float* x,
const fortran_int_t* incx );
void BLAS_DTPSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const double* ap, double* x,
const fortran_int_t* incx );
void BLAS_CTPSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* ap, void* x,
const fortran_int_t* incx );
void BLAS_ZTPSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* ap, void* x,
const fortran_int_t* incx );
// Value-type variants of trmv
void BLAS_STRMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const float* a, const fortran_int_t* lda,
float* x, const fortran_int_t* incx );
void BLAS_DTRMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const double* a, const fortran_int_t* lda,
double* x, const fortran_int_t* incx );
void BLAS_CTRMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* a, const fortran_int_t* lda,
void* x, const fortran_int_t* incx );
void BLAS_ZTRMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* a, const fortran_int_t* lda,
void* x, const fortran_int_t* incx );
// Value-type variants of trsv
void BLAS_STRSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const float* a, const fortran_int_t* lda,
float* x, const fortran_int_t* incx );
void BLAS_DTRSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const double* a, const fortran_int_t* lda,
double* x, const fortran_int_t* incx );
void BLAS_CTRSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* a, const fortran_int_t* lda,
void* x, const fortran_int_t* incx );
void BLAS_ZTRSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* a, const fortran_int_t* lda,
void* x, const fortran_int_t* incx );
//
// BLAS level3 routines
//
// Value-type variants of gemm
void BLAS_SGEMM( const char* transa, const char* transb,
const fortran_int_t* m, const fortran_int_t* n,
const fortran_int_t* k, const float* alpha, const float* a,
const fortran_int_t* lda, const float* b, const fortran_int_t* ldb,
const float* beta, float* c, const fortran_int_t* ldc );
void BLAS_DGEMM( const char* transa, const char* transb,
const fortran_int_t* m, const fortran_int_t* n,
const fortran_int_t* k, const double* alpha, const double* a,
const fortran_int_t* lda, const double* b, const fortran_int_t* ldb,
const double* beta, double* c, const fortran_int_t* ldc );
void BLAS_CGEMM( const char* transa, const char* transb,
const fortran_int_t* m, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZGEMM( const char* transa, const char* transb,
const fortran_int_t* m, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of hemm
void BLAS_CHEMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZHEMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of her2k
void BLAS_CHER2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const float* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZHER2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const double* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of herk
void BLAS_CHERK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const float* alpha, const void* a,
const fortran_int_t* lda, const float* beta, void* c,
const fortran_int_t* ldc );
void BLAS_ZHERK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const double* alpha, const void* a,
const fortran_int_t* lda, const double* beta, void* c,
const fortran_int_t* ldc );
// Value-type variants of symm
void BLAS_SSYMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const float* alpha, const float* a,
const fortran_int_t* lda, const float* b, const fortran_int_t* ldb,
const float* beta, float* c, const fortran_int_t* ldc );
void BLAS_DSYMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const double* alpha, const double* a,
const fortran_int_t* lda, const double* b, const fortran_int_t* ldb,
const double* beta, double* c, const fortran_int_t* ldc );
void BLAS_CSYMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZSYMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of syr2k
void BLAS_SSYR2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const float* alpha, const float* a,
const fortran_int_t* lda, const float* b, const fortran_int_t* ldb,
const float* beta, float* c, const fortran_int_t* ldc );
void BLAS_DSYR2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const double* alpha, const double* a,
const fortran_int_t* lda, const double* b, const fortran_int_t* ldb,
const double* beta, double* c, const fortran_int_t* ldc );
void BLAS_CSYR2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZSYR2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of syrk
void BLAS_SSYRK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const float* alpha, const float* a,
const fortran_int_t* lda, const float* beta, float* c,
const fortran_int_t* ldc );
void BLAS_DSYRK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const double* alpha, const double* a,
const fortran_int_t* lda, const double* beta, double* c,
const fortran_int_t* ldc );
void BLAS_CSYRK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* beta, void* c,
const fortran_int_t* ldc );
void BLAS_ZSYRK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* beta, void* c,
const fortran_int_t* ldc );
// Value-type variants of trmm
void BLAS_STRMM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const float* alpha, const float* a, const fortran_int_t* lda,
float* b, const fortran_int_t* ldb );
void BLAS_DTRMM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const double* alpha, const double* a, const fortran_int_t* lda,
double* b, const fortran_int_t* ldb );
void BLAS_CTRMM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* a, const fortran_int_t* lda, void* b,
const fortran_int_t* ldb );
void BLAS_ZTRMM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* a, const fortran_int_t* lda, void* b,
const fortran_int_t* ldb );
// Value-type variants of trsm
void BLAS_STRSM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const float* alpha, const float* a, const fortran_int_t* lda,
float* b, const fortran_int_t* ldb );
void BLAS_DTRSM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const double* alpha, const double* a, const fortran_int_t* lda,
double* b, const fortran_int_t* ldb );
void BLAS_CTRSM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* a, const fortran_int_t* lda, void* b,
const fortran_int_t* ldb );
void BLAS_ZTRSM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* a, const fortran_int_t* lda, void* b,
const fortran_int_t* ldb );
}
#endif

View File

@@ -0,0 +1,275 @@
//
// Copyright (c) 2003--2009
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_NAMES_H
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_NAMES_H
#include <boost/numeric/bindings/detail/config/fortran.hpp>
//
// BLAS level1 routines
//
// Value-type variants of asum
#define BLAS_SASUM FORTRAN_ID2( sasum, SASUM )
#define BLAS_DASUM FORTRAN_ID2( dasum, DASUM )
#define BLAS_SCASUM FORTRAN_ID2( scasum, SCASUM )
#define BLAS_DZASUM FORTRAN_ID2( dzasum, DZASUM )
// Value-type variants of axpy
#define BLAS_SAXPY FORTRAN_ID2( saxpy, SAXPY )
#define BLAS_DAXPY FORTRAN_ID2( daxpy, DAXPY )
#define BLAS_CAXPY FORTRAN_ID2( caxpy, CAXPY )
#define BLAS_ZAXPY FORTRAN_ID2( zaxpy, ZAXPY )
// Value-type variants of copy
#define BLAS_SCOPY FORTRAN_ID2( scopy, SCOPY )
#define BLAS_DCOPY FORTRAN_ID2( dcopy, DCOPY )
#define BLAS_CCOPY FORTRAN_ID2( ccopy, CCOPY )
#define BLAS_ZCOPY FORTRAN_ID2( zcopy, ZCOPY )
// Value-type variants of dot
#define BLAS_SDOT FORTRAN_ID2( sdot, SDOT )
#define BLAS_DDOT FORTRAN_ID2( ddot, DDOT )
#define BLAS_CDOTU FORTRAN_ID2( cdotu, CDOTU )
#define BLAS_ZDOTU FORTRAN_ID2( zdotu, ZDOTU )
// Value-type variants of dotc
#define BLAS_CDOTC FORTRAN_ID2( cdotc, CDOTC )
#define BLAS_ZDOTC FORTRAN_ID2( zdotc, ZDOTC )
// Value-type variants of iamax
#define BLAS_ISAMAX FORTRAN_ID2( isamax, ISAMAX )
#define BLAS_IDAMAX FORTRAN_ID2( idamax, IDAMAX )
#define BLAS_ICAMAX FORTRAN_ID2( icamax, ICAMAX )
#define BLAS_IZAMAX FORTRAN_ID2( izamax, IZAMAX )
// Value-type variants of nrm2
#define BLAS_SNRM2 FORTRAN_ID2( snrm2, SNRM2 )
#define BLAS_DNRM2 FORTRAN_ID2( dnrm2, DNRM2 )
#define BLAS_SCNRM2 FORTRAN_ID2( scnrm2, SCNRM2 )
#define BLAS_DZNRM2 FORTRAN_ID2( dznrm2, DZNRM2 )
// Value-type variants of prec_dot
#define BLAS_DSDOT FORTRAN_ID2( dsdot, DSDOT )
// Value-type variants of rot
#define BLAS_SROT FORTRAN_ID2( srot, SROT )
#define BLAS_DROT FORTRAN_ID2( drot, DROT )
#define BLAS_CSROT FORTRAN_ID2( csrot, CSROT )
#define BLAS_ZDROT FORTRAN_ID2( zdrot, ZDROT )
// Value-type variants of rotg
#define BLAS_SROTG FORTRAN_ID2( srotg, SROTG )
#define BLAS_DROTG FORTRAN_ID2( drotg, DROTG )
#define BLAS_CROTG FORTRAN_ID2( crotg, CROTG )
#define BLAS_ZROTG FORTRAN_ID2( zrotg, ZROTG )
// Value-type variants of rotm
#define BLAS_SROTM FORTRAN_ID2( srotm, SROTM )
#define BLAS_DROTM FORTRAN_ID2( drotm, DROTM )
// Value-type variants of rotmg
#define BLAS_SROTMG FORTRAN_ID2( srotmg, SROTMG )
#define BLAS_DROTMG FORTRAN_ID2( drotmg, DROTMG )
// Value-type variants of scal
#define BLAS_SSCAL FORTRAN_ID2( sscal, SSCAL )
#define BLAS_DSCAL FORTRAN_ID2( dscal, DSCAL )
#define BLAS_CSSCAL FORTRAN_ID2( csscal, CSSCAL )
#define BLAS_ZDSCAL FORTRAN_ID2( zdscal, ZDSCAL )
#define BLAS_CSCAL FORTRAN_ID2( cscal, CSCAL )
#define BLAS_ZSCAL FORTRAN_ID2( zscal, ZSCAL )
// Value-type variants of swap
#define BLAS_SSWAP FORTRAN_ID2( sswap, SSWAP )
#define BLAS_DSWAP FORTRAN_ID2( dswap, DSWAP )
#define BLAS_CSWAP FORTRAN_ID2( cswap, CSWAP )
#define BLAS_ZSWAP FORTRAN_ID2( zswap, ZSWAP )
//
// BLAS level2 routines
//
// Value-type variants of gbmv
#define BLAS_SGBMV FORTRAN_ID2( sgbmv, SGBMV )
#define BLAS_DGBMV FORTRAN_ID2( dgbmv, DGBMV )
#define BLAS_CGBMV FORTRAN_ID2( cgbmv, CGBMV )
#define BLAS_ZGBMV FORTRAN_ID2( zgbmv, ZGBMV )
// Value-type variants of gemv
#define BLAS_SGEMV FORTRAN_ID2( sgemv, SGEMV )
#define BLAS_DGEMV FORTRAN_ID2( dgemv, DGEMV )
#define BLAS_CGEMV FORTRAN_ID2( cgemv, CGEMV )
#define BLAS_ZGEMV FORTRAN_ID2( zgemv, ZGEMV )
// Value-type variants of ger
#define BLAS_SGER FORTRAN_ID2( sger, SGER )
#define BLAS_DGER FORTRAN_ID2( dger, DGER )
// Value-type variants of gerc
#define BLAS_CGERC FORTRAN_ID2( cgerc, CGERC )
#define BLAS_ZGERC FORTRAN_ID2( zgerc, ZGERC )
// Value-type variants of geru
#define BLAS_CGERU FORTRAN_ID2( cgeru, CGERU )
#define BLAS_ZGERU FORTRAN_ID2( zgeru, ZGERU )
// Value-type variants of hbmv
#define BLAS_CHBMV FORTRAN_ID2( chbmv, CHBMV )
#define BLAS_ZHBMV FORTRAN_ID2( zhbmv, ZHBMV )
// Value-type variants of hemv
#define BLAS_CHEMV FORTRAN_ID2( chemv, CHEMV )
#define BLAS_ZHEMV FORTRAN_ID2( zhemv, ZHEMV )
// Value-type variants of her
#define BLAS_CHER FORTRAN_ID2( cher, CHER )
#define BLAS_ZHER FORTRAN_ID2( zher, ZHER )
// Value-type variants of her2
#define BLAS_CHER2 FORTRAN_ID2( cher2, CHER2 )
#define BLAS_ZHER2 FORTRAN_ID2( zher2, ZHER2 )
// Value-type variants of hpmv
#define BLAS_CHPMV FORTRAN_ID2( chpmv, CHPMV )
#define BLAS_ZHPMV FORTRAN_ID2( zhpmv, ZHPMV )
// Value-type variants of hpr
#define BLAS_CHPR FORTRAN_ID2( chpr, CHPR )
#define BLAS_ZHPR FORTRAN_ID2( zhpr, ZHPR )
// Value-type variants of hpr2
#define BLAS_CHPR2 FORTRAN_ID2( chpr2, CHPR2 )
#define BLAS_ZHPR2 FORTRAN_ID2( zhpr2, ZHPR2 )
// Value-type variants of sbmv
#define BLAS_SSBMV FORTRAN_ID2( ssbmv, SSBMV )
#define BLAS_DSBMV FORTRAN_ID2( dsbmv, DSBMV )
// Value-type variants of spmv
#define BLAS_SSPMV FORTRAN_ID2( sspmv, SSPMV )
#define BLAS_DSPMV FORTRAN_ID2( dspmv, DSPMV )
// Value-type variants of spr
#define BLAS_SSPR FORTRAN_ID2( sspr, SSPR )
#define BLAS_DSPR FORTRAN_ID2( dspr, DSPR )
// Value-type variants of spr2
#define BLAS_SSPR2 FORTRAN_ID2( sspr2, SSPR2 )
#define BLAS_DSPR2 FORTRAN_ID2( dspr2, DSPR2 )
// Value-type variants of symv
#define BLAS_SSYMV FORTRAN_ID2( ssymv, SSYMV )
#define BLAS_DSYMV FORTRAN_ID2( dsymv, DSYMV )
// Value-type variants of syr
#define BLAS_SSYR FORTRAN_ID2( ssyr, SSYR )
#define BLAS_DSYR FORTRAN_ID2( dsyr, DSYR )
// Value-type variants of syr2
#define BLAS_SSYR2 FORTRAN_ID2( ssyr2, SSYR2 )
#define BLAS_DSYR2 FORTRAN_ID2( dsyr2, DSYR2 )
// Value-type variants of tbmv
#define BLAS_STBMV FORTRAN_ID2( stbmv, STBMV )
#define BLAS_DTBMV FORTRAN_ID2( dtbmv, DTBMV )
#define BLAS_CTBMV FORTRAN_ID2( ctbmv, CTBMV )
#define BLAS_ZTBMV FORTRAN_ID2( ztbmv, ZTBMV )
// Value-type variants of tbsv
#define BLAS_STBSV FORTRAN_ID2( stbsv, STBSV )
#define BLAS_DTBSV FORTRAN_ID2( dtbsv, DTBSV )
#define BLAS_CTBSV FORTRAN_ID2( ctbsv, CTBSV )
#define BLAS_ZTBSV FORTRAN_ID2( ztbsv, ZTBSV )
// Value-type variants of tpmv
#define BLAS_STPMV FORTRAN_ID2( stpmv, STPMV )
#define BLAS_DTPMV FORTRAN_ID2( dtpmv, DTPMV )
#define BLAS_CTPMV FORTRAN_ID2( ctpmv, CTPMV )
#define BLAS_ZTPMV FORTRAN_ID2( ztpmv, ZTPMV )
// Value-type variants of tpsv
#define BLAS_STPSV FORTRAN_ID2( stpsv, STPSV )
#define BLAS_DTPSV FORTRAN_ID2( dtpsv, DTPSV )
#define BLAS_CTPSV FORTRAN_ID2( ctpsv, CTPSV )
#define BLAS_ZTPSV FORTRAN_ID2( ztpsv, ZTPSV )
// Value-type variants of trmv
#define BLAS_STRMV FORTRAN_ID2( strmv, STRMV )
#define BLAS_DTRMV FORTRAN_ID2( dtrmv, DTRMV )
#define BLAS_CTRMV FORTRAN_ID2( ctrmv, CTRMV )
#define BLAS_ZTRMV FORTRAN_ID2( ztrmv, ZTRMV )
// Value-type variants of trsv
#define BLAS_STRSV FORTRAN_ID2( strsv, STRSV )
#define BLAS_DTRSV FORTRAN_ID2( dtrsv, DTRSV )
#define BLAS_CTRSV FORTRAN_ID2( ctrsv, CTRSV )
#define BLAS_ZTRSV FORTRAN_ID2( ztrsv, ZTRSV )
//
// BLAS level3 routines
//
// Value-type variants of gemm
#define BLAS_SGEMM FORTRAN_ID2( sgemm, SGEMM )
#define BLAS_DGEMM FORTRAN_ID2( dgemm, DGEMM )
#define BLAS_CGEMM FORTRAN_ID2( cgemm, CGEMM )
#define BLAS_ZGEMM FORTRAN_ID2( zgemm, ZGEMM )
// Value-type variants of hemm
#define BLAS_CHEMM FORTRAN_ID2( chemm, CHEMM )
#define BLAS_ZHEMM FORTRAN_ID2( zhemm, ZHEMM )
// Value-type variants of her2k
#define BLAS_CHER2K FORTRAN_ID2( cher2k, CHER2K )
#define BLAS_ZHER2K FORTRAN_ID2( zher2k, ZHER2K )
// Value-type variants of herk
#define BLAS_CHERK FORTRAN_ID2( cherk, CHERK )
#define BLAS_ZHERK FORTRAN_ID2( zherk, ZHERK )
// Value-type variants of symm
#define BLAS_SSYMM FORTRAN_ID2( ssymm, SSYMM )
#define BLAS_DSYMM FORTRAN_ID2( dsymm, DSYMM )
#define BLAS_CSYMM FORTRAN_ID2( csymm, CSYMM )
#define BLAS_ZSYMM FORTRAN_ID2( zsymm, ZSYMM )
// Value-type variants of syr2k
#define BLAS_SSYR2K FORTRAN_ID2( ssyr2k, SSYR2K )
#define BLAS_DSYR2K FORTRAN_ID2( dsyr2k, DSYR2K )
#define BLAS_CSYR2K FORTRAN_ID2( csyr2k, CSYR2K )
#define BLAS_ZSYR2K FORTRAN_ID2( zsyr2k, ZSYR2K )
// Value-type variants of syrk
#define BLAS_SSYRK FORTRAN_ID2( ssyrk, SSYRK )
#define BLAS_DSYRK FORTRAN_ID2( dsyrk, DSYRK )
#define BLAS_CSYRK FORTRAN_ID2( csyrk, CSYRK )
#define BLAS_ZSYRK FORTRAN_ID2( zsyrk, ZSYRK )
// Value-type variants of trmm
#define BLAS_STRMM FORTRAN_ID2( strmm, STRMM )
#define BLAS_DTRMM FORTRAN_ID2( dtrmm, DTRMM )
#define BLAS_CTRMM FORTRAN_ID2( ctrmm, CTRMM )
#define BLAS_ZTRMM FORTRAN_ID2( ztrmm, ZTRMM )
// Value-type variants of trsm
#define BLAS_STRSM FORTRAN_ID2( strsm, STRSM )
#define BLAS_DTRSM FORTRAN_ID2( dtrsm, DTRSM )
#define BLAS_CTRSM FORTRAN_ID2( ctrsm, CTRSM )
#define BLAS_ZTRSM FORTRAN_ID2( ztrsm, ZTRSM )
#endif

View File

@@ -0,0 +1,57 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_OPTION_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_OPTION_HPP
#include <boost/mpl/char.hpp>
#include <boost/numeric/bindings/tag.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
namespace detail {
template< typename Tag >
struct blas_option {};
template<>
struct blas_option< tag::transpose >: mpl::char_< 'T' > {};
template<>
struct blas_option< tag::no_transpose >: mpl::char_< 'N' > {};
template<>
struct blas_option< tag::conjugate >: mpl::char_< 'C' > {};
template<>
struct blas_option< tag::upper >: mpl::char_< 'U' > {};
template<>
struct blas_option< tag::lower >: mpl::char_< 'L' > {};
template<>
struct blas_option< tag::unit >: mpl::char_< 'U' > {};
template<>
struct blas_option< tag::non_unit >: mpl::char_< 'N' > {};
template<>
struct blas_option< tag::left >: mpl::char_< 'L' > {};
template<>
struct blas_option< tag::right >: mpl::char_< 'R' > {};
} // namespace detail
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,41 @@
/*
*
* Copyright (c) Kresimir Fresl 2002
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* Author acknowledges the support of the Faculty of Civil Engineering,
* University of Zagreb, Croatia.
*
*/
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CBLAS_H
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CBLAS_H
//
// MKL-specific CBLAS include
//
#if defined BOOST_NUMERIC_BINDINGS_BLAS_MKL
extern "C" {
#include <mkl_cblas.h>
#include <mkl_service.h>
//
// mkl_types.h defines P4 macro which breaks MPL, undefine it here.
//
#undef P4
}
//
// Default CBLAS include
//
#else
extern "C" {
#include <cblas.h>
}
#endif
#endif

View File

@@ -0,0 +1,85 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CBLAS_OPTION_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CBLAS_OPTION_HPP
#include <boost/numeric/bindings/blas/detail/cblas.h>
#include <boost/numeric/bindings/tag.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
namespace detail {
template< typename Tag >
struct cblas_option {};
template<>
struct cblas_option< tag::row_major > {
static const CBLAS_ORDER value = CblasRowMajor;
};
template<>
struct cblas_option< tag::column_major > {
static const CBLAS_ORDER value = CblasColMajor;
};
template<>
struct cblas_option< tag::transpose > {
static const CBLAS_TRANSPOSE value = CblasTrans;
};
template<>
struct cblas_option< tag::no_transpose > {
static const CBLAS_TRANSPOSE value = CblasNoTrans;
};
template<>
struct cblas_option< tag::conjugate > {
static const CBLAS_TRANSPOSE value = CblasConjTrans;
};
template<>
struct cblas_option< tag::upper > {
static const CBLAS_UPLO value = CblasUpper;
};
template<>
struct cblas_option< tag::lower > {
static const CBLAS_UPLO value = CblasLower;
};
template<>
struct cblas_option< tag::unit > {
static const CBLAS_DIAG value = CblasUnit;
};
template<>
struct cblas_option< tag::non_unit > {
static const CBLAS_DIAG value = CblasNonUnit;
};
template<>
struct cblas_option< tag::left > {
static const CBLAS_SIDE value = CblasLeft;
};
template<>
struct cblas_option< tag::right > {
static const CBLAS_SIDE value = CblasRight;
};
} // namespace detail
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,16 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CUBLAS_H
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CUBLAS_H
extern "C" {
#include <cublas.h>
}
#endif

View File

@@ -0,0 +1,38 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_DEFAULT_ORDER_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_DEFAULT_ORDER_HPP
#include <boost/mpl/if.hpp>
#include <boost/numeric/bindings/is_row_major.hpp>
#include <boost/numeric/bindings/tag.hpp>
#include <boost/numeric/bindings/detail/property_map.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
namespace detail {
template< typename T >
struct default_order {
typedef typename mpl::if_<
bindings::detail::is_same_at< T, tag::value_transform, tag::conjugate >,
typename mpl::if_< is_row_major< T >, tag::column_major, tag::row_major >::type,
tag::column_major
>::type type;
};
} // namespace detail
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,29 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_HPP
#include <boost/numeric/bindings/blas/level1/asum.hpp>
#include <boost/numeric/bindings/blas/level1/axpy.hpp>
#include <boost/numeric/bindings/blas/level1/copy.hpp>
#include <boost/numeric/bindings/blas/level1/dotc.hpp>
#include <boost/numeric/bindings/blas/level1/dot.hpp>
#include <boost/numeric/bindings/blas/level1/dotu.hpp>
#include <boost/numeric/bindings/blas/level1/iamax.hpp>
#include <boost/numeric/bindings/blas/level1/nrm2.hpp>
#include <boost/numeric/bindings/blas/level1/prec_dot.hpp>
#include <boost/numeric/bindings/blas/level1/rotg.hpp>
#include <boost/numeric/bindings/blas/level1/rot.hpp>
#include <boost/numeric/bindings/blas/level1/rotmg.hpp>
#include <boost/numeric/bindings/blas/level1/rotm.hpp>
#include <boost/numeric/bindings/blas/level1/scal.hpp>
#include <boost/numeric/bindings/blas/level1/set.hpp>
#include <boost/numeric/bindings/blas/level1/swap.hpp>
#endif

View File

@@ -0,0 +1,230 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ASUM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ASUM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline float asum( const int n, const float* x, const int incx ) {
return cblas_sasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline double asum( const int n, const double* x, const int incx ) {
return cblas_dasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline float asum( const int n, const std::complex<float>* x,
const int incx ) {
return cblas_scasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline double asum( const int n, const std::complex<double>* x,
const int incx ) {
return cblas_dzasum( n, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline float asum( const int n, const float* x, const int incx ) {
return cublasSasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline double asum( const int n, const double* x, const int incx ) {
return cublasDasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline float asum( const int n, const std::complex<float>* x,
const int incx ) {
return cublasScasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline double asum( const int n, const std::complex<double>* x,
const int incx ) {
return cublasDzasum( n, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline float asum( const fortran_int_t n, const float* x,
const fortran_int_t incx ) {
return BLAS_SASUM( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline double asum( const fortran_int_t n, const double* x,
const fortran_int_t incx ) {
return BLAS_DASUM( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline float asum( const fortran_int_t n, const std::complex<float>* x,
const fortran_int_t incx ) {
return BLAS_SCASUM( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline double asum( const fortran_int_t n, const std::complex<double>* x,
const fortran_int_t incx ) {
return BLAS_DZASUM( &n, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to asum.
//
template< typename Value >
struct asum_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef real_type result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX >
static result_type invoke( const VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
return detail::asum( bindings::size(x),
bindings::begin_value(x), bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the asum_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for asum. Its overload differs for
//
template< typename VectorX >
inline typename asum_impl< typename bindings::value_type<
VectorX >::type >::result_type
asum( const VectorX& x ) {
return asum_impl< typename bindings::value_type<
VectorX >::type >::invoke( x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,249 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_AXPY_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_AXPY_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline void axpy( const int n, const float a, const float* x, const int incx,
float* y, const int incy ) {
cblas_saxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void axpy( const int n, const double a, const double* x,
const int incx, double* y, const int incy ) {
cblas_daxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void axpy( const int n, const std::complex<float> a,
const std::complex<float>* x, const int incx, std::complex<float>* y,
const int incy ) {
cblas_caxpy( n, &a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void axpy( const int n, const std::complex<double> a,
const std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cblas_zaxpy( n, &a, x, incx, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void axpy( const int n, const float a, const float* x, const int incx,
float* y, const int incy ) {
cublasSaxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void axpy( const int n, const double a, const double* x,
const int incx, double* y, const int incy ) {
cublasDaxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void axpy( const int n, const std::complex<float> a,
const std::complex<float>* x, const int incx, std::complex<float>* y,
const int incy ) {
cublasCaxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void axpy( const int n, const std::complex<double> a,
const std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cublasZaxpy( n, a, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void axpy( const fortran_int_t n, const float a, const float* x,
const fortran_int_t incx, float* y, const fortran_int_t incy ) {
BLAS_SAXPY( &n, &a, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void axpy( const fortran_int_t n, const double a, const double* x,
const fortran_int_t incx, double* y, const fortran_int_t incy ) {
BLAS_DAXPY( &n, &a, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void axpy( const fortran_int_t n, const std::complex<float> a,
const std::complex<float>* x, const fortran_int_t incx,
std::complex<float>* y, const fortran_int_t incy ) {
BLAS_CAXPY( &n, &a, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void axpy( const fortran_int_t n, const std::complex<double> a,
const std::complex<double>* x, const fortran_int_t incx,
std::complex<double>* y, const fortran_int_t incy ) {
BLAS_ZAXPY( &n, &a, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to axpy.
//
template< typename Value >
struct axpy_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY >
static result_type invoke( const value_type a, const VectorX& x,
VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
detail::axpy( bindings::size(x), a, bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the axpy_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for axpy. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename axpy_impl< typename bindings::value_type<
VectorX >::type >::result_type
axpy( const typename bindings::value_type< VectorX >::type a,
const VectorX& x, VectorY& y ) {
axpy_impl< typename bindings::value_type<
VectorX >::type >::invoke( a, x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,243 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_COPY_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_COPY_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline void copy( const int n, const float* x, const int incx, float* y,
const int incy ) {
cblas_scopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void copy( const int n, const double* x, const int incx, double* y,
const int incy ) {
cblas_dcopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void copy( const int n, const std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy ) {
cblas_ccopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void copy( const int n, const std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cblas_zcopy( n, x, incx, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void copy( const int n, const float* x, const int incx, float* y,
const int incy ) {
cublasScopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void copy( const int n, const double* x, const int incx, double* y,
const int incy ) {
cublasDcopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void copy( const int n, const std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy ) {
cublasCcopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void copy( const int n, const std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cublasZcopy( n, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void copy( const fortran_int_t n, const float* x,
const fortran_int_t incx, float* y, const fortran_int_t incy ) {
BLAS_SCOPY( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void copy( const fortran_int_t n, const double* x,
const fortran_int_t incx, double* y, const fortran_int_t incy ) {
BLAS_DCOPY( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void copy( const fortran_int_t n, const std::complex<float>* x,
const fortran_int_t incx, std::complex<float>* y,
const fortran_int_t incy ) {
BLAS_CCOPY( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void copy( const fortran_int_t n, const std::complex<double>* x,
const fortran_int_t incx, std::complex<double>* y,
const fortran_int_t incy ) {
BLAS_ZCOPY( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to copy.
//
template< typename Value >
struct copy_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY >
static result_type invoke( const VectorX& x, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
detail::copy( bindings::size(x), bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the copy_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for copy. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename copy_impl< typename bindings::value_type<
VectorX >::type >::result_type
copy( const VectorX& x, VectorY& y ) {
copy_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,246 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOT_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline float dot( const int n, const float* x, const int incx, const float* y,
const int incy ) {
return cblas_sdot( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline double dot( const int n, const double* x, const int incx,
const double* y, const int incy ) {
return cblas_ddot( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline std::complex<float> dot( const int n, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy ) {
std::complex<float> result;
cblas_cdotu_sub( n, x, incx, y, incy, &result );
return result;
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline std::complex<double> dot( const int n, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy ) {
std::complex<double> result;
cblas_zdotu_sub( n, x, incx, y, incy, &result );
return result;
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline float dot( const int n, const float* x, const int incx, const float* y,
const int incy ) {
return cublasSdot( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline double dot( const int n, const double* x, const int incx,
const double* y, const int incy ) {
return cublasDdot( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline std::complex<float> dot( const int n, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy ) {
return cublasCdotu( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline std::complex<double> dot( const int n, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy ) {
return cublasZdotu( n, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline float dot( const fortran_int_t n, const float* x,
const fortran_int_t incx, const float* y, const fortran_int_t incy ) {
return BLAS_SDOT( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline double dot( const fortran_int_t n, const double* x,
const fortran_int_t incx, const double* y, const fortran_int_t incy ) {
return BLAS_DDOT( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline std::complex<float> dot( const fortran_int_t n,
const std::complex<float>* x, const fortran_int_t incx,
const std::complex<float>* y, const fortran_int_t incy ) {
return BLAS_CDOTU( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline std::complex<double> dot( const fortran_int_t n,
const std::complex<double>* x, const fortran_int_t incx,
const std::complex<double>* y, const fortran_int_t incy ) {
return BLAS_ZDOTU( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to dot.
//
template< typename Value >
struct dot_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef value_type result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY >
static result_type invoke( const VectorX& x, const VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
return detail::dot( bindings::size(x),
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(y), bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the dot_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for dot. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename dot_impl< typename bindings::value_type<
VectorX >::type >::result_type
dot( const VectorX& x, const VectorY& y ) {
return dot_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,186 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTC_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTC_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline std::complex<float> dotc( const int n, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy ) {
std::complex<float> result;
cblas_cdotc_sub( n, x, incx, y, incy, &result );
return result;
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline std::complex<double> dotc( const int n, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy ) {
std::complex<double> result;
cblas_zdotc_sub( n, x, incx, y, incy, &result );
return result;
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline std::complex<float> dotc( const int n, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy ) {
return cublasCdotc( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline std::complex<double> dotc( const int n, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy ) {
return cublasZdotc( n, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline std::complex<float> dotc( const fortran_int_t n,
const std::complex<float>* x, const fortran_int_t incx,
const std::complex<float>* y, const fortran_int_t incy ) {
return BLAS_CDOTC( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline std::complex<double> dotc( const fortran_int_t n,
const std::complex<double>* x, const fortran_int_t incx,
const std::complex<double>* y, const fortran_int_t incy ) {
return BLAS_ZDOTC( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to dotc.
//
template< typename Value >
struct dotc_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef value_type result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY >
static result_type invoke( const VectorX& x, const VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
return detail::dotc( bindings::size(x),
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(y), bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the dotc_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for dotc. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename dotc_impl< typename bindings::value_type<
VectorX >::type >::result_type
dotc( const VectorX& x, const VectorY& y ) {
return dotc_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,42 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTU_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTU_HPP
#include <boost/numeric/bindings/blas/level1/dot.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// dotu is a synonym for dot
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access.
//
//
// Overloaded function for dotu.
//
template< typename VectorX, typename VectorY >
inline typename dot_impl< typename bindings::value_type< VectorX >::type >::result_type
dotu( const VectorX& x, const VectorY& y ) {
return dot_impl< typename bindings::value_type< VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,232 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_IAMAX_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_IAMAX_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline std::ptrdiff_t iamax( const int n, const float* x, const int incx ) {
return cblas_isamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline std::ptrdiff_t iamax( const int n, const double* x,
const int incx ) {
return cblas_idamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline std::ptrdiff_t iamax( const int n, const std::complex<float>* x,
const int incx ) {
return cblas_icamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline std::ptrdiff_t iamax( const int n, const std::complex<double>* x,
const int incx ) {
return cblas_izamax( n, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline std::ptrdiff_t iamax( const int n, const float* x, const int incx ) {
return cublasIsamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline std::ptrdiff_t iamax( const int n, const double* x,
const int incx ) {
return cublasIdamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline std::ptrdiff_t iamax( const int n, const std::complex<float>* x,
const int incx ) {
return cublasIcamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline std::ptrdiff_t iamax( const int n, const std::complex<double>* x,
const int incx ) {
return cublasIzamax( n, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t iamax( const fortran_int_t n, const float* x,
const fortran_int_t incx ) {
return BLAS_ISAMAX( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t iamax( const fortran_int_t n, const double* x,
const fortran_int_t incx ) {
return BLAS_IDAMAX( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t iamax( const fortran_int_t n,
const std::complex<float>* x, const fortran_int_t incx ) {
return BLAS_ICAMAX( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t iamax( const fortran_int_t n,
const std::complex<double>* x, const fortran_int_t incx ) {
return BLAS_IZAMAX( &n, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to iamax.
//
template< typename Value >
struct iamax_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef std::ptrdiff_t result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX >
static result_type invoke( const VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
return detail::iamax( bindings::size(x),
bindings::begin_value(x), bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the iamax_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for iamax. Its overload differs for
//
template< typename VectorX >
inline typename iamax_impl< typename bindings::value_type<
VectorX >::type >::result_type
iamax( const VectorX& x ) {
return iamax_impl< typename bindings::value_type<
VectorX >::type >::invoke( x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,230 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_NRM2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_NRM2_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline float nrm2( const int n, const float* x, const int incx ) {
return cblas_snrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline double nrm2( const int n, const double* x, const int incx ) {
return cblas_dnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline float nrm2( const int n, const std::complex<float>* x,
const int incx ) {
return cblas_scnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline double nrm2( const int n, const std::complex<double>* x,
const int incx ) {
return cblas_dznrm2( n, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline float nrm2( const int n, const float* x, const int incx ) {
return cublasSnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline double nrm2( const int n, const double* x, const int incx ) {
return cublasDnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline float nrm2( const int n, const std::complex<float>* x,
const int incx ) {
return cublasScnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline double nrm2( const int n, const std::complex<double>* x,
const int incx ) {
return cublasDznrm2( n, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline float nrm2( const fortran_int_t n, const float* x,
const fortran_int_t incx ) {
return BLAS_SNRM2( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline double nrm2( const fortran_int_t n, const double* x,
const fortran_int_t incx ) {
return BLAS_DNRM2( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline float nrm2( const fortran_int_t n, const std::complex<float>* x,
const fortran_int_t incx ) {
return BLAS_SCNRM2( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline double nrm2( const fortran_int_t n, const std::complex<double>* x,
const fortran_int_t incx ) {
return BLAS_DZNRM2( &n, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to nrm2.
//
template< typename Value >
struct nrm2_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef real_type result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX >
static result_type invoke( const VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
return detail::nrm2( bindings::size(x),
bindings::begin_value(x), bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the nrm2_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for nrm2. Its overload differs for
//
template< typename VectorX >
inline typename nrm2_impl< typename bindings::value_type<
VectorX >::type >::result_type
nrm2( const VectorX& x ) {
return nrm2_impl< typename bindings::value_type<
VectorX >::type >::invoke( x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,150 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_PREC_DOT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_PREC_DOT_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline double prec_dot( const int n, const float* x, const int incx,
const float* y, const int incy ) {
return cblas_dsdot( n, x, incx, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline double prec_dot( const int n, const float* x, const int incx,
const float* y, const int incy ) {
return // NOT FOUND();
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline double prec_dot( const fortran_int_t n, const float* x,
const fortran_int_t incx, const float* y, const fortran_int_t incy ) {
return BLAS_DSDOT( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to prec_dot.
//
template< typename Value >
struct prec_dot_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef double result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY >
static result_type invoke( const VectorX& x, const VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
return detail::prec_dot( bindings::size(x),
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(y), bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the prec_dot_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for prec_dot. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename prec_dot_impl< typename bindings::value_type<
VectorX >::type >::result_type
prec_dot( const VectorX& x, const VectorY& y ) {
return prec_dot_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,250 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROT_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline void rot( const int n, float* x, const int incx, float* y,
const int incy, const float c, const float s ) {
cblas_srot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void rot( const int n, double* x, const int incx, double* y,
const int incy, const double c, const double s ) {
cblas_drot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void rot( const int n, std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy, const float c,
const float s ) {
// NOT FOUND();
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void rot( const int n, std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy, const double c,
const double s ) {
// NOT FOUND();
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void rot( const int n, float* x, const int incx, float* y,
const int incy, const float c, const float s ) {
cublasSrot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void rot( const int n, double* x, const int incx, double* y,
const int incy, const double c, const double s ) {
cublasDrot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void rot( const int n, std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy, const float c,
const float s ) {
cublasCsrot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void rot( const int n, std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy, const double c,
const double s ) {
cublasZdrot( n, x, incx, y, incy, c, s );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void rot( const fortran_int_t n, float* x, const fortran_int_t incx,
float* y, const fortran_int_t incy, const float c, const float s ) {
BLAS_SROT( &n, x, &incx, y, &incy, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void rot( const fortran_int_t n, double* x, const fortran_int_t incx,
double* y, const fortran_int_t incy, const double c, const double s ) {
BLAS_DROT( &n, x, &incx, y, &incy, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void rot( const fortran_int_t n, std::complex<float>* x,
const fortran_int_t incx, std::complex<float>* y,
const fortran_int_t incy, const float c, const float s ) {
BLAS_CSROT( &n, x, &incx, y, &incy, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void rot( const fortran_int_t n, std::complex<double>* x,
const fortran_int_t incx, std::complex<double>* y,
const fortran_int_t incy, const double c, const double s ) {
BLAS_ZDROT( &n, x, &incx, y, &incy, &c, &s );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to rot.
//
template< typename Value >
struct rot_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY >
static result_type invoke( VectorX& x, VectorY& y, const real_type c,
const real_type s ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
detail::rot( bindings::size(x), bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y), c, s );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the rot_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for rot. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename rot_impl< typename bindings::value_type<
VectorX >::type >::result_type
rot( VectorX& x, VectorY& y, const typename remove_imaginary<
typename bindings::value_type< VectorX >::type >::type c,
const typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type s ) {
rot_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y, c, s );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,223 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTG_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTG_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline void rotg( float& a, float& b, float& c, float& s ) {
cblas_srotg( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void rotg( double& a, double& b, double& c, double& s ) {
cblas_drotg( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void rotg( std::complex<float>& a, std::complex<float>& b, float& c,
std::complex<float>& s ) {
// NOT FOUND();
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void rotg( std::complex<double>& a, std::complex<double>& b, double& c,
std::complex<double>& s ) {
// NOT FOUND();
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void rotg( float& a, float& b, float& c, float& s ) {
cublasSrotg( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void rotg( double& a, double& b, double& c, double& s ) {
cublasDrotg( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void rotg( std::complex<float>& a, std::complex<float>& b, float& c,
std::complex<float>& s ) {
cublasCrotg( &a, b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void rotg( std::complex<double>& a, std::complex<double>& b, double& c,
std::complex<double>& s ) {
cublasZrotg( &a, b, &c, &s );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void rotg( float& a, float& b, float& c, float& s ) {
BLAS_SROTG( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void rotg( double& a, double& b, double& c, double& s ) {
BLAS_DROTG( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void rotg( std::complex<float>& a, std::complex<float>& b, float& c,
std::complex<float>& s ) {
BLAS_CROTG( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void rotg( std::complex<double>& a, std::complex<double>& b, double& c,
std::complex<double>& s ) {
BLAS_ZROTG( &a, &b, &c, &s );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to rotg.
//
template< typename Value >
struct rotg_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
static result_type invoke( value_type& a, value_type& b, real_type& c,
value_type& s ) {
namespace bindings = ::boost::numeric::bindings;
detail::rotg( a, b, c, s );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the rotg_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for rotg. Its overload differs for
//
template< typename Value >
inline typename rotg_impl< Value >::result_type
rotg( Value& a, Value& b, Value& c, Value& s ) {
rotg_impl< Value >::invoke( a, b, c, s );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,187 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline void rotm( const int n, float* x, const int incx, float* y,
const int incy, float* param ) {
cblas_srotm( n, x, incx, y, incy, param );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void rotm( const int n, double* x, const int incx, double* y,
const int incy, double* param ) {
cblas_drotm( n, x, incx, y, incy, param );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void rotm( const int n, float* x, const int incx, float* y,
const int incy, float* param ) {
cublasSrotm( n, x, incx, y, incy, param );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void rotm( const int n, double* x, const int incx, double* y,
const int incy, double* param ) {
cublasDrotm( n, x, incx, y, incy, param );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void rotm( const fortran_int_t n, float* x, const fortran_int_t incx,
float* y, const fortran_int_t incy, float* param ) {
BLAS_SROTM( &n, x, &incx, y, &incy, param );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void rotm( const fortran_int_t n, double* x, const fortran_int_t incx,
double* y, const fortran_int_t incy, double* param ) {
BLAS_DROTM( &n, x, &incx, y, &incy, param );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to rotm.
//
template< typename Value >
struct rotm_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename VectorPARAM >
static result_type invoke( VectorX& x, VectorY& y, VectorPARAM& param ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorPARAM >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorPARAM >::value) );
detail::rotm( bindings::size(x), bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y), bindings::begin_value(param) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the rotm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for rotm. Its overload differs for
//
template< typename VectorX, typename VectorY, typename VectorPARAM >
inline typename rotm_impl< typename bindings::value_type<
VectorX >::type >::result_type
rotm( VectorX& x, VectorY& y, VectorPARAM& param ) {
rotm_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y, param );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,179 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTMG_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTMG_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline void rotmg( float& d1, float& d2, float& x1, const float y1,
float* sparam ) {
cblas_srotmg( &d1, &d2, &x1, y1, sparam );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void rotmg( double& d1, double& d2, double& x1, const double y1,
double* dparam ) {
cblas_drotmg( &d1, &d2, &x1, y1, dparam );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void rotmg( float& d1, float& d2, float& x1, const float y1,
float* sparam ) {
cublasSrotmg( &d1, &d2, &x1, &y1, sparam );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void rotmg( double& d1, double& d2, double& x1, const double y1,
double* dparam ) {
cublasDrotmg( &d1, &d2, &x1, &y1, dparam );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void rotmg( float& d1, float& d2, float& x1, const float y1,
float* sparam ) {
BLAS_SROTMG( &d1, &d2, &x1, &y1, sparam );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void rotmg( double& d1, double& d2, double& x1, const double y1,
double* dparam ) {
BLAS_DROTMG( &d1, &d2, &x1, &y1, dparam );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to rotmg.
//
template< typename Value >
struct rotmg_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorDPARAM >
static result_type invoke( real_type& d1, real_type& d2, real_type& x1,
const real_type y1, VectorDPARAM& dparam ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorDPARAM >::value) );
detail::rotmg( d1, d2, x1, y1, bindings::begin_value(dparam) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the rotmg_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for rotmg. Its overload differs for
//
template< typename VectorDPARAM >
inline typename rotmg_impl< typename bindings::value_type<
VectorDPARAM >::type >::result_type
rotmg( typename remove_imaginary< typename bindings::value_type<
VectorDPARAM >::type >::type& d1, typename remove_imaginary<
typename bindings::value_type< VectorDPARAM >::type >::type& d2,
typename remove_imaginary< typename bindings::value_type<
VectorDPARAM >::type >::type& x1, const typename remove_imaginary<
typename bindings::value_type< VectorDPARAM >::type >::type y1,
VectorDPARAM& dparam ) {
rotmg_impl< typename bindings::value_type<
VectorDPARAM >::type >::invoke( d1, d2, x1, y1, dparam );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,291 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SCAL_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SCAL_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline void scal( const int n, const float a, float* x, const int incx ) {
cblas_sscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void scal( const int n, const double a, double* x, const int incx ) {
cblas_dscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * combined float and complex<float> value-type.
//
inline void scal( const int n, const float a, std::complex<float>* x,
const int incx ) {
cblas_csscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * combined double and complex<double> value-type.
//
inline void scal( const int n, const double a, std::complex<double>* x,
const int incx ) {
cblas_zdscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void scal( const int n, const std::complex<float> a,
std::complex<float>* x, const int incx ) {
cblas_cscal( n, &a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void scal( const int n, const std::complex<double> a,
std::complex<double>* x, const int incx ) {
cblas_zscal( n, &a, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void scal( const int n, const float a, float* x, const int incx ) {
cublasSscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void scal( const int n, const double a, double* x, const int incx ) {
cublasDscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * combined float and complex<float> value-type.
//
inline void scal( const int n, const float a, std::complex<float>* x,
const int incx ) {
cublasCsscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * combined double and complex<double> value-type.
//
inline void scal( const int n, const double a, std::complex<double>* x,
const int incx ) {
cublasZdscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void scal( const int n, const std::complex<float> a,
std::complex<float>* x, const int incx ) {
cublasCscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void scal( const int n, const std::complex<double> a,
std::complex<double>* x, const int incx ) {
cublasZscal( n, a, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void scal( const fortran_int_t n, const float a, float* x,
const fortran_int_t incx ) {
BLAS_SSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void scal( const fortran_int_t n, const double a, double* x,
const fortran_int_t incx ) {
BLAS_DSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * combined float and complex<float> value-type.
//
inline void scal( const fortran_int_t n, const float a,
std::complex<float>* x, const fortran_int_t incx ) {
BLAS_CSSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * combined double and complex<double> value-type.
//
inline void scal( const fortran_int_t n, const double a,
std::complex<double>* x, const fortran_int_t incx ) {
BLAS_ZDSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void scal( const fortran_int_t n, const std::complex<float> a,
std::complex<float>* x, const fortran_int_t incx ) {
BLAS_CSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void scal( const fortran_int_t n, const std::complex<double> a,
std::complex<double>* x, const fortran_int_t incx ) {
BLAS_ZSCAL( &n, &a, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to scal.
//
template< typename Value >
struct scal_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename ScalarA, typename VectorX >
static result_type invoke( const ScalarA a, VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
detail::scal( bindings::size(x), a, bindings::begin_value(x),
bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the scal_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for scal. Its overload differs for
//
template< typename ScalarA, typename VectorX >
inline typename scal_impl< typename bindings::value_type<
VectorX >::type >::result_type
scal( const ScalarA a, VectorX& x ) {
scal_impl< typename bindings::value_type<
VectorX >::type >::invoke( a, x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,62 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SET_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SET_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/end.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// set is an extension, not part of the BLAS API.
//
// TODO implement ATLAS backend call(s)
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access.
//
//
// Overloaded function for set. Its overload differs for
// * VectorX&
//
template< typename VectorX >
inline void
set( const typename bindings::value_type< VectorX >::type a, VectorX& x ) {
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
std::fill( bindings::begin(x), bindings::end(x), a );
}
//
// Overloaded function for set. Its overload differs for
// * const VectorX&
//
template< typename VectorX >
inline void
set( const typename bindings::value_type< const VectorX >::type a, const VectorX& x ) {
BOOST_STATIC_ASSERT( (bindings::is_mutable< const VectorX >::value) );
std::fill( bindings::begin(x), bindings::end(x), a );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,244 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SWAP_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SWAP_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
inline void swap( const int n, float* x, const int incx, float* y,
const int incy ) {
cblas_sswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void swap( const int n, double* x, const int incx, double* y,
const int incy ) {
cblas_dswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void swap( const int n, std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy ) {
cblas_cswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void swap( const int n, std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cblas_zswap( n, x, incx, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void swap( const int n, float* x, const int incx, float* y,
const int incy ) {
cublasSswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void swap( const int n, double* x, const int incx, double* y,
const int incy ) {
cublasDswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void swap( const int n, std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy ) {
cublasCswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void swap( const int n, std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cublasZswap( n, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void swap( const fortran_int_t n, float* x, const fortran_int_t incx,
float* y, const fortran_int_t incy ) {
BLAS_SSWAP( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void swap( const fortran_int_t n, double* x, const fortran_int_t incx,
double* y, const fortran_int_t incy ) {
BLAS_DSWAP( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void swap( const fortran_int_t n, std::complex<float>* x,
const fortran_int_t incx, std::complex<float>* y,
const fortran_int_t incy ) {
BLAS_CSWAP( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void swap( const fortran_int_t n, std::complex<double>* x,
const fortran_int_t incx, std::complex<double>* y,
const fortran_int_t incy ) {
BLAS_ZSWAP( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to swap.
//
template< typename Value >
struct swap_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY >
static result_type invoke( VectorX& x, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
detail::swap( bindings::size(x), bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the swap_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for swap. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename swap_impl< typename bindings::value_type<
VectorX >::type >::result_type
swap( VectorX& x, VectorY& y ) {
swap_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,38 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPP
#include <boost/numeric/bindings/blas/level2/gbmv.hpp>
#include <boost/numeric/bindings/blas/level2/gemv.hpp>
#include <boost/numeric/bindings/blas/level2/gerc.hpp>
#include <boost/numeric/bindings/blas/level2/ger.hpp>
#include <boost/numeric/bindings/blas/level2/geru.hpp>
#include <boost/numeric/bindings/blas/level2/hbmv.hpp>
#include <boost/numeric/bindings/blas/level2/hemv.hpp>
#include <boost/numeric/bindings/blas/level2/her2.hpp>
#include <boost/numeric/bindings/blas/level2/her.hpp>
#include <boost/numeric/bindings/blas/level2/hpmv.hpp>
#include <boost/numeric/bindings/blas/level2/hpr2.hpp>
#include <boost/numeric/bindings/blas/level2/hpr.hpp>
#include <boost/numeric/bindings/blas/level2/sbmv.hpp>
#include <boost/numeric/bindings/blas/level2/spmv.hpp>
#include <boost/numeric/bindings/blas/level2/spr2.hpp>
#include <boost/numeric/bindings/blas/level2/spr.hpp>
#include <boost/numeric/bindings/blas/level2/symv.hpp>
#include <boost/numeric/bindings/blas/level2/syr2.hpp>
#include <boost/numeric/bindings/blas/level2/syr.hpp>
#include <boost/numeric/bindings/blas/level2/tbmv.hpp>
#include <boost/numeric/bindings/blas/level2/tbsv.hpp>
#include <boost/numeric/bindings/blas/level2/tpmv.hpp>
#include <boost/numeric/bindings/blas/level2/tpsv.hpp>
#include <boost/numeric/bindings/blas/level2/trmv.hpp>
#include <boost/numeric/bindings/blas/level2/trsv.hpp>
#endif

View File

@@ -0,0 +1,332 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GBMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GBMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
#include <boost/numeric/bindings/has_band_array.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const int m, const int n,
const int kl, const int ku, const float alpha, const float* a,
const int lda, const float* x, const int incx, const float beta,
float* y, const int incy ) {
cblas_sgbmv( cblas_option< Order >::value, cblas_option< Trans >::value,
m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const int m, const int n,
const int kl, const int ku, const double alpha, const double* a,
const int lda, const double* x, const int incx, const double beta,
double* y, const int incy ) {
cblas_dgbmv( cblas_option< Order >::value, cblas_option< Trans >::value,
m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const int m, const int n,
const int kl, const int ku, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
cblas_cgbmv( cblas_option< Order >::value, cblas_option< Trans >::value,
m, n, kl, ku, &alpha, a, lda, x, incx, &beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const int m, const int n,
const int kl, const int ku, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
cblas_zgbmv( cblas_option< Order >::value, cblas_option< Trans >::value,
m, n, kl, ku, &alpha, a, lda, x, incx, &beta, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const int m, const int n,
const int kl, const int ku, const float alpha, const float* a,
const int lda, const float* x, const int incx, const float beta,
float* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSgbmv( blas_option< Trans >::value, m, n, kl, ku, alpha, a, lda, x,
incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const int m, const int n,
const int kl, const int ku, const double alpha, const double* a,
const int lda, const double* x, const int incx, const double beta,
double* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDgbmv( blas_option< Trans >::value, m, n, kl, ku, alpha, a, lda, x,
incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const int m, const int n,
const int kl, const int ku, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCgbmv( blas_option< Trans >::value, m, n, kl, ku, alpha, a, lda, x,
incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const int m, const int n,
const int kl, const int ku, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZgbmv( blas_option< Trans >::value, m, n, kl, ku, alpha, a, lda, x,
incx, beta, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const fortran_int_t m,
const fortran_int_t n, const fortran_int_t kl, const fortran_int_t ku,
const float alpha, const float* a, const fortran_int_t lda,
const float* x, const fortran_int_t incx, const float beta, float* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SGBMV( &blas_option< Trans >::value, &m, &n, &kl, &ku, &alpha, a,
&lda, x, &incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const fortran_int_t m,
const fortran_int_t n, const fortran_int_t kl, const fortran_int_t ku,
const double alpha, const double* a, const fortran_int_t lda,
const double* x, const fortran_int_t incx, const double beta,
double* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DGBMV( &blas_option< Trans >::value, &m, &n, &kl, &ku, &alpha, a,
&lda, x, &incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const fortran_int_t m,
const fortran_int_t n, const fortran_int_t kl, const fortran_int_t ku,
const std::complex<float> alpha, const std::complex<float>* a,
const fortran_int_t lda, const std::complex<float>* x,
const fortran_int_t incx, const std::complex<float> beta,
std::complex<float>* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CGBMV( &blas_option< Trans >::value, &m, &n, &kl, &ku, &alpha, a,
&lda, x, &incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Trans >
inline void gbmv( const Order, const Trans, const fortran_int_t m,
const fortran_int_t n, const fortran_int_t kl, const fortran_int_t ku,
const std::complex<double> alpha, const std::complex<double>* a,
const fortran_int_t lda, const std::complex<double>* x,
const fortran_int_t incx, const std::complex<double> beta,
std::complex<double>* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZGBMV( &blas_option< Trans >::value, &m, &n, &kl, &ku, &alpha, a,
&lda, x, &incx, &beta, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to gbmv.
//
template< typename Value >
struct gbmv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX, typename VectorY >
static result_type invoke( const value_type alpha, const MatrixA& a,
const VectorX& x, const value_type beta, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename detail::default_order< MatrixA >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::gbmv( order(), trans(), bindings::size_row_op(a,
trans()), bindings::size_column_op(a, trans()),
bindings::bandwidth_lower_op(a, trans()),
bindings::bandwidth_upper_op(a, trans()), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), bindings::stride(x), beta,
bindings::begin_value(y), bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the gbmv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for gbmv. Its overload differs for
//
template< typename MatrixA, typename VectorX, typename VectorY >
inline typename gbmv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
gbmv( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const VectorX& x,
const typename bindings::value_type< MatrixA >::type beta,
VectorY& y ) {
gbmv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, x, beta, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,325 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GEMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GEMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const int m, const int n,
const float alpha, const float* a, const int lda, const float* x,
const int incx, const float beta, float* y, const int incy ) {
cblas_sgemv( cblas_option< Order >::value, cblas_option< Trans >::value,
m, n, alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const int m, const int n,
const double alpha, const double* a, const int lda, const double* x,
const int incx, const double beta, double* y, const int incy ) {
cblas_dgemv( cblas_option< Order >::value, cblas_option< Trans >::value,
m, n, alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const int m, const int n,
const std::complex<float> alpha, const std::complex<float>* a,
const int lda, const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
cblas_cgemv( cblas_option< Order >::value, cblas_option< Trans >::value,
m, n, &alpha, a, lda, x, incx, &beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
cblas_zgemv( cblas_option< Order >::value, cblas_option< Trans >::value,
m, n, &alpha, a, lda, x, incx, &beta, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const int m, const int n,
const float alpha, const float* a, const int lda, const float* x,
const int incx, const float beta, float* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSgemv( blas_option< Trans >::value, m, n, alpha, a, lda, x, incx,
beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const int m, const int n,
const double alpha, const double* a, const int lda, const double* x,
const int incx, const double beta, double* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDgemv( blas_option< Trans >::value, m, n, alpha, a, lda, x, incx,
beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const int m, const int n,
const std::complex<float> alpha, const std::complex<float>* a,
const int lda, const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCgemv( blas_option< Trans >::value, m, n, alpha, a, lda, x, incx,
beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZgemv( blas_option< Trans >::value, m, n, alpha, a, lda, x, incx,
beta, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const fortran_int_t m,
const fortran_int_t n, const float alpha, const float* a,
const fortran_int_t lda, const float* x, const fortran_int_t incx,
const float beta, float* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SGEMV( &blas_option< Trans >::value, &m, &n, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const fortran_int_t m,
const fortran_int_t n, const double alpha, const double* a,
const fortran_int_t lda, const double* x, const fortran_int_t incx,
const double beta, double* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DGEMV( &blas_option< Trans >::value, &m, &n, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const fortran_int_t m,
const fortran_int_t n, const std::complex<float> alpha,
const std::complex<float>* a, const fortran_int_t lda,
const std::complex<float>* x, const fortran_int_t incx,
const std::complex<float> beta, std::complex<float>* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CGEMV( &blas_option< Trans >::value, &m, &n, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Trans >
inline void gemv( const Order, const Trans, const fortran_int_t m,
const fortran_int_t n, const std::complex<double> alpha,
const std::complex<double>* a, const fortran_int_t lda,
const std::complex<double>* x, const fortran_int_t incx,
const std::complex<double> beta, std::complex<double>* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZGEMV( &blas_option< Trans >::value, &m, &n, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to gemv.
//
template< typename Value >
struct gemv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
// high-level transform typedefs and functions
template< typename MatrixA, typename VectorX, typename VectorY >
static result_type transform( MatrixA& A, VectorX& x, VectorY& y,
const value_type alpha, const value_type beta ) {
invoke();
}
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX, typename VectorY >
static result_type invoke( const value_type alpha, const MatrixA& a,
const VectorX& x, const value_type beta, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename detail::default_order< MatrixA >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::gemv( order(), trans(), bindings::size_row_op(a,
trans()), bindings::size_column_op(a, trans()), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), bindings::stride(x), beta,
bindings::begin_value(y), bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the gemv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for gemv. Its overload differs for
//
template< typename MatrixA, typename VectorX, typename VectorY >
inline typename gemv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
gemv( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const VectorX& x,
const typename bindings::value_type< MatrixA >::type beta,
VectorY& y ) {
gemv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, x, beta, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,215 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GER_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GER_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order >
inline void ger( const Order, const int m, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* a, const int lda ) {
cblas_sger( cblas_option< Order >::value, m, n, alpha, x, incx, y, incy,
a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order >
inline void ger( const Order, const int m, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* a, const int lda ) {
cblas_dger( cblas_option< Order >::value, m, n, alpha, x, incx, y, incy,
a, lda );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order >
inline void ger( const Order, const int m, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSger( m, n, alpha, x, incx, y, incy, a, lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order >
inline void ger( const Order, const int m, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDger( m, n, alpha, x, incx, y, incy, a, lda );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order >
inline void ger( const Order, const fortran_int_t m, const fortran_int_t n,
const float alpha, const float* x, const fortran_int_t incx,
const float* y, const fortran_int_t incy, float* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SGER( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order >
inline void ger( const Order, const fortran_int_t m, const fortran_int_t n,
const double alpha, const double* x, const fortran_int_t incx,
const double* y, const fortran_int_t incy, double* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DGER( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to ger.
//
template< typename Value >
struct ger_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename MatrixA >
static result_type invoke( const real_type alpha, const VectorX& x,
const VectorY& y, MatrixA& a ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixA >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::ger( order(), bindings::size_row(a),
bindings::size_column(a), alpha, bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y), bindings::begin_value(a),
bindings::stride_major(a) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the ger_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for ger. Its overload differs for
//
template< typename VectorX, typename VectorY, typename MatrixA >
inline typename ger_impl< typename bindings::value_type<
VectorX >::type >::result_type
ger( const typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type alpha, const VectorX& x, const VectorY& y,
MatrixA& a ) {
ger_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, y, a );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,220 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERC_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERC_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order >
inline void gerc( const Order, const int m, const int n,
const std::complex<float> alpha, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy,
std::complex<float>* a, const int lda ) {
cblas_cgerc( cblas_option< Order >::value, m, n, &alpha, x, incx, y, incy,
a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order >
inline void gerc( const Order, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy,
std::complex<double>* a, const int lda ) {
cblas_zgerc( cblas_option< Order >::value, m, n, &alpha, x, incx, y, incy,
a, lda );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order >
inline void gerc( const Order, const int m, const int n,
const std::complex<float> alpha, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy,
std::complex<float>* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCgerc( m, n, alpha, x, incx, y, incy, a, lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order >
inline void gerc( const Order, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy,
std::complex<double>* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZgerc( m, n, alpha, x, incx, y, incy, a, lda );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order >
inline void gerc( const Order, const fortran_int_t m, const fortran_int_t n,
const std::complex<float> alpha, const std::complex<float>* x,
const fortran_int_t incx, const std::complex<float>* y,
const fortran_int_t incy, std::complex<float>* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CGERC( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order >
inline void gerc( const Order, const fortran_int_t m, const fortran_int_t n,
const std::complex<double> alpha, const std::complex<double>* x,
const fortran_int_t incx, const std::complex<double>* y,
const fortran_int_t incy, std::complex<double>* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZGERC( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to gerc.
//
template< typename Value >
struct gerc_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename MatrixA >
static result_type invoke( const value_type alpha, const VectorX& x,
const VectorY& y, MatrixA& a ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixA >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::gerc( order(), bindings::size_row(a),
bindings::size_column(a), alpha, bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y), bindings::begin_value(a),
bindings::stride_major(a) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the gerc_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for gerc. Its overload differs for
//
template< typename VectorX, typename VectorY, typename MatrixA >
inline typename gerc_impl< typename bindings::value_type<
VectorX >::type >::result_type
gerc( const typename bindings::value_type< VectorX >::type alpha,
const VectorX& x, const VectorY& y, MatrixA& a ) {
gerc_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, y, a );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,220 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERU_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERU_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order >
inline void geru( const Order, const int m, const int n,
const std::complex<float> alpha, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy,
std::complex<float>* a, const int lda ) {
cblas_cgeru( cblas_option< Order >::value, m, n, &alpha, x, incx, y, incy,
a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order >
inline void geru( const Order, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy,
std::complex<double>* a, const int lda ) {
cblas_zgeru( cblas_option< Order >::value, m, n, &alpha, x, incx, y, incy,
a, lda );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order >
inline void geru( const Order, const int m, const int n,
const std::complex<float> alpha, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy,
std::complex<float>* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCgeru( m, n, alpha, x, incx, y, incy, a, lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order >
inline void geru( const Order, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy,
std::complex<double>* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZgeru( m, n, alpha, x, incx, y, incy, a, lda );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order >
inline void geru( const Order, const fortran_int_t m, const fortran_int_t n,
const std::complex<float> alpha, const std::complex<float>* x,
const fortran_int_t incx, const std::complex<float>* y,
const fortran_int_t incy, std::complex<float>* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CGERU( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order >
inline void geru( const Order, const fortran_int_t m, const fortran_int_t n,
const std::complex<double> alpha, const std::complex<double>* x,
const fortran_int_t incx, const std::complex<double>* y,
const fortran_int_t incy, std::complex<double>* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZGERU( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to geru.
//
template< typename Value >
struct geru_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename MatrixA >
static result_type invoke( const value_type alpha, const VectorX& x,
const VectorY& y, MatrixA& a ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixA >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::geru( order(), bindings::size_row(a),
bindings::size_column(a), alpha, bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y), bindings::begin_value(a),
bindings::stride_major(a) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the geru_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for geru. Its overload differs for
//
template< typename VectorX, typename VectorY, typename MatrixA >
inline typename geru_impl< typename bindings::value_type<
VectorX >::type >::result_type
geru( const typename bindings::value_type< VectorX >::type alpha,
const VectorX& x, const VectorY& y, MatrixA& a ) {
geru_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, y, a );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,320 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HBMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HBMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_band_array.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const int n, const int k,
const float alpha, const float* a, const int lda, const float* x,
const int incx, const float beta, float* y, const int incy ) {
cblas_ssbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
k, alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const int n, const int k,
const double alpha, const double* a, const int lda, const double* x,
const int incx, const double beta, double* y, const int incy ) {
cblas_dsbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
k, alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const int n, const int k,
const std::complex<float> alpha, const std::complex<float>* a,
const int lda, const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
cblas_chbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
k, &alpha, a, lda, x, incx, &beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const int n, const int k,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
cblas_zhbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
k, &alpha, a, lda, x, incx, &beta, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const int n, const int k,
const float alpha, const float* a, const int lda, const float* x,
const int incx, const float beta, float* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const int n, const int k,
const double alpha, const double* a, const int lda, const double* x,
const int incx, const double beta, double* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const int n, const int k,
const std::complex<float> alpha, const std::complex<float>* a,
const int lda, const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasChbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const int n, const int k,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZhbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
beta, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const fortran_int_t n,
const fortran_int_t k, const float alpha, const float* a,
const fortran_int_t lda, const float* x, const fortran_int_t incx,
const float beta, float* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const fortran_int_t n,
const fortran_int_t k, const double alpha, const double* a,
const fortran_int_t lda, const double* x, const fortran_int_t incx,
const double beta, double* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const fortran_int_t n,
const fortran_int_t k, const std::complex<float> alpha,
const std::complex<float>* a, const fortran_int_t lda,
const std::complex<float>* x, const fortran_int_t incx,
const std::complex<float> beta, std::complex<float>* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hbmv( const Order, const UpLo, const fortran_int_t n,
const fortran_int_t k, const std::complex<double> alpha,
const std::complex<double>* a, const fortran_int_t lda,
const std::complex<double>* x, const fortran_int_t incx,
const std::complex<double> beta, std::complex<double>* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to hbmv.
//
template< typename Value >
struct hbmv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX, typename VectorY >
static result_type invoke( const value_type alpha, const MatrixA& a,
const VectorX& x, const value_type beta, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::hbmv( order(), uplo(), bindings::size_column(a),
bindings::bandwidth_upper(a), alpha, bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(x),
bindings::stride(x), beta, bindings::begin_value(y),
bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the hbmv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for hbmv. Its overload differs for
//
template< typename MatrixA, typename VectorX, typename VectorY >
inline typename hbmv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
hbmv( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const VectorX& x,
const typename bindings::value_type< MatrixA >::type beta,
VectorY& y ) {
hbmv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, x, beta, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,315 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HEMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HEMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const int n, const float alpha,
const float* a, const int lda, const float* x, const int incx,
const float beta, float* y, const int incy ) {
cblas_ssymv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const int n, const double alpha,
const double* a, const int lda, const double* x, const int incx,
const double beta, double* y, const int incy ) {
cblas_dsymv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const int n,
const std::complex<float> alpha, const std::complex<float>* a,
const int lda, const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
cblas_chemv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
&alpha, a, lda, x, incx, &beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
cblas_zhemv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
&alpha, a, lda, x, incx, &beta, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const int n, const float alpha,
const float* a, const int lda, const float* x, const int incx,
const float beta, float* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsymv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const int n, const double alpha,
const double* a, const int lda, const double* x, const int incx,
const double beta, double* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsymv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const int n,
const std::complex<float> alpha, const std::complex<float>* a,
const int lda, const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasChemv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZhemv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* a, const fortran_int_t lda,
const float* x, const fortran_int_t incx, const float beta, float* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
&beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* a, const fortran_int_t lda,
const double* x, const fortran_int_t incx, const double beta,
double* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
&beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const fortran_int_t n,
const std::complex<float> alpha, const std::complex<float>* a,
const fortran_int_t lda, const std::complex<float>* x,
const fortran_int_t incx, const std::complex<float> beta,
std::complex<float>* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHEMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
&beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hemv( const Order, const UpLo, const fortran_int_t n,
const std::complex<double> alpha, const std::complex<double>* a,
const fortran_int_t lda, const std::complex<double>* x,
const fortran_int_t incx, const std::complex<double> beta,
std::complex<double>* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHEMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
&beta, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to hemv.
//
template< typename Value >
struct hemv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX, typename VectorY >
static result_type invoke( const value_type alpha, const MatrixA& a,
const VectorX& x, const value_type beta, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::hemv( order(), uplo(), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), bindings::stride(x), beta,
bindings::begin_value(y), bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the hemv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for hemv. Its overload differs for
//
template< typename MatrixA, typename VectorX, typename VectorY >
inline typename hemv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
hemv( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const VectorX& x,
const typename bindings::value_type< MatrixA >::type beta,
VectorY& y ) {
hemv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, x, beta, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,283 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, float* a, const int lda ) {
cblas_ssyr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, double* a, const int lda ) {
cblas_dsyr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const int n, const float alpha,
const std::complex<float>* x, const int incx, std::complex<float>* a,
const int lda ) {
cblas_cher( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const int n, const double alpha,
const std::complex<double>* x, const int incx,
std::complex<double>* a, const int lda ) {
cblas_zher( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, a, lda );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, float* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyr( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, double* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyr( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const int n, const float alpha,
const std::complex<float>* x, const int incx, std::complex<float>* a,
const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCher( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const int n, const double alpha,
const std::complex<double>* x, const int incx,
std::complex<double>* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZher( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* x, const fortran_int_t incx, float* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* x, const fortran_int_t incx,
double* a, const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const fortran_int_t n,
const float alpha, const std::complex<float>* x,
const fortran_int_t incx, std::complex<float>* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHER( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void her( const Order, const UpLo, const fortran_int_t n,
const double alpha, const std::complex<double>* x,
const fortran_int_t incx, std::complex<double>* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHER( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to her.
//
template< typename Value >
struct her_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename MatrixA >
static result_type invoke( const real_type alpha, const VectorX& x,
MatrixA& a ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixA >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::her( order(), uplo(), bindings::size_column(a), alpha,
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(a), bindings::stride_major(a) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the her_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for her. Its overload differs for
//
template< typename VectorX, typename MatrixA >
inline typename her_impl< typename bindings::value_type<
VectorX >::type >::result_type
her( const typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type alpha, const VectorX& x, MatrixA& a ) {
her_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, a );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,309 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER2_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* a, const int lda ) {
cblas_ssyr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, y, incy, a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* a, const int lda ) {
cblas_dsyr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, y, incy, a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const int n,
const std::complex<float> alpha, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy,
std::complex<float>* a, const int lda ) {
cblas_cher2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
&alpha, x, incx, y, incy, a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const int n,
const std::complex<double> alpha, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy,
std::complex<double>* a, const int lda ) {
cblas_zher2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
&alpha, x, incx, y, incy, a, lda );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const int n,
const std::complex<float> alpha, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy,
std::complex<float>* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCher2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const int n,
const std::complex<double> alpha, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy,
std::complex<double>* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZher2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
lda );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* x, const fortran_int_t incx,
const float* y, const fortran_int_t incy, float* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* x, const fortran_int_t incx,
const double* y, const fortran_int_t incy, double* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const fortran_int_t n,
const std::complex<float> alpha, const std::complex<float>* x,
const fortran_int_t incx, const std::complex<float>* y,
const fortran_int_t incy, std::complex<float>* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHER2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void her2( const Order, const UpLo, const fortran_int_t n,
const std::complex<double> alpha, const std::complex<double>* x,
const fortran_int_t incx, const std::complex<double>* y,
const fortran_int_t incy, std::complex<double>* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHER2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
a, &lda );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to her2.
//
template< typename Value >
struct her2_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename MatrixA >
static result_type invoke( const value_type alpha, const VectorX& x,
const VectorY& y, MatrixA& a ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixA >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::her2( order(), uplo(), bindings::size_column(a), alpha,
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(y), bindings::stride(y),
bindings::begin_value(a), bindings::stride_major(a) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the her2_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for her2. Its overload differs for
//
template< typename VectorX, typename VectorY, typename MatrixA >
inline typename her2_impl< typename bindings::value_type<
VectorX >::type >::result_type
her2( const typename bindings::value_type< VectorX >::type alpha,
const VectorX& x, const VectorY& y, MatrixA& a ) {
her2_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, y, a );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,315 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/has_triangular_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const int n, const float alpha,
const float* ap, const float* x, const int incx, const float beta,
float* y, const int incy ) {
cblas_sspmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, ap, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const int n, const double alpha,
const double* ap, const double* x, const int incx, const double beta,
double* y, const int incy ) {
cblas_dspmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, ap, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const int n,
const std::complex<float> alpha, const std::complex<float>* ap,
const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
cblas_chpmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
&alpha, ap, x, incx, &beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const int n,
const std::complex<double> alpha, const std::complex<double>* ap,
const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
cblas_zhpmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
&alpha, ap, x, incx, &beta, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const int n, const float alpha,
const float* ap, const float* x, const int incx, const float beta,
float* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSspmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const int n, const double alpha,
const double* ap, const double* x, const int incx, const double beta,
double* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDspmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const int n,
const std::complex<float> alpha, const std::complex<float>* ap,
const std::complex<float>* x, const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasChpmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const int n,
const std::complex<double> alpha, const std::complex<double>* ap,
const std::complex<double>* x, const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZhpmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* ap, const float* x,
const fortran_int_t incx, const float beta, float* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* ap, const double* x,
const fortran_int_t incx, const double beta, double* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const fortran_int_t n,
const std::complex<float> alpha, const std::complex<float>* ap,
const std::complex<float>* x, const fortran_int_t incx,
const std::complex<float> beta, std::complex<float>* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hpmv( const Order, const UpLo, const fortran_int_t n,
const std::complex<double> alpha, const std::complex<double>* ap,
const std::complex<double>* x, const fortran_int_t incx,
const std::complex<double> beta, std::complex<double>* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to hpmv.
//
template< typename Value >
struct hpmv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAP, typename VectorX, typename VectorY >
static result_type invoke( const value_type alpha, const MatrixAP& ap,
const VectorX& x, const value_type beta, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixAP >::type order;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixAP >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixAP >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
MatrixAP >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
detail::hpmv( order(), uplo(), bindings::size_column(ap), alpha,
bindings::begin_value(ap), bindings::begin_value(x),
bindings::stride(x), beta, bindings::begin_value(y),
bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the hpmv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for hpmv. Its overload differs for
//
template< typename MatrixAP, typename VectorX, typename VectorY >
inline typename hpmv_impl< typename bindings::value_type<
MatrixAP >::type >::result_type
hpmv( const typename bindings::value_type< MatrixAP >::type alpha,
const MatrixAP& ap, const VectorX& x,
const typename bindings::value_type< MatrixAP >::type beta,
VectorY& y ) {
hpmv_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( alpha, ap, x, beta, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,281 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/has_triangular_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, float* ap ) {
cblas_sspr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, ap );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, double* ap ) {
cblas_dspr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, ap );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const int n, const float alpha,
const std::complex<float>* x, const int incx,
std::complex<float>* ap ) {
cblas_chpr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, ap );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const int n, const double alpha,
const std::complex<double>* x, const int incx,
std::complex<double>* ap ) {
cblas_zhpr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, ap );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, float* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSspr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, double* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDspr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const int n, const float alpha,
const std::complex<float>* x, const int incx,
std::complex<float>* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasChpr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const int n, const double alpha,
const std::complex<double>* x, const int incx,
std::complex<double>* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZhpr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* x, const fortran_int_t incx,
float* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* x, const fortran_int_t incx,
double* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const fortran_int_t n,
const float alpha, const std::complex<float>* x,
const fortran_int_t incx, std::complex<float>* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hpr( const Order, const UpLo, const fortran_int_t n,
const double alpha, const std::complex<double>* x,
const fortran_int_t incx, std::complex<double>* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to hpr.
//
template< typename Value >
struct hpr_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename MatrixAP >
static result_type invoke( const real_type alpha, const VectorX& x,
MatrixAP& ap ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixAP >::type order;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixAP >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
MatrixAP >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
detail::hpr( order(), uplo(), bindings::size_column(ap), alpha,
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(ap) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the hpr_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for hpr. Its overload differs for
//
template< typename VectorX, typename MatrixAP >
inline typename hpr_impl< typename bindings::value_type<
VectorX >::type >::result_type
hpr( const typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type alpha, const VectorX& x, MatrixAP& ap ) {
hpr_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, ap );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,301 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR2_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/has_triangular_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* ap ) {
cblas_sspr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, y, incy, ap );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* ap ) {
cblas_dspr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, y, incy, ap );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const int n,
const std::complex<float> alpha, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy,
std::complex<float>* ap ) {
cblas_chpr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
&alpha, x, incx, y, incy, ap );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const int n,
const std::complex<double> alpha, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy,
std::complex<double>* ap ) {
cblas_zhpr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
&alpha, x, incx, y, incy, ap );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSspr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDspr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const int n,
const std::complex<float> alpha, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy,
std::complex<float>* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasChpr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const int n,
const std::complex<double> alpha, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy,
std::complex<double>* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZhpr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* x, const fortran_int_t incx,
const float* y, const fortran_int_t incy, float* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
ap );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* x, const fortran_int_t incx,
const double* y, const fortran_int_t incy, double* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
ap );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const fortran_int_t n,
const std::complex<float> alpha, const std::complex<float>* x,
const fortran_int_t incx, const std::complex<float>* y,
const fortran_int_t incy, std::complex<float>* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
ap );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo >
inline void hpr2( const Order, const UpLo, const fortran_int_t n,
const std::complex<double> alpha, const std::complex<double>* x,
const fortran_int_t incx, const std::complex<double>* y,
const fortran_int_t incy, std::complex<double>* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
ap );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to hpr2.
//
template< typename Value >
struct hpr2_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename MatrixAP >
static result_type invoke( const value_type alpha, const VectorX& x,
const VectorY& y, MatrixAP& ap ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixAP >::type order;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixAP >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
MatrixAP >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
detail::hpr2( order(), uplo(), bindings::size_column(ap), alpha,
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(y), bindings::stride(y),
bindings::begin_value(ap) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the hpr2_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for hpr2. Its overload differs for
//
template< typename VectorX, typename VectorY, typename MatrixAP >
inline typename hpr2_impl< typename bindings::value_type<
VectorX >::type >::result_type
hpr2( const typename bindings::value_type< VectorX >::type alpha,
const VectorX& x, const VectorY& y, MatrixAP& ap ) {
hpr2_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, y, ap );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,224 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SBMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SBMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_band_array.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void sbmv( const Order, const UpLo, const int n, const int k,
const float alpha, const float* a, const int lda, const float* x,
const int incx, const float beta, float* y, const int incy ) {
cblas_ssbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
k, alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void sbmv( const Order, const UpLo, const int n, const int k,
const double alpha, const double* a, const int lda, const double* x,
const int incx, const double beta, double* y, const int incy ) {
cblas_dsbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
k, alpha, a, lda, x, incx, beta, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void sbmv( const Order, const UpLo, const int n, const int k,
const float alpha, const float* a, const int lda, const float* x,
const int incx, const float beta, float* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void sbmv( const Order, const UpLo, const int n, const int k,
const double alpha, const double* a, const int lda, const double* x,
const int incx, const double beta, double* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
beta, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void sbmv( const Order, const UpLo, const fortran_int_t n,
const fortran_int_t k, const float alpha, const float* a,
const fortran_int_t lda, const float* x, const fortran_int_t incx,
const float beta, float* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void sbmv( const Order, const UpLo, const fortran_int_t n,
const fortran_int_t k, const double alpha, const double* a,
const fortran_int_t lda, const double* x, const fortran_int_t incx,
const double beta, double* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
&incx, &beta, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to sbmv.
//
template< typename Value >
struct sbmv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX, typename VectorY >
static result_type invoke( const real_type alpha, const MatrixA& a,
const VectorX& x, const real_type beta, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::sbmv( order(), uplo(), bindings::size_column(a),
bindings::bandwidth_upper(a), alpha, bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(x),
bindings::stride(x), beta, bindings::begin_value(y),
bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the sbmv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for sbmv. Its overload differs for
//
template< typename MatrixA, typename VectorX, typename VectorY >
inline typename sbmv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
sbmv( const typename remove_imaginary< typename bindings::value_type<
MatrixA >::type >::type alpha, const MatrixA& a, const VectorX& x,
const typename remove_imaginary< typename bindings::value_type<
MatrixA >::type >::type beta, VectorY& y ) {
sbmv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, x, beta, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,221 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/has_triangular_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void spmv( const Order, const UpLo, const int n, const float alpha,
const float* ap, const float* x, const int incx, const float beta,
float* y, const int incy ) {
cblas_sspmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, ap, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void spmv( const Order, const UpLo, const int n, const double alpha,
const double* ap, const double* x, const int incx, const double beta,
double* y, const int incy ) {
cblas_dspmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, ap, x, incx, beta, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void spmv( const Order, const UpLo, const int n, const float alpha,
const float* ap, const float* x, const int incx, const float beta,
float* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSspmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void spmv( const Order, const UpLo, const int n, const double alpha,
const double* ap, const double* x, const int incx, const double beta,
double* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDspmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void spmv( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* ap, const float* x,
const fortran_int_t incx, const float beta, float* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void spmv( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* ap, const double* x,
const fortran_int_t incx, const double beta, double* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to spmv.
//
template< typename Value >
struct spmv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAP, typename VectorX, typename VectorY >
static result_type invoke( const real_type alpha, const MatrixAP& ap,
const VectorX& x, const real_type beta, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixAP >::type order;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixAP >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixAP >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
MatrixAP >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
detail::spmv( order(), uplo(), bindings::size_column(ap), alpha,
bindings::begin_value(ap), bindings::begin_value(x),
bindings::stride(x), beta, bindings::begin_value(y),
bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the spmv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for spmv. Its overload differs for
//
template< typename MatrixAP, typename VectorX, typename VectorY >
inline typename spmv_impl< typename bindings::value_type<
MatrixAP >::type >::result_type
spmv( const typename remove_imaginary< typename bindings::value_type<
MatrixAP >::type >::type alpha, const MatrixAP& ap, const VectorX& x,
const typename remove_imaginary< typename bindings::value_type<
MatrixAP >::type >::type beta, VectorY& y ) {
spmv_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( alpha, ap, x, beta, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,203 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/has_triangular_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void spr( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, float* ap ) {
cblas_sspr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, ap );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void spr( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, double* ap ) {
cblas_dspr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, ap );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void spr( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, float* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSspr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void spr( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, double* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDspr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void spr( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* x, const fortran_int_t incx,
float* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void spr( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* x, const fortran_int_t incx,
double* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to spr.
//
template< typename Value >
struct spr_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename MatrixAP >
static result_type invoke( const real_type alpha, const VectorX& x,
MatrixAP& ap ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixAP >::type order;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixAP >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
MatrixAP >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
detail::spr( order(), uplo(), bindings::size_column(ap), alpha,
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(ap) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the spr_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for spr. Its overload differs for
//
template< typename VectorX, typename MatrixAP >
inline typename spr_impl< typename bindings::value_type<
VectorX >::type >::result_type
spr( const typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type alpha, const VectorX& x, MatrixAP& ap ) {
spr_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, ap );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,216 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR2_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/has_triangular_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void spr2( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* ap ) {
cblas_sspr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, y, incy, ap );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void spr2( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* ap ) {
cblas_dspr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, y, incy, ap );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void spr2( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSspr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void spr2( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDspr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void spr2( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* x, const fortran_int_t incx,
const float* y, const fortran_int_t incy, float* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
ap );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void spr2( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* x, const fortran_int_t incx,
const double* y, const fortran_int_t incy, double* ap ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
ap );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to spr2.
//
template< typename Value >
struct spr2_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename MatrixAP >
static result_type invoke( const real_type alpha, const VectorX& x,
const VectorY& y, MatrixAP& ap ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixAP >::type order;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixAP >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
MatrixAP >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
detail::spr2( order(), uplo(), bindings::size_column(ap), alpha,
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(y), bindings::stride(y),
bindings::begin_value(ap) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the spr2_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for spr2. Its overload differs for
//
template< typename VectorX, typename VectorY, typename MatrixAP >
inline typename spr2_impl< typename bindings::value_type<
VectorX >::type >::result_type
spr2( const typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type alpha, const VectorX& x, const VectorY& y,
MatrixAP& ap ) {
spr2_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, y, ap );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,221 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void symv( const Order, const UpLo, const int n, const float alpha,
const float* a, const int lda, const float* x, const int incx,
const float beta, float* y, const int incy ) {
cblas_ssymv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, a, lda, x, incx, beta, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void symv( const Order, const UpLo, const int n, const double alpha,
const double* a, const int lda, const double* x, const int incx,
const double beta, double* y, const int incy ) {
cblas_dsymv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, a, lda, x, incx, beta, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void symv( const Order, const UpLo, const int n, const float alpha,
const float* a, const int lda, const float* x, const int incx,
const float beta, float* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsymv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void symv( const Order, const UpLo, const int n, const double alpha,
const double* a, const int lda, const double* x, const int incx,
const double beta, double* y, const int incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsymv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void symv( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* a, const fortran_int_t lda,
const float* x, const fortran_int_t incx, const float beta, float* y,
const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
&beta, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void symv( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* a, const fortran_int_t lda,
const double* x, const fortran_int_t incx, const double beta,
double* y, const fortran_int_t incy ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
&beta, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to symv.
//
template< typename Value >
struct symv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX, typename VectorY >
static result_type invoke( const real_type alpha, const MatrixA& a,
const VectorX& x, const real_type beta, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::symv( order(), uplo(), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), bindings::stride(x), beta,
bindings::begin_value(y), bindings::stride(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the symv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for symv. Its overload differs for
//
template< typename MatrixA, typename VectorX, typename VectorY >
inline typename symv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
symv( const typename remove_imaginary< typename bindings::value_type<
MatrixA >::type >::type alpha, const MatrixA& a, const VectorX& x,
const typename remove_imaginary< typename bindings::value_type<
MatrixA >::type >::type beta, VectorY& y ) {
symv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, x, beta, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,203 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void syr( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, float* a, const int lda ) {
cblas_ssyr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void syr( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, double* a, const int lda ) {
cblas_dsyr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, a, lda );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void syr( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, float* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyr( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void syr( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, double* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyr( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void syr( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* x, const fortran_int_t incx, float* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void syr( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* x, const fortran_int_t incx,
double* a, const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to syr.
//
template< typename Value >
struct syr_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename MatrixA >
static result_type invoke( const real_type alpha, const VectorX& x,
MatrixA& a ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixA >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::syr( order(), uplo(), bindings::size_column(a), alpha,
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(a), bindings::stride_major(a) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the syr_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for syr. Its overload differs for
//
template< typename VectorX, typename MatrixA >
inline typename syr_impl< typename bindings::value_type<
VectorX >::type >::result_type
syr( const typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type alpha, const VectorX& x, MatrixA& a ) {
syr_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, a );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,220 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR2_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void syr2( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* a, const int lda ) {
cblas_ssyr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, y, incy, a, lda );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void syr2( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* a, const int lda ) {
cblas_dsyr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
alpha, x, incx, y, incy, a, lda );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void syr2( const Order, const UpLo, const int n, const float alpha,
const float* x, const int incx, const float* y, const int incy,
float* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
lda );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void syr2( const Order, const UpLo, const int n, const double alpha,
const double* x, const int incx, const double* y, const int incy,
double* a, const int lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
lda );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo >
inline void syr2( const Order, const UpLo, const fortran_int_t n,
const float alpha, const float* x, const fortran_int_t incx,
const float* y, const fortran_int_t incy, float* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
a, &lda );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo >
inline void syr2( const Order, const UpLo, const fortran_int_t n,
const double alpha, const double* x, const fortran_int_t incx,
const double* y, const fortran_int_t incy, double* a,
const fortran_int_t lda ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
a, &lda );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to syr2.
//
template< typename Value >
struct syr2_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename MatrixA >
static result_type invoke( const real_type alpha, const VectorX& x,
const VectorY& y, MatrixA& a ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixA >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::syr2( order(), uplo(), bindings::size_column(a), alpha,
bindings::begin_value(x), bindings::stride(x),
bindings::begin_value(y), bindings::stride(y),
bindings::begin_value(a), bindings::stride_major(a) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the syr2_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for syr2. Its overload differs for
//
template< typename VectorX, typename VectorY, typename MatrixA >
inline typename syr2_impl< typename bindings::value_type<
VectorX >::type >::result_type
syr2( const typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type alpha, const VectorX& x, const VectorY& y,
MatrixA& a ) {
syr2_impl< typename bindings::value_type<
VectorX >::type >::invoke( alpha, x, y, a );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,305 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/has_band_array.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const float* a, const int lda, float* x,
const int incx ) {
cblas_stbmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const double* a, const int lda, double* x,
const int incx ) {
cblas_dtbmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const std::complex<float>* a, const int lda,
std::complex<float>* x, const int incx ) {
cblas_ctbmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const std::complex<double>* a,
const int lda, std::complex<double>* x, const int incx ) {
cblas_ztbmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
a, lda, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const float* a, const int lda, float* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStbmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, k, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const double* a, const int lda, double* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtbmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, k, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const std::complex<float>* a, const int lda,
std::complex<float>* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtbmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, k, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const std::complex<double>* a,
const int lda, std::complex<double>* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtbmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, k, a, lda, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const fortran_int_t k, const float* a,
const fortran_int_t lda, float* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STBMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const fortran_int_t k, const double* a,
const fortran_int_t lda, double* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTBMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const fortran_int_t k,
const std::complex<float>* a, const fortran_int_t lda,
std::complex<float>* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTBMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const fortran_int_t k,
const std::complex<double>* a, const fortran_int_t lda,
std::complex<double>* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTBMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to tbmv.
//
template< typename Value >
struct tbmv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX >
static result_type invoke( const std::ptrdiff_t k, const MatrixA& a,
VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename detail::default_order< MatrixA >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
typedef typename result_of::diag_tag< MatrixA >::type diag;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::tbmv( order(), uplo(), trans(), diag(),
bindings::size_column_op(a, trans()), k,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the tbmv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for tbmv. Its overload differs for
//
template< typename MatrixA, typename VectorX >
inline typename tbmv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
tbmv( const std::ptrdiff_t k, const MatrixA& a, VectorX& x ) {
tbmv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( k, a, x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,305 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBSV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBSV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/has_band_array.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const float* a, const int lda, float* x,
const int incx ) {
cblas_stbsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const double* a, const int lda, double* x,
const int incx ) {
cblas_dtbsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const std::complex<float>* a, const int lda,
std::complex<float>* x, const int incx ) {
cblas_ctbsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const std::complex<double>* a,
const int lda, std::complex<double>* x, const int incx ) {
cblas_ztbsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
a, lda, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const float* a, const int lda, float* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStbsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, k, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const double* a, const int lda, double* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtbsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, k, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const std::complex<float>* a, const int lda,
std::complex<float>* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtbsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, k, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const int n, const int k, const std::complex<double>* a,
const int lda, std::complex<double>* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtbsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, k, a, lda, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const fortran_int_t k, const float* a,
const fortran_int_t lda, float* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STBSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const fortran_int_t k, const double* a,
const fortran_int_t lda, double* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTBSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const fortran_int_t k,
const std::complex<float>* a, const fortran_int_t lda,
std::complex<float>* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTBSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const fortran_int_t k,
const std::complex<double>* a, const fortran_int_t lda,
std::complex<double>* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTBSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to tbsv.
//
template< typename Value >
struct tbsv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX >
static result_type invoke( const std::ptrdiff_t k, const MatrixA& a,
VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename detail::default_order< MatrixA >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
typedef typename result_of::diag_tag< MatrixA >::type diag;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::tbsv( order(), uplo(), trans(), diag(),
bindings::size_column_op(a, trans()), k,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the tbsv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for tbsv. Its overload differs for
//
template< typename MatrixA, typename VectorX >
inline typename tbsv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
tbsv( const std::ptrdiff_t k, const MatrixA& a, VectorX& x ) {
tbsv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( k, a, x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,296 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/has_triangular_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const int n, const float* ap, float* x, const int incx ) {
cblas_stpmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const int n, const double* ap, double* x, const int incx ) {
cblas_dtpmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<float>* ap, std::complex<float>* x,
const int incx ) {
cblas_ctpmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<double>* ap, std::complex<double>* x,
const int incx ) {
cblas_ztpmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const int n, const float* ap, float* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStpmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, ap, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const int n, const double* ap, double* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtpmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, ap, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<float>* ap, std::complex<float>* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtpmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, ap, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<double>* ap, std::complex<double>* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtpmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, ap, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const float* ap, float* x,
const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STPMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, ap, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const double* ap, double* x,
const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTPMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, ap, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const std::complex<float>* ap,
std::complex<float>* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTPMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, ap, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const std::complex<double>* ap,
std::complex<double>* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTPMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, ap, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to tpmv.
//
template< typename Value >
struct tpmv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAP, typename VectorX >
static result_type invoke( const MatrixAP& ap, VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename detail::default_order< MatrixAP >::type order;
typedef typename result_of::trans_tag< MatrixAP, order >::type trans;
typedef typename result_of::uplo_tag< MatrixAP, trans >::type uplo;
typedef typename result_of::diag_tag< MatrixAP >::type diag;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixAP >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
MatrixAP >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
detail::tpmv( order(), uplo(), trans(), diag(),
bindings::size_column_op(ap, trans()),
bindings::begin_value(ap), bindings::begin_value(x),
bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the tpmv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for tpmv. Its overload differs for
//
template< typename MatrixAP, typename VectorX >
inline typename tpmv_impl< typename bindings::value_type<
MatrixAP >::type >::result_type
tpmv( const MatrixAP& ap, VectorX& x ) {
tpmv_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( ap, x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,296 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPSV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPSV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/has_triangular_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const int n, const float* ap, float* x, const int incx ) {
cblas_stpsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const int n, const double* ap, double* x, const int incx ) {
cblas_dtpsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<float>* ap, std::complex<float>* x,
const int incx ) {
cblas_ctpsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<double>* ap, std::complex<double>* x,
const int incx ) {
cblas_ztpsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const int n, const float* ap, float* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStpsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, ap, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const int n, const double* ap, double* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtpsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, ap, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<float>* ap, std::complex<float>* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtpsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, ap, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<double>* ap, std::complex<double>* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtpsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, ap, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const float* ap, float* x,
const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STPSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, ap, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const double* ap, double* x,
const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTPSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, ap, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const std::complex<float>* ap,
std::complex<float>* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTPSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, ap, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const std::complex<double>* ap,
std::complex<double>* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTPSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, ap, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to tpsv.
//
template< typename Value >
struct tpsv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAP, typename VectorX >
static result_type invoke( const MatrixAP& ap, VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename detail::default_order< MatrixAP >::type order;
typedef typename result_of::trans_tag< MatrixAP, order >::type trans;
typedef typename result_of::uplo_tag< MatrixAP, trans >::type uplo;
typedef typename result_of::diag_tag< MatrixAP >::type diag;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixAP >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
MatrixAP >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
detail::tpsv( order(), uplo(), trans(), diag(),
bindings::size_column_op(ap, trans()),
bindings::begin_value(ap), bindings::begin_value(x),
bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the tpsv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for tpsv. Its overload differs for
//
template< typename MatrixAP, typename VectorX >
inline typename tpsv_impl< typename bindings::value_type<
MatrixAP >::type >::result_type
tpsv( const MatrixAP& ap, VectorX& x ) {
tpsv_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( ap, x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,302 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRMV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const int n, const float* a, const int lda, float* x,
const int incx ) {
cblas_strmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const int n, const double* a, const int lda, double* x,
const int incx ) {
cblas_dtrmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<float>* a, const int lda,
std::complex<float>* x, const int incx ) {
cblas_ctrmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<double>* a, const int lda,
std::complex<double>* x, const int incx ) {
cblas_ztrmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
lda, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const int n, const float* a, const int lda, float* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStrmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const int n, const double* a, const int lda, double* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtrmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<float>* a, const int lda,
std::complex<float>* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtrmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<double>* a, const int lda,
std::complex<double>* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtrmv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, a, lda, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const float* a, const fortran_int_t lda,
float* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STRMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const double* a, const fortran_int_t lda,
double* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTRMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const std::complex<float>* a,
const fortran_int_t lda, std::complex<float>* x,
const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTRMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trmv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const std::complex<double>* a,
const fortran_int_t lda, std::complex<double>* x,
const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTRMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to trmv.
//
template< typename Value >
struct trmv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX >
static result_type invoke( const MatrixA& a, VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename detail::default_order< MatrixA >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
typedef typename result_of::diag_tag< MatrixA >::type diag;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::trmv( order(), uplo(), trans(), diag(),
bindings::size_column_op(a, trans()),
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the trmv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for trmv. Its overload differs for
//
template< typename MatrixA, typename VectorX >
inline typename trmv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
trmv( const MatrixA& a, VectorX& x ) {
trmv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( a, x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,302 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRSV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRSV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const int n, const float* a, const int lda, float* x,
const int incx ) {
cblas_strsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const int n, const double* a, const int lda, double* x,
const int incx ) {
cblas_dtrsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<float>* a, const int lda,
std::complex<float>* x, const int incx ) {
cblas_ctrsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<double>* a, const int lda,
std::complex<double>* x, const int incx ) {
cblas_ztrsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
lda, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const int n, const float* a, const int lda, float* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStrsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const int n, const double* a, const int lda, double* x,
const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtrsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<float>* a, const int lda,
std::complex<float>* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtrsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, a, lda, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const int n, const std::complex<double>* a, const int lda,
std::complex<double>* x, const int incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtrsv( blas_option< UpLo >::value, blas_option< Trans >::value,
blas_option< Diag >::value, n, a, lda, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const float* a, const fortran_int_t lda,
float* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STRSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const double* a, const fortran_int_t lda,
double* x, const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTRSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const std::complex<float>* a,
const fortran_int_t lda, std::complex<float>* x,
const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTRSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans, typename Diag >
inline void trsv( const Order, const UpLo, const Trans, const Diag,
const fortran_int_t n, const std::complex<double>* a,
const fortran_int_t lda, std::complex<double>* x,
const fortran_int_t incx ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTRSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to trsv.
//
template< typename Value >
struct trsv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX >
static result_type invoke( const MatrixA& a, VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename detail::default_order< MatrixA >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
typedef typename result_of::diag_tag< MatrixA >::type diag;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
detail::trsv( order(), uplo(), trans(), diag(),
bindings::size_column_op(a, trans()),
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), bindings::stride(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the trsv_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for trsv. Its overload differs for
//
template< typename MatrixA, typename VectorX >
inline typename trsv_impl< typename bindings::value_type<
MatrixA >::type >::result_type
trsv( const MatrixA& a, VectorX& x ) {
trsv_impl< typename bindings::value_type<
MatrixA >::type >::invoke( a, x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,22 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HPP
#include <boost/numeric/bindings/blas/level3/gemm.hpp>
#include <boost/numeric/bindings/blas/level3/hemm.hpp>
#include <boost/numeric/bindings/blas/level3/her2k.hpp>
#include <boost/numeric/bindings/blas/level3/herk.hpp>
#include <boost/numeric/bindings/blas/level3/symm.hpp>
#include <boost/numeric/bindings/blas/level3/syr2k.hpp>
#include <boost/numeric/bindings/blas/level3/syrk.hpp>
#include <boost/numeric/bindings/blas/level3/trmm.hpp>
#include <boost/numeric/bindings/blas/level3/trsm.hpp>
#endif

View File

@@ -0,0 +1,338 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_GEMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_GEMM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const float alpha, const float* a,
const int lda, const float* b, const int ldb, const float beta,
float* c, const int ldc ) {
cblas_sgemm( cblas_option< Order >::value, cblas_option< TransA >::value,
cblas_option< TransB >::value, m, n, k, alpha, a, lda, b, ldb,
beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const double alpha, const double* a,
const int lda, const double* b, const int ldb, const double beta,
double* c, const int ldc ) {
cblas_dgemm( cblas_option< Order >::value, cblas_option< TransA >::value,
cblas_option< TransB >::value, m, n, k, alpha, a, lda, b, ldb,
beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_cgemm( cblas_option< Order >::value, cblas_option< TransA >::value,
cblas_option< TransB >::value, m, n, k, &alpha, a, lda, b, ldb,
&beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zgemm( cblas_option< Order >::value, cblas_option< TransA >::value,
cblas_option< TransB >::value, m, n, k, &alpha, a, lda, b, ldb,
&beta, c, ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const float alpha, const float* a,
const int lda, const float* b, const int ldb, const float beta,
float* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSgemm( blas_option< TransA >::value, blas_option< TransB >::value,
m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const double alpha, const double* a,
const int lda, const double* b, const int ldb, const double beta,
double* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDgemm( blas_option< TransA >::value, blas_option< TransB >::value,
m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCgemm( blas_option< TransA >::value, blas_option< TransB >::value,
m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZgemm( blas_option< TransA >::value, blas_option< TransB >::value,
m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB,
const fortran_int_t m, const fortran_int_t n, const fortran_int_t k,
const float alpha, const float* a, const fortran_int_t lda,
const float* b, const fortran_int_t ldb, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SGEMM( &blas_option< TransA >::value, &blas_option< TransB >::value,
&m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB,
const fortran_int_t m, const fortran_int_t n, const fortran_int_t k,
const double alpha, const double* a, const fortran_int_t lda,
const double* b, const fortran_int_t ldb, const double beta,
double* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DGEMM( &blas_option< TransA >::value, &blas_option< TransB >::value,
&m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB,
const fortran_int_t m, const fortran_int_t n, const fortran_int_t k,
const std::complex<float> alpha, const std::complex<float>* a,
const fortran_int_t lda, const std::complex<float>* b,
const fortran_int_t ldb, const std::complex<float> beta,
std::complex<float>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CGEMM( &blas_option< TransA >::value, &blas_option< TransB >::value,
&m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB,
const fortran_int_t m, const fortran_int_t n, const fortran_int_t k,
const std::complex<double> alpha, const std::complex<double>* a,
const fortran_int_t lda, const std::complex<double>* b,
const fortran_int_t ldb, const std::complex<double> beta,
std::complex<double>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZGEMM( &blas_option< TransA >::value, &blas_option< TransB >::value,
&m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to gemm.
//
template< typename Value >
struct gemm_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename MatrixB, typename MatrixC >
static result_type invoke( const value_type alpha, const MatrixA& a,
const MatrixB& b, const value_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixC >::type order;
typedef typename result_of::trans_tag< MatrixB, order >::type transb;
typedef typename result_of::trans_tag< MatrixA, order >::type transa;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::gemm( order(), transa(), transb(),
bindings::size_row(c), bindings::size_column(c),
bindings::size_column(a), alpha, bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(b),
bindings::stride_major(b), beta, bindings::begin_value(c),
bindings::stride_major(c) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the gemm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for gemm. Its overload differs for
//
template< typename MatrixA, typename MatrixB, typename MatrixC >
inline typename gemm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
gemm( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const MatrixB& b,
const typename bindings::value_type< MatrixA >::type beta,
MatrixC& c ) {
gemm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,336 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HEMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HEMM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
cblas_ssymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, alpha, a, lda, b, ldb, beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
cblas_dsymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, alpha, a, lda, b, ldb, beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_chemm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zhemm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasChemm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZhemm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const float alpha, const float* a,
const fortran_int_t lda, const float* b, const fortran_int_t ldb,
const float beta, float* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const double alpha, const double* a,
const fortran_int_t lda, const double* b, const fortran_int_t ldb,
const double beta, double* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const std::complex<float> alpha,
const std::complex<float>* a, const fortran_int_t lda,
const std::complex<float>* b, const fortran_int_t ldb,
const std::complex<float> beta, std::complex<float>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHEMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const std::complex<double> alpha,
const std::complex<double>* a, const fortran_int_t lda,
const std::complex<double>* b, const fortran_int_t ldb,
const std::complex<double> beta, std::complex<double>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHEMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to hemm.
//
template< typename Value >
struct hemm_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename MatrixA, typename MatrixB,
typename MatrixC >
static result_type invoke( const Side side, const value_type alpha,
const MatrixA& a, const MatrixB& b, const value_type beta,
MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::hemm( order(), side, uplo(), bindings::size_row(c),
bindings::size_column(c), alpha, bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(b),
bindings::stride_major(b), beta, bindings::begin_value(c),
bindings::stride_major(c) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the hemm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for hemm. Its overload differs for
//
template< typename Side, typename MatrixA, typename MatrixB, typename MatrixC >
inline typename hemm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
hemm( const Side side, const typename bindings::value_type<
MatrixA >::type alpha, const MatrixA& a, const MatrixB& b,
const typename bindings::value_type< MatrixA >::type beta,
MatrixC& c ) {
hemm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( side, alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,334 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HER2K_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HER2K_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
cblas_ssyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
cblas_dsyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb, const float beta,
std::complex<float>* c, const int ldc ) {
cblas_cher2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb, const double beta,
std::complex<double>* c, const int ldc ) {
cblas_zher2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, b, ldb, beta,
c, ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb, const float beta,
std::complex<float>* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCher2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb, const double beta,
std::complex<double>* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZher2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k, const float alpha,
const float* a, const fortran_int_t lda, const float* b,
const fortran_int_t ldb, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k, const double alpha,
const double* a, const fortran_int_t lda, const double* b,
const fortran_int_t ldb, const double beta, double* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k,
const std::complex<float> alpha, const std::complex<float>* a,
const fortran_int_t lda, const std::complex<float>* b,
const fortran_int_t ldb, const float beta, std::complex<float>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHER2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k,
const std::complex<double> alpha, const std::complex<double>* a,
const fortran_int_t lda, const std::complex<double>* b,
const fortran_int_t ldb, const double beta, std::complex<double>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHER2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to her2k.
//
template< typename Value >
struct her2k_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename MatrixB, typename MatrixC >
static result_type invoke( const value_type alpha, const MatrixA& a,
const MatrixB& b, const real_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixB >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixC >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::her2k( order(), uplo(), trans(),
bindings::size_column(c), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(b), bindings::stride_major(b), beta,
bindings::begin_value(c), bindings::stride_major(c) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the her2k_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for her2k. Its overload differs for
//
template< typename MatrixA, typename MatrixB, typename MatrixC >
inline typename her2k_impl< typename bindings::value_type<
MatrixA >::type >::result_type
her2k( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const MatrixB& b, const typename remove_imaginary<
typename bindings::value_type< MatrixA >::type >::type beta,
MatrixC& c ) {
her2k_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,308 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HERK_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HERK_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float beta, float* c, const int ldc ) {
cblas_ssyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double beta, double* c, const int ldc ) {
cblas_dsyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const std::complex<float>* a,
const int lda, const float beta, std::complex<float>* c,
const int ldc ) {
cblas_cherk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const std::complex<double>* a,
const int lda, const double beta, std::complex<double>* c,
const int ldc ) {
cblas_zherk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float beta, float* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double beta, double* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const std::complex<float>* a,
const int lda, const float beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCherk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const std::complex<double>* a,
const int lda, const double beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZherk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const float alpha, const float* a,
const fortran_int_t lda, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const double alpha, const double* a,
const fortran_int_t lda, const double beta, double* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const float alpha,
const std::complex<float>* a, const fortran_int_t lda,
const float beta, std::complex<float>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHERK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const double alpha,
const std::complex<double>* a, const fortran_int_t lda,
const double beta, std::complex<double>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHERK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to herk.
//
template< typename Value >
struct herk_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename MatrixC >
static result_type invoke( const real_type alpha, const MatrixA& a,
const real_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixC >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixC >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::herk( order(), uplo(), trans(),
bindings::size_column(c), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a), beta,
bindings::begin_value(c), bindings::stride_major(c) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the herk_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for herk. Its overload differs for
//
template< typename MatrixA, typename MatrixC >
inline typename herk_impl< typename bindings::value_type<
MatrixA >::type >::result_type
herk( const typename remove_imaginary< typename bindings::value_type<
MatrixA >::type >::type alpha, const MatrixA& a,
const typename remove_imaginary< typename bindings::value_type<
MatrixA >::type >::type beta, MatrixC& c ) {
herk_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,336 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYMM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
cblas_ssymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, alpha, a, lda, b, ldb, beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
cblas_dsymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, alpha, a, lda, b, ldb, beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_csymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zsymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const float alpha, const float* a,
const fortran_int_t lda, const float* b, const fortran_int_t ldb,
const float beta, float* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const double alpha, const double* a,
const fortran_int_t lda, const double* b, const fortran_int_t ldb,
const double beta, double* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const std::complex<float> alpha,
const std::complex<float>* a, const fortran_int_t lda,
const std::complex<float>* b, const fortran_int_t ldb,
const std::complex<float> beta, std::complex<float>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const std::complex<double> alpha,
const std::complex<double>* a, const fortran_int_t lda,
const std::complex<double>* b, const fortran_int_t ldb,
const std::complex<double> beta, std::complex<double>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to symm.
//
template< typename Value >
struct symm_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename MatrixA, typename MatrixB,
typename MatrixC >
static result_type invoke( const Side side, const value_type alpha,
const MatrixA& a, const MatrixB& b, const value_type beta,
MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixA >::type order;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::symm( order(), side, uplo(), bindings::size_row(c),
bindings::size_column(c), alpha, bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(b),
bindings::stride_major(b), beta, bindings::begin_value(c),
bindings::stride_major(c) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the symm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for symm. Its overload differs for
//
template< typename Side, typename MatrixA, typename MatrixB, typename MatrixC >
inline typename symm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
symm( const Side side, const typename bindings::value_type<
MatrixA >::type alpha, const MatrixA& a, const MatrixB& b,
const typename bindings::value_type< MatrixA >::type beta,
MatrixC& c ) {
symm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( side, alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,338 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYR2K_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYR2K_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
cblas_ssyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
cblas_dsyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_csyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zsyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k, const float alpha,
const float* a, const fortran_int_t lda, const float* b,
const fortran_int_t ldb, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k, const double alpha,
const double* a, const fortran_int_t lda, const double* b,
const fortran_int_t ldb, const double beta, double* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k,
const std::complex<float> alpha, const std::complex<float>* a,
const fortran_int_t lda, const std::complex<float>* b,
const fortran_int_t ldb, const std::complex<float> beta,
std::complex<float>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k,
const std::complex<double> alpha, const std::complex<double>* a,
const fortran_int_t lda, const std::complex<double>* b,
const fortran_int_t ldb, const std::complex<double> beta,
std::complex<double>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to syr2k.
//
template< typename Value >
struct syr2k_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename MatrixB, typename MatrixC >
static result_type invoke( const value_type alpha, const MatrixA& a,
const MatrixB& b, const value_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixB >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixC >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::syr2k( order(), uplo(), trans(),
bindings::size_column(c), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(b), bindings::stride_major(b), beta,
bindings::begin_value(c), bindings::stride_major(c) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the syr2k_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for syr2k. Its overload differs for
//
template< typename MatrixA, typename MatrixB, typename MatrixC >
inline typename syr2k_impl< typename bindings::value_type<
MatrixA >::type >::result_type
syr2k( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const MatrixB& b,
const typename bindings::value_type< MatrixA >::type beta,
MatrixC& c ) {
syr2k_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,315 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYRK_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYRK_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float beta, float* c, const int ldc ) {
cblas_ssyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double beta, double* c, const int ldc ) {
cblas_dsyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_csyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, &beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zsyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, &beta, c,
ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float beta, float* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double beta, double* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const float alpha, const float* a,
const fortran_int_t lda, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const double alpha, const double* a,
const fortran_int_t lda, const double beta, double* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const std::complex<float> alpha,
const std::complex<float>* a, const fortran_int_t lda,
const std::complex<float> beta, std::complex<float>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const std::complex<double> alpha,
const std::complex<double>* a, const fortran_int_t lda,
const std::complex<double> beta, std::complex<double>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to syrk.
//
template< typename Value >
struct syrk_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename MatrixC >
static result_type invoke( const value_type alpha, const MatrixA& a,
const value_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixC >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixC >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::syrk( order(), uplo(), trans(),
bindings::size_column(c), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a), beta,
bindings::begin_value(c), bindings::stride_major(c) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the syrk_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for syrk. Its overload differs for
//
template< typename MatrixA, typename MatrixC >
inline typename syrk_impl< typename bindings::value_type<
MatrixA >::type >::result_type
syrk( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const typename bindings::value_type<
MatrixA >::type beta, MatrixC& c ) {
syrk_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,334 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRMM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const float alpha,
const float* a, const int lda, float* b, const int ldb ) {
cblas_strmm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const double alpha,
const double* a, const int lda, double* b, const int ldb ) {
cblas_dtrmm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda, std::complex<float>* b,
const int ldb ) {
cblas_ctrmm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, &alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, std::complex<double>* b, const int ldb ) {
cblas_ztrmm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, &alpha, a, lda, b, ldb );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const float alpha,
const float* a, const int lda, float* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStrmm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const double alpha,
const double* a, const int lda, double* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtrmm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda, std::complex<float>* b,
const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtrmm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, std::complex<double>* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtrmm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const float alpha, const float* a, const fortran_int_t lda, float* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STRMM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const double alpha, const double* a, const fortran_int_t lda,
double* b, const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTRMM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const std::complex<float> alpha, const std::complex<float>* a,
const fortran_int_t lda, std::complex<float>* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTRMM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const std::complex<double> alpha, const std::complex<double>* a,
const fortran_int_t lda, std::complex<double>* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTRMM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to trmm.
//
template< typename Value >
struct trmm_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename MatrixA, typename MatrixB >
static result_type invoke( const Side side, const value_type alpha,
const MatrixA& a, MatrixB& b ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixB >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type transa;
typedef typename result_of::uplo_tag< MatrixA, transa >::type uplo;
typedef typename result_of::diag_tag< MatrixA >::type diag;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
detail::trmm( order(), side, uplo(), transa(), diag(),
bindings::size_row(b), bindings::size_column(b), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(b), bindings::stride_major(b) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the trmm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for trmm. Its overload differs for
//
template< typename Side, typename MatrixA, typename MatrixB >
inline typename trmm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
trmm( const Side side, const typename bindings::value_type<
MatrixA >::type alpha, const MatrixA& a, MatrixB& b ) {
trmm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( side, alpha, a, b );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,334 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRSM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRSM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/trans_tag.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// 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
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end BLAS-routine.
//
namespace detail {
#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const float alpha,
const float* a, const int lda, float* b, const int ldb ) {
cblas_strsm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const double alpha,
const double* a, const int lda, double* b, const int ldb ) {
cblas_dtrsm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda, std::complex<float>* b,
const int ldb ) {
cblas_ctrsm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, &alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, std::complex<double>* b, const int ldb ) {
cblas_ztrsm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, &alpha, a, lda, b, ldb );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const float alpha,
const float* a, const int lda, float* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStrsm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const double alpha,
const double* a, const int lda, double* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtrsm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda, std::complex<float>* b,
const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtrsm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, std::complex<double>* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtrsm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const float alpha, const float* a, const fortran_int_t lda, float* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STRSM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const double alpha, const double* a, const fortran_int_t lda,
double* b, const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTRSM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const std::complex<float> alpha, const std::complex<float>* a,
const fortran_int_t lda, std::complex<float>* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTRSM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const std::complex<double> alpha, const std::complex<double>* a,
const fortran_int_t lda, std::complex<double>* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTRSM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to trsm.
//
template< typename Value >
struct trsm_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef void result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename MatrixA, typename MatrixB >
static result_type invoke( const Side side, const value_type alpha,
const MatrixA& a, MatrixB& b ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixB >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type transa;
typedef typename result_of::uplo_tag< MatrixA, transa >::type uplo;
typedef typename result_of::diag_tag< MatrixA >::type diag;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
detail::trsm( order(), side, uplo(), transa(), diag(),
bindings::size_row(b), bindings::size_column(b), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(b), bindings::stride_major(b) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. Calls
// to these functions are passed to the trsm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for trsm. Its overload differs for
//
template< typename Side, typename MatrixA, typename MatrixB >
inline typename trsm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
trsm( const Side side, const typename bindings::value_type<
MatrixA >::type alpha, const MatrixA& a, MatrixB& b ) {
trsm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( side, alpha, a, b );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,47 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BOOST_ARRAY_HPP
#define BOOST_NUMERIC_BINDINGS_BOOST_ARRAY_HPP
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/array.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, std::size_t N, typename Id, typename Enable >
struct adaptor< boost::array<T,N>, Id, Enable > {
typedef typename copy_const< Id, T >::type value_type;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::vector >,
mpl::pair< tag::size_type<1>, mpl::int_<N> >,
mpl::pair< tag::data_structure, tag::linear_array >,
mpl::pair< tag::stride_type<1>, tag::contiguous >
> property_map;
static value_type* begin_value( Id& t ) {
return t.begin();
}
static value_type* end_value( Id& t ) {
return t.end();
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,87 @@
//
// Copyright (c) 2010 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_BOOST_MULTI_ARRAY_HPP
#define BOOST_NUMERIC_BINDINGS_BOOST_MULTI_ARRAY_HPP
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/multi_array.hpp>
#include <boost/mpl/range_c.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename Map, typename AddressingIndex >
struct multi_array_dim_inserter {
typedef typename mpl::insert<
typename mpl::insert<
Map,
mpl::pair< tag::size_type< AddressingIndex::value >, std::ptrdiff_t >
>::type,
mpl::pair< tag::stride_type< AddressingIndex::value >, std::ptrdiff_t >
>::type type;
};
template< typename T, std::size_t Dim, typename Alloc, typename Id, typename Enable >
struct adaptor< boost::multi_array<T,Dim,Alloc>, Id, Enable > {
typedef typename copy_const< Id, T >::type value_type;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::tensor< Dim > >,
mpl::pair< tag::data_order, tag::row_major >,
mpl::pair< tag::data_structure, tag::linear_array >
> basic_map;
typedef typename mpl::fold<
mpl::range_c< std::size_t, 1, Dim+1 >,
basic_map,
multi_array_dim_inserter<
mpl::_1,
mpl::_2
>
>::type property_map;
// Sizes are only reachable if Addressing Index <= Dim, otherwise
// the default (1) will be returned
static std::ptrdiff_t size1( const Id& id ) {
return id.shape()[0];
}
static std::ptrdiff_t size2( const Id& id ) {
return id.shape()[1];
}
static std::ptrdiff_t stride1( const Id& id ) {
return id.strides()[0];
}
// Only reachable if dimension D is sufficient
static std::ptrdiff_t stride2( const Id& id ) {
return id.strides()[1];
}
static value_type* begin_value( Id& id ) {
return id.data();
}
static value_type* end_value( Id& id ) {
return id.data()+id.num_elements();
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,96 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_COLUMN_HPP
#define BOOST_NUMERIC_BINDINGS_COLUMN_HPP
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/end.hpp>
#include <boost/numeric/bindings/detail/adaptable_type.hpp>
#include <boost/numeric/bindings/detail/offset.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/ref.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T >
struct column_wrapper:
adaptable_type< column_wrapper<T> >,
reference_wrapper<T> {
column_wrapper( T& t, std::size_t index ):
reference_wrapper<T>(t),
m_index( index ) {}
std::size_t m_index;
};
template< typename T, typename Id, typename Enable >
struct adaptor< column_wrapper<T>, Id, Enable > {
typedef typename bindings::value_type< T>::type value_type;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::vector >,
mpl::pair< tag::size_type<1>, typename result_of::size1<T>::type >,
mpl::pair< tag::data_structure, tag::linear_array >,
mpl::pair< tag::stride_type<1>, typename result_of::stride1<T>::type >
> property_map;
static typename result_of::size1<T>::type size1( const Id& id ) {
return bindings::size1( id.get() );
}
static typename result_of::begin_value< T >::type begin_value( Id& id ) {
return bindings::begin_value( id.get() ) +
offset( id.get(), 0, id.m_index );
}
static typename result_of::end_value< T >::type end_value( Id& id ) {
return bindings::begin_value( id.get() ) +
offset( id.get(), size1(id), id.m_index );
}
static typename result_of::stride1<T>::type stride1( const Id& id ) {
return bindings::stride1( id.get() );
}
};
} // namespace detail
namespace result_of {
template< typename T >
struct column {
typedef detail::column_wrapper<T> type;
};
}
template< typename T >
detail::column_wrapper<T> const column( T& underlying, std::size_t index ) {
return detail::column_wrapper<T>( underlying, index );
}
template< typename T >
detail::column_wrapper<const T> const column( const T& underlying, std::size_t index ) {
return detail::column_wrapper<const T>( underlying, index );
}
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,48 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_CONJ_HPP
#define BOOST_NUMERIC_BINDINGS_CONJ_HPP
#include <boost/numeric/bindings/trans.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace result_of {
template< typename T >
struct conj {
typedef detail::trans_wrapper<
T,
typename mpl::if_<
detail::is_same_at< T, tag::value_transform, tag::conjugate >,
mpl::pair< tag::value_transform, mpl::void_ >,
mpl::pair< tag::value_transform, tag::conjugate >
>::type
> type;
};
}
template< typename T >
typename result_of::conj< T >::type const conj( T& t ) {
return typename result_of::conj< T >::type( t );
}
template< typename T >
typename result_of::conj< const T >::type const conj( const T& t ) {
return typename result_of::conj< const T >::type( t );
}
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,44 @@
//
// Copyright (c) 2009 by Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DATA_ORDER_HPP
#define BOOST_NUMERIC_BINDINGS_DATA_ORDER_HPP
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_row_major.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace result_of {
template< typename T, typename Enable = void >
struct data_order {};
template< typename T >
struct data_order< T, typename boost::enable_if< is_column_major<T> >::type > {
typedef tag::column_major type;
};
template< typename T >
struct data_order< T, typename boost::enable_if< is_row_major<T> >::type > {
typedef tag::row_major type;
};
} // namespace result_of
template< typename T >
typename result_of::data_order<T>::type data_order( const T& ) {
return typename result_of::data_order<T>::type();
}
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,35 @@
//
// Copyright (c) 2009 by Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DATA_SIDE_HPP
#define BOOST_NUMERIC_BINDINGS_DATA_SIDE_HPP
#include <boost/numeric/bindings/detail/property_map.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace result_of {
template< typename T >
struct data_side {
typedef typename detail::property_at< T, tag::data_side >::type type;
};
} // namespace result_of
template< typename T >
typename result_of::data_side<T>::type data_side( const T& ) {
return result_of::data_side<T>::type();
}
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,43 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_ADAPTABLE_TYPE_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_ADAPTABLE_TYPE_HPP
#include <boost/numeric/bindings/detail/adaptor.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename Derived >
struct adaptable_type {
inline
Derived& derived() {
return *static_cast<Derived*>(this);
}
inline
Derived const& derived() const {
return *static_cast<Derived const*>(this);
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
template< typename T >
std::ostream& operator<<( std::ostream& os,
boost::numeric::bindings::detail::adaptable_type<T> const& object );
#endif

View File

@@ -0,0 +1,51 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_ADAPTOR_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_ADAPTOR_HPP
#include <boost/mpl/map.hpp>
#include <boost/numeric/bindings/detail/copy_const.hpp>
#include <boost/numeric/bindings/is_numeric.hpp>
#include <boost/numeric/bindings/tag.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename Id, typename Enable = void >
struct adaptor {
typedef mpl::map<
mpl::pair< tag::value_type, void >
> property_map;
};
template< typename T >
struct is_adaptable: is_numeric< typename mpl::at<
typename adaptor< typename boost::remove_const<T>::type, T >::property_map,
tag::value_type >::type > {};
template< typename T, typename Enable = void >
struct adaptor_access {};
template< typename T >
struct adaptor_access< T, typename boost::enable_if< is_adaptable<T> >::type >:
adaptor< typename boost::remove_const<T>::type, T > {};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#include <boost/numeric/bindings/detail/pod.hpp>
#include <boost/numeric/bindings/detail/property_map.hpp>
#endif

View File

@@ -0,0 +1,127 @@
//
// Copyright (c) 2003 Kresimir Fresl
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_ARRAY_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_ARRAY_HPP
#include <new>
#include <boost/noncopyable.hpp>
#include <boost/numeric/bindings/detail/adaptor.hpp>
/*
very simple dynamic array class which is used in `higher level'
bindings functions for pivot and work arrays
Namely, there are (at least) two versions of all bindings functions
where called LAPACK function expects work and/or pivot array, e.g.
`lower' level (user should provide work and pivot arrays):
int sysv (SymmA& a, IVec& i, MatrB& b, Work& w);
`higher' level (with `internal' work and pivot arrays):
int sysv (SymmA& a, MatrB& b);
Probably you ask why I didn't use std::vector. There are two reasons.
First is efficiency -- std::vector's constructor initialises vector
elements. Second is consistency. LAPACK functions use `info' parameter
as an error indicator. On the other hand, std::vector's allocator can
throw an exception if memory allocation fails. detail::array's
constructor uses `new (nothrow)' which returns 0 if allocation fails.
So I can check whether array::storage == 0 and return appropriate error
in `info'.*/
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template <typename T>
class array : private noncopyable {
public:
typedef std::ptrdiff_t size_type ;
array (size_type n) {
stg = new (std::nothrow) T[n];
sz = (stg != 0) ? n : 0;
}
~array() {
delete[] stg;
}
size_type size() const {
return sz;
}
bool valid() const {
return stg != 0;
}
void resize (int n) {
delete[] stg;
stg = new (std::nothrow) T[n];
sz = (stg != 0) ? n : 0;
}
T* storage() {
return stg;
}
T const* storage() const {
return stg;
}
T& operator[] (int i) {
return stg[i];
}
T const& operator[] (int i) const {
return stg[i];
}
private:
size_type sz;
T* stg;
};
template< typename T, typename Id, typename Enable >
struct adaptor< array< T >, Id, Enable > {
typedef typename copy_const< Id, T >::type value_type;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::vector >,
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
mpl::pair< tag::data_structure, tag::linear_array >,
mpl::pair< tag::stride_type<1>, tag::contiguous >
> property_map;
static std::ptrdiff_t size1( const Id& t ) {
return t.size();
}
static value_type* begin_value( Id& t ) {
return t.storage();
}
static value_type* end_value( Id& t ) {
return t.storage() + t.size();
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,56 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_BASIC_UNWRAPPER_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_BASIC_UNWRAPPER_HPP
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/end.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename Id >
struct basic_unwrapper {
static typename result_of::size1< T >::type size1( const Id& id ) {
return bindings::size1( id.get() );
}
static typename result_of::size2< T >::type size2( const Id& id ) {
return bindings::size2( id.get() );
}
static typename result_of::stride1< T >::type stride1( const Id& id ) {
return bindings::stride1( id.get() );
}
static typename result_of::stride2< T >::type stride2( const Id& id ) {
return bindings::stride2( id.get() );
}
static typename result_of::begin_value< T >::type begin_value( Id& id ) {
return bindings::begin_value( id.get() );
}
static typename result_of::end_value< T >::type end_value( Id& id ) {
return bindings::end_value( id.get() );
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,41 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_BASIC_WRAPPER_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_BASIC_WRAPPER_HPP
#include <boost/ref.hpp>
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/numeric/bindings/detail/basic_unwrapper.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename P1 = mpl::void_, typename P2 = mpl::void_,
typename P3 = mpl::void_, typename P4 = mpl::void_ >
struct basic_wrapper: reference_wrapper<T> {
basic_wrapper( T& t ): reference_wrapper<T>( t ) {}
};
template< typename T, typename P1, typename P2, typename P3, typename P4,
typename Id, typename Enable >
struct adaptor< basic_wrapper<T, P1, P2, P3, P4>, Id, Enable >:
basic_unwrapper< T, Id > {
typedef typename property_insert< T, P1, P2, P3, P4 >::type property_map;
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,182 @@
//
// Copyright (c) 2003 Kresimir Fresl
// Copyright (c) 2010 Thomas Klimpel
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_COMPLEX_UTILS_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_COMPLEX_UTILS_HPP
#include <iterator>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/end.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/numeric/bindings/vector_view.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
#ifdef BOOST_NUMERIC_BINDINGS_BY_THE_BOOK
template <typename It>
void inshuffle(It it, std::size_t n) {
if (n==0) return;
for (std::size_t i = 0; 2*i < n; ++i) {
std::size_t k = 2*i + 1;
while (2*k <= n) k *= 2;
typename std::iterator_traits<It>::value_type tmp = it[n+i];
it[n+i] = it[k-1];
while (k % 2 == 0) {
it[k-1] = it[(k/2)-1];
k /= 2;
}
it[k-1] = tmp;
}
std::size_t kmin = 1;
while (2*kmin <= n) kmin *= 2;
for (std::size_t i = 0; 4*i+1 < n; ++i) {
std::size_t k = 2*i + 1;
while (2*k <= n) k *= 2;
std::size_t k1 = 2*(i+1) + 1;
while (2*k1 <= n) k1 *= 2;
if (k > k1) {
if (k1 < kmin) {
kmin = k1;
inshuffle(it+n, i+1);
}
else
inshuffle(it+n+1, i);
}
}
return inshuffle(it+n+(n%2), n/2);
}
#else
template <typename It>
void inshuffle(It it, std::size_t n) {
while (n > 0) {
std::size_t kmin = 1;
while (kmin <= n)
kmin *= 2;
{
std::size_t kk = kmin/2;
It itn = it + n;
for (std::size_t i = 0, s = (n+1)/2; i < s; ++i) {
std::size_t k = (2*i+1)*kk;
while (k > n) {
k /= 2;
kk /= 2;
}
// apply the cyclic permutation
typename std::iterator_traits<It>::value_type tmp = itn[i];
itn[i] = it[k-1];
while (k % 2 == 0) {
it[k-1] = it[(k/2)-1];
k /= 2;
}
it[k-1] = tmp;
}
}
// the optimized computation of k fails for n=2,
// so skip the 'normalization' loop when possible
if (n > 3) {
std::size_t kk = kmin/4;
for (std::size_t i = 1; 4*i < n+3; ++i) {
std::size_t k = (2*i+1)*kk;
if (k > n) {
kk /= 2;
if (k < kmin) {
kmin = k;
// if kmin is updated, do an in-shuffle
inshuffle(it+n, i);
}
else
// otherwise do an out-shuffle
inshuffle(it+n+1, i-1);
}
}
}
// implement the tail recursion as an iteration
it += n+(n%2);
n /= 2;
}
}
#endif
// Reorders a real array followed by an imaginary array to a true complex array
// where real and imaginary part of each number directly follow each other.
template <typename VectorW>
typename boost::enable_if< is_complex< typename bindings::value_type< VectorW >::type >, void >::type
interlace (VectorW& w) {
typedef typename bindings::value_type< VectorW >::type value_type;
typedef typename bindings::remove_imaginary< value_type >::type real_type;
value_type* pw = bindings::begin_value(w);
std::ptrdiff_t n = bindings::end_value(w) - pw;
if (n < 2) return;
inshuffle(reinterpret_cast<real_type*> (pw)+1, n-1);
}
} // namespace detail
namespace result_of {
template< typename VectorW >
struct real_part_view {
typedef typename bindings::result_of::vector_view< typename
bindings::remove_imaginary< typename
bindings::value_type< VectorW >::type
>::type >::type type;
};
template< typename VectorW >
struct imag_part_view {
typedef typename bindings::result_of::vector_view< typename
bindings::remove_imaginary< typename
bindings::value_type< VectorW >::type
>::type >::type type;
};
} // namespace result_of
namespace detail {
// Creates a real vector_view to the first half of the complex array,
// which is intended to be filled by the real part
template <typename VectorW>
typename boost::enable_if< is_complex< typename bindings::value_type< VectorW >::type >,
typename result_of::real_part_view< VectorW >::type const >::type
real_part_view (VectorW& w) {
typedef typename bindings::value_type< VectorW >::type value_type;
typedef typename bindings::remove_imaginary< value_type >::type real_type;
value_type* pw = bindings::begin_value(w);
std::ptrdiff_t n = bindings::end_value(w) - pw;
return bindings::vector_view(reinterpret_cast<real_type*> (pw), n);
}
// Creates a real vector_view to the second half of the complex array,
// which is intended to be filled by the imaginary part
template <typename VectorW>
typename boost::enable_if< is_complex< typename bindings::value_type< VectorW >::type >,
typename result_of::imag_part_view< VectorW >::type const >::type
imag_part_view (VectorW& w) {
typedef typename bindings::value_type< VectorW >::type value_type;
typedef typename bindings::remove_imaginary< value_type >::type real_type;
value_type* pw = bindings::begin_value(w);
std::ptrdiff_t n = bindings::end_value(w) - pw;
return bindings::vector_view(reinterpret_cast<real_type*> (pw)+n, n);
}
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,88 @@
//
// Copyright (C) 2002, 2003 Si-Lab b.v.b.a., Toon Knapen and Kresimir Fresl
// 2010 Thomas Klimpel
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_CONFIG_FORTRAN_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_CONFIG_FORTRAN_HPP
#if defined(BIND_FORTRAN_LOWERCASE_UNDERSCORE) || defined(BIND_FORTRAN_LOWERCASE) || defined(BIND_FORTRAN_UPPERCASE_UNDERSCORE) || defined(BIND_FORTRAN_UPPERCASE)
// Allow manual override of the defaults, e.g. if you want to use a fortran
// lib compiled with gcc from MSVC
#else
// We have no chance of determining the conventions for linking C with Fortran
// here, because they only depend on the fortran compiler and it's command line
// switches, but not on the C++ compiler which compiles these lines.
// We default to lowercase underscore, because this is much more common than
// the other option. (The previous automatic configuration only selected the
// other option in case of "defined(__IBMCPP__) || defined(_MSC_VER)".)
#define BIND_FORTRAN_LOWERCASE_UNDERSCORE
#endif
// Next we define macro's to convert our symbols to
// the current convention
#if defined(BIND_FORTRAN_LOWERCASE_UNDERSCORE)
#define FORTRAN_ID( id ) id##_
#define FORTRAN_ID2( id, ID2 ) id##_
#elif defined(BIND_FORTRAN_LOWERCASE)
#define FORTRAN_ID( id ) id
#define FORTRAN_ID2( id, ID2 ) id
#elif defined(BIND_FORTRAN_UPPERCASE_UNDERSCORE)
#define FORTRAN_ID2( id, ID2 ) ID2##_
#elif defined(BIND_FORTRAN_UPPERCASE)
#define FORTRAN_ID2( id, ID2 ) ID2
#else
#error do not know how to bind to fortran calling convention
#endif
#ifdef BIND_FORTRAN_F2C_RETURN_CONVENTIONS
// "g77" or clapack or "gfortran -ff2c"
#define BIND_FORTRAN_RETURN_REAL_DOUBLE
#define BIND_FORTRAN_RETURN_COMPLEX_FIRST_ARG
#elif BIND_FORTRAN_MKL_RETURN_CONVENTIONS
// mkl
#define BIND_FORTRAN_RETURN_COMPLEX_FIRST_ARG
#elif BIND_FORTRAN_OSX_RETURN_CONVENTIONS
// OS X
#define BIND_FORTRAN_RETURN_COMPLEX_LAST_ARG
#else
// "g77 -fno-f2c" or "gfortran"
#endif
// "g77" or "gfortran" or mkl_intel_lp64
//#undef BIND_FORTRAN_INTEGER_8
// clapack or "gfortran -fdefault-integer-8" or mkl_intel_ilp64
//#define BIND_FORTRAN_INTEGER_8
// Most fortran compilers use fortran_int_t := int by default, so we follow
// this default, even so f2c (=clapack) uses "typedef long int integer;"
#ifndef BIND_FORTRAN_INTEGER_8
typedef int fortran_int_t;
#else
typedef std::ptrdiff_t fortran_int_t;
#endif
// Looks like fortran_int_t and fortran_bool_t should be identical, the unsigned is
// required so overloads can distinguish between fortran_bool_t and fortran_int_t.
#ifndef BIND_FORTRAN_INTEGER_8
typedef unsigned int fortran_bool_t;
#else
typedef std::size_t fortran_bool_t;
#endif
// This definition of external_fp is identical to the definition of L_fp from
// f2c, and it seems to work more or less. These functions return fortran_bool_t,
// but they don't all take the same type of arguments. A reinterpret_cast will
// probably work for most compilers to extend the allowed function signatures.
typedef fortran_bool_t (*external_fp)(...);
#endif // BOOST_NUMERIC_BINDINGS_TRAITS_FORTRAN_H

View File

@@ -0,0 +1,25 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_CONVERT_TO_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_CONVERT_TO_HPP
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename Target, typename Source >
struct convert_to {};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,32 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_COPY_CONST_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_COPY_CONST_HPP
#include <boost/mpl/if.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename Source, typename Target >
struct copy_const {
typedef typename mpl::if_< is_const<Source>,
typename add_const<Target>::type, Target >::type type;
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,48 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_GENERATE_FUNCTIONS_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_GENERATE_FUNCTIONS_HPP
#include <boost/preprocessor/repetition.hpp>
#include <boost/preprocessor/cat.hpp>
//
// Macro used to generate convenience functions
//
#define GENERATE_FUNCTIONS( function_name, suffix, tag ) \
\
namespace result_of {\
\
template< typename T > \
struct BOOST_PP_CAT( function_name, suffix ) { \
typedef typename detail::\
BOOST_PP_CAT( function_name, _impl ) \
<T, tag >::result_type type; \
}; \
\
}\
\
template< typename T >\
typename result_of:: BOOST_PP_CAT( function_name, suffix )<T>::type \
BOOST_PP_CAT( function_name, suffix )( T& t ) {\
return detail:: \
BOOST_PP_CAT( function_name, _impl ) \
<T, tag >::invoke( t );\
}\
\
template< typename T >\
typename result_of:: BOOST_PP_CAT( function_name, suffix )<const T>::type \
BOOST_PP_CAT( function_name, suffix )( const T& t ) {\
return detail:: \
BOOST_PP_CAT( function_name, _impl ) \
<const T, tag >::invoke( t );\
}
#endif

View File

@@ -0,0 +1,96 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_GET_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_GET_HPP
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/preprocessor/repetition.hpp>
#include <boost/preprocessor/cat.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename Key >
struct get_dispatch {};
#define GENERATE_GET( z, which, unused ) \
template<> \
struct get_dispatch< tag::size_type<which> > { \
template< typename T > \
static std::ptrdiff_t invoke( const T& t ) { \
return detail::adaptor_access<T>:: \
BOOST_PP_CAT( size, which )( t ); \
} \
};\
\
template<> \
struct get_dispatch< tag::stride_type<which> > { \
template< typename T > \
static std::ptrdiff_t invoke( const T& t ) { \
return detail::adaptor_access<T>:: \
BOOST_PP_CAT( stride, which )( t ); \
} \
};\
\
template<> \
struct get_dispatch< tag::bandwidth_type<which> > { \
template< typename T > \
static std::ptrdiff_t invoke( const T& t ) { \
return detail::adaptor_access<T>:: \
BOOST_PP_CAT( bandwidth, which )( t ); \
} \
};
BOOST_PP_REPEAT_FROM_TO(1,3,GENERATE_GET,~)
template< typename T, typename Key, typename Enable = void >
struct get_impl {};
template< typename T, typename Key >
struct get_impl< T, Key, typename boost::enable_if<
is_same_at< T, Key, std::ptrdiff_t > >::type > {
typedef std::ptrdiff_t result_type;
static std::ptrdiff_t invoke( const T& t ) {
return get_dispatch<Key>::invoke( t );
}
};
template< typename T, typename Key >
struct get_impl< T, Key, typename boost::enable_if<
mpl::not_< is_same_at< T, Key, std::ptrdiff_t > > >::type > {
typedef typename property_at< T, Key >::type result_type;
static result_type invoke( const T& ) {
return result_type();
}
};
template< typename T, typename Key >
struct result_of_get {
typedef typename get_impl< T, Key >::result_type type;
};
template< typename Key, typename T >
typename result_of_get< T, Key >::type get( const T& t ) {
return get_impl< T, Key >::invoke( t );
}
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,53 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_IF_LEFT_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_IF_LEFT_HPP
#include <boost/numeric/bindings/tag.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename Side, typename Left, typename Right >
struct if_left_impl {
typedef Right result_type;
static result_type invoke( Left, Right right ) {
return right;
}
};
template< typename Left, typename Right >
struct if_left_impl< tag::left, Left, Right > {
typedef Left result_type;
static result_type invoke( Left left, Right ) {
return left;
}
};
// by-value
template< typename Side, typename Left, typename Right >
typename if_left_impl< Side, const Left, const Right >::result_type
if_left( const Side, const Left left, const Right right ) {
return if_left_impl< Side, const Left, const Right >::invoke( left, right );
}
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,34 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_IF_ROW_MAJOR_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_IF_ROW_MAJOR_HPP
#include <boost/numeric/bindings/tag.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename Order, typename True, typename False >
struct if_row_major {
typedef False type;
};
template< typename True, typename False >
struct if_row_major< tag::row_major, True, False > {
typedef True type;
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,89 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_LINEAR_ITERATOR_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_LINEAR_ITERATOR_HPP
#include <boost/iterator/iterator_adaptor.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename StrideType >
class linear_iterator: public boost::iterator_adaptor<
linear_iterator<T, StrideType >,
T*, use_default, random_access_traversal_tag > {
public:
typedef mpl::int_<StrideType::value> stride_type;
linear_iterator():
linear_iterator::iterator_adaptor_(0) {}
explicit linear_iterator( T* p, StrideType ignore ):
linear_iterator::iterator_adaptor_(p) {}
private:
friend class boost::iterator_core_access;
void advance( int n ) {
(this->base_reference()) += n * stride_type::value;
}
void decrement() {
(this->base_reference()) -= stride_type::value;
}
void increment() {
(this->base_reference()) += stride_type::value;
}
};
template< typename T >
class linear_iterator< T, std::ptrdiff_t >: public boost::iterator_adaptor<
linear_iterator< T, std::ptrdiff_t >,
T*, use_default, random_access_traversal_tag > {
public:
typedef std::ptrdiff_t stride_type;
linear_iterator():
linear_iterator::iterator_adaptor_(0),
m_stride(0) {}
explicit linear_iterator( T* p, std::ptrdiff_t stride ):
linear_iterator::iterator_adaptor_(p),
m_stride( stride ) {}
private:
friend class boost::iterator_core_access;
void advance( int n ) {
(this->base_reference()) += n * m_stride;
}
void decrement() {
(this->base_reference()) -= m_stride;
}
void increment() {
(this->base_reference()) += m_stride;
}
std::ptrdiff_t m_stride;
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,72 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_OFFSET_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_OFFSET_HPP
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/has_linear_array.hpp>
#include <boost/numeric/bindings/has_band_array.hpp>
#include <boost/numeric/bindings/stride.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename Enable = void >
struct offset_impl {};
template< typename T >
struct offset_impl< T, typename boost::enable_if< has_linear_array< T > >::type > {
static std::ptrdiff_t invoke( const T& t, std::ptrdiff_t i1 ) {
return i1 * bindings::stride1( t );
}
static std::ptrdiff_t invoke( const T& t, std::ptrdiff_t i1, std::ptrdiff_t i2 ) {
return i1 * bindings::stride1( t ) +
i2 * bindings::stride2( t );
}
};
template< typename T >
struct offset_impl< T,
typename boost::enable_if<
mpl::and_<
has_band_array< T >,
is_column_major< T >
>
>::type > {
static std::ptrdiff_t invoke( const T& t, std::ptrdiff_t i1, std::ptrdiff_t i2 ) {
return i1 * bindings::stride1( t ) +
i2 * (bindings::stride2( t )-1);
}
};
template< typename T >
std::ptrdiff_t offset( const T& t, std::ptrdiff_t i1 ) {
return offset_impl< T >::invoke( t, i1 );
}
template< typename T >
std::ptrdiff_t offset( const T& t, std::ptrdiff_t i1, std::ptrdiff_t i2 ) {
return offset_impl< T >::invoke( t, i1, i2 );
}
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,90 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_POD_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_POD_HPP
#include <boost/numeric/bindings/is_numeric.hpp>
#include <boost/numeric/bindings/detail/adaptor.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename Id >
struct adaptor< T, Id, typename boost::enable_if< is_numeric<T> >::type > {
typedef typename copy_const< Id, T >::type value_type;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::scalar >,
mpl::pair< tag::size_type<1>, mpl::int_<1> >,
mpl::pair< tag::data_structure, tag::linear_array >
> property_map;
static value_type* begin_value( Id& t ) {
return &t;
}
};
template< typename T, std::size_t N, typename Id >
struct adaptor< T[N], Id, typename boost::enable_if< is_numeric<T> >::type > {
typedef typename copy_const< Id, T >::type value_type;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::vector >,
mpl::pair< tag::size_type<1>, mpl::int_<N> >,
mpl::pair< tag::data_structure, tag::linear_array >,
mpl::pair< tag::stride_type<1>, tag::contiguous >
> property_map;
static value_type* begin_value( Id& t ) {
return &t[0];
}
static value_type* end_value( Id& t ) {
return &t[N];
}
};
template< typename T, std::size_t M, std::size_t N, typename Id >
struct adaptor< T[M][N], Id, typename boost::enable_if< is_numeric<T> >::type > {
typedef typename copy_const< Id, T >::type value_type;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::matrix >,
mpl::pair< tag::size_type<1>, mpl::int_<M> >,
mpl::pair< tag::size_type<2>, mpl::int_<N> >,
mpl::pair< tag::matrix_type, tag::general >,
mpl::pair< tag::data_structure, tag::linear_array >,
mpl::pair< tag::data_order, tag::row_major >,
mpl::pair< tag::stride_type<1>, mpl::int_<N> >,
mpl::pair< tag::stride_type<2>, tag::contiguous >
> property_map;
static value_type* begin_value( Id& t ) {
return &t[0][0];
}
static value_type* end_value( Id& t ) {
return &t[M][N];
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,73 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_PROPERTY_MAP_HPP
#define BOOST_NUMERIC_BINDINGS_DETAIL_PROPERTY_MAP_HPP
#include <boost/mpl/at.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/has_key.hpp>
#include <boost/mpl/insert.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename Key >
struct property_has_key: mpl::has_key< typename adaptor_access<T>::property_map, Key > {};
template< typename T, typename Key >
struct property_at {
typedef typename mpl::at< typename adaptor_access<T>::property_map, Key >::type type;
};
template< typename T >
struct property_map_of {
typedef typename adaptor_access<T>::property_map type;
};
template< typename T, typename Key, typename Value >
struct is_same_at: is_same< typename property_at< T, Key >::type, Value > {};
//
// Meta-function to insert multiple pairs into a map by using fold. Using the
// provided mpl::insert can (only) insert elements in a map one-by-one.
//
template< typename T,
typename P1 = mpl::na, typename P2 = mpl::na, typename P3 = mpl::na,
typename P4 = mpl::na, typename P5 = mpl::na, typename P6 = mpl::na,
typename P7 = mpl::na, typename P8 = mpl::na, typename P9 = mpl::na,
typename P10 = mpl::na >
struct property_insert {
typedef mpl::vector< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 > pair_vector;
typedef typename property_map_of< T >::type properties;
typedef typename mpl::fold<
pair_vector,
properties,
mpl::if_<
is_same< mpl::_2, mpl::void_ >,
mpl::_1,
mpl::insert< mpl::_1, mpl::_2 >
>
>::type type;
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,56 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_DIAG_TAG_HPP
#define BOOST_NUMERIC_BINDINGS_DIAG_TAG_HPP
#include <boost/numeric/bindings/tag.hpp>
#include <boost/numeric/bindings/detail/property_map.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T >
struct diag_tag_impl {
typedef tag::non_unit type;
};
template<>
struct diag_tag_impl< tag::unit_triangular > {
typedef tag::unit type;
};
} // namespace detail
namespace result_of {
template< typename T >
struct diag_tag {
typedef typename detail::diag_tag_impl<
typename detail::property_at< T, tag::matrix_type >::type
>::type type;
};
} // namespace result_of
//
// diag_tag will output tags that are compatible with BLAS and LAPACK
//
template< typename T, typename Order >
typename result_of::diag_tag< T >::type diag_tag( const T& t ) {
return result_of::diag_tag< T >::type();
}
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,92 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_EIGEN_MATRIX_HPP
#define BOOST_NUMERIC_BINDINGS_EIGEN_MATRIX_HPP
#include <boost/mpl/equal.hpp>
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/numeric/bindings/detail/if_row_major.hpp>
#include <Eigen/Core>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< int Value >
struct eigen_size_type {
typedef typename mpl::if_<
mpl::bool_< Value == Eigen::Dynamic >,
std::ptrdiff_t,
mpl::int_<Value>
>::type type;
};
template< int Value >
struct eigen_data_order {
typedef typename mpl::if_<
mpl::bool_< Value & Eigen::RowMajorBit >,
tag::row_major,
tag::column_major
>::type type;
};
template< typename T, int Rows, int Cols, int Options,
typename Id, typename Enable >
struct adaptor< Eigen::Matrix< T, Rows, Cols, Options >, Id, Enable > {
typedef typename copy_const< Id, T >::type value_type;
typedef typename eigen_size_type< Rows >::type size_type1;
typedef typename eigen_size_type< Cols >::type size_type2;
typedef typename eigen_data_order< Options >::type data_order;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::matrix >,
mpl::pair< tag::size_type<1>, size_type1 >,
mpl::pair< tag::size_type<2>, size_type2 >,
mpl::pair< tag::data_structure, tag::linear_array >,
mpl::pair< tag::data_order, data_order >,
mpl::pair< tag::stride_type<1>,
typename if_row_major< data_order, size_type2, tag::contiguous >::type >,
mpl::pair< tag::stride_type<2>,
typename if_row_major< data_order, tag::contiguous, size_type1 >::type >
> property_map;
static std::ptrdiff_t size1( const Id& id ) {
return id.rows();
}
static std::ptrdiff_t size2( const Id& id ) {
return id.cols();
}
static value_type* begin_value( Id& id ) {
return id.data();
}
static value_type* end_value( Id& id ) {
return id.data() + id.size();
}
static std::ptrdiff_t stride1( const Id& id ) {
return id.cols();
}
static std::ptrdiff_t stride2( const Id& id ) {
return id.rows();
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,92 @@
//
// Copyright (c) 2009--2010
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_EIGEN_SPARSEMATRIX_HPP
#define BOOST_NUMERIC_BINDINGS_EIGEN_SPARSEMATRIX_HPP
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/numeric/bindings/detail/copy_const.hpp>
#include <Eigen/Sparse>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< int Value >
struct eigen_data_order {
typedef typename mpl::if_<
mpl::bool_< Value & Eigen::RowMajorBit >,
tag::row_major,
tag::column_major
>::type type;
};
template< typename T, int Flags, typename Id, typename Enable >
struct adaptor< Eigen::SparseMatrix< T, Flags >, Id, Enable > {
typedef typename copy_const< Id, T >::type value_type;
typedef typename copy_const<
Id,
//??? (Sorry, couldn't find it. Maybe fix it later.)
std::ptrdiff_t
>::type index_type;
typedef typename eigen_data_order< Flags >::type data_order;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::index_type, index_type >,
mpl::pair< tag::entity, tag::matrix >,
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
mpl::pair< tag::matrix_type, tag::general >,
mpl::pair< tag::data_structure, tag::compressed_sparse >,
mpl::pair< tag::data_order, data_order >,
mpl::pair< tag::index_base, mpl::int_<0> >
> property_map;
static std::ptrdiff_t size1( const Id& id ) {
return id.rows();
}
static std::ptrdiff_t size2( const Id& id ) {
return id.cols();
}
static value_type* begin_value( Id& id ) {
return id._valuePtr();
}
static value_type* end_value( Id& id ) {
return id._valuePtr() + id.nonZeros();
}
static index_type* begin_compressed_index_major( Id& id ) {
return id._outerIndexPtr();
}
static index_type* end_compressed_index_major( Id& id ) {
return id._outerIndexPtr() + id.outerSize() + 1;
}
static index_type* begin_index_minor( Id& id ) {
return id._innerIndexPtr();
}
static index_type* end_index_minor( Id& id ) {
return id._innerIndexPtr() + id.nonZeros();
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,139 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_END_HPP
#define BOOST_NUMERIC_BINDINGS_END_HPP
#include <boost/numeric/bindings/begin.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename Tag >
struct end_impl {};
template< typename T >
struct end_impl< T, tag::value > {
typedef typename bindings::value_type< T>::type* result_type;
static result_type invoke( T& t ) {
return adaptor_access<T>::end_value( t );
}
};
template< typename T, int N >
struct end_impl< T, tag::addressing_index<N> > {
typedef tag::addressing_index<N> tag_type;
typedef linear_iterator<
typename bindings::value_type< T>::type,
typename result_of::stride< T, tag_type >::type
> result_type;
static result_type invoke( T& t ) {
return result_type( adaptor_access<T>::end_value( t ), stride(t, tag_type() ) );
}
};
template< typename T >
struct end_impl< T, tag::index_major > {
typedef typename detail::property_at< T, tag::index_type >::type* result_type;
static result_type invoke( T& t ) {
return adaptor_access<T>::end_index_major( t );
}
};
template< typename T >
struct end_impl< T, tag::compressed_index_major > {
typedef typename detail::property_at< T, tag::index_type >::type* result_type;
static result_type invoke( T& t ) {
return adaptor_access<T>::end_compressed_index_major( t );
}
};
template< typename T >
struct end_impl< T, tag::index_minor > {
typedef typename detail::property_at< T, tag::index_type >::type* result_type;
static result_type invoke( T& t ) {
return adaptor_access<T>::end_index_minor( t );
}
};
} // namespace detail
namespace result_of {
template< typename T, typename Tag = tag::addressing_index<1> >
struct end {
BOOST_STATIC_ASSERT( (is_tag<Tag>::value) );
typedef typename detail::end_impl<T,Tag>::result_type type;
};
} // namespace result_of
//
// Free Functions
//
//
// Overloads like end( t, tag );
//
template< typename T, typename Tag >
inline typename result_of::end<T,Tag>::type
end( T& t, Tag ) {
return detail::end_impl<T,Tag>::invoke( t );
}
template< typename T, typename Tag >
inline typename result_of::end<const T,Tag>::type
end( const T& t, Tag ) {
return detail::end_impl<const T,Tag>::invoke( t );
}
// Overloads for types with rank <= 1 (scalars, vectors)
// In theory, we could provide overloads for matrices here, too,
// if their minimal_rank is at most 1.
template< typename T >
typename boost::enable_if< mpl::less< rank<T>, mpl::int_<2> >,
typename result_of::end< T, tag::addressing_index<1> >::type >::type
end( T& t ) {
return detail::end_impl<T,tag::addressing_index<1> >::invoke( t );
}
template< typename T >
typename boost::enable_if< mpl::less< rank<T>, mpl::int_<2> >,
typename result_of::end< const T >::type >::type
end( const T& t ) {
return detail::end_impl<const T, tag::addressing_index<1> >::invoke( t );
}
#define GENERATE_END_INDEX( z, which, unused ) \
GENERATE_FUNCTIONS( end, which, mpl::int_<which> )
BOOST_PP_REPEAT_FROM_TO(1,3,GENERATE_END_INDEX,~)
GENERATE_FUNCTIONS( end, _value, tag::value )
GENERATE_FUNCTIONS( end, _row, tag::addressing_index<1> )
GENERATE_FUNCTIONS( end, _column, tag::addressing_index<2> )
GENERATE_FUNCTIONS( end, _index_major, tag::index_major )
GENERATE_FUNCTIONS( end, _compressed_index_major, tag::compressed_index_major )
GENERATE_FUNCTIONS( end, _index_minor, tag::index_minor )
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,84 @@
//
// Copyright (c) 2009--2010
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_GLAS_COMPRESSED_HPP
#define BOOST_NUMERIC_BINDINGS_GLAS_COMPRESSED_HPP
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/end.hpp>
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/numeric/bindings/detail/copy_const.hpp>
#include <boost/numeric/bindings/glas/detail/convert_to.hpp>
#include <boost/numeric/bindings/glas/dense_vector.hpp>
#include <boost/numeric/bindings/std/vector.hpp>
#include <glas/sparse/compressed.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename O, typename IndexType, typename NNZType, int IB, typename Id, typename Enable >
struct adaptor< glas::sparse_matrix< T, glas::compressed_sparse_structure<O, IndexType, NNZType, IB> >, Id, Enable > {
typedef typename copy_const< Id, T >::type value_type;
typedef typename copy_const< Id, IndexType >::type index_type;
typedef typename convert_to< tag::data_order, O >::type data_order;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::index_type, index_type >,
mpl::pair< tag::entity, tag::matrix >,
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
mpl::pair< tag::matrix_type, tag::general >,
mpl::pair< tag::data_structure, tag::compressed_sparse >,
mpl::pair< tag::data_order, data_order >,
mpl::pair< tag::index_base, mpl::int_<IB> >
> property_map;
static std::ptrdiff_t size1( const Id& id ) {
return id.num_rows();
}
static std::ptrdiff_t size2( const Id& id ) {
return id.num_columns();
}
static value_type* begin_value( Id& id ) {
return bindings::begin_value( id.value_array() );
}
static value_type* end_value( Id& id ) {
return bindings::begin_value( id.value_array() ) + id.nnz();
}
static index_type* begin_compressed_index_major( Id& id ) {
return bindings::begin_value( id.sparse_structure().compressed_index_array() );
}
static index_type* end_compressed_index_major( Id& id ) {
return bindings::end_value( id.sparse_structure().compressed_index_array() );
}
static index_type* begin_index_minor( Id& id ) {
return bindings::begin_value( id.sparse_structure().index_array() );
}
static index_type* end_index_minor( Id& id ) {
return bindings::begin_value( id.sparse_structure().index_array() ) + id.nnz();
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,71 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_GLAS_DENSE_MATRIX_HPP
#define BOOST_NUMERIC_BINDINGS_GLAS_DENSE_MATRIX_HPP
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/numeric/bindings/detail/if_row_major.hpp>
#include <boost/numeric/bindings/glas/detail/convert_to.hpp>
#include <glas/container/dense_matrix.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename O, typename Id, typename Enable >
struct adaptor< glas::dense_matrix< T, O >, Id, Enable > {
typedef typename copy_const< Id, T >::type value_type;
typedef typename convert_to< tag::data_order, O >::type data_order;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::matrix >,
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
mpl::pair< tag::data_structure, tag::linear_array >,
mpl::pair< tag::data_order, data_order >,
mpl::pair< tag::stride_type<1>,
typename if_row_major< data_order, std::ptrdiff_t, tag::contiguous >::type >,
mpl::pair< tag::stride_type<2>,
typename if_row_major< data_order, tag::contiguous, std::ptrdiff_t >::type >
> property_map;
static std::ptrdiff_t size1( const Id& id ) {
return id.num_rows();
}
static std::ptrdiff_t size2( const Id& id ) {
return id.num_columns();
}
static value_type* begin_value( Id& id ) {
return id.storage_ptr();
}
static value_type* end_value( Id& id ) {
return id.storage_ptr() + id.num_rows() * id.num_columns();
}
static std::ptrdiff_t stride1( const Id& id ) {
return id.num_columns();
}
static std::ptrdiff_t stride2( const Id& id ) {
return id.num_rows();
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,51 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_GLAS_DENSE_VECTOR_HPP
#define BOOST_NUMERIC_BINDINGS_GLAS_DENSE_VECTOR_HPP
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <glas/container/dense_vector.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template< typename T, typename Id, typename Enable >
struct adaptor< glas::dense_vector< T >, Id, Enable > {
typedef typename copy_const< Id, T >::type value_type;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::vector >,
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
mpl::pair< tag::data_structure, tag::linear_array >,
mpl::pair< tag::stride_type<1>, tag::contiguous >
> property_map;
static std::ptrdiff_t size1( const Id& id ) {
return id.size();
}
static value_type* begin_value( Id& id ) {
return id.storage_ptr();
}
static value_type* end_value( Id& id ) {
return id.storage_ptr() + id.size();
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,84 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_GLAS_DENSE_VECTOR_COLLECTION_HPP
#define BOOST_NUMERIC_BINDINGS_GLAS_DENSE_VECTOR_COLLECTION_HPP
#include <boost/numeric/bindings/detail/adaptor.hpp>
#include <boost/numeric/bindings/detail/offset.hpp>
#include <glas/concept/dense_vector_collection.hpp>
#include <glas/concept/fixed_size_vector_expression.hpp>
#include <glas/concept/fixed_size.hpp>
#include <glas/concept/value_type.hpp>
#include <glas/concept/size.hpp>
#include <glas/concept/stride.hpp>
#include <glas/concept/storage_ptr.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
// Need a helper type here, because
// glas::fixed_size<T> doesn't work for any T
template< typename T, typename Enable = void >
struct glas_vector_size_type {
typedef std::ptrdiff_t type;
};
template< typename T >
struct glas_vector_size_type<
T, typename boost::enable_if< glas::FixedSizeVectorExpression<T> >::type > {
typedef mpl::int_< glas::fixed_size<T>::value > type;
};
template< typename T, typename Id >
struct adaptor< T, Id, typename boost::enable_if< glas::DenseVectorCollection<T> >::type > {
typedef typename copy_const< Id, typename glas::value_type<T>::type >::type value_type;
typedef typename glas_vector_size_type< T >::type size_type1;
typedef typename mpl::if_<
glas::ContiguousDenseVectorCollection<T>,
tag::contiguous,
std::ptrdiff_t
>::type stride_type1;
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::entity, tag::vector >,
mpl::pair< tag::size_type<1>, size_type1 >,
mpl::pair< tag::data_structure, tag::linear_array >,
mpl::pair< tag::stride_type<1>, stride_type1 >
> property_map;
// Only called in case of dynamic sizes
static std::ptrdiff_t size1( const Id& id ) {
return glas::size( id );
}
static value_type* begin_value( Id& id ) {
return glas::storage_ptr( id );
}
static value_type* end_value( Id& id ) {
return glas::storage_ptr( id ) + offset( id, bindings::size1( id ) );
}
// Only called in case of dynamic strides
static std::ptrdiff_t stride1( const Id& id ) {
return glas::stride( id );
}
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,36 @@
//
// Copyright (c) 2009 Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_GLAS_DETAIL_CONVERT_TO_HPP
#define BOOST_NUMERIC_BINDINGS_GLAS_DETAIL_CONVERT_TO_HPP
#include <boost/numeric/bindings/detail/convert_to.hpp>
#include <boost/numeric/bindings/tag.hpp>
#include <glas/concept/orientation.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace detail {
template<>
struct convert_to< bindings::tag::data_order, glas::row_orientation > {
typedef bindings::tag::row_major type;
};
template<>
struct convert_to< bindings::tag::data_order, glas::column_orientation > {
typedef bindings::tag::column_major type;
};
} // namespace detail
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,28 @@
//
// Copyright (c) 2009 by Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_HAS_BAND_ARRAY_HPP
#define BOOST_NUMERIC_BINDINGS_HAS_BAND_ARRAY_HPP
#include <boost/numeric/bindings/detail/property_map.hpp>
#include <boost/numeric/bindings/tag.hpp>
namespace boost {
namespace numeric {
namespace bindings {
template< typename T >
struct has_band_array:
detail::is_same_at< T, tag::data_structure, tag::band_array > {};
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,32 @@
//
// Copyright (c) 2009 by Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_BINDINGS_HAS_LINEAR_ARRAY_HPP
#define BOOST_NUMERIC_BINDINGS_HAS_LINEAR_ARRAY_HPP
#include <boost/numeric/bindings/detail/property_map.hpp>
#include <boost/numeric/bindings/tag.hpp>
namespace boost {
namespace numeric {
namespace bindings {
template< typename T, typename Enable = void >
struct has_linear_array: mpl::false_ {};
template< typename T >
struct has_linear_array<
T,
typename boost::enable_if< detail::is_adaptable<T> >::type >:
detail::is_same_at< T, tag::data_structure, tag::linear_array > {};
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

Some files were not shown because too many files have changed in this diff Show More