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

View File

@@ -0,0 +1,38 @@
/*
*
* Copyright (c) Toon Knapen, Kresimir Fresl and Matthias Troyer 2003
*
* 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)
*
* KF acknowledges the support of the Faculty of Civil Engineering,
* University of Zagreb, Croatia.
*
*/
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_ILAENV_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_ILAENV_HPP
#include <cstring>
#include <boost/numeric/bindings/lapack/detail/lapack.h>
namespace boost { namespace numeric { namespace bindings { namespace lapack {
//
// ilaenv() is called from the LAPACK routines to choose
// problem-dependent parameters such as the block sizes
// for the local environment.
//
inline std::ptrdiff_t ilaenv( const fortran_int_t ispec, const char* name,
const char* opts, const fortran_int_t n1 = -1, const fortran_int_t n2 = -1,
const fortran_int_t n3 = -1, const fortran_int_t n4 = -1) {
return LAPACK_ILAENV( &ispec, name, opts, &n1, &n2, &n3, &n4,
std::strlen (name), std::strlen (opts) );
}
}}}}
#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_LAPACK_AUXILIARY_LABRD_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LABRD_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for labrd is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t labrd( const fortran_int_t m, const fortran_int_t n,
const fortran_int_t nb, float* a, const fortran_int_t lda, float* d,
float* e, float* tauq, float* taup, float* x, const fortran_int_t ldx,
float* y, const fortran_int_t ldy ) {
fortran_int_t info(0);
LAPACK_SLABRD( &m, &n, &nb, a, &lda, d, e, tauq, taup, x, &ldx, y, &ldy );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t labrd( const fortran_int_t m, const fortran_int_t n,
const fortran_int_t nb, double* a, const fortran_int_t lda, double* d,
double* e, double* tauq, double* taup, double* x,
const fortran_int_t ldx, double* y, const fortran_int_t ldy ) {
fortran_int_t info(0);
LAPACK_DLABRD( &m, &n, &nb, a, &lda, d, e, tauq, taup, x, &ldx, y, &ldy );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t labrd( const fortran_int_t m, const fortran_int_t n,
const fortran_int_t nb, std::complex<float>* a,
const fortran_int_t lda, float* d, float* e,
std::complex<float>* tauq, std::complex<float>* taup,
std::complex<float>* x, const fortran_int_t ldx,
std::complex<float>* y, const fortran_int_t ldy ) {
fortran_int_t info(0);
LAPACK_CLABRD( &m, &n, &nb, a, &lda, d, e, tauq, taup, x, &ldx, y, &ldy );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t labrd( const fortran_int_t m, const fortran_int_t n,
const fortran_int_t nb, std::complex<double>* a,
const fortran_int_t lda, double* d, double* e,
std::complex<double>* tauq, std::complex<double>* taup,
std::complex<double>* x, const fortran_int_t ldx,
std::complex<double>* y, const fortran_int_t ldy ) {
fortran_int_t info(0);
LAPACK_ZLABRD( &m, &n, &nb, a, &lda, d, e, tauq, taup, x, &ldx, y, &ldy );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to labrd.
//
template< typename Value, typename Enable = void >
struct labrd_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct labrd_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorD, typename VectorE,
typename VectorTAUQ, typename VectorTAUP, typename MatrixX,
typename MatrixY >
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
VectorTAUQ& tauq, VectorTAUP& taup, MatrixX& x, MatrixY& y ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixY >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorD >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorE >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorTAUQ >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorTAUP >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUQ >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUP >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixY >::value) );
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(a) );
BOOST_ASSERT( bindings::size(e) >= bindings::size_column(a) );
BOOST_ASSERT( bindings::size(taup) >= bindings::size_column(a) );
BOOST_ASSERT( bindings::size(tauq) >= bindings::size_column(a) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
bindings::stride_minor(x) == 1 );
BOOST_ASSERT( bindings::size_minor(y) == 1 ||
bindings::stride_minor(y) == 1 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(a)) );
BOOST_ASSERT( bindings::stride_major(x) >= bindings::size_row(a) );
BOOST_ASSERT( bindings::stride_major(y) >= bindings::size_column(a) );
return detail::labrd( bindings::size_row(a), bindings::size_column(a),
bindings::size_column(a), bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(d),
bindings::begin_value(e), bindings::begin_value(tauq),
bindings::begin_value(taup), bindings::begin_value(x),
bindings::stride_major(x), bindings::begin_value(y),
bindings::stride_major(y) );
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct labrd_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorD, typename VectorE,
typename VectorTAUQ, typename VectorTAUP, typename MatrixX,
typename MatrixY >
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
VectorTAUQ& tauq, VectorTAUP& taup, MatrixX& x, MatrixY& y ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixY >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorE >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorTAUQ >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorTAUP >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixX >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUQ >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUP >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixY >::value) );
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(a) );
BOOST_ASSERT( bindings::size(e) >= bindings::size_column(a) );
BOOST_ASSERT( bindings::size(taup) >= bindings::size_column(a) );
BOOST_ASSERT( bindings::size(tauq) >= bindings::size_column(a) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
bindings::stride_minor(x) == 1 );
BOOST_ASSERT( bindings::size_minor(y) == 1 ||
bindings::stride_minor(y) == 1 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(a)) );
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(a)) );
BOOST_ASSERT( bindings::stride_major(y) >= std::max< std::ptrdiff_t >(1,
bindings::size_column(a)) );
return detail::labrd( bindings::size_row(a), bindings::size_column(a),
bindings::size_column(a), bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(d),
bindings::begin_value(e), bindings::begin_value(tauq),
bindings::begin_value(taup), bindings::begin_value(x),
bindings::stride_major(x), bindings::begin_value(y),
bindings::stride_major(y) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the labrd_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for labrd. Its overload differs for
//
template< typename MatrixA, typename VectorD, typename VectorE,
typename VectorTAUQ, typename VectorTAUP, typename MatrixX,
typename MatrixY >
inline std::ptrdiff_t labrd( MatrixA& a, VectorD& d, VectorE& e,
VectorTAUQ& tauq, VectorTAUP& taup, MatrixX& x, MatrixY& y ) {
return labrd_impl< typename bindings::value_type<
MatrixA >::type >::invoke( a, d, e, tauq, taup, x, y );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,122 @@
//
// 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_LAPACK_AUXILIARY_LACGV_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LACGV_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 LAPACK-backend for lacgv is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t lacgv( const fortran_int_t n, std::complex<float>* x,
const fortran_int_t incx ) {
fortran_int_t info(0);
LAPACK_CLACGV( &n, x, &incx );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t lacgv( const fortran_int_t n, std::complex<double>* x,
const fortran_int_t incx ) {
fortran_int_t info(0);
LAPACK_ZLACGV( &n, x, &incx );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lacgv.
//
template< typename Value >
struct lacgv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorX >
static std::ptrdiff_t invoke( const fortran_int_t n, VectorX& x,
const fortran_int_t incx ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_ASSERT( n >= 0 );
return detail::lacgv( n, bindings::begin_value(x), incx );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lacgv_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lacgv. Its overload differs for
//
template< typename VectorX >
inline std::ptrdiff_t lacgv( const fortran_int_t n, VectorX& x,
const fortran_int_t incx ) {
return lacgv_impl< typename bindings::value_type<
VectorX >::type >::invoke( n, x, incx );
}
} // namespace lapack
} // 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_LAPACK_AUXILIARY_LACON_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LACON_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.hpp>
#include <boost/numeric/bindings/lapack/workspace.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for lacon is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t lacon( const fortran_int_t n, float* v, float* x,
fortran_int_t* isgn, float& est, fortran_int_t& kase ) {
fortran_int_t info(0);
LAPACK_SLACON( &n, v, x, isgn, &est, &kase );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t lacon( const fortran_int_t n, double* v, double* x,
fortran_int_t* isgn, double& est, fortran_int_t& kase ) {
fortran_int_t info(0);
LAPACK_DLACON( &n, v, x, isgn, &est, &kase );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t lacon( const fortran_int_t n, std::complex<float>* v,
std::complex<float>* x, float& est, fortran_int_t& kase ) {
fortran_int_t info(0);
LAPACK_CLACON( &n, v, x, &est, &kase );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t lacon( const fortran_int_t n, std::complex<double>* v,
std::complex<double>* x, double& est, fortran_int_t& kase ) {
fortran_int_t info(0);
LAPACK_ZLACON( &n, v, x, &est, &kase );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lacon.
//
template< typename Value, typename Enable = void >
struct lacon_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct lacon_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename V, typename ISGN >
static std::ptrdiff_t invoke( const fortran_int_t n, VectorX& x,
real_type& est, fortran_int_t& kase, detail::workspace2< V,
ISGN > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
min_size_isgn( n ));
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_v( n ));
BOOST_ASSERT( n >= 1 );
return detail::lacon( n,
bindings::begin_value(work.select(real_type())),
bindings::begin_value(x),
bindings::begin_value(work.select(fortran_int_t())), est,
kase );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename VectorX >
static std::ptrdiff_t invoke( const fortran_int_t n, VectorX& x,
real_type& est, fortran_int_t& kase, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_v( min_size_v( n ) );
bindings::detail::array<
fortran_int_t > tmp_isgn( min_size_isgn( n ) );
return invoke( n, x, est, kase, workspace( tmp_v, tmp_isgn ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename VectorX >
static std::ptrdiff_t invoke( const fortran_int_t n, VectorX& x,
real_type& est, fortran_int_t& kase, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( n, x, est, kase, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array v.
//
static std::ptrdiff_t min_size_v( const std::ptrdiff_t n ) {
return n;
}
//
// Static member function that returns the minimum size of
// workspace-array isgn.
//
static std::ptrdiff_t min_size_isgn( const std::ptrdiff_t n ) {
return n;
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct lacon_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename V >
static std::ptrdiff_t invoke( const fortran_int_t n, VectorX& x,
real_type& est, fortran_int_t& kase, detail::workspace1<
V > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
min_size_v( n ));
BOOST_ASSERT( n >= 1 );
return detail::lacon( n,
bindings::begin_value(work.select(value_type())),
bindings::begin_value(x), est, kase );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename VectorX >
static std::ptrdiff_t invoke( const fortran_int_t n, VectorX& x,
real_type& est, fortran_int_t& kase, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< value_type > tmp_v( min_size_v( n ) );
return invoke( n, x, est, kase, workspace( tmp_v ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename VectorX >
static std::ptrdiff_t invoke( const fortran_int_t n, VectorX& x,
real_type& est, fortran_int_t& kase, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( n, x, est, kase, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array v.
//
static std::ptrdiff_t min_size_v( const std::ptrdiff_t n ) {
return n;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lacon_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lacon. Its overload differs for
// * User-defined workspace
//
template< typename VectorX, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lacon( const fortran_int_t n, VectorX& x, typename remove_imaginary<
typename bindings::value_type< VectorX >::type >::type& est,
fortran_int_t& kase, Workspace work ) {
return lacon_impl< typename bindings::value_type<
VectorX >::type >::invoke( n, x, est, kase, work );
}
//
// Overloaded function for lacon. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename VectorX >
inline typename boost::disable_if< detail::is_workspace< VectorX >,
std::ptrdiff_t >::type
lacon( const fortran_int_t n, VectorX& x, typename remove_imaginary<
typename bindings::value_type< VectorX >::type >::type& est,
fortran_int_t& kase ) {
return lacon_impl< typename bindings::value_type<
VectorX >::type >::invoke( n, x, est, kase, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,287 @@
//
// 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_LAPACK_AUXILIARY_LAEBZ_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LAEBZ_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for laebz is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t laebz( const fortran_int_t ijob,
const fortran_int_t nitmax, const fortran_int_t n,
const fortran_int_t mmax, const fortran_int_t minp,
const fortran_int_t nbmin, const float abstol, const float reltol,
const float pivmin, const float* d, const float* e, const float* e2,
fortran_int_t* nval, float* ab, float* c, fortran_int_t& mout,
fortran_int_t* nab, float* work, fortran_int_t* iwork ) {
fortran_int_t info(0);
LAPACK_SLAEBZ( &ijob, &nitmax, &n, &mmax, &minp, &nbmin, &abstol, &reltol,
&pivmin, d, e, e2, nval, ab, c, &mout, nab, work, iwork, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t laebz( const fortran_int_t ijob,
const fortran_int_t nitmax, const fortran_int_t n,
const fortran_int_t mmax, const fortran_int_t minp,
const fortran_int_t nbmin, const double abstol, const double reltol,
const double pivmin, const double* d, const double* e,
const double* e2, fortran_int_t* nval, double* ab, double* c,
fortran_int_t& mout, fortran_int_t* nab, double* work,
fortran_int_t* iwork ) {
fortran_int_t info(0);
LAPACK_DLAEBZ( &ijob, &nitmax, &n, &mmax, &minp, &nbmin, &abstol, &reltol,
&pivmin, d, e, e2, nval, ab, c, &mout, nab, work, iwork, &info );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to laebz.
//
template< typename Value >
struct laebz_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorNVAL, typename MatrixAB, typename VectorC,
typename MatrixNAB, typename WORK, typename IWORK >
static std::ptrdiff_t invoke( const fortran_int_t ijob,
const fortran_int_t nitmax, const fortran_int_t n,
const fortran_int_t minp, const fortran_int_t nbmin,
const real_type abstol, const real_type reltol,
const real_type pivmin, const VectorD& d, const VectorE& e,
const VectorE2& e2, VectorNVAL& nval, MatrixAB& ab, VectorC& c,
fortran_int_t& mout, MatrixNAB& nab, detail::workspace2< WORK,
IWORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorE >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorE2 >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixAB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorNVAL >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixNAB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorNVAL >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixNAB >::value) );
BOOST_ASSERT( bindings::size(d) >= n );
BOOST_ASSERT( bindings::size(e) >= n );
BOOST_ASSERT( bindings::size(e2) >= n );
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
min_size_iwork( bindings::stride_major(ab) ));
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( bindings::stride_major(ab) ));
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
bindings::stride_minor(ab) == 1 );
return detail::laebz( ijob, nitmax, n, bindings::stride_major(ab),
minp, nbmin, abstol, reltol, pivmin, bindings::begin_value(d),
bindings::begin_value(e), bindings::begin_value(e2),
bindings::begin_value(nval), bindings::begin_value(ab),
bindings::begin_value(c), mout, bindings::begin_value(nab),
bindings::begin_value(work.select(real_type())),
bindings::begin_value(work.select(fortran_int_t())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorNVAL, typename MatrixAB, typename VectorC,
typename MatrixNAB >
static std::ptrdiff_t invoke( const fortran_int_t ijob,
const fortran_int_t nitmax, const fortran_int_t n,
const fortran_int_t minp, const fortran_int_t nbmin,
const real_type abstol, const real_type reltol,
const real_type pivmin, const VectorD& d, const VectorE& e,
const VectorE2& e2, VectorNVAL& nval, MatrixAB& ab, VectorC& c,
fortran_int_t& mout, MatrixNAB& nab, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work(
bindings::stride_major(ab) ) );
bindings::detail::array< fortran_int_t > tmp_iwork(
min_size_iwork( bindings::stride_major(ab) ) );
return invoke( ijob, nitmax, n, minp, nbmin, abstol, reltol, pivmin,
d, e, e2, nval, ab, c, mout, nab, workspace( tmp_work,
tmp_iwork ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorNVAL, typename MatrixAB, typename VectorC,
typename MatrixNAB >
static std::ptrdiff_t invoke( const fortran_int_t ijob,
const fortran_int_t nitmax, const fortran_int_t n,
const fortran_int_t minp, const fortran_int_t nbmin,
const real_type abstol, const real_type reltol,
const real_type pivmin, const VectorD& d, const VectorE& e,
const VectorE2& e2, VectorNVAL& nval, MatrixAB& ab, VectorC& c,
fortran_int_t& mout, MatrixNAB& nab, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( ijob, nitmax, n, minp, nbmin, abstol, reltol, pivmin,
d, e, e2, nval, ab, c, mout, nab, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t mmax ) {
return mmax;
}
//
// Static member function that returns the minimum size of
// workspace-array iwork.
//
static std::ptrdiff_t min_size_iwork( const std::ptrdiff_t mmax ) {
return mmax;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the laebz_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for laebz. Its overload differs for
// * User-defined workspace
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorNVAL, typename MatrixAB, typename VectorC,
typename MatrixNAB, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
laebz( const fortran_int_t ijob, const fortran_int_t nitmax,
const fortran_int_t n, const fortran_int_t minp,
const fortran_int_t nbmin, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type abstol,
const typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type reltol, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type pivmin,
const VectorD& d, const VectorE& e, const VectorE2& e2,
VectorNVAL& nval, MatrixAB& ab, VectorC& c, fortran_int_t& mout,
MatrixNAB& nab, Workspace work ) {
return laebz_impl< typename bindings::value_type<
VectorD >::type >::invoke( ijob, nitmax, n, minp, nbmin, abstol,
reltol, pivmin, d, e, e2, nval, ab, c, mout, nab, work );
}
//
// Overloaded function for laebz. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorNVAL, typename MatrixAB, typename VectorC,
typename MatrixNAB >
inline typename boost::disable_if< detail::is_workspace< MatrixNAB >,
std::ptrdiff_t >::type
laebz( const fortran_int_t ijob, const fortran_int_t nitmax,
const fortran_int_t n, const fortran_int_t minp,
const fortran_int_t nbmin, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type abstol,
const typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type reltol, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type pivmin,
const VectorD& d, const VectorE& e, const VectorE2& e2,
VectorNVAL& nval, MatrixAB& ab, VectorC& c, fortran_int_t& mout,
MatrixNAB& nab ) {
return laebz_impl< typename bindings::value_type<
VectorD >::type >::invoke( ijob, nitmax, n, minp, nbmin, abstol,
reltol, pivmin, d, e, e2, nval, ab, c, mout, nab,
optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,425 @@
//
// 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_LAPACK_AUXILIARY_LALSD_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LALSD_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.hpp>
#include <boost/numeric/bindings/lapack/workspace.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for lalsd is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t lalsd( const char uplo, const fortran_int_t smlsiz,
const fortran_int_t n, const fortran_int_t nrhs, float* d, float* e,
float* b, const fortran_int_t ldb, const float rcond,
fortran_int_t& rank, float* work, fortran_int_t* iwork ) {
fortran_int_t info(0);
LAPACK_SLALSD( &uplo, &smlsiz, &n, &nrhs, d, e, b, &ldb, &rcond, &rank,
work, iwork, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t lalsd( const char uplo, const fortran_int_t smlsiz,
const fortran_int_t n, const fortran_int_t nrhs, double* d, double* e,
double* b, const fortran_int_t ldb, const double rcond,
fortran_int_t& rank, double* work, fortran_int_t* iwork ) {
fortran_int_t info(0);
LAPACK_DLALSD( &uplo, &smlsiz, &n, &nrhs, d, e, b, &ldb, &rcond, &rank,
work, iwork, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t lalsd( const char uplo, const fortran_int_t smlsiz,
const fortran_int_t n, const fortran_int_t nrhs, float* d, float* e,
std::complex<float>* b, const fortran_int_t ldb, const float rcond,
fortran_int_t& rank, std::complex<float>* work, float* rwork,
fortran_int_t* iwork ) {
fortran_int_t info(0);
LAPACK_CLALSD( &uplo, &smlsiz, &n, &nrhs, d, e, b, &ldb, &rcond, &rank,
work, rwork, iwork, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t lalsd( const char uplo, const fortran_int_t smlsiz,
const fortran_int_t n, const fortran_int_t nrhs, double* d, double* e,
std::complex<double>* b, const fortran_int_t ldb, const double rcond,
fortran_int_t& rank, std::complex<double>* work, double* rwork,
fortran_int_t* iwork ) {
fortran_int_t info(0);
LAPACK_ZLALSD( &uplo, &smlsiz, &n, &nrhs, d, e, b, &ldb, &rcond, &rank,
work, rwork, iwork, &info );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lalsd.
//
template< typename Value, typename Enable = void >
struct lalsd_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct lalsd_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorD, typename VectorE, typename MatrixB,
typename WORK, typename IWORK >
static std::ptrdiff_t invoke( const char uplo,
const fortran_int_t smlsiz, const fortran_int_t n,
VectorD& d, VectorE& e, MatrixB& b, const real_type rcond,
fortran_int_t& rank, detail::workspace2< WORK, IWORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorE >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
std::ptrdiff_t nlvl = std::max< std::ptrdiff_t >( 0,
static_cast<std::ptrdiff_t>(
std::log(static_cast<real_type>(n)/static_cast<real_type>(smlsiz+
1)) /
std::log(static_cast<real_type>(2.)) ) + 1 );
BOOST_ASSERT( bindings::size(e) >= n-1 );
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
min_size_iwork( n, nlvl ));
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( n, smlsiz, nlvl, bindings::size_column(b) ));
BOOST_ASSERT( bindings::size_column(b) >= 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
n) );
BOOST_ASSERT( n >= 0 );
return detail::lalsd( uplo, smlsiz, n, bindings::size_column(b),
bindings::begin_value(d), bindings::begin_value(e),
bindings::begin_value(b), bindings::stride_major(b), rcond,
rank, bindings::begin_value(work.select(real_type())),
bindings::begin_value(work.select(fortran_int_t())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename VectorD, typename VectorE, typename MatrixB >
static std::ptrdiff_t invoke( const char uplo,
const fortran_int_t smlsiz, const fortran_int_t n,
VectorD& d, VectorE& e, MatrixB& b, const real_type rcond,
fortran_int_t& rank, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
std::ptrdiff_t nlvl = std::max< std::ptrdiff_t >( 0,
static_cast<std::ptrdiff_t>(
std::log(static_cast<real_type>(n)/static_cast<real_type>(smlsiz+
1)) /
std::log(static_cast<real_type>(2.)) ) + 1 );
bindings::detail::array< real_type > tmp_work( min_size_work( n,
smlsiz, nlvl, bindings::size_column(b) ) );
bindings::detail::array< fortran_int_t > tmp_iwork(
min_size_iwork( n, nlvl ) );
return invoke( uplo, smlsiz, n, d, e, b, rcond, rank,
workspace( tmp_work, tmp_iwork ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename VectorD, typename VectorE, typename MatrixB >
static std::ptrdiff_t invoke( const char uplo,
const fortran_int_t smlsiz, const fortran_int_t n,
VectorD& d, VectorE& e, MatrixB& b, const real_type rcond,
fortran_int_t& rank, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( uplo, smlsiz, n, d, e, b, rcond, rank,
minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t n,
const std::ptrdiff_t smlsiz, const std::ptrdiff_t nlvl,
const std::ptrdiff_t nrhs ) {
std::ptrdiff_t smlsiz_plus_one = smlsiz + 1;
return 9*n + 2*n*smlsiz + 8*n*nlvl + n*nrhs +
smlsiz_plus_one * smlsiz_plus_one;
}
//
// Static member function that returns the minimum size of
// workspace-array iwork.
//
static std::ptrdiff_t min_size_iwork( const std::ptrdiff_t n,
const std::ptrdiff_t nlvl ) {
return 3*n*nlvl + 11*n;
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct lalsd_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorD, typename VectorE, typename MatrixB,
typename WORK, typename RWORK, typename IWORK >
static std::ptrdiff_t invoke( const char uplo,
const fortran_int_t smlsiz, const fortran_int_t n,
VectorD& d, VectorE& e, MatrixB& b, const real_type rcond,
fortran_int_t& rank, detail::workspace3< WORK, RWORK,
IWORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorE >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
std::ptrdiff_t nlvl = std::max< std::ptrdiff_t >( 0,
static_cast<std::ptrdiff_t>(
std::log(static_cast<real_type>(n)/
static_cast<real_type>(smlsiz+1)) /
std::log(static_cast<real_type>(2.))) + 1 );
BOOST_ASSERT( bindings::size(e) >= n-1 );
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
min_size_iwork( n, nlvl ));
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_rwork( n, smlsiz, nlvl, bindings::size_column(b) ));
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
min_size_work( n, bindings::size_column(b) ));
BOOST_ASSERT( bindings::size_column(b) >= 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
n) );
BOOST_ASSERT( n >= 0 );
return detail::lalsd( uplo, smlsiz, n, bindings::size_column(b),
bindings::begin_value(d), bindings::begin_value(e),
bindings::begin_value(b), bindings::stride_major(b), rcond,
rank, bindings::begin_value(work.select(value_type())),
bindings::begin_value(work.select(real_type())),
bindings::begin_value(work.select(fortran_int_t())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename VectorD, typename VectorE, typename MatrixB >
static std::ptrdiff_t invoke( const char uplo,
const fortran_int_t smlsiz, const fortran_int_t n,
VectorD& d, VectorE& e, MatrixB& b, const real_type rcond,
fortran_int_t& rank, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
std::ptrdiff_t nlvl = std::max< std::ptrdiff_t >( 0,
static_cast<std::ptrdiff_t>(
std::log(static_cast<real_type>(n)/
static_cast<real_type>(smlsiz+1)) /
std::log(static_cast<real_type>(2.))) + 1 );
bindings::detail::array< value_type > tmp_work( min_size_work( n,
bindings::size_column(b) ) );
bindings::detail::array< real_type > tmp_rwork( min_size_rwork( n,
smlsiz, nlvl, bindings::size_column(b) ) );
bindings::detail::array< fortran_int_t > tmp_iwork(
min_size_iwork( n, nlvl ) );
return invoke( uplo, smlsiz, n, d, e, b, rcond, rank,
workspace( tmp_work, tmp_rwork, tmp_iwork ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename VectorD, typename VectorE, typename MatrixB >
static std::ptrdiff_t invoke( const char uplo,
const fortran_int_t smlsiz, const fortran_int_t n,
VectorD& d, VectorE& e, MatrixB& b, const real_type rcond,
fortran_int_t& rank, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( uplo, smlsiz, n, d, e, b, rcond, rank,
minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t n,
const std::ptrdiff_t nrhs ) {
return n*nrhs;
}
//
// Static member function that returns the minimum size of
// workspace-array rwork.
//
static std::ptrdiff_t min_size_rwork( const std::ptrdiff_t n,
const std::ptrdiff_t smlsiz, const std::ptrdiff_t nlvl,
const std::ptrdiff_t nrhs ) {
std::ptrdiff_t smlsiz_plus_one = smlsiz + 1;
return 9*n + 2*n*smlsiz + 8*n*nlvl + 3*smlsiz*nrhs +
smlsiz_plus_one * smlsiz_plus_one;
}
//
// Static member function that returns the minimum size of
// workspace-array iwork.
//
static std::ptrdiff_t min_size_iwork( const std::ptrdiff_t n,
const std::ptrdiff_t nlvl ) {
return 3*n*nlvl+11*n;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lalsd_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lalsd. Its overload differs for
// * User-defined workspace
//
template< typename VectorD, typename VectorE, typename MatrixB,
typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lalsd( const char uplo, const fortran_int_t smlsiz,
const fortran_int_t n, VectorD& d, VectorE& e, MatrixB& b,
const typename remove_imaginary< typename bindings::value_type<
MatrixB >::type >::type rcond, fortran_int_t& rank,
Workspace work ) {
return lalsd_impl< typename bindings::value_type<
MatrixB >::type >::invoke( uplo, smlsiz, n, d, e, b, rcond, rank,
work );
}
//
// Overloaded function for lalsd. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename VectorD, typename VectorE, typename MatrixB >
inline typename boost::disable_if< detail::is_workspace< MatrixB >,
std::ptrdiff_t >::type
lalsd( const char uplo, const fortran_int_t smlsiz,
const fortran_int_t n, VectorD& d, VectorE& e, MatrixB& b,
const typename remove_imaginary< typename bindings::value_type<
MatrixB >::type >::type rcond, fortran_int_t& rank ) {
return lalsd_impl< typename bindings::value_type<
MatrixB >::type >::invoke( uplo, smlsiz, n, d, e, b, rcond, rank,
optimal_workspace() );
}
} // namespace lapack
} // 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_LAPACK_AUXILIARY_LANGB_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANGB_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for langb is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t langb( const char norm, const fortran_int_t n,
const fortran_int_t kl, const fortran_int_t ku, const float* ab,
const fortran_int_t ldab, float* work ) {
fortran_int_t info(0);
LAPACK_SLANGB( &norm, &n, &kl, &ku, ab, &ldab, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t langb( const char norm, const fortran_int_t n,
const fortran_int_t kl, const fortran_int_t ku, const double* ab,
const fortran_int_t ldab, double* work ) {
fortran_int_t info(0);
LAPACK_DLANGB( &norm, &n, &kl, &ku, ab, &ldab, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t langb( const char norm, const fortran_int_t n,
const fortran_int_t kl, const fortran_int_t ku,
const std::complex<float>* ab, const fortran_int_t ldab,
float* work ) {
fortran_int_t info(0);
LAPACK_CLANGB( &norm, &n, &kl, &ku, ab, &ldab, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t langb( const char norm, const fortran_int_t n,
const fortran_int_t kl, const fortran_int_t ku,
const std::complex<double>* ab, const fortran_int_t ldab,
double* work ) {
fortran_int_t info(0);
LAPACK_ZLANGB( &norm, &n, &kl, &ku, ab, &ldab, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to langb.
//
template< typename Value >
struct langb_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAB, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
BOOST_ASSERT( bindings::bandwidth_lower(ab) >= 0 );
BOOST_ASSERT( bindings::bandwidth_upper(ab) >= 0 );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(ab) ));
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
bindings::stride_minor(ab) == 1 );
BOOST_ASSERT( bindings::stride_major(ab) >=
bindings::bandwidth_lower(ab)+bindings::bandwidth_upper(ab)+
1 );
return detail::langb( norm, bindings::size_column(ab),
bindings::bandwidth_lower(ab), bindings::bandwidth_upper(ab),
bindings::begin_value(ab), bindings::stride_major(ab),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixAB >
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(ab) ) );
return invoke( norm, ab, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixAB >
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( norm, ab, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the langb_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for langb. Its overload differs for
// * User-defined workspace
//
template< typename MatrixAB, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
langb( const char norm, const MatrixAB& ab, Workspace work ) {
return langb_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( norm, ab, work );
}
//
// Overloaded function for langb. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixAB >
inline typename boost::disable_if< detail::is_workspace< MatrixAB >,
std::ptrdiff_t >::type
langb( const char norm, const MatrixAB& ab ) {
return langb_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( norm, ab, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,218 @@
//
// 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_LAPACK_AUXILIARY_LANGE_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANGE_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lange is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t lange( const char norm, const fortran_int_t m,
const fortran_int_t n, const float* a, const fortran_int_t lda,
float* work ) {
fortran_int_t info(0);
LAPACK_SLANGE( &norm, &m, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t lange( const char norm, const fortran_int_t m,
const fortran_int_t n, const double* a, const fortran_int_t lda,
double* work ) {
fortran_int_t info(0);
LAPACK_DLANGE( &norm, &m, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t lange( const char norm, const fortran_int_t m,
const fortran_int_t n, const std::complex<float>* a,
const fortran_int_t lda, float* work ) {
fortran_int_t info(0);
LAPACK_CLANGE( &norm, &m, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t lange( const char norm, const fortran_int_t m,
const fortran_int_t n, const std::complex<double>* a,
const fortran_int_t lda, double* work ) {
fortran_int_t info(0);
LAPACK_ZLANGE( &norm, &m, &n, a, &lda, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lange.
//
template< typename Value >
struct lange_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_row(a) ));
BOOST_ASSERT( bindings::size_column(a) >= 0 );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_row(a) >= 0 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max<
std::ptrdiff_t >(bindings::size_row(a),1) );
return detail::lange( norm, bindings::size_row(a),
bindings::size_column(a), bindings::begin_value(a),
bindings::stride_major(a),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_row(a) ) );
return invoke( norm, a, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( norm, a, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t m ) {
if ( norm == 'I' )
return std::max< std::ptrdiff_t >( 1, m );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lange_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lange. Its overload differs for
// * User-defined workspace
//
template< typename MatrixA, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lange( const char norm, const MatrixA& a, Workspace work ) {
return lange_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, work );
}
//
// Overloaded function for lange. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixA >
inline typename boost::disable_if< detail::is_workspace< MatrixA >,
std::ptrdiff_t >::type
lange( const char norm, const MatrixA& a ) {
return lange_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, optimal_workspace() );
}
} // namespace lapack
} // 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_LAPACK_AUXILIARY_LANHB_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANHB_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lanhb is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lanhb( const char norm, const UpLo,
const fortran_int_t n, const fortran_int_t k,
const std::complex<float>* ab, const fortran_int_t ldab,
float* work ) {
fortran_int_t info(0);
LAPACK_CLANHB( &norm, &lapack_option< UpLo >::value, &n, &k, ab, &ldab,
work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lanhb( const char norm, const UpLo,
const fortran_int_t n, const fortran_int_t k,
const std::complex<double>* ab, const fortran_int_t ldab,
double* work ) {
fortran_int_t info(0);
LAPACK_ZLANHB( &norm, &lapack_option< UpLo >::value, &n, &k, ab, &ldab,
work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lanhb.
//
template< typename Value >
struct lanhb_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAB, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
BOOST_ASSERT( bindings::bandwidth_lower(ab) >= 0 );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(ab) ));
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
bindings::stride_minor(ab) == 1 );
BOOST_ASSERT( bindings::stride_major(ab) >=
bindings::bandwidth_lower(ab)+1 );
return detail::lanhb( norm, uplo(), bindings::size_column(ab),
bindings::bandwidth_lower(ab), bindings::begin_value(ab),
bindings::stride_major(ab),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixAB >
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(ab) ) );
return invoke( norm, ab, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixAB >
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
return invoke( norm, ab, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' || norm == '1' || norm == 'O' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lanhb_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lanhb. Its overload differs for
// * User-defined workspace
//
template< typename MatrixAB, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lanhb( const char norm, const MatrixAB& ab, Workspace work ) {
return lanhb_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( norm, ab, work );
}
//
// Overloaded function for lanhb. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixAB >
inline typename boost::disable_if< detail::is_workspace< MatrixAB >,
std::ptrdiff_t >::type
lanhb( const char norm, const MatrixAB& ab ) {
return lanhb_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( norm, ab, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,196 @@
//
// 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_LAPACK_AUXILIARY_LANHE_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANHE_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lanhe is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lanhe( const char norm, const UpLo,
const fortran_int_t n, const std::complex<float>* a,
const fortran_int_t lda, float* work ) {
fortran_int_t info(0);
LAPACK_CLANHE( &norm, &lapack_option< UpLo >::value, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lanhe( const char norm, const UpLo,
const fortran_int_t n, const std::complex<double>* a,
const fortran_int_t lda, double* work ) {
fortran_int_t info(0);
LAPACK_ZLANHE( &norm, &lapack_option< UpLo >::value, &n, a, &lda, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lanhe.
//
template< typename Value >
struct lanhe_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(a) ));
BOOST_ASSERT( bindings::size_column(a) >= 0 );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max<
std::ptrdiff_t >(bindings::size_column(a),1) );
return detail::lanhe( norm, uplo(), bindings::size_column(a),
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(a) ) );
return invoke( norm, a, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
return invoke( norm, a, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' || norm == '1' || norm == 'O' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lanhe_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lanhe. Its overload differs for
// * User-defined workspace
//
template< typename MatrixA, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lanhe( const char norm, const MatrixA& a, Workspace work ) {
return lanhe_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, work );
}
//
// Overloaded function for lanhe. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixA >
inline typename boost::disable_if< detail::is_workspace< MatrixA >,
std::ptrdiff_t >::type
lanhe( const char norm, const MatrixA& a ) {
return lanhe_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,188 @@
//
// 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_LAPACK_AUXILIARY_LANHP_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANHP_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lanhp is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lanhp( const char norm, const UpLo,
const fortran_int_t n, const std::complex<float>* ap, float* work ) {
fortran_int_t info(0);
LAPACK_CLANHP( &norm, &lapack_option< UpLo >::value, &n, ap, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lanhp( const char norm, const UpLo,
const fortran_int_t n, const std::complex<double>* ap, double* work ) {
fortran_int_t info(0);
LAPACK_ZLANHP( &norm, &lapack_option< UpLo >::value, &n, ap, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lanhp.
//
template< typename Value >
struct lanhp_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAP, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixAP& ap,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(ap) ));
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
return detail::lanhp( norm, uplo(), bindings::size_column(ap),
bindings::begin_value(ap),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixAP >
static std::ptrdiff_t invoke( const char norm, const MatrixAP& ap,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(ap) ) );
return invoke( norm, ap, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixAP >
static std::ptrdiff_t invoke( const char norm, const MatrixAP& ap,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
return invoke( norm, ap, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' || norm == '1' || norm == 'O' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lanhp_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lanhp. Its overload differs for
// * User-defined workspace
//
template< typename MatrixAP, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lanhp( const char norm, const MatrixAP& ap, Workspace work ) {
return lanhp_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( norm, ap, work );
}
//
// Overloaded function for lanhp. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixAP >
inline typename boost::disable_if< detail::is_workspace< MatrixAP >,
std::ptrdiff_t >::type
lanhp( const char norm, const MatrixAP& ap ) {
return lanhp_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( norm, ap, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,213 @@
//
// 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_LAPACK_AUXILIARY_LANHS_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANHS_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lanhs is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t lanhs( const char norm, const fortran_int_t n,
const float* a, const fortran_int_t lda, float* work ) {
fortran_int_t info(0);
LAPACK_SLANHS( &norm, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t lanhs( const char norm, const fortran_int_t n,
const double* a, const fortran_int_t lda, double* work ) {
fortran_int_t info(0);
LAPACK_DLANHS( &norm, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t lanhs( const char norm, const fortran_int_t n,
const std::complex<float>* a, const fortran_int_t lda, float* work ) {
fortran_int_t info(0);
LAPACK_CLANHS( &norm, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t lanhs( const char norm, const fortran_int_t n,
const std::complex<double>* a, const fortran_int_t lda,
double* work ) {
fortran_int_t info(0);
LAPACK_ZLANHS( &norm, &n, a, &lda, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lanhs.
//
template< typename Value >
struct lanhs_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(a) ));
BOOST_ASSERT( bindings::size_column(a) >= 0 );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max<
std::ptrdiff_t >(bindings::size_column(a),1) );
return detail::lanhs( norm, bindings::size_column(a),
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(a) ) );
return invoke( norm, a, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( norm, a, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lanhs_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lanhs. Its overload differs for
// * User-defined workspace
//
template< typename MatrixA, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lanhs( const char norm, const MatrixA& a, Workspace work ) {
return lanhs_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, work );
}
//
// Overloaded function for lanhs. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixA >
inline typename boost::disable_if< detail::is_workspace< MatrixA >,
std::ptrdiff_t >::type
lanhs( const char norm, const MatrixA& a ) {
return lanhs_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,233 @@
//
// 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_LAPACK_AUXILIARY_LANSB_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANSB_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lansb is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansb( const char norm, const UpLo,
const fortran_int_t n, const fortran_int_t k, const float* ab,
const fortran_int_t ldab, float* work ) {
fortran_int_t info(0);
LAPACK_SLANSB( &norm, &lapack_option< UpLo >::value, &n, &k, ab, &ldab,
work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansb( const char norm, const UpLo,
const fortran_int_t n, const fortran_int_t k, const double* ab,
const fortran_int_t ldab, double* work ) {
fortran_int_t info(0);
LAPACK_DLANSB( &norm, &lapack_option< UpLo >::value, &n, &k, ab, &ldab,
work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansb( const char norm, const UpLo,
const fortran_int_t n, const fortran_int_t k,
const std::complex<float>* ab, const fortran_int_t ldab,
float* work ) {
fortran_int_t info(0);
LAPACK_CLANSB( &norm, &lapack_option< UpLo >::value, &n, &k, ab, &ldab,
work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansb( const char norm, const UpLo,
const fortran_int_t n, const fortran_int_t k,
const std::complex<double>* ab, const fortran_int_t ldab,
double* work ) {
fortran_int_t info(0);
LAPACK_ZLANSB( &norm, &lapack_option< UpLo >::value, &n, &k, ab, &ldab,
work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lansb.
//
template< typename Value >
struct lansb_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAB, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
BOOST_ASSERT( bindings::bandwidth_lower(ab) >= 0 );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(ab) ));
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
bindings::stride_minor(ab) == 1 );
BOOST_ASSERT( bindings::stride_major(ab) >=
bindings::bandwidth_lower(ab)+1 );
return detail::lansb( norm, uplo(), bindings::size_column(ab),
bindings::bandwidth_lower(ab), bindings::begin_value(ab),
bindings::stride_major(ab),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixAB >
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(ab) ) );
return invoke( norm, ab, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixAB >
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
return invoke( norm, ab, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' || norm == '1' || norm == 'O' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lansb_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lansb. Its overload differs for
// * User-defined workspace
//
template< typename MatrixAB, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lansb( const char norm, const MatrixAB& ab, Workspace work ) {
return lansb_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( norm, ab, work );
}
//
// Overloaded function for lansb. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixAB >
inline typename boost::disable_if< detail::is_workspace< MatrixAB >,
std::ptrdiff_t >::type
lansb( const char norm, const MatrixAB& ab ) {
return lansb_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( norm, ab, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,214 @@
//
// 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_LAPACK_AUXILIARY_LANSP_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANSP_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lansp is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansp( const char norm, const UpLo,
const fortran_int_t n, const float* ap, float* work ) {
fortran_int_t info(0);
LAPACK_SLANSP( &norm, &lapack_option< UpLo >::value, &n, ap, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansp( const char norm, const UpLo,
const fortran_int_t n, const double* ap, double* work ) {
fortran_int_t info(0);
LAPACK_DLANSP( &norm, &lapack_option< UpLo >::value, &n, ap, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansp( const char norm, const UpLo,
const fortran_int_t n, const std::complex<float>* ap, float* work ) {
fortran_int_t info(0);
LAPACK_CLANSP( &norm, &lapack_option< UpLo >::value, &n, ap, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansp( const char norm, const UpLo,
const fortran_int_t n, const std::complex<double>* ap, double* work ) {
fortran_int_t info(0);
LAPACK_ZLANSP( &norm, &lapack_option< UpLo >::value, &n, ap, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lansp.
//
template< typename Value >
struct lansp_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAP, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixAP& ap,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(ap) ));
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
return detail::lansp( norm, uplo(), bindings::size_column(ap),
bindings::begin_value(ap),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixAP >
static std::ptrdiff_t invoke( const char norm, const MatrixAP& ap,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(ap) ) );
return invoke( norm, ap, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixAP >
static std::ptrdiff_t invoke( const char norm, const MatrixAP& ap,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
return invoke( norm, ap, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' || norm == '1' || norm == 'O' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lansp_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lansp. Its overload differs for
// * User-defined workspace
//
template< typename MatrixAP, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lansp( const char norm, const MatrixAP& ap, Workspace work ) {
return lansp_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( norm, ap, work );
}
//
// Overloaded function for lansp. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixAP >
inline typename boost::disable_if< detail::is_workspace< MatrixAP >,
std::ptrdiff_t >::type
lansp( const char norm, const MatrixAP& ap ) {
return lansp_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( norm, ap, optimal_workspace() );
}
} // namespace lapack
} // 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_LAPACK_AUXILIARY_LANSY_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANSY_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lansy is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansy( const char norm, const UpLo,
const fortran_int_t n, const float* a, const fortran_int_t lda,
float* work ) {
fortran_int_t info(0);
LAPACK_SLANSY( &norm, &lapack_option< UpLo >::value, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansy( const char norm, const UpLo,
const fortran_int_t n, const double* a, const fortran_int_t lda,
double* work ) {
fortran_int_t info(0);
LAPACK_DLANSY( &norm, &lapack_option< UpLo >::value, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansy( const char norm, const UpLo,
const fortran_int_t n, const std::complex<float>* a,
const fortran_int_t lda, float* work ) {
fortran_int_t info(0);
LAPACK_CLANSY( &norm, &lapack_option< UpLo >::value, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t lansy( const char norm, const UpLo,
const fortran_int_t n, const std::complex<double>* a,
const fortran_int_t lda, double* work ) {
fortran_int_t info(0);
LAPACK_ZLANSY( &norm, &lapack_option< UpLo >::value, &n, a, &lda, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lansy.
//
template< typename Value >
struct lansy_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(a) ));
BOOST_ASSERT( bindings::size_column(a) >= 0 );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max<
std::ptrdiff_t >(bindings::size_column(a),1) );
return detail::lansy( norm, uplo(), bindings::size_column(a),
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(a) ) );
return invoke( norm, a, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
return invoke( norm, a, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' || norm == '1' || norm == 'O' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lansy_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lansy. Its overload differs for
// * User-defined workspace
//
template< typename MatrixA, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lansy( const char norm, const MatrixA& a, Workspace work ) {
return lansy_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, work );
}
//
// Overloaded function for lansy. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixA >
inline typename boost::disable_if< detail::is_workspace< MatrixA >,
std::ptrdiff_t >::type
lansy( const char norm, const MatrixA& a ) {
return lansy_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,238 @@
//
// 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_LAPACK_AUXILIARY_LANTB_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANTB_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lantb is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename Diag >
inline std::ptrdiff_t lantb( const char norm, const char uplo, const Diag,
const fortran_int_t n, const fortran_int_t k, const float* ab,
const fortran_int_t ldab, float* work ) {
fortran_int_t info(0);
LAPACK_SLANTB( &norm, &uplo, &lapack_option< Diag >::value, &n, &k, ab,
&ldab, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename Diag >
inline std::ptrdiff_t lantb( const char norm, const char uplo, const Diag,
const fortran_int_t n, const fortran_int_t k, const double* ab,
const fortran_int_t ldab, double* work ) {
fortran_int_t info(0);
LAPACK_DLANTB( &norm, &uplo, &lapack_option< Diag >::value, &n, &k, ab,
&ldab, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename Diag >
inline std::ptrdiff_t lantb( const char norm, const char uplo, const Diag,
const fortran_int_t n, const fortran_int_t k,
const std::complex<float>* ab, const fortran_int_t ldab,
float* work ) {
fortran_int_t info(0);
LAPACK_CLANTB( &norm, &uplo, &lapack_option< Diag >::value, &n, &k, ab,
&ldab, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename Diag >
inline std::ptrdiff_t lantb( const char norm, const char uplo, const Diag,
const fortran_int_t n, const fortran_int_t k,
const std::complex<double>* ab, const fortran_int_t ldab,
double* work ) {
fortran_int_t info(0);
LAPACK_ZLANTB( &norm, &uplo, &lapack_option< Diag >::value, &n, &k, ab,
&ldab, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lantb.
//
template< typename Value >
struct lantb_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAB, typename WORK >
static std::ptrdiff_t invoke( const char norm, const char uplo,
const fortran_int_t k, const MatrixAB& ab, detail::workspace1<
WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::diag_tag< MatrixAB >::type diag;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(ab) ));
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
bindings::stride_minor(ab) == 1 );
BOOST_ASSERT( bindings::stride_major(ab) >= k+1 );
BOOST_ASSERT( k >= 0 );
return detail::lantb( norm, uplo, diag(), bindings::size_column(ab),
k, bindings::begin_value(ab), bindings::stride_major(ab),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixAB >
static std::ptrdiff_t invoke( const char norm, const char uplo,
const fortran_int_t k, const MatrixAB& ab,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::diag_tag< MatrixAB >::type diag;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(ab) ) );
return invoke( norm, uplo, k, ab, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixAB >
static std::ptrdiff_t invoke( const char norm, const char uplo,
const fortran_int_t k, const MatrixAB& ab,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::diag_tag< MatrixAB >::type diag;
return invoke( norm, uplo, k, ab, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lantb_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lantb. Its overload differs for
// * User-defined workspace
//
template< typename MatrixAB, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lantb( const char norm, const char uplo, const fortran_int_t k,
const MatrixAB& ab, Workspace work ) {
return lantb_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( norm, uplo, k, ab, work );
}
//
// Overloaded function for lantb. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixAB >
inline typename boost::disable_if< detail::is_workspace< MatrixAB >,
std::ptrdiff_t >::type
lantb( const char norm, const char uplo, const fortran_int_t k,
const MatrixAB& ab ) {
return lantb_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( norm, uplo, k, ab,
optimal_workspace() );
}
} // namespace lapack
} // 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_LAPACK_AUXILIARY_LANTP_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANTP_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lantp is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename Diag >
inline std::ptrdiff_t lantp( const char norm, const char uplo, const Diag,
const fortran_int_t n, const float* ap, float* work ) {
fortran_int_t info(0);
LAPACK_SLANTP( &norm, &uplo, &lapack_option< Diag >::value, &n, ap, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename Diag >
inline std::ptrdiff_t lantp( const char norm, const char uplo, const Diag,
const fortran_int_t n, const double* ap, double* work ) {
fortran_int_t info(0);
LAPACK_DLANTP( &norm, &uplo, &lapack_option< Diag >::value, &n, ap, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename Diag >
inline std::ptrdiff_t lantp( const char norm, const char uplo, const Diag,
const fortran_int_t n, const std::complex<float>* ap, float* work ) {
fortran_int_t info(0);
LAPACK_CLANTP( &norm, &uplo, &lapack_option< Diag >::value, &n, ap, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename Diag >
inline std::ptrdiff_t lantp( const char norm, const char uplo, const Diag,
const fortran_int_t n, const std::complex<double>* ap, double* work ) {
fortran_int_t info(0);
LAPACK_ZLANTP( &norm, &uplo, &lapack_option< Diag >::value, &n, ap, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lantp.
//
template< typename Value >
struct lantp_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAP, typename WORK >
static std::ptrdiff_t invoke( const char norm, const char uplo,
const MatrixAP& ap, detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::diag_tag< MatrixAP >::type diag;
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_column(ap) ));
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
return detail::lantp( norm, uplo, diag(), bindings::size_column(ap),
bindings::begin_value(ap),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixAP >
static std::ptrdiff_t invoke( const char norm, const char uplo,
const MatrixAP& ap, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::diag_tag< MatrixAP >::type diag;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_column(ap) ) );
return invoke( norm, uplo, ap, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixAP >
static std::ptrdiff_t invoke( const char norm, const char uplo,
const MatrixAP& ap, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::diag_tag< MatrixAP >::type diag;
return invoke( norm, uplo, ap, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t n ) {
if ( norm == 'I' )
return std::max< std::ptrdiff_t >( 1, n );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lantp_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lantp. Its overload differs for
// * User-defined workspace
//
template< typename MatrixAP, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lantp( const char norm, const char uplo, const MatrixAP& ap,
Workspace work ) {
return lantp_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( norm, uplo, ap, work );
}
//
// Overloaded function for lantp. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixAP >
inline typename boost::disable_if< detail::is_workspace< MatrixAP >,
std::ptrdiff_t >::type
lantp( const char norm, const char uplo, const MatrixAP& ap ) {
return lantp_impl< typename bindings::value_type<
MatrixAP >::type >::invoke( norm, uplo, ap, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,235 @@
//
// 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_LAPACK_AUXILIARY_LANTR_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LANTR_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/diag_tag.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for lantr is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename UpLo, typename Diag >
inline std::ptrdiff_t lantr( const char norm, const UpLo, const Diag,
const fortran_int_t m, const fortran_int_t n, const float* a,
const fortran_int_t lda, float* work ) {
fortran_int_t info(0);
LAPACK_SLANTR( &norm, &lapack_option< UpLo >::value, &lapack_option<
Diag >::value, &m, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename UpLo, typename Diag >
inline std::ptrdiff_t lantr( const char norm, const UpLo, const Diag,
const fortran_int_t m, const fortran_int_t n, const double* a,
const fortran_int_t lda, double* work ) {
fortran_int_t info(0);
LAPACK_DLANTR( &norm, &lapack_option< UpLo >::value, &lapack_option<
Diag >::value, &m, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename UpLo, typename Diag >
inline std::ptrdiff_t lantr( const char norm, const UpLo, const Diag,
const fortran_int_t m, const fortran_int_t n,
const std::complex<float>* a, const fortran_int_t lda, float* work ) {
fortran_int_t info(0);
LAPACK_CLANTR( &norm, &lapack_option< UpLo >::value, &lapack_option<
Diag >::value, &m, &n, a, &lda, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename UpLo, typename Diag >
inline std::ptrdiff_t lantr( const char norm, const UpLo, const Diag,
const fortran_int_t m, const fortran_int_t n,
const std::complex<double>* a, const fortran_int_t lda,
double* work ) {
fortran_int_t info(0);
LAPACK_ZLANTR( &norm, &lapack_option< UpLo >::value, &lapack_option<
Diag >::value, &m, &n, a, &lda, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to lantr.
//
template< typename Value >
struct lantr_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename WORK >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
typedef typename result_of::diag_tag< MatrixA >::type diag;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( norm, bindings::size_row(a) ));
BOOST_ASSERT( bindings::size_column(a) >= 0 );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_row(a) >= 0 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max<
std::ptrdiff_t >(bindings::size_row(a),1) );
return detail::lantr( norm, uplo(), diag(), bindings::size_row(a),
bindings::size_column(a), bindings::begin_value(a),
bindings::stride_major(a),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
typedef typename result_of::diag_tag< MatrixA >::type diag;
bindings::detail::array< real_type > tmp_work( min_size_work( norm,
bindings::size_row(a) ) );
return invoke( norm, a, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixA >
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
typedef typename result_of::diag_tag< MatrixA >::type diag;
return invoke( norm, a, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const char norm,
const std::ptrdiff_t m ) {
if ( norm == 'I' )
return std::max< std::ptrdiff_t >( 1, m );
else
return 1;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the lantr_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for lantr. Its overload differs for
// * User-defined workspace
//
template< typename MatrixA, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
lantr( const char norm, const MatrixA& a, Workspace work ) {
return lantr_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, work );
}
//
// Overloaded function for lantr. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixA >
inline typename boost::disable_if< detail::is_workspace< MatrixA >,
std::ptrdiff_t >::type
lantr( const char norm, const MatrixA& a ) {
return lantr_impl< typename bindings::value_type<
MatrixA >::type >::invoke( norm, a, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,362 @@
//
// 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_LAPACK_AUXILIARY_LARF_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARF_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/detail/if_left.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.hpp>
#include <boost/numeric/bindings/lapack/workspace.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for larf is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename Side >
inline std::ptrdiff_t larf( const Side, const fortran_int_t m,
const fortran_int_t n, const float* v, const fortran_int_t incv,
const float tau, float* c, const fortran_int_t ldc, float* work ) {
fortran_int_t info(0);
LAPACK_SLARF( &lapack_option< Side >::value, &m, &n, v, &incv, &tau, c,
&ldc, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename Side >
inline std::ptrdiff_t larf( const Side, const fortran_int_t m,
const fortran_int_t n, const double* v, const fortran_int_t incv,
const double tau, double* c, const fortran_int_t ldc, double* work ) {
fortran_int_t info(0);
LAPACK_DLARF( &lapack_option< Side >::value, &m, &n, v, &incv, &tau, c,
&ldc, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename Side >
inline std::ptrdiff_t larf( const Side, const fortran_int_t m,
const fortran_int_t n, const std::complex<float>* v,
const fortran_int_t incv, const std::complex<float> tau,
std::complex<float>* c, const fortran_int_t ldc,
std::complex<float>* work ) {
fortran_int_t info(0);
LAPACK_CLARF( &lapack_option< Side >::value, &m, &n, v, &incv, &tau, c,
&ldc, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename Side >
inline std::ptrdiff_t larf( const Side, const fortran_int_t m,
const fortran_int_t n, const std::complex<double>* v,
const fortran_int_t incv, const std::complex<double> tau,
std::complex<double>* c, const fortran_int_t ldc,
std::complex<double>* work ) {
fortran_int_t info(0);
LAPACK_ZLARF( &lapack_option< Side >::value, &m, &n, v, &incv, &tau, c,
&ldc, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to larf.
//
template< typename Value, typename Enable = void >
struct larf_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct larf_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename VectorV, typename MatrixC,
typename WORK >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const real_type tau, MatrixC& c, detail::workspace1<
WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( side, bindings::size_row(c),
bindings::size_column(c) ));
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(c)) );
return detail::larf( side, bindings::size_row(c),
bindings::size_column(c), bindings::begin_value(v),
bindings::stride(v), tau, bindings::begin_value(c),
bindings::stride_major(c),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const real_type tau, MatrixC& c, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work( side,
bindings::size_row(c), bindings::size_column(c) ) );
return invoke( side, v, tau, c, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const real_type tau, MatrixC& c, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( side, v, tau, c, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
template< typename Side >
static std::ptrdiff_t min_size_work( const Side side,
const std::ptrdiff_t m, const std::ptrdiff_t n ) {
return std::max< std::ptrdiff_t >( 1, bindings::detail::if_left( side,
n, m ) );
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct larf_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename VectorV, typename MatrixC,
typename WORK >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const value_type tau, MatrixC& c, detail::workspace1<
WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
min_size_work( side, bindings::size_row(c),
bindings::size_column(c) ));
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(c)) );
return detail::larf( side, bindings::size_row(c),
bindings::size_column(c), bindings::begin_value(v),
bindings::stride(v), tau, bindings::begin_value(c),
bindings::stride_major(c),
bindings::begin_value(work.select(value_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const value_type tau, MatrixC& c, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< value_type > tmp_work( min_size_work( side,
bindings::size_row(c), bindings::size_column(c) ) );
return invoke( side, v, tau, c, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const value_type tau, MatrixC& c, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( side, v, tau, c, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
template< typename Side >
static std::ptrdiff_t min_size_work( const Side side,
const std::ptrdiff_t m, const std::ptrdiff_t n ) {
return std::max< std::ptrdiff_t >( 1, bindings::detail::if_left( side,
n, m ) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the larf_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for larf. Its overload differs for
// * User-defined workspace
//
template< typename Side, typename VectorV, typename MatrixC,
typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
larf( const Side side, const VectorV& v,
const typename remove_imaginary< typename bindings::value_type<
VectorV >::type >::type tau, MatrixC& c, Workspace work ) {
return larf_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, v, tau, c, work );
}
//
// Overloaded function for larf. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename Side, typename VectorV, typename MatrixC >
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
std::ptrdiff_t >::type
larf( const Side side, const VectorV& v,
const typename remove_imaginary< typename bindings::value_type<
VectorV >::type >::type tau, MatrixC& c ) {
return larf_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, v, tau, c, optimal_workspace() );
}
//
// Overloaded function for larf. Its overload differs for
// * User-defined workspace
//
template< typename Side, typename VectorV, typename MatrixC,
typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
larf( const Side side, const VectorV& v,
const typename bindings::value_type< VectorV >::type tau, MatrixC& c,
Workspace work ) {
return larf_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, v, tau, c, work );
}
//
// Overloaded function for larf. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename Side, typename VectorV, typename MatrixC >
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
std::ptrdiff_t >::type
larf( const Side side, const VectorV& v,
const typename bindings::value_type< VectorV >::type tau,
MatrixC& c ) {
return larf_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, v, tau, c, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,393 @@
//
// 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_LAPACK_AUXILIARY_LARFB_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARFB_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_order.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/detail/if_left.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.hpp>
#include <boost/numeric/bindings/lapack/workspace.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for larfb is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename Side, typename Trans >
inline std::ptrdiff_t larfb( const Side, const Trans, const char direct,
const char storev, const fortran_int_t m, const fortran_int_t n,
const fortran_int_t k, const float* v, const fortran_int_t ldv,
const float* t, const fortran_int_t ldt, float* c,
const fortran_int_t ldc, float* work, const fortran_int_t ldwork ) {
fortran_int_t info(0);
LAPACK_SLARFB( &lapack_option< Side >::value, &lapack_option<
Trans >::value, &direct, &storev, &m, &n, &k, v, &ldv, t, &ldt, c,
&ldc, work, &ldwork );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename Side, typename Trans >
inline std::ptrdiff_t larfb( const Side, const Trans, const char direct,
const char storev, const fortran_int_t m, const fortran_int_t n,
const fortran_int_t k, const double* v, const fortran_int_t ldv,
const double* t, const fortran_int_t ldt, double* c,
const fortran_int_t ldc, double* work, const fortran_int_t ldwork ) {
fortran_int_t info(0);
LAPACK_DLARFB( &lapack_option< Side >::value, &lapack_option<
Trans >::value, &direct, &storev, &m, &n, &k, v, &ldv, t, &ldt, c,
&ldc, work, &ldwork );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename Side, typename Trans >
inline std::ptrdiff_t larfb( const Side, const Trans, const char direct,
const char storev, const fortran_int_t m, const fortran_int_t n,
const fortran_int_t k, const std::complex<float>* v,
const fortran_int_t ldv, const std::complex<float>* t,
const fortran_int_t ldt, std::complex<float>* c,
const fortran_int_t ldc, std::complex<float>* work,
const fortran_int_t ldwork ) {
fortran_int_t info(0);
LAPACK_CLARFB( &lapack_option< Side >::value, &lapack_option<
Trans >::value, &direct, &storev, &m, &n, &k, v, &ldv, t, &ldt, c,
&ldc, work, &ldwork );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename Side, typename Trans >
inline std::ptrdiff_t larfb( const Side, const Trans, const char direct,
const char storev, const fortran_int_t m, const fortran_int_t n,
const fortran_int_t k, const std::complex<double>* v,
const fortran_int_t ldv, const std::complex<double>* t,
const fortran_int_t ldt, std::complex<double>* c,
const fortran_int_t ldc, std::complex<double>* work,
const fortran_int_t ldwork ) {
fortran_int_t info(0);
LAPACK_ZLARFB( &lapack_option< Side >::value, &lapack_option<
Trans >::value, &direct, &storev, &m, &n, &k, v, &ldv, t, &ldt, c,
&ldc, work, &ldwork );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to larfb.
//
template< typename Value, typename Enable = void >
struct larfb_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct larfb_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename MatrixV, typename MatrixT,
typename MatrixC, typename WORK >
static std::ptrdiff_t invoke( const Side side, const char direct,
const char storev, const MatrixV& v, const MatrixT& t, MatrixC& c,
const fortran_int_t ldwork, detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixT >::type order;
typedef typename result_of::trans_tag< MatrixV, order >::type trans;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixT >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( ldwork, bindings::size_column(t) ));
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
BOOST_ASSERT( bindings::size_minor(t) == 1 ||
bindings::stride_minor(t) == 1 );
BOOST_ASSERT( bindings::size_minor(v) == 1 ||
bindings::stride_minor(v) == 1 );
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(c)) );
BOOST_ASSERT( bindings::stride_major(t) >= bindings::size_column(t) );
BOOST_ASSERT( direct == 'F' || direct == 'B' );
BOOST_ASSERT( storev == 'C' || storev == 'R' );
return detail::larfb( side, trans(), direct, storev,
bindings::size_row(c), bindings::size_column(c),
bindings::size_column(t), bindings::begin_value(v),
bindings::stride_major(v), bindings::begin_value(t),
bindings::stride_major(t), bindings::begin_value(c),
bindings::stride_major(c),
bindings::begin_value(work.select(real_type())), ldwork );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename Side, typename MatrixV, typename MatrixT,
typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const char direct,
const char storev, const MatrixV& v, const MatrixT& t, MatrixC& c,
const fortran_int_t ldwork, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixT >::type order;
typedef typename result_of::trans_tag< MatrixV, order >::type trans;
bindings::detail::array< real_type > tmp_work( min_size_work( ldwork,
bindings::size_column(t) ) );
return invoke( side, direct, storev, v, t, c, ldwork,
workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename Side, typename MatrixV, typename MatrixT,
typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const char direct,
const char storev, const MatrixV& v, const MatrixT& t, MatrixC& c,
const fortran_int_t ldwork, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixT >::type order;
typedef typename result_of::trans_tag< MatrixV, order >::type trans;
return invoke( side, direct, storev, v, t, c, ldwork,
minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t ldwork,
const std::ptrdiff_t k ) {
return ldwork * k;
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct larfb_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename MatrixV, typename MatrixT,
typename MatrixC, typename WORK >
static std::ptrdiff_t invoke( const Side side, const char direct,
const char storev, const MatrixV& v, const MatrixT& t, MatrixC& c,
const fortran_int_t ldwork, detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixT >::type order;
typedef typename result_of::trans_tag< MatrixV, order >::type trans;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixT >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
min_size_work( ldwork, bindings::size_column(t) ));
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
BOOST_ASSERT( bindings::size_minor(t) == 1 ||
bindings::stride_minor(t) == 1 );
BOOST_ASSERT( bindings::size_minor(v) == 1 ||
bindings::stride_minor(v) == 1 );
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(c)) );
BOOST_ASSERT( bindings::stride_major(t) >= bindings::size_column(t) );
BOOST_ASSERT( direct == 'F' || direct == 'B' );
BOOST_ASSERT( storev == 'C' || storev == 'R' );
return detail::larfb( side, trans(), direct, storev,
bindings::size_row(c), bindings::size_column(c),
bindings::size_column(t), bindings::begin_value(v),
bindings::stride_major(v), bindings::begin_value(t),
bindings::stride_major(t), bindings::begin_value(c),
bindings::stride_major(c),
bindings::begin_value(work.select(value_type())), ldwork );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename Side, typename MatrixV, typename MatrixT,
typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const char direct,
const char storev, const MatrixV& v, const MatrixT& t, MatrixC& c,
const fortran_int_t ldwork, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixT >::type order;
typedef typename result_of::trans_tag< MatrixV, order >::type trans;
bindings::detail::array< value_type > tmp_work( min_size_work( ldwork,
bindings::size_column(t) ) );
return invoke( side, direct, storev, v, t, c, ldwork,
workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename Side, typename MatrixV, typename MatrixT,
typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const char direct,
const char storev, const MatrixV& v, const MatrixT& t, MatrixC& c,
const fortran_int_t ldwork, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixT >::type order;
typedef typename result_of::trans_tag< MatrixV, order >::type trans;
return invoke( side, direct, storev, v, t, c, ldwork,
minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t ldwork,
const std::ptrdiff_t k ) {
return ldwork * k;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the larfb_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for larfb. Its overload differs for
// * User-defined workspace
//
template< typename Side, typename MatrixV, typename MatrixT, typename MatrixC,
typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
larfb( const Side side, const char direct, const char storev,
const MatrixV& v, const MatrixT& t, MatrixC& c,
const fortran_int_t ldwork, Workspace work ) {
return larfb_impl< typename bindings::value_type<
MatrixV >::type >::invoke( side, direct, storev, v, t, c, ldwork,
work );
}
//
// Overloaded function for larfb. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename Side, typename MatrixV, typename MatrixT, typename MatrixC >
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
std::ptrdiff_t >::type
larfb( const Side side, const char direct, const char storev,
const MatrixV& v, const MatrixT& t, MatrixC& c,
const fortran_int_t ldwork ) {
return larfb_impl< typename bindings::value_type<
MatrixV >::type >::invoke( side, direct, storev, v, t, c, ldwork,
optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,195 @@
//
// 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_LAPACK_AUXILIARY_LARFG_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARFG_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for larfg is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t larfg( const fortran_int_t n, float& alpha, float* x,
const fortran_int_t incx, float& tau ) {
fortran_int_t info(0);
LAPACK_SLARFG( &n, &alpha, x, &incx, &tau );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t larfg( const fortran_int_t n, double& alpha, double* x,
const fortran_int_t incx, double& tau ) {
fortran_int_t info(0);
LAPACK_DLARFG( &n, &alpha, x, &incx, &tau );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t larfg( const fortran_int_t n, std::complex<float>& alpha,
std::complex<float>* x, const fortran_int_t incx,
std::complex<float>& tau ) {
fortran_int_t info(0);
LAPACK_CLARFG( &n, &alpha, x, &incx, &tau );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t larfg( const fortran_int_t n,
std::complex<double>& alpha, std::complex<double>* x,
const fortran_int_t incx, std::complex<double>& tau ) {
fortran_int_t info(0);
LAPACK_ZLARFG( &n, &alpha, x, &incx, &tau );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to larfg.
//
template< typename Value, typename Enable = void >
struct larfg_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct larfg_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorX >
static std::ptrdiff_t invoke( const fortran_int_t n, real_type& alpha,
VectorX& x, real_type& tau ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
return detail::larfg( n, alpha, bindings::begin_value(x),
bindings::stride(x), tau );
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct larfg_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorX >
static std::ptrdiff_t invoke( const fortran_int_t n, value_type& alpha,
VectorX& x, value_type& tau ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
return detail::larfg( n, alpha, bindings::begin_value(x),
bindings::stride(x), tau );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the larfg_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for larfg. Its overload differs for
//
template< typename VectorX >
inline std::ptrdiff_t larfg( const fortran_int_t n,
typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type& alpha, VectorX& x, typename remove_imaginary<
typename bindings::value_type< VectorX >::type >::type& tau ) {
return larfg_impl< typename bindings::value_type<
VectorX >::type >::invoke( n, alpha, x, tau );
}
//
// Overloaded function for larfg. Its overload differs for
//
template< typename VectorX >
inline std::ptrdiff_t larfg( const fortran_int_t n,
typename bindings::value_type< VectorX >::type& alpha, VectorX& x,
typename bindings::value_type< VectorX >::type& tau ) {
return larfg_impl< typename bindings::value_type<
VectorX >::type >::invoke( n, alpha, x, tau );
}
} // namespace lapack
} // 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_LAPACK_AUXILIARY_LARFT_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARFT_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/is_column_major.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 LAPACK-backend for larft is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t larft( const char direct, const char storev,
const fortran_int_t n, const fortran_int_t k, float* v,
const fortran_int_t ldv, const float* tau, float* t,
const fortran_int_t ldt ) {
fortran_int_t info(0);
LAPACK_SLARFT( &direct, &storev, &n, &k, v, &ldv, tau, t, &ldt );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t larft( const char direct, const char storev,
const fortran_int_t n, const fortran_int_t k, double* v,
const fortran_int_t ldv, const double* tau, double* t,
const fortran_int_t ldt ) {
fortran_int_t info(0);
LAPACK_DLARFT( &direct, &storev, &n, &k, v, &ldv, tau, t, &ldt );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t larft( const char direct, const char storev,
const fortran_int_t n, const fortran_int_t k, std::complex<float>* v,
const fortran_int_t ldv, const std::complex<float>* tau,
std::complex<float>* t, const fortran_int_t ldt ) {
fortran_int_t info(0);
LAPACK_CLARFT( &direct, &storev, &n, &k, v, &ldv, tau, t, &ldt );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t larft( const char direct, const char storev,
const fortran_int_t n, const fortran_int_t k, std::complex<double>* v,
const fortran_int_t ldv, const std::complex<double>* tau,
std::complex<double>* t, const fortran_int_t ldt ) {
fortran_int_t info(0);
LAPACK_ZLARFT( &direct, &storev, &n, &k, v, &ldv, tau, t, &ldt );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to larft.
//
template< typename Value >
struct larft_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixV, typename VectorTAU, typename MatrixT >
static std::ptrdiff_t invoke( const char direct, const char storev,
const fortran_int_t n, const fortran_int_t k, MatrixV& v,
const VectorTAU& tau, MatrixT& t ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixV >::value) );
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixT >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixV >::type >::type,
typename remove_const< typename bindings::value_type<
VectorTAU >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixT >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixV >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixT >::value) );
BOOST_ASSERT( bindings::size(tau) >= k );
BOOST_ASSERT( bindings::size_minor(t) == 1 ||
bindings::stride_minor(t) == 1 );
BOOST_ASSERT( bindings::size_minor(v) == 1 ||
bindings::stride_minor(v) == 1 );
BOOST_ASSERT( bindings::stride_major(t) >= k );
BOOST_ASSERT( direct == 'F' || direct == 'B' );
BOOST_ASSERT( k >= 1 );
BOOST_ASSERT( n >= 0 );
BOOST_ASSERT( storev == 'C' || storev == 'R' );
return detail::larft( direct, storev, n, k, bindings::begin_value(v),
bindings::stride_major(v), bindings::begin_value(tau),
bindings::begin_value(t), bindings::stride_major(t) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the larft_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for larft. Its overload differs for
//
template< typename MatrixV, typename VectorTAU, typename MatrixT >
inline std::ptrdiff_t larft( const char direct, const char storev,
const fortran_int_t n, const fortran_int_t k, MatrixV& v,
const VectorTAU& tau, MatrixT& t ) {
return larft_impl< typename bindings::value_type<
MatrixV >::type >::invoke( direct, storev, n, k, v, tau, t );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,364 @@
//
// 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_LAPACK_AUXILIARY_LARFX_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARFX_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/detail/if_left.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.hpp>
#include <boost/numeric/bindings/lapack/workspace.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for larfx is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename Side >
inline std::ptrdiff_t larfx( const Side, const fortran_int_t m,
const fortran_int_t n, const float* v, const float tau, float* c,
const fortran_int_t ldc, float* work ) {
fortran_int_t info(0);
LAPACK_SLARFX( &lapack_option< Side >::value, &m, &n, v, &tau, c, &ldc,
work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename Side >
inline std::ptrdiff_t larfx( const Side, const fortran_int_t m,
const fortran_int_t n, const double* v, const double tau, double* c,
const fortran_int_t ldc, double* work ) {
fortran_int_t info(0);
LAPACK_DLARFX( &lapack_option< Side >::value, &m, &n, v, &tau, c, &ldc,
work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename Side >
inline std::ptrdiff_t larfx( const Side, const fortran_int_t m,
const fortran_int_t n, const std::complex<float>* v,
const std::complex<float> tau, std::complex<float>* c,
const fortran_int_t ldc, std::complex<float>* work ) {
fortran_int_t info(0);
LAPACK_CLARFX( &lapack_option< Side >::value, &m, &n, v, &tau, c, &ldc,
work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename Side >
inline std::ptrdiff_t larfx( const Side, const fortran_int_t m,
const fortran_int_t n, const std::complex<double>* v,
const std::complex<double> tau, std::complex<double>* c,
const fortran_int_t ldc, std::complex<double>* work ) {
fortran_int_t info(0);
LAPACK_ZLARFX( &lapack_option< Side >::value, &m, &n, v, &tau, c, &ldc,
work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to larfx.
//
template< typename Value, typename Enable = void >
struct larfx_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct larfx_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename VectorV, typename MatrixC,
typename WORK >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const real_type tau, MatrixC& c, detail::workspace1<
WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( side, bindings::size_row(c),
bindings::size_column(c) ));
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(c)) );
return detail::larfx( side, bindings::size_row(c),
bindings::size_column(c), bindings::begin_value(v), tau,
bindings::begin_value(c), bindings::stride_major(c),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const real_type tau, MatrixC& c, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work( side,
bindings::size_row(c), bindings::size_column(c) ) );
return invoke( side, v, tau, c, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const real_type tau, MatrixC& c, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( side, v, tau, c, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
template< typename Side >
static std::ptrdiff_t min_size_work( const Side side,
const std::ptrdiff_t m, const std::ptrdiff_t n ) {
std::ptrdiff_t order = bindings::detail::if_left( side, n, m );
if ( order < 11)
return 1;
else
return std::max< std::ptrdiff_t >( 1, order );
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct larfx_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename VectorV, typename MatrixC,
typename WORK >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const value_type tau, MatrixC& c, detail::workspace1<
WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
min_size_work( side, bindings::size_row(c),
bindings::size_column(c) ));
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(c)) );
return detail::larfx( side, bindings::size_row(c),
bindings::size_column(c), bindings::begin_value(v), tau,
bindings::begin_value(c), bindings::stride_major(c),
bindings::begin_value(work.select(value_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const value_type tau, MatrixC& c, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< value_type > tmp_work( min_size_work( side,
bindings::size_row(c), bindings::size_column(c) ) );
return invoke( side, v, tau, c, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const VectorV& v,
const value_type tau, MatrixC& c, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( side, v, tau, c, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
template< typename Side >
static std::ptrdiff_t min_size_work( const Side side,
const std::ptrdiff_t m, const std::ptrdiff_t n ) {
std::ptrdiff_t order = bindings::detail::if_left( side, n, m );
if ( order < 11)
return 1;
else
return std::max< std::ptrdiff_t >( 1, order );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the larfx_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for larfx. Its overload differs for
// * User-defined workspace
//
template< typename Side, typename VectorV, typename MatrixC,
typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
larfx( const Side side, const VectorV& v,
const typename remove_imaginary< typename bindings::value_type<
VectorV >::type >::type tau, MatrixC& c, Workspace work ) {
return larfx_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, v, tau, c, work );
}
//
// Overloaded function for larfx. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename Side, typename VectorV, typename MatrixC >
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
std::ptrdiff_t >::type
larfx( const Side side, const VectorV& v,
const typename remove_imaginary< typename bindings::value_type<
VectorV >::type >::type tau, MatrixC& c ) {
return larfx_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, v, tau, c, optimal_workspace() );
}
//
// Overloaded function for larfx. Its overload differs for
// * User-defined workspace
//
template< typename Side, typename VectorV, typename MatrixC,
typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
larfx( const Side side, const VectorV& v,
const typename bindings::value_type< VectorV >::type tau, MatrixC& c,
Workspace work ) {
return larfx_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, v, tau, c, work );
}
//
// Overloaded function for larfx. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename Side, typename VectorV, typename MatrixC >
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
std::ptrdiff_t >::type
larfx( const Side side, const VectorV& v,
const typename bindings::value_type< VectorV >::type tau,
MatrixC& c ) {
return larfx_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, v, tau, c, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,210 @@
//
// 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_LAPACK_AUXILIARY_LARGV_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARGV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for largv is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t largv( const fortran_int_t n, float* x,
const fortran_int_t incx, float* y, const fortran_int_t incy,
float* c, const fortran_int_t incc ) {
fortran_int_t info(0);
LAPACK_SLARGV( &n, x, &incx, y, &incy, c, &incc );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t largv( const fortran_int_t n, double* x,
const fortran_int_t incx, double* y, const fortran_int_t incy,
double* c, const fortran_int_t incc ) {
fortran_int_t info(0);
LAPACK_DLARGV( &n, x, &incx, y, &incy, c, &incc );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t largv( const fortran_int_t n, std::complex<float>* x,
const fortran_int_t incx, std::complex<float>* y,
const fortran_int_t incy, float* c, const fortran_int_t incc ) {
fortran_int_t info(0);
LAPACK_CLARGV( &n, x, &incx, y, &incy, c, &incc );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t largv( const fortran_int_t n, std::complex<double>* x,
const fortran_int_t incx, std::complex<double>* y,
const fortran_int_t incy, double* c, const fortran_int_t incc ) {
fortran_int_t info(0);
LAPACK_ZLARGV( &n, x, &incx, y, &incy, c, &incc );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to largv.
//
template< typename Value, typename Enable = void >
struct largv_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct largv_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename VectorC >
static std::ptrdiff_t invoke( const fortran_int_t n, VectorX& x,
VectorY& y, VectorC& c ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (boost::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( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorC >::value) );
BOOST_ASSERT( bindings::size(c) >= 1+(n-1)*bindings::stride(c) );
BOOST_ASSERT( bindings::size(x) >= 1+(n-1)*bindings::stride(x) );
BOOST_ASSERT( bindings::size(y) >= 1+(n-1)*bindings::stride(y) );
return detail::largv( n, bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y), bindings::begin_value(c),
bindings::stride(c) );
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct largv_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorX, typename VectorY, typename VectorC >
static std::ptrdiff_t invoke( const fortran_int_t n, VectorX& x,
VectorY& y, VectorC& c ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (boost::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::is_mutable< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorC >::value) );
BOOST_ASSERT( bindings::size(c) >= 1+(n-1)*bindings::stride(c) );
BOOST_ASSERT( bindings::size(x) >= 1+(n-1)*bindings::stride(x) );
BOOST_ASSERT( bindings::size(y) >= 1+(n-1)*bindings::stride(y) );
return detail::largv( n, bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y), bindings::begin_value(c),
bindings::stride(c) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the largv_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for largv. Its overload differs for
//
template< typename VectorX, typename VectorY, typename VectorC >
inline std::ptrdiff_t largv( const fortran_int_t n, VectorX& x,
VectorY& y, VectorC& c ) {
return largv_impl< typename bindings::value_type<
VectorX >::type >::invoke( n, x, y, c );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,149 @@
//
// 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_LAPACK_AUXILIARY_LARNV_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARNV_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 LAPACK-backend for larnv is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t larnv( const fortran_int_t idist, fortran_int_t* iseed,
const fortran_int_t n, float* x ) {
fortran_int_t info(0);
LAPACK_SLARNV( &idist, iseed, &n, x );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t larnv( const fortran_int_t idist, fortran_int_t* iseed,
const fortran_int_t n, double* x ) {
fortran_int_t info(0);
LAPACK_DLARNV( &idist, iseed, &n, x );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t larnv( const fortran_int_t idist, fortran_int_t* iseed,
const fortran_int_t n, std::complex<float>* x ) {
fortran_int_t info(0);
LAPACK_CLARNV( &idist, iseed, &n, x );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t larnv( const fortran_int_t idist, fortran_int_t* iseed,
const fortran_int_t n, std::complex<double>* x ) {
fortran_int_t info(0);
LAPACK_ZLARNV( &idist, iseed, &n, x );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to larnv.
//
template< typename Value >
struct larnv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorISEED, typename VectorX >
static std::ptrdiff_t invoke( const fortran_int_t idist,
VectorISEED& iseed, const fortran_int_t n, VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorISEED >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_ASSERT( bindings::size(iseed) >= 4 );
BOOST_ASSERT( bindings::size(x) >= n );
return detail::larnv( idist, bindings::begin_value(iseed), n,
bindings::begin_value(x) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the larnv_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for larnv. Its overload differs for
//
template< typename VectorISEED, typename VectorX >
inline std::ptrdiff_t larnv( const fortran_int_t idist,
VectorISEED& iseed, const fortran_int_t n, VectorX& x ) {
return larnv_impl< typename bindings::value_type<
VectorX >::type >::invoke( idist, iseed, n, x );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,271 @@
//
// 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_LAPACK_AUXILIARY_LARRB_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARRB_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for larrb is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t larrb( const fortran_int_t n, const float* d,
const float* lld, const fortran_int_t ifirst,
const fortran_int_t ilast, const float rtol1, const float rtol2,
const fortran_int_t offset, float* w, float* wgap, float* werr,
float* work, fortran_int_t* iwork, const float pivmin,
const float spdiam, const fortran_int_t twist ) {
fortran_int_t info(0);
LAPACK_SLARRB( &n, d, lld, &ifirst, &ilast, &rtol1, &rtol2, &offset, w,
wgap, werr, work, iwork, &pivmin, &spdiam, &twist, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t larrb( const fortran_int_t n, const double* d,
const double* lld, const fortran_int_t ifirst,
const fortran_int_t ilast, const double rtol1, const double rtol2,
const fortran_int_t offset, double* w, double* wgap, double* werr,
double* work, fortran_int_t* iwork, const double pivmin,
const double spdiam, const fortran_int_t twist ) {
fortran_int_t info(0);
LAPACK_DLARRB( &n, d, lld, &ifirst, &ilast, &rtol1, &rtol2, &offset, w,
wgap, werr, work, iwork, &pivmin, &spdiam, &twist, &info );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to larrb.
//
template< typename Value >
struct larrb_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorD, typename VectorLLD, typename VectorW,
typename VectorWGAP, typename VectorWERR, typename WORK,
typename IWORK >
static std::ptrdiff_t invoke( const fortran_int_t n, const VectorD& d,
const VectorLLD& lld, const fortran_int_t ifirst,
const fortran_int_t ilast, const real_type rtol1,
const real_type rtol2, const fortran_int_t offset, VectorW& w,
VectorWGAP& wgap, VectorWERR& werr, const real_type pivmin,
const real_type spdiam, const fortran_int_t twist,
detail::workspace2< WORK, IWORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorLLD >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorW >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorWGAP >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorWERR >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorW >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorWGAP >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorWERR >::value) );
BOOST_ASSERT( bindings::size(d) >= n );
BOOST_ASSERT( bindings::size(lld) >= n-1 );
BOOST_ASSERT( bindings::size(w) >= n );
BOOST_ASSERT( bindings::size(werr) >= n );
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
min_size_iwork( n ));
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( n ));
return detail::larrb( n, bindings::begin_value(d),
bindings::begin_value(lld), ifirst, ilast, rtol1, rtol2,
offset, bindings::begin_value(w), bindings::begin_value(wgap),
bindings::begin_value(werr),
bindings::begin_value(work.select(real_type())),
bindings::begin_value(work.select(fortran_int_t())),
pivmin, spdiam, twist );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename VectorD, typename VectorLLD, typename VectorW,
typename VectorWGAP, typename VectorWERR >
static std::ptrdiff_t invoke( const fortran_int_t n, const VectorD& d,
const VectorLLD& lld, const fortran_int_t ifirst,
const fortran_int_t ilast, const real_type rtol1,
const real_type rtol2, const fortran_int_t offset, VectorW& w,
VectorWGAP& wgap, VectorWERR& werr, const real_type pivmin,
const real_type spdiam, const fortran_int_t twist,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work( n ) );
bindings::detail::array< fortran_int_t > tmp_iwork(
min_size_iwork( n ) );
return invoke( n, d, lld, ifirst, ilast, rtol1, rtol2, offset, w,
wgap, werr, pivmin, spdiam, twist, workspace( tmp_work,
tmp_iwork ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename VectorD, typename VectorLLD, typename VectorW,
typename VectorWGAP, typename VectorWERR >
static std::ptrdiff_t invoke( const fortran_int_t n, const VectorD& d,
const VectorLLD& lld, const fortran_int_t ifirst,
const fortran_int_t ilast, const real_type rtol1,
const real_type rtol2, const fortran_int_t offset, VectorW& w,
VectorWGAP& wgap, VectorWERR& werr, const real_type pivmin,
const real_type spdiam, const fortran_int_t twist,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( n, d, lld, ifirst, ilast, rtol1, rtol2, offset, w,
wgap, werr, pivmin, spdiam, twist, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t n ) {
return 2*n;
}
//
// Static member function that returns the minimum size of
// workspace-array iwork.
//
static std::ptrdiff_t min_size_iwork( const std::ptrdiff_t n ) {
return 2*n;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the larrb_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for larrb. Its overload differs for
// * User-defined workspace
//
template< typename VectorD, typename VectorLLD, typename VectorW,
typename VectorWGAP, typename VectorWERR, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
larrb( const fortran_int_t n, const VectorD& d, const VectorLLD& lld,
const fortran_int_t ifirst, const fortran_int_t ilast,
const typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type rtol1, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type rtol2,
const fortran_int_t offset, VectorW& w, VectorWGAP& wgap,
VectorWERR& werr, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type pivmin,
const typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type spdiam, const fortran_int_t twist,
Workspace work ) {
return larrb_impl< typename bindings::value_type<
VectorD >::type >::invoke( n, d, lld, ifirst, ilast, rtol1, rtol2,
offset, w, wgap, werr, pivmin, spdiam, twist, work );
}
//
// Overloaded function for larrb. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename VectorD, typename VectorLLD, typename VectorW,
typename VectorWGAP, typename VectorWERR >
inline typename boost::disable_if< detail::is_workspace< VectorWERR >,
std::ptrdiff_t >::type
larrb( const fortran_int_t n, const VectorD& d, const VectorLLD& lld,
const fortran_int_t ifirst, const fortran_int_t ilast,
const typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type rtol1, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type rtol2,
const fortran_int_t offset, VectorW& w, VectorWGAP& wgap,
VectorWERR& werr, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type pivmin,
const typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type spdiam, const fortran_int_t twist ) {
return larrb_impl< typename bindings::value_type<
VectorD >::type >::invoke( n, d, lld, ifirst, ilast, rtol1, rtol2,
offset, w, wgap, werr, pivmin, spdiam, twist,
optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#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_LAPACK_AUXILIARY_LARRE_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARRE_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.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 LAPACK-backend for larre is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t larre( const char range, const fortran_int_t n,
float& vl, float& vu, const fortran_int_t il, const fortran_int_t iu,
float* d, float* e, float* e2, const float rtol1, const float rtol2,
const float spltol, fortran_int_t& nsplit, fortran_int_t* isplit,
fortran_int_t& m, float* w, float* werr, float* wgap,
fortran_int_t* iblock, fortran_int_t* indexw, float* gers,
float& pivmin, float* work, fortran_int_t* iwork ) {
fortran_int_t info(0);
LAPACK_SLARRE( &range, &n, &vl, &vu, &il, &iu, d, e, e2, &rtol1, &rtol2,
&spltol, &nsplit, isplit, &m, w, werr, wgap, iblock, indexw, gers,
&pivmin, work, iwork, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t larre( const char range, const fortran_int_t n,
double& vl, double& vu, const fortran_int_t il,
const fortran_int_t iu, double* d, double* e, double* e2,
const double rtol1, const double rtol2, const double spltol,
fortran_int_t& nsplit, fortran_int_t* isplit, fortran_int_t& m,
double* w, double* werr, double* wgap, fortran_int_t* iblock,
fortran_int_t* indexw, double* gers, double& pivmin, double* work,
fortran_int_t* iwork ) {
fortran_int_t info(0);
LAPACK_DLARRE( &range, &n, &vl, &vu, &il, &iu, d, e, e2, &rtol1, &rtol2,
&spltol, &nsplit, isplit, &m, w, werr, wgap, iblock, indexw, gers,
&pivmin, work, iwork, &info );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to larre.
//
template< typename Value >
struct larre_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorISPLIT, typename VectorW, typename VectorWERR,
typename VectorWGAP, typename VectorIBLOCK, typename VectorINDEXW,
typename VectorGERS, typename WORK, typename IWORK >
static std::ptrdiff_t invoke( const char range, const fortran_int_t n,
real_type& vl, real_type& vu, const fortran_int_t il,
const fortran_int_t iu, VectorD& d, VectorE& e, VectorE2& e2,
const real_type rtol1, const real_type rtol2,
const real_type spltol, fortran_int_t& nsplit,
VectorISPLIT& isplit, fortran_int_t& m, VectorW& w,
VectorWERR& werr, VectorWGAP& wgap, VectorIBLOCK& iblock,
VectorINDEXW& indexw, VectorGERS& gers, real_type& pivmin,
detail::workspace2< WORK, IWORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorE >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorE2 >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorW >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorWERR >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorWGAP >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorD >::type >::type,
typename remove_const< typename bindings::value_type<
VectorGERS >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorISPLIT >::type >::type,
typename remove_const< typename bindings::value_type<
VectorIBLOCK >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorISPLIT >::type >::type,
typename remove_const< typename bindings::value_type<
VectorINDEXW >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE2 >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorISPLIT >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorW >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorWERR >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorWGAP >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIBLOCK >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorINDEXW >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorGERS >::value) );
BOOST_ASSERT( bindings::size(d) >= n );
BOOST_ASSERT( bindings::size(e) >= n );
BOOST_ASSERT( bindings::size(e2) >= n );
BOOST_ASSERT( bindings::size(gers) >= 2*n );
BOOST_ASSERT( bindings::size(indexw) >= n );
BOOST_ASSERT( bindings::size(isplit) >= n );
BOOST_ASSERT( bindings::size(w) >= n );
BOOST_ASSERT( bindings::size(werr) >= n );
BOOST_ASSERT( bindings::size(wgap) >= n );
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
min_size_iwork( n ));
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( n ));
BOOST_ASSERT( range == 'A' || range == 'V' || range == 'I' );
return detail::larre( range, n, vl, vu, il, iu,
bindings::begin_value(d), bindings::begin_value(e),
bindings::begin_value(e2), rtol1, rtol2, spltol, nsplit,
bindings::begin_value(isplit), m, bindings::begin_value(w),
bindings::begin_value(werr), bindings::begin_value(wgap),
bindings::begin_value(iblock), bindings::begin_value(indexw),
bindings::begin_value(gers), pivmin,
bindings::begin_value(work.select(real_type())),
bindings::begin_value(work.select(fortran_int_t())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorISPLIT, typename VectorW, typename VectorWERR,
typename VectorWGAP, typename VectorIBLOCK, typename VectorINDEXW,
typename VectorGERS >
static std::ptrdiff_t invoke( const char range, const fortran_int_t n,
real_type& vl, real_type& vu, const fortran_int_t il,
const fortran_int_t iu, VectorD& d, VectorE& e, VectorE2& e2,
const real_type rtol1, const real_type rtol2,
const real_type spltol, fortran_int_t& nsplit,
VectorISPLIT& isplit, fortran_int_t& m, VectorW& w,
VectorWERR& werr, VectorWGAP& wgap, VectorIBLOCK& iblock,
VectorINDEXW& indexw, VectorGERS& gers, real_type& pivmin,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work( n ) );
bindings::detail::array< fortran_int_t > tmp_iwork(
min_size_iwork( n ) );
return invoke( range, n, vl, vu, il, iu, d, e, e2, rtol1, rtol2,
spltol, nsplit, isplit, m, w, werr, wgap, iblock, indexw,
gers, pivmin, workspace( tmp_work, tmp_iwork ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorISPLIT, typename VectorW, typename VectorWERR,
typename VectorWGAP, typename VectorIBLOCK, typename VectorINDEXW,
typename VectorGERS >
static std::ptrdiff_t invoke( const char range, const fortran_int_t n,
real_type& vl, real_type& vu, const fortran_int_t il,
const fortran_int_t iu, VectorD& d, VectorE& e, VectorE2& e2,
const real_type rtol1, const real_type rtol2,
const real_type spltol, fortran_int_t& nsplit,
VectorISPLIT& isplit, fortran_int_t& m, VectorW& w,
VectorWERR& werr, VectorWGAP& wgap, VectorIBLOCK& iblock,
VectorINDEXW& indexw, VectorGERS& gers, real_type& pivmin,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( range, n, vl, vu, il, iu, d, e, e2, rtol1, rtol2,
spltol, nsplit, isplit, m, w, werr, wgap, iblock, indexw,
gers, pivmin, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t n ) {
return 6*n;
}
//
// Static member function that returns the minimum size of
// workspace-array iwork.
//
static std::ptrdiff_t min_size_iwork( const std::ptrdiff_t n ) {
return 5*n;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the larre_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for larre. Its overload differs for
// * User-defined workspace
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorISPLIT, typename VectorW, typename VectorWERR,
typename VectorWGAP, typename VectorIBLOCK, typename VectorINDEXW,
typename VectorGERS, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
larre( const char range, const fortran_int_t n,
typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type& vl, typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type& vu,
const fortran_int_t il, const fortran_int_t iu, VectorD& d,
VectorE& e, VectorE2& e2, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type rtol1,
const typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type rtol2, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type spltol,
fortran_int_t& nsplit, VectorISPLIT& isplit, fortran_int_t& m,
VectorW& w, VectorWERR& werr, VectorWGAP& wgap, VectorIBLOCK& iblock,
VectorINDEXW& indexw, VectorGERS& gers, typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type& pivmin,
Workspace work ) {
return larre_impl< typename bindings::value_type<
VectorD >::type >::invoke( range, n, vl, vu, il, iu, d, e, e2,
rtol1, rtol2, spltol, nsplit, isplit, m, w, werr, wgap, iblock,
indexw, gers, pivmin, work );
}
//
// Overloaded function for larre. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename VectorD, typename VectorE, typename VectorE2,
typename VectorISPLIT, typename VectorW, typename VectorWERR,
typename VectorWGAP, typename VectorIBLOCK, typename VectorINDEXW,
typename VectorGERS >
inline typename boost::disable_if< detail::is_workspace< VectorGERS >,
std::ptrdiff_t >::type
larre( const char range, const fortran_int_t n,
typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type& vl, typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type& vu,
const fortran_int_t il, const fortran_int_t iu, VectorD& d,
VectorE& e, VectorE2& e2, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type rtol1,
const typename remove_imaginary< typename bindings::value_type<
VectorD >::type >::type rtol2, const typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type spltol,
fortran_int_t& nsplit, VectorISPLIT& isplit, fortran_int_t& m,
VectorW& w, VectorWERR& werr, VectorWGAP& wgap, VectorIBLOCK& iblock,
VectorINDEXW& indexw, VectorGERS& gers, typename remove_imaginary<
typename bindings::value_type< VectorD >::type >::type& pivmin ) {
return larre_impl< typename bindings::value_type<
VectorD >::type >::invoke( range, n, vl, vu, il, iu, d, e, e2,
rtol1, rtol2, spltol, nsplit, isplit, m, w, werr, wgap, iblock,
indexw, gers, pivmin, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,370 @@
//
// 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_LAPACK_AUXILIARY_LARZ_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LARZ_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/detail/if_left.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.hpp>
#include <boost/numeric/bindings/lapack/workspace.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for larz is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename Side >
inline std::ptrdiff_t larz( const Side, const fortran_int_t m,
const fortran_int_t n, const fortran_int_t l, const float* v,
const fortran_int_t incv, const float tau, float* c,
const fortran_int_t ldc, float* work ) {
fortran_int_t info(0);
LAPACK_SLARZ( &lapack_option< Side >::value, &m, &n, &l, v, &incv, &tau,
c, &ldc, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename Side >
inline std::ptrdiff_t larz( const Side, const fortran_int_t m,
const fortran_int_t n, const fortran_int_t l, const double* v,
const fortran_int_t incv, const double tau, double* c,
const fortran_int_t ldc, double* work ) {
fortran_int_t info(0);
LAPACK_DLARZ( &lapack_option< Side >::value, &m, &n, &l, v, &incv, &tau,
c, &ldc, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename Side >
inline std::ptrdiff_t larz( const Side, const fortran_int_t m,
const fortran_int_t n, const fortran_int_t l,
const std::complex<float>* v, const fortran_int_t incv,
const std::complex<float> tau, std::complex<float>* c,
const fortran_int_t ldc, std::complex<float>* work ) {
fortran_int_t info(0);
LAPACK_CLARZ( &lapack_option< Side >::value, &m, &n, &l, v, &incv, &tau,
c, &ldc, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename Side >
inline std::ptrdiff_t larz( const Side, const fortran_int_t m,
const fortran_int_t n, const fortran_int_t l,
const std::complex<double>* v, const fortran_int_t incv,
const std::complex<double> tau, std::complex<double>* c,
const fortran_int_t ldc, std::complex<double>* work ) {
fortran_int_t info(0);
LAPACK_ZLARZ( &lapack_option< Side >::value, &m, &n, &l, v, &incv, &tau,
c, &ldc, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to larz.
//
template< typename Value, typename Enable = void >
struct larz_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct larz_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename VectorV, typename MatrixC,
typename WORK >
static std::ptrdiff_t invoke( const Side side, const fortran_int_t l,
const VectorV& v, const real_type tau, MatrixC& c,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( side, bindings::size_row(c),
bindings::size_column(c) ));
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(c)) );
return detail::larz( side, bindings::size_row(c),
bindings::size_column(c), l, bindings::begin_value(v),
bindings::stride(v), tau, bindings::begin_value(c),
bindings::stride_major(c),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const fortran_int_t l,
const VectorV& v, const real_type tau, MatrixC& c,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work( side,
bindings::size_row(c), bindings::size_column(c) ) );
return invoke( side, l, v, tau, c, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const fortran_int_t l,
const VectorV& v, const real_type tau, MatrixC& c,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( side, l, v, tau, c, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
template< typename Side >
static std::ptrdiff_t min_size_work( const Side side,
const std::ptrdiff_t m, const std::ptrdiff_t n ) {
return std::max< std::ptrdiff_t >( 1, bindings::detail::if_left( side,
n, m ) );
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct larz_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename Side, typename VectorV, typename MatrixC,
typename WORK >
static std::ptrdiff_t invoke( const Side side, const fortran_int_t l,
const VectorV& v, const value_type tau, MatrixC& c,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< VectorV >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
min_size_work( side, bindings::size_row(c),
bindings::size_column(c) ));
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(c)) );
return detail::larz( side, bindings::size_row(c),
bindings::size_column(c), l, bindings::begin_value(v),
bindings::stride(v), tau, bindings::begin_value(c),
bindings::stride_major(c),
bindings::begin_value(work.select(value_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const fortran_int_t l,
const VectorV& v, const value_type tau, MatrixC& c,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< value_type > tmp_work( min_size_work( side,
bindings::size_row(c), bindings::size_column(c) ) );
return invoke( side, l, v, tau, c, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename Side, typename VectorV, typename MatrixC >
static std::ptrdiff_t invoke( const Side side, const fortran_int_t l,
const VectorV& v, const value_type tau, MatrixC& c,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( side, l, v, tau, c, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
template< typename Side >
static std::ptrdiff_t min_size_work( const Side side,
const std::ptrdiff_t m, const std::ptrdiff_t n ) {
return std::max< std::ptrdiff_t >( 1, bindings::detail::if_left( side,
n, m ) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the larz_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for larz. Its overload differs for
// * User-defined workspace
//
template< typename Side, typename VectorV, typename MatrixC,
typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
larz( const Side side, const fortran_int_t l, const VectorV& v,
const typename remove_imaginary< typename bindings::value_type<
VectorV >::type >::type tau, MatrixC& c, Workspace work ) {
return larz_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, l, v, tau, c, work );
}
//
// Overloaded function for larz. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename Side, typename VectorV, typename MatrixC >
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
std::ptrdiff_t >::type
larz( const Side side, const fortran_int_t l, const VectorV& v,
const typename remove_imaginary< typename bindings::value_type<
VectorV >::type >::type tau, MatrixC& c ) {
return larz_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, l, v, tau, c,
optimal_workspace() );
}
//
// Overloaded function for larz. Its overload differs for
// * User-defined workspace
//
template< typename Side, typename VectorV, typename MatrixC,
typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
larz( const Side side, const fortran_int_t l, const VectorV& v,
const typename bindings::value_type< VectorV >::type tau, MatrixC& c,
Workspace work ) {
return larz_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, l, v, tau, c, work );
}
//
// Overloaded function for larz. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename Side, typename VectorV, typename MatrixC >
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
std::ptrdiff_t >::type
larz( const Side side, const fortran_int_t l, const VectorV& v,
const typename bindings::value_type< VectorV >::type tau,
MatrixC& c ) {
return larz_impl< typename bindings::value_type<
VectorV >::type >::invoke( side, l, v, tau, c,
optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,251 @@
//
// 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_LAPACK_AUXILIARY_LATRD_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LATRD_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for latrd is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename UpLo >
inline std::ptrdiff_t latrd( const UpLo, const fortran_int_t n,
const fortran_int_t nb, float* a, const fortran_int_t lda, float* e,
float* tau, float* w, const fortran_int_t ldw ) {
fortran_int_t info(0);
LAPACK_SLATRD( &lapack_option< UpLo >::value, &n, &nb, a, &lda, e, tau, w,
&ldw );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename UpLo >
inline std::ptrdiff_t latrd( const UpLo, const fortran_int_t n,
const fortran_int_t nb, double* a, const fortran_int_t lda, double* e,
double* tau, double* w, const fortran_int_t ldw ) {
fortran_int_t info(0);
LAPACK_DLATRD( &lapack_option< UpLo >::value, &n, &nb, a, &lda, e, tau, w,
&ldw );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t latrd( const UpLo, const fortran_int_t n,
const fortran_int_t nb, std::complex<float>* a,
const fortran_int_t lda, float* e, std::complex<float>* tau,
std::complex<float>* w, const fortran_int_t ldw ) {
fortran_int_t info(0);
LAPACK_CLATRD( &lapack_option< UpLo >::value, &n, &nb, a, &lda, e, tau, w,
&ldw );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename UpLo >
inline std::ptrdiff_t latrd( const UpLo, const fortran_int_t n,
const fortran_int_t nb, std::complex<double>* a,
const fortran_int_t lda, double* e, std::complex<double>* tau,
std::complex<double>* w, const fortran_int_t ldw ) {
fortran_int_t info(0);
LAPACK_ZLATRD( &lapack_option< UpLo >::value, &n, &nb, a, &lda, e, tau, w,
&ldw );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to latrd.
//
template< typename Value, typename Enable = void >
struct latrd_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct latrd_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorE, typename VectorTAU,
typename MatrixW >
static std::ptrdiff_t invoke( const fortran_int_t nb, MatrixA& a,
VectorE& e, VectorTAU& tau, MatrixW& w ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixW >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorE >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorTAU >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixW >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAU >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixW >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(w) == 1 ||
bindings::stride_minor(w) == 1 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
bindings::size_column(a)) );
BOOST_ASSERT( bindings::stride_major(w) >= std::max< std::ptrdiff_t >(1,
bindings::size_column(a)) );
return detail::latrd( uplo(), bindings::size_column(a), nb,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(e), bindings::begin_value(tau),
bindings::begin_value(w), bindings::stride_major(w) );
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct latrd_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorE, typename VectorTAU,
typename MatrixW >
static std::ptrdiff_t invoke( const fortran_int_t nb, MatrixA& a,
VectorE& e, VectorTAU& tau, MatrixW& w ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixW >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorTAU >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixW >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAU >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixW >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(w) == 1 ||
bindings::stride_minor(w) == 1 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
bindings::size_column(a)) );
BOOST_ASSERT( bindings::stride_major(w) >= std::max< std::ptrdiff_t >(1,
bindings::size_column(a)) );
return detail::latrd( uplo(), bindings::size_column(a), nb,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(e), bindings::begin_value(tau),
bindings::begin_value(w), bindings::stride_major(w) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the latrd_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for latrd. Its overload differs for
//
template< typename MatrixA, typename VectorE, typename VectorTAU,
typename MatrixW >
inline std::ptrdiff_t latrd( const fortran_int_t nb, MatrixA& a,
VectorE& e, VectorTAU& tau, MatrixW& w ) {
return latrd_impl< typename bindings::value_type<
MatrixA >::type >::invoke( nb, a, e, tau, w );
}
} // namespace lapack
} // 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_LAPACK_AUXILIARY_LATRS_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LATRS_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/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for latrs is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename Trans, typename Diag >
inline std::ptrdiff_t latrs( const char uplo, const Trans, const Diag,
const char normin, const fortran_int_t n, const float* a,
const fortran_int_t lda, float* x, float& scale, float* cnorm ) {
fortran_int_t info(0);
LAPACK_SLATRS( &uplo, &lapack_option< Trans >::value, &lapack_option<
Diag >::value, &normin, &n, a, &lda, x, &scale, cnorm, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename Trans, typename Diag >
inline std::ptrdiff_t latrs( const char uplo, const Trans, const Diag,
const char normin, const fortran_int_t n, const double* a,
const fortran_int_t lda, double* x, double& scale, double* cnorm ) {
fortran_int_t info(0);
LAPACK_DLATRS( &uplo, &lapack_option< Trans >::value, &lapack_option<
Diag >::value, &normin, &n, a, &lda, x, &scale, cnorm, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
template< typename Trans, typename Diag >
inline std::ptrdiff_t latrs( const char uplo, const Trans, const Diag,
const char normin, const fortran_int_t n,
const std::complex<float>* a, const fortran_int_t lda,
std::complex<float>* x, float& scale, float* cnorm ) {
fortran_int_t info(0);
LAPACK_CLATRS( &uplo, &lapack_option< Trans >::value, &lapack_option<
Diag >::value, &normin, &n, a, &lda, x, &scale, cnorm, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
template< typename Trans, typename Diag >
inline std::ptrdiff_t latrs( const char uplo, const Trans, const Diag,
const char normin, const fortran_int_t n,
const std::complex<double>* a, const fortran_int_t lda,
std::complex<double>* x, double& scale, double* cnorm ) {
fortran_int_t info(0);
LAPACK_ZLATRS( &uplo, &lapack_option< Trans >::value, &lapack_option<
Diag >::value, &normin, &n, a, &lda, x, &scale, cnorm, &info );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to latrs.
//
template< typename Value, typename Enable = void >
struct latrs_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct latrs_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX, typename VectorCNORM >
static std::ptrdiff_t invoke( const char uplo, const char normin,
const MatrixA& a, VectorX& x, real_type& scale,
VectorCNORM& cnorm ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename blas::detail::default_order< MatrixA >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::diag_tag< MatrixA >::type diag;
BOOST_STATIC_ASSERT( (boost::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( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorCNORM >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorCNORM >::value) );
BOOST_ASSERT( bindings::size(x) >= bindings::size_column_op(a,
trans()) );
BOOST_ASSERT( bindings::size_column_op(a, trans()) >= 0 );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
bindings::size_column_op(a, trans())) );
BOOST_ASSERT( normin == 'Y' || normin == 'N' );
return detail::latrs( uplo, trans(), diag(), normin,
bindings::size_column_op(a, trans()),
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), scale,
bindings::begin_value(cnorm) );
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct latrs_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorX, typename VectorCNORM >
static std::ptrdiff_t invoke( const char uplo, const char normin,
const MatrixA& a, VectorX& x, real_type& scale,
VectorCNORM& cnorm ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename blas::detail::default_order< MatrixA >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::diag_tag< MatrixA >::type diag;
BOOST_STATIC_ASSERT( (boost::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::is_mutable< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorCNORM >::value) );
BOOST_ASSERT( bindings::size(x) >= bindings::size_column_op(a,
trans()) );
BOOST_ASSERT( bindings::size_column_op(a, trans()) >= 0 );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
bindings::size_column_op(a, trans())) );
BOOST_ASSERT( normin == 'Y' || normin == 'N' );
return detail::latrs( uplo, trans(), diag(), normin,
bindings::size_column_op(a, trans()),
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(x), scale,
bindings::begin_value(cnorm) );
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the latrs_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for latrs. Its overload differs for
//
template< typename MatrixA, typename VectorX, typename VectorCNORM >
inline std::ptrdiff_t latrs( const char uplo, const char normin,
const MatrixA& a, VectorX& x, typename remove_imaginary<
typename bindings::value_type< MatrixA >::type >::type& scale,
VectorCNORM& cnorm ) {
return latrs_impl< typename bindings::value_type<
MatrixA >::type >::invoke( uplo, normin, a, x, scale, cnorm );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,313 @@
//
// 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_LAPACK_AUXILIARY_LATRZ_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_AUXILIARY_LATRZ_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_complex.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/is_real.hpp>
#include <boost/numeric/bindings/lapack/workspace.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>
#include <boost/utility/enable_if.hpp>
//
// The LAPACK-backend for latrz is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t latrz( const fortran_int_t m, const fortran_int_t n,
const fortran_int_t l, float* a, const fortran_int_t lda, float* tau,
float* work ) {
fortran_int_t info(0);
LAPACK_SLATRZ( &m, &n, &l, a, &lda, tau, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t latrz( const fortran_int_t m, const fortran_int_t n,
const fortran_int_t l, double* a, const fortran_int_t lda,
double* tau, double* work ) {
fortran_int_t info(0);
LAPACK_DLATRZ( &m, &n, &l, a, &lda, tau, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t latrz( const fortran_int_t m, const fortran_int_t n,
const fortran_int_t l, std::complex<float>* a,
const fortran_int_t lda, std::complex<float>* tau,
std::complex<float>* work ) {
fortran_int_t info(0);
LAPACK_CLATRZ( &m, &n, &l, a, &lda, tau, work );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t latrz( const fortran_int_t m, const fortran_int_t n,
const fortran_int_t l, std::complex<double>* a,
const fortran_int_t lda, std::complex<double>* tau,
std::complex<double>* work ) {
fortran_int_t info(0);
LAPACK_ZLATRZ( &m, &n, &l, a, &lda, tau, work );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to latrz.
//
template< typename Value, typename Enable = void >
struct latrz_impl {};
//
// This implementation is enabled if Value is a real type.
//
template< typename Value >
struct latrz_impl< Value, typename boost::enable_if< is_real< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorTAU, typename WORK >
static std::ptrdiff_t invoke( MatrixA& a, VectorTAU& tau,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorTAU >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAU >::value) );
BOOST_ASSERT( bindings::size(tau) >= bindings::size_row(a) );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( bindings::size_row(a) ));
BOOST_ASSERT( bindings::size_column(a) >= 0 );
BOOST_ASSERT( bindings::size_column(a) >= 0 );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_row(a) >= 0 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(a)) );
return detail::latrz( bindings::size_row(a), bindings::size_column(a),
bindings::size_column(a), bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(tau),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixA, typename VectorTAU >
static std::ptrdiff_t invoke( MatrixA& a, VectorTAU& tau,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< real_type > tmp_work( min_size_work(
bindings::size_row(a) ) );
return invoke( a, tau, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixA, typename VectorTAU >
static std::ptrdiff_t invoke( MatrixA& a, VectorTAU& tau,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( a, tau, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t m ) {
return m;
}
};
//
// This implementation is enabled if Value is a complex type.
//
template< typename Value >
struct latrz_impl< Value, typename boost::enable_if< is_complex< Value > >::type > {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixA, typename VectorTAU, typename WORK >
static std::ptrdiff_t invoke( MatrixA& a, VectorTAU& tau,
detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
VectorTAU >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAU >::value) );
BOOST_ASSERT( bindings::size(tau) >= bindings::size_row(a) );
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
min_size_work( bindings::size_row(a) ));
BOOST_ASSERT( bindings::size_column(a) >= 0 );
BOOST_ASSERT( bindings::size_column(a) >= 0 );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_row(a) >= 0 );
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
bindings::size_row(a)) );
return detail::latrz( bindings::size_row(a), bindings::size_column(a),
bindings::size_column(a), bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(tau),
bindings::begin_value(work.select(value_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixA, typename VectorTAU >
static std::ptrdiff_t invoke( MatrixA& a, VectorTAU& tau,
minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
bindings::detail::array< value_type > tmp_work( min_size_work(
bindings::size_row(a) ) );
return invoke( a, tau, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixA, typename VectorTAU >
static std::ptrdiff_t invoke( MatrixA& a, VectorTAU& tau,
optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
return invoke( a, tau, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t m ) {
return m;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the latrz_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for latrz. Its overload differs for
// * User-defined workspace
//
template< typename MatrixA, typename VectorTAU, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
latrz( MatrixA& a, VectorTAU& tau, Workspace work ) {
return latrz_impl< typename bindings::value_type<
MatrixA >::type >::invoke( a, tau, work );
}
//
// Overloaded function for latrz. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixA, typename VectorTAU >
inline typename boost::disable_if< detail::is_workspace< VectorTAU >,
std::ptrdiff_t >::type
latrz( MatrixA& a, VectorTAU& tau ) {
return latrz_impl< typename bindings::value_type<
MatrixA >::type >::invoke( a, tau, optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif