mirror of
http://172.16.200.102/MOISE/Timed-Altarica-To-Fiacre-Translator.git
synced 2025-11-26 06:37:59 +01:00
Initial commit.
This commit is contained in:
256
sdk/boost/numeric/bindings/lapack/computational/bdsdc.hpp
Normal file
256
sdk/boost/numeric/bindings/lapack/computational/bdsdc.hpp
Normal file
@@ -0,0 +1,256 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_BDSDC_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_BDSDC_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 bdsdc 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 bdsdc( const char uplo, const char compq,
|
||||
const fortran_int_t n, float* d, float* e, float* u,
|
||||
const fortran_int_t ldu, float* vt, const fortran_int_t ldvt,
|
||||
float* q, fortran_int_t* iq, float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SBDSDC( &uplo, &compq, &n, d, e, u, &ldu, vt, &ldvt, q, iq, work,
|
||||
iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t bdsdc( const char uplo, const char compq,
|
||||
const fortran_int_t n, double* d, double* e, double* u,
|
||||
const fortran_int_t ldu, double* vt, const fortran_int_t ldvt,
|
||||
double* q, fortran_int_t* iq, double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DBDSDC( &uplo, &compq, &n, d, e, u, &ldu, vt, &ldvt, q, iq, work,
|
||||
iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to bdsdc.
|
||||
//
|
||||
template< typename Value >
|
||||
struct bdsdc_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 MatrixU,
|
||||
typename MatrixVT, typename VectorQ, typename VectorIQ,
|
||||
typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const char uplo, const char compq,
|
||||
const fortran_int_t n, VectorD& d, VectorE& e, MatrixU& u,
|
||||
MatrixVT& vt, VectorQ& q, VectorIQ& iq, detail::workspace2< WORK,
|
||||
IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVT >::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<
|
||||
MatrixU >::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<
|
||||
MatrixVT >::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<
|
||||
VectorQ >::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< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixVT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIQ >::value) );
|
||||
BOOST_ASSERT( bindings::size(e) >= n-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( n ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( compq, n ));
|
||||
BOOST_ASSERT( bindings::size_minor(u) == 1 ||
|
||||
bindings::stride_minor(u) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(vt) == 1 ||
|
||||
bindings::stride_minor(vt) == 1 );
|
||||
BOOST_ASSERT( compq == 'N' || compq == 'P' || compq == 'I' );
|
||||
BOOST_ASSERT( n >= 0 );
|
||||
return detail::bdsdc( uplo, compq, n, bindings::begin_value(d),
|
||||
bindings::begin_value(e), bindings::begin_value(u),
|
||||
bindings::stride_major(u), bindings::begin_value(vt),
|
||||
bindings::stride_major(vt), bindings::begin_value(q),
|
||||
bindings::begin_value(iq),
|
||||
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 MatrixU,
|
||||
typename MatrixVT, typename VectorQ, typename VectorIQ >
|
||||
static std::ptrdiff_t invoke( const char uplo, const char compq,
|
||||
const fortran_int_t n, VectorD& d, VectorE& e, MatrixU& u,
|
||||
MatrixVT& vt, VectorQ& q, VectorIQ& iq, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( compq,
|
||||
n ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( n ) );
|
||||
return invoke( uplo, compq, n, d, e, u, vt, q, iq,
|
||||
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 MatrixU,
|
||||
typename MatrixVT, typename VectorQ, typename VectorIQ >
|
||||
static std::ptrdiff_t invoke( const char uplo, const char compq,
|
||||
const fortran_int_t n, VectorD& d, VectorE& e, MatrixU& u,
|
||||
MatrixVT& vt, VectorQ& q, VectorIQ& iq, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( uplo, compq, n, d, e, u, vt, q, iq,
|
||||
minimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work( const char compq,
|
||||
const std::ptrdiff_t n ) {
|
||||
switch ( compq ) {
|
||||
case 'N': return 4*n;
|
||||
case 'P': return 6*n;
|
||||
case 'I': return 3*n*n + 4*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 8*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 bdsdc_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for bdsdc. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename MatrixU,
|
||||
typename MatrixVT, typename VectorQ, typename VectorIQ,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
bdsdc( const char uplo, const char compq, const fortran_int_t n,
|
||||
VectorD& d, VectorE& e, MatrixU& u, MatrixVT& vt, VectorQ& q,
|
||||
VectorIQ& iq, Workspace work ) {
|
||||
return bdsdc_impl< typename bindings::value_type<
|
||||
VectorD >::type >::invoke( uplo, compq, n, d, e, u, vt, q, iq,
|
||||
work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for bdsdc. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename MatrixU,
|
||||
typename MatrixVT, typename VectorQ, typename VectorIQ >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIQ >,
|
||||
std::ptrdiff_t >::type
|
||||
bdsdc( const char uplo, const char compq, const fortran_int_t n,
|
||||
VectorD& d, VectorE& e, MatrixU& u, MatrixVT& vt, VectorQ& q,
|
||||
VectorIQ& iq ) {
|
||||
return bdsdc_impl< typename bindings::value_type<
|
||||
VectorD >::type >::invoke( uplo, compq, n, d, e, u, vt, q, iq,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
401
sdk/boost/numeric/bindings/lapack/computational/bdsqr.hpp
Normal file
401
sdk/boost/numeric/bindings/lapack/computational/bdsqr.hpp
Normal file
@@ -0,0 +1,401 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_BDSQR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_BDSQR_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 bdsqr 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 bdsqr( const char uplo, const fortran_int_t n,
|
||||
const fortran_int_t ncvt, const fortran_int_t nru,
|
||||
const fortran_int_t ncc, float* d, float* e, float* vt,
|
||||
const fortran_int_t ldvt, float* u, const fortran_int_t ldu, float* c,
|
||||
const fortran_int_t ldc, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SBDSQR( &uplo, &n, &ncvt, &nru, &ncc, d, e, vt, &ldvt, u, &ldu, c,
|
||||
&ldc, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t bdsqr( const char uplo, const fortran_int_t n,
|
||||
const fortran_int_t ncvt, const fortran_int_t nru,
|
||||
const fortran_int_t ncc, double* d, double* e, double* vt,
|
||||
const fortran_int_t ldvt, double* u, const fortran_int_t ldu,
|
||||
double* c, const fortran_int_t ldc, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DBDSQR( &uplo, &n, &ncvt, &nru, &ncc, d, e, vt, &ldvt, u, &ldu, c,
|
||||
&ldc, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t bdsqr( const char uplo, const fortran_int_t n,
|
||||
const fortran_int_t ncvt, const fortran_int_t nru,
|
||||
const fortran_int_t ncc, float* d, float* e, std::complex<float>* vt,
|
||||
const fortran_int_t ldvt, std::complex<float>* u,
|
||||
const fortran_int_t ldu, std::complex<float>* c,
|
||||
const fortran_int_t ldc, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CBDSQR( &uplo, &n, &ncvt, &nru, &ncc, d, e, vt, &ldvt, u, &ldu, c,
|
||||
&ldc, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t bdsqr( const char uplo, const fortran_int_t n,
|
||||
const fortran_int_t ncvt, const fortran_int_t nru,
|
||||
const fortran_int_t ncc, double* d, double* e,
|
||||
std::complex<double>* vt, const fortran_int_t ldvt,
|
||||
std::complex<double>* u, const fortran_int_t ldu,
|
||||
std::complex<double>* c, const fortran_int_t ldc, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZBDSQR( &uplo, &n, &ncvt, &nru, &ncc, d, e, vt, &ldvt, u, &ldu, c,
|
||||
&ldc, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to bdsqr.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct bdsqr_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct bdsqr_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 MatrixVT,
|
||||
typename MatrixU, typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char uplo, const fortran_int_t n,
|
||||
VectorD& d, VectorE& e, MatrixVT& vt, MatrixU& u, MatrixC& c,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::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<
|
||||
MatrixVT >::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<
|
||||
MatrixU >::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<
|
||||
MatrixC >::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< MatrixVT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( n, bindings::size_column(vt),
|
||||
bindings::size_row(u), bindings::size_column(c) ));
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(vt) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(u) == 1 ||
|
||||
bindings::stride_minor(u) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(vt) == 1 ||
|
||||
bindings::stride_minor(vt) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(u) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(u) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(u)) );
|
||||
BOOST_ASSERT( n >= 0 );
|
||||
return detail::bdsqr( uplo, n, bindings::size_column(vt),
|
||||
bindings::size_row(u), bindings::size_column(c),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(vt), bindings::stride_major(vt),
|
||||
bindings::begin_value(u), bindings::stride_major(u),
|
||||
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 VectorD, typename VectorE, typename MatrixVT,
|
||||
typename MatrixU, typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char uplo, const fortran_int_t n,
|
||||
VectorD& d, VectorE& e, MatrixVT& vt, MatrixU& u, MatrixC& c,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( n,
|
||||
bindings::size_column(vt), bindings::size_row(u),
|
||||
bindings::size_column(c) ) );
|
||||
return invoke( uplo, n, d, e, vt, u, 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 VectorD, typename VectorE, typename MatrixVT,
|
||||
typename MatrixU, typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char uplo, const fortran_int_t n,
|
||||
VectorD& d, VectorE& e, MatrixVT& vt, MatrixU& u, MatrixC& c,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( uplo, n, d, e, vt, u, c, 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 ncvt, const std::ptrdiff_t nru,
|
||||
const std::ptrdiff_t ncc ) {
|
||||
if ( ncvt == 0 && nru == 0 && ncc == 0 )
|
||||
return 2*n;
|
||||
else
|
||||
return std::max< std::ptrdiff_t >(1, 4*n);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct bdsqr_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 MatrixVT,
|
||||
typename MatrixU, typename MatrixC, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const char uplo, const fortran_int_t n,
|
||||
VectorD& d, VectorE& e, MatrixVT& vt, MatrixU& u, MatrixC& c,
|
||||
detail::workspace1< RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::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< MatrixVT >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixU >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixVT >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixC >::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< MatrixVT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( n, bindings::size_column(vt),
|
||||
bindings::size_row(u), bindings::size_column(c) ));
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(vt) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(u) == 1 ||
|
||||
bindings::stride_minor(u) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(vt) == 1 ||
|
||||
bindings::stride_minor(vt) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(u) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(u) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(u)) );
|
||||
BOOST_ASSERT( n >= 0 );
|
||||
return detail::bdsqr( uplo, n, bindings::size_column(vt),
|
||||
bindings::size_row(u), bindings::size_column(c),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(vt), bindings::stride_major(vt),
|
||||
bindings::begin_value(u), bindings::stride_major(u),
|
||||
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 VectorD, typename VectorE, typename MatrixVT,
|
||||
typename MatrixU, typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char uplo, const fortran_int_t n,
|
||||
VectorD& d, VectorE& e, MatrixVT& vt, MatrixU& u, MatrixC& c,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork( n,
|
||||
bindings::size_column(vt), bindings::size_row(u),
|
||||
bindings::size_column(c) ) );
|
||||
return invoke( uplo, n, d, e, vt, u, c, workspace( tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 MatrixVT,
|
||||
typename MatrixU, typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char uplo, const fortran_int_t n,
|
||||
VectorD& d, VectorE& e, MatrixVT& vt, MatrixU& u, MatrixC& c,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( uplo, n, d, e, vt, u, c, minimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ncvt, const std::ptrdiff_t nru,
|
||||
const std::ptrdiff_t ncc ) {
|
||||
if ( ncvt == 0 && nru == 0 && ncc == 0 )
|
||||
return 2*n;
|
||||
else
|
||||
return std::max< std::ptrdiff_t >(1, 4*n-4);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 bdsqr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for bdsqr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename MatrixVT,
|
||||
typename MatrixU, typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
bdsqr( const char uplo, const fortran_int_t n, VectorD& d,
|
||||
VectorE& e, MatrixVT& vt, MatrixU& u, MatrixC& c, Workspace work ) {
|
||||
return bdsqr_impl< typename bindings::value_type<
|
||||
MatrixVT >::type >::invoke( uplo, n, d, e, vt, u, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for bdsqr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename MatrixVT,
|
||||
typename MatrixU, typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
bdsqr( const char uplo, const fortran_int_t n, VectorD& d,
|
||||
VectorE& e, MatrixVT& vt, MatrixU& u, MatrixC& c ) {
|
||||
return bdsqr_impl< typename bindings::value_type<
|
||||
MatrixVT >::type >::invoke( uplo, n, d, e, vt, u, c,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
456
sdk/boost/numeric/bindings/lapack/computational/gbbrd.hpp
Normal file
456
sdk/boost/numeric/bindings/lapack/computational/gbbrd.hpp
Normal file
@@ -0,0 +1,456 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GBBRD_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GBBRD_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_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 gbbrd 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 gbbrd( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t ncc,
|
||||
const fortran_int_t kl, const fortran_int_t ku, float* ab,
|
||||
const fortran_int_t ldab, float* d, float* e, float* q,
|
||||
const fortran_int_t ldq, float* pt, const fortran_int_t ldpt,
|
||||
float* c, const fortran_int_t ldc, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGBBRD( &vect, &m, &n, &ncc, &kl, &ku, ab, &ldab, d, e, q, &ldq,
|
||||
pt, &ldpt, c, &ldc, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbbrd( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t ncc,
|
||||
const fortran_int_t kl, const fortran_int_t ku, double* ab,
|
||||
const fortran_int_t ldab, double* d, double* e, double* q,
|
||||
const fortran_int_t ldq, double* pt, const fortran_int_t ldpt,
|
||||
double* c, const fortran_int_t ldc, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGBBRD( &vect, &m, &n, &ncc, &kl, &ku, ab, &ldab, d, e, q, &ldq,
|
||||
pt, &ldpt, c, &ldc, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbbrd( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t ncc,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
std::complex<float>* ab, const fortran_int_t ldab, float* d, float* e,
|
||||
std::complex<float>* q, const fortran_int_t ldq,
|
||||
std::complex<float>* pt, const fortran_int_t ldpt,
|
||||
std::complex<float>* c, const fortran_int_t ldc,
|
||||
std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGBBRD( &vect, &m, &n, &ncc, &kl, &ku, ab, &ldab, d, e, q, &ldq,
|
||||
pt, &ldpt, c, &ldc, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbbrd( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t ncc,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
std::complex<double>* ab, const fortran_int_t ldab, double* d,
|
||||
double* e, std::complex<double>* q, const fortran_int_t ldq,
|
||||
std::complex<double>* pt, const fortran_int_t ldpt,
|
||||
std::complex<double>* c, const fortran_int_t ldc,
|
||||
std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGBBRD( &vect, &m, &n, &ncc, &kl, &ku, ab, &ldab, d, e, q, &ldq,
|
||||
pt, &ldpt, c, &ldc, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gbbrd.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gbbrd_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbbrd_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 MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename MatrixPT, typename MatrixC,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, MatrixPT& pt, MatrixC& c,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixPT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::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< MatrixAB >::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< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixPT >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixPT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth_lower(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::bandwidth_upper(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(d) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(ab),
|
||||
bindings::size_column(ab)) );
|
||||
BOOST_ASSERT( bindings::size(e) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(ab),
|
||||
bindings::size_column(ab))-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_row(ab),
|
||||
bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(pt) == 1 ||
|
||||
bindings::stride_minor(pt) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >=
|
||||
bindings::bandwidth_lower(ab)+bindings::bandwidth_upper(ab)+
|
||||
1 );
|
||||
BOOST_ASSERT( vect == 'N' || vect == 'Q' || vect == 'P' ||
|
||||
vect == 'B' );
|
||||
return detail::gbbrd( vect, bindings::size_row(ab),
|
||||
bindings::size_column(ab), bindings::size_column(c),
|
||||
bindings::bandwidth_lower(ab), bindings::bandwidth_upper(ab),
|
||||
bindings::begin_value(ab), bindings::stride_major(ab),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(q), bindings::stride_major(q),
|
||||
bindings::begin_value(pt), bindings::stride_major(pt),
|
||||
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 MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename MatrixPT, typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, MatrixPT& pt, MatrixC& c,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_row(ab), bindings::size_column(ab) ) );
|
||||
return invoke( vect, ab, d, e, q, pt, 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 MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename MatrixPT, typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, MatrixPT& pt, MatrixC& c,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( vect, ab, d, e, q, pt, c, 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,
|
||||
const std::ptrdiff_t n ) {
|
||||
return 2*std::max< std::ptrdiff_t >(m,n);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbbrd_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 MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename MatrixPT, typename MatrixC,
|
||||
typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, MatrixPT& pt, MatrixC& c,
|
||||
detail::workspace2< WORK, RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixPT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixC >::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< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixPT >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixPT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth_lower(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::bandwidth_upper(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(d) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(ab),
|
||||
bindings::size_column(ab)) );
|
||||
BOOST_ASSERT( bindings::size(e) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(ab),
|
||||
bindings::size_column(ab))-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_row(ab),
|
||||
bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_row(ab),
|
||||
bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(pt) == 1 ||
|
||||
bindings::stride_minor(pt) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >=
|
||||
bindings::bandwidth_lower(ab)+bindings::bandwidth_upper(ab)+
|
||||
1 );
|
||||
BOOST_ASSERT( vect == 'N' || vect == 'Q' || vect == 'P' ||
|
||||
vect == 'B' );
|
||||
return detail::gbbrd( vect, bindings::size_row(ab),
|
||||
bindings::size_column(ab), bindings::size_column(c),
|
||||
bindings::bandwidth_lower(ab), bindings::bandwidth_upper(ab),
|
||||
bindings::begin_value(ab), bindings::stride_major(ab),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(q), bindings::stride_major(q),
|
||||
bindings::begin_value(pt), bindings::stride_major(pt),
|
||||
bindings::begin_value(c), bindings::stride_major(c),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename MatrixPT, typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, MatrixPT& pt, MatrixC& c,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_row(ab), bindings::size_column(ab) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_row(ab), bindings::size_column(ab) ) );
|
||||
return invoke( vect, ab, d, e, q, pt, c, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename MatrixPT, typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, MatrixPT& pt, MatrixC& c,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( vect, ab, d, e, q, pt, c, 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,
|
||||
const std::ptrdiff_t n ) {
|
||||
return std::max< std::ptrdiff_t >(m,n);
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( const std::ptrdiff_t m,
|
||||
const std::ptrdiff_t n ) {
|
||||
return std::max< std::ptrdiff_t >(m,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 gbbrd_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gbbrd. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename MatrixPT, typename MatrixC,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
gbbrd( const char vect, MatrixAB& ab, VectorD& d, VectorE& e, MatrixQ& q,
|
||||
MatrixPT& pt, MatrixC& c, Workspace work ) {
|
||||
return gbbrd_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, d, e, q, pt, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gbbrd. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename MatrixPT, typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
gbbrd( const char vect, MatrixAB& ab, VectorD& d, VectorE& e, MatrixQ& q,
|
||||
MatrixPT& pt, MatrixC& c ) {
|
||||
return gbbrd_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, d, e, q, pt, c,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
364
sdk/boost/numeric/bindings/lapack/computational/gbcon.hpp
Normal file
364
sdk/boost/numeric/bindings/lapack/computational/gbcon.hpp
Normal 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_COMPUTATIONAL_GBCON_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GBCON_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_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 gbcon 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 gbcon( 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, const fortran_int_t* ipiv,
|
||||
const float anorm, float& rcond, float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGBCON( &norm, &n, &kl, &ku, ab, &ldab, ipiv, &anorm, &rcond, work,
|
||||
iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbcon( 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, const fortran_int_t* ipiv,
|
||||
const double anorm, double& rcond, double* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGBCON( &norm, &n, &kl, &ku, ab, &ldab, ipiv, &anorm, &rcond, 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 gbcon( 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,
|
||||
const fortran_int_t* ipiv, const float anorm, float& rcond,
|
||||
std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGBCON( &norm, &n, &kl, &ku, ab, &ldab, ipiv, &anorm, &rcond, work,
|
||||
rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbcon( 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,
|
||||
const fortran_int_t* ipiv, const double anorm, double& rcond,
|
||||
std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGBCON( &norm, &n, &kl, &ku, ab, &ldab, ipiv, &anorm, &rcond, work,
|
||||
rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gbcon.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gbcon_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbcon_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 MatrixAB, typename VectorIPIV, typename WORK,
|
||||
typename IWORK >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
|
||||
const VectorIPIV& ipiv, const real_type anorm, real_type& rcond,
|
||||
detail::workspace2< WORK, IWORK > 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::size(ipiv) >= bindings::size_column(ab) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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) >=
|
||||
2*bindings::bandwidth_lower(ab)+(bindings::bandwidth_upper(ab)-
|
||||
bindings::bandwidth_lower(ab))+1 );
|
||||
BOOST_ASSERT( (bindings::bandwidth_upper(ab)-
|
||||
bindings::bandwidth_lower(ab)) >= 0 );
|
||||
BOOST_ASSERT( norm == '1' || norm == 'O' || norm == 'I' );
|
||||
return detail::gbcon( norm, bindings::size_column(ab),
|
||||
bindings::bandwidth_lower(ab), (bindings::bandwidth_upper(ab)-
|
||||
bindings::bandwidth_lower(ab)), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(ipiv),
|
||||
anorm, rcond, 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 MatrixAB, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
|
||||
const VectorIPIV& ipiv, const real_type anorm, real_type& rcond,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ab) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(ab) ) );
|
||||
return invoke( norm, ab, ipiv, anorm, rcond, 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 MatrixAB, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
|
||||
const VectorIPIV& ipiv, const real_type anorm, real_type& rcond,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( norm, ab, ipiv, anorm, rcond, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbcon_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 MatrixAB, typename VectorIPIV, typename WORK,
|
||||
typename RWORK >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
|
||||
const VectorIPIV& ipiv, const real_type anorm, real_type& rcond,
|
||||
detail::workspace2< WORK, RWORK > 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::size(ipiv) >= bindings::size_column(ab) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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) >=
|
||||
2*bindings::bandwidth_lower(ab)+(bindings::bandwidth_upper(ab)-
|
||||
bindings::bandwidth_lower(ab))+1 );
|
||||
BOOST_ASSERT( (bindings::bandwidth_upper(ab)-
|
||||
bindings::bandwidth_lower(ab)) >= 0 );
|
||||
BOOST_ASSERT( norm == '1' || norm == 'O' || norm == 'I' );
|
||||
return detail::gbcon( norm, bindings::size_column(ab),
|
||||
bindings::bandwidth_lower(ab), (bindings::bandwidth_upper(ab)-
|
||||
bindings::bandwidth_lower(ab)), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(ipiv),
|
||||
anorm, rcond,
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
|
||||
const VectorIPIV& ipiv, const real_type anorm, real_type& rcond,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ab) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(ab) ) );
|
||||
return invoke( norm, ab, ipiv, anorm, rcond, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixAB& ab,
|
||||
const VectorIPIV& ipiv, const real_type anorm, real_type& rcond,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( norm, ab, ipiv, anorm, rcond, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 gbcon_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gbcon. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAB, typename VectorIPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
gbcon( const char norm, const MatrixAB& ab, const VectorIPIV& ipiv,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAB >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAB >::type >::type& rcond,
|
||||
Workspace work ) {
|
||||
return gbcon_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( norm, ab, ipiv, anorm, rcond, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gbcon. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAB, typename VectorIPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
gbcon( const char norm, const MatrixAB& ab, const VectorIPIV& ipiv,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAB >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAB >::type >::type& rcond ) {
|
||||
return gbcon_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( norm, ab, ipiv, anorm, rcond,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
238
sdk/boost/numeric/bindings/lapack/computational/gbequ.hpp
Normal file
238
sdk/boost/numeric/bindings/lapack/computational/gbequ.hpp
Normal 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_COMPUTATIONAL_GBEQU_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GBEQU_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.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 gbequ 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 gbequ( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku, const float* ab,
|
||||
const fortran_int_t ldab, float* r, float* c, float& rowcnd,
|
||||
float& colcnd, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGBEQU( &m, &n, &kl, &ku, ab, &ldab, r, c, &rowcnd, &colcnd, &amax,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbequ( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku, const double* ab,
|
||||
const fortran_int_t ldab, double* r, double* c, double& rowcnd,
|
||||
double& colcnd, double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGBEQU( &m, &n, &kl, &ku, ab, &ldab, r, c, &rowcnd, &colcnd, &amax,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbequ( const fortran_int_t m, 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* r,
|
||||
float* c, float& rowcnd, float& colcnd, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGBEQU( &m, &n, &kl, &ku, ab, &ldab, r, c, &rowcnd, &colcnd, &amax,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbequ( const fortran_int_t m, 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* r,
|
||||
double* c, double& rowcnd, double& colcnd, double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGBEQU( &m, &n, &kl, &ku, ab, &ldab, r, c, &rowcnd, &colcnd, &amax,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gbequ.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gbequ_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbequ_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 MatrixAB, typename VectorR, typename VectorC >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, VectorR& r, VectorC& c,
|
||||
real_type& rowcnd, real_type& colcnd, real_type& amax ) {
|
||||
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< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorC >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth_lower(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::bandwidth_upper(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >=
|
||||
bindings::bandwidth_lower(ab)+bindings::bandwidth_upper(ab)+
|
||||
1 );
|
||||
return detail::gbequ( bindings::size_row(ab),
|
||||
bindings::size_column(ab), bindings::bandwidth_lower(ab),
|
||||
bindings::bandwidth_upper(ab), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(r),
|
||||
bindings::begin_value(c), rowcnd, colcnd, amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbequ_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 MatrixAB, typename VectorR, typename VectorC >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, VectorR& r, VectorC& c,
|
||||
real_type& rowcnd, real_type& colcnd, real_type& amax ) {
|
||||
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< VectorR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorC >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth_lower(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::bandwidth_upper(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >=
|
||||
bindings::bandwidth_lower(ab)+bindings::bandwidth_upper(ab)+
|
||||
1 );
|
||||
return detail::gbequ( bindings::size_row(ab),
|
||||
bindings::size_column(ab), bindings::bandwidth_lower(ab),
|
||||
bindings::bandwidth_upper(ab), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(r),
|
||||
bindings::begin_value(c), rowcnd, colcnd, amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 gbequ_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gbequ. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAB, typename VectorR, typename VectorC >
|
||||
inline std::ptrdiff_t gbequ( const MatrixAB& ab, VectorR& r, VectorC& c,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAB >::type >::type& rowcnd, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAB >::type >::type& colcnd,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAB >::type >::type& amax ) {
|
||||
return gbequ_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, r, c, rowcnd, colcnd, amax );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
499
sdk/boost/numeric/bindings/lapack/computational/gbrfs.hpp
Normal file
499
sdk/boost/numeric/bindings/lapack/computational/gbrfs.hpp
Normal file
@@ -0,0 +1,499 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GBRFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GBRFS_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/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/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 gbrfs 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 >
|
||||
inline std::ptrdiff_t gbrfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
const fortran_int_t nrhs, const float* ab, const fortran_int_t ldab,
|
||||
const float* afb, const fortran_int_t ldafb,
|
||||
const fortran_int_t* ipiv, const float* b, const fortran_int_t ldb,
|
||||
float* x, const fortran_int_t ldx, float* ferr, float* berr,
|
||||
float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGBRFS( &lapack_option< Trans >::value, &n, &kl, &ku, &nrhs, ab,
|
||||
&ldab, afb, &ldafb, ipiv, b, &ldb, x, &ldx, ferr, berr, work,
|
||||
iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gbrfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
const fortran_int_t nrhs, const double* ab, const fortran_int_t ldab,
|
||||
const double* afb, const fortran_int_t ldafb,
|
||||
const fortran_int_t* ipiv, const double* b, const fortran_int_t ldb,
|
||||
double* x, const fortran_int_t ldx, double* ferr, double* berr,
|
||||
double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGBRFS( &lapack_option< Trans >::value, &n, &kl, &ku, &nrhs, ab,
|
||||
&ldab, afb, &ldafb, ipiv, b, &ldb, x, &ldx, ferr, berr, work,
|
||||
iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gbrfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
const fortran_int_t nrhs, const std::complex<float>* ab,
|
||||
const fortran_int_t ldab, const std::complex<float>* afb,
|
||||
const fortran_int_t ldafb, const fortran_int_t* ipiv,
|
||||
const std::complex<float>* b, const fortran_int_t ldb,
|
||||
std::complex<float>* x, const fortran_int_t ldx, float* ferr,
|
||||
float* berr, std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGBRFS( &lapack_option< Trans >::value, &n, &kl, &ku, &nrhs, ab,
|
||||
&ldab, afb, &ldafb, ipiv, b, &ldb, x, &ldx, ferr, berr, work,
|
||||
rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gbrfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
const fortran_int_t nrhs, const std::complex<double>* ab,
|
||||
const fortran_int_t ldab, const std::complex<double>* afb,
|
||||
const fortran_int_t ldafb, const fortran_int_t* ipiv,
|
||||
const std::complex<double>* b, const fortran_int_t ldb,
|
||||
std::complex<double>* x, const fortran_int_t ldx, double* ferr,
|
||||
double* berr, std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGBRFS( &lapack_option< Trans >::value, &n, &kl, &ku, &nrhs, ab,
|
||||
&ldab, afb, &ldafb, ipiv, b, &ldb, x, &ldx, ferr, berr, work,
|
||||
rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gbrfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gbrfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbrfs_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 MatrixAB, typename MatrixAFB, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAFB >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixAB, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::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< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorFERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth_lower_op(ab, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column_op(ab,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column_op(ab, trans()) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column_op(ab, trans()) ));
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column_op(ab, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(afb) == 1 ||
|
||||
bindings::stride_minor(afb) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >=
|
||||
bindings::bandwidth_lower_op(ab, trans())+
|
||||
(bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans()))+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(afb) >=
|
||||
2*bindings::bandwidth_lower_op(ab, trans())+
|
||||
(bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans()))+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(ab, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(ab, trans())) );
|
||||
BOOST_ASSERT( (bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans())) >= 0 );
|
||||
return detail::gbrfs( trans(), bindings::size_column_op(ab, trans()),
|
||||
bindings::bandwidth_lower_op(ab, trans()),
|
||||
(bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans())),
|
||||
bindings::size_column(b), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(afb),
|
||||
bindings::stride_major(afb), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
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 MatrixAB, typename MatrixAFB, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAFB >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixAB, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column_op(ab, trans()) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column_op(ab, trans()) ) );
|
||||
return invoke( ab, afb, ipiv, b, x, ferr, berr, 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 MatrixAB, typename MatrixAFB, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAFB >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixAB, order >::type trans;
|
||||
return invoke( ab, afb, ipiv, b, x, ferr, berr, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbrfs_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 MatrixAB, typename MatrixAFB, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAFB >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixAB, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorFERR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth_lower_op(ab, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column_op(ab,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column_op(ab, trans()) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column_op(ab, trans()) ));
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column_op(ab, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(afb) == 1 ||
|
||||
bindings::stride_minor(afb) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >=
|
||||
bindings::bandwidth_lower_op(ab, trans())+
|
||||
(bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans()))+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(afb) >=
|
||||
2*bindings::bandwidth_lower_op(ab, trans())+
|
||||
(bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans()))+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(ab, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(ab, trans())) );
|
||||
BOOST_ASSERT( (bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans())) >= 0 );
|
||||
return detail::gbrfs( trans(), bindings::size_column_op(ab, trans()),
|
||||
bindings::bandwidth_lower_op(ab, trans()),
|
||||
(bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans())),
|
||||
bindings::size_column(b), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(afb),
|
||||
bindings::stride_major(afb), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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, typename MatrixAFB, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAFB >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixAB, order >::type trans;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column_op(ab, trans()) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column_op(ab, trans()) ) );
|
||||
return invoke( ab, afb, ipiv, b, x, ferr, berr, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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, typename MatrixAFB, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAFB >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixAB, order >::type trans;
|
||||
return invoke( ab, afb, ipiv, b, x, ferr, berr, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 gbrfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gbrfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAB, typename MatrixAFB, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
gbrfs( const MatrixAB& ab, const MatrixAFB& afb, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
Workspace work ) {
|
||||
return gbrfs_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, afb, ipiv, b, x, ferr, berr,
|
||||
work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gbrfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAB, typename MatrixAFB, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
gbrfs( const MatrixAB& ab, const MatrixAFB& afb, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return gbrfs_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, afb, ipiv, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
170
sdk/boost/numeric/bindings/lapack/computational/gbtrf.hpp
Normal file
170
sdk/boost/numeric/bindings/lapack/computational/gbtrf.hpp
Normal file
@@ -0,0 +1,170 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GBTRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GBTRF_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.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 gbtrf 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 gbtrf( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku, float* ab,
|
||||
const fortran_int_t ldab, fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGBTRF( &m, &n, &kl, &ku, ab, &ldab, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbtrf( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku, double* ab,
|
||||
const fortran_int_t ldab, fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGBTRF( &m, &n, &kl, &ku, ab, &ldab, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbtrf( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
std::complex<float>* ab, const fortran_int_t ldab,
|
||||
fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGBTRF( &m, &n, &kl, &ku, ab, &ldab, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gbtrf( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
std::complex<double>* ab, const fortran_int_t ldab,
|
||||
fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGBTRF( &m, &n, &kl, &ku, ab, &ldab, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gbtrf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbtrf_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 MatrixAB, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAB& ab, VectorIPIV& ipiv ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIPIV >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth_lower(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(ab),
|
||||
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::size_row(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >=
|
||||
2*bindings::bandwidth_lower(ab)+(bindings::bandwidth_upper(ab)-
|
||||
bindings::bandwidth_lower(ab))+1 );
|
||||
BOOST_ASSERT( (bindings::bandwidth_upper(ab)-
|
||||
bindings::bandwidth_lower(ab)) >= 0 );
|
||||
return detail::gbtrf( bindings::size_row(ab),
|
||||
bindings::size_column(ab), bindings::bandwidth_lower(ab),
|
||||
(bindings::bandwidth_upper(ab)-bindings::bandwidth_lower(ab)),
|
||||
bindings::begin_value(ab), bindings::stride_major(ab),
|
||||
bindings::begin_value(ipiv) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 gbtrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gbtrf. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAB, typename VectorIPIV >
|
||||
inline std::ptrdiff_t gbtrf( MatrixAB& ab, VectorIPIV& ipiv ) {
|
||||
return gbtrf_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, ipiv );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
195
sdk/boost/numeric/bindings/lapack/computational/gbtrs.hpp
Normal file
195
sdk/boost/numeric/bindings/lapack/computational/gbtrs.hpp
Normal 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_COMPUTATIONAL_GBTRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GBTRS_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/is_mutable.hpp>
|
||||
#include <boost/numeric/bindings/remove_imaginary.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for gbtrs 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 >
|
||||
inline std::ptrdiff_t gbtrs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
const fortran_int_t nrhs, const float* ab, const fortran_int_t ldab,
|
||||
const fortran_int_t* ipiv, float* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGBTRS( &lapack_option< Trans >::value, &n, &kl, &ku, &nrhs, ab,
|
||||
&ldab, ipiv, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gbtrs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
const fortran_int_t nrhs, const double* ab, const fortran_int_t ldab,
|
||||
const fortran_int_t* ipiv, double* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGBTRS( &lapack_option< Trans >::value, &n, &kl, &ku, &nrhs, ab,
|
||||
&ldab, ipiv, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gbtrs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
const fortran_int_t nrhs, const std::complex<float>* ab,
|
||||
const fortran_int_t ldab, const fortran_int_t* ipiv,
|
||||
std::complex<float>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGBTRS( &lapack_option< Trans >::value, &n, &kl, &ku, &nrhs, ab,
|
||||
&ldab, ipiv, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gbtrs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t kl, const fortran_int_t ku,
|
||||
const fortran_int_t nrhs, const std::complex<double>* ab,
|
||||
const fortran_int_t ldab, const fortran_int_t* ipiv,
|
||||
std::complex<double>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGBTRS( &lapack_option< Trans >::value, &n, &kl, &ku, &nrhs, ab,
|
||||
&ldab, ipiv, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gbtrs.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbtrs_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 MatrixAB, typename VectorIPIV, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixB >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixAB, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth_lower_op(ab, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column_op(ab,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column_op(ab, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >=
|
||||
2*bindings::bandwidth_lower_op(ab, trans())+
|
||||
(bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans()))+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(ab, trans())) );
|
||||
BOOST_ASSERT( (bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans())) >= 0 );
|
||||
return detail::gbtrs( trans(), bindings::size_column_op(ab, trans()),
|
||||
bindings::bandwidth_lower_op(ab, trans()),
|
||||
(bindings::bandwidth_upper_op(ab, trans())-
|
||||
bindings::bandwidth_lower_op(ab, trans())),
|
||||
bindings::size_column(b), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the gbtrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gbtrs. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAB, typename VectorIPIV, typename MatrixB >
|
||||
inline std::ptrdiff_t gbtrs( const MatrixAB& ab, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
return gbtrs_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, ipiv, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
222
sdk/boost/numeric/bindings/lapack/computational/gebak.hpp
Normal file
222
sdk/boost/numeric/bindings/lapack/computational/gebak.hpp
Normal file
@@ -0,0 +1,222 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GEBAK_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GEBAK_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 gebak 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 gebak( const char job, const Side, const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi, const float* scale,
|
||||
const fortran_int_t m, float* v, const fortran_int_t ldv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGEBAK( &job, &lapack_option< Side >::value, &n, &ilo, &ihi, scale,
|
||||
&m, v, &ldv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Side >
|
||||
inline std::ptrdiff_t gebak( const char job, const Side, const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi, const double* scale,
|
||||
const fortran_int_t m, double* v, const fortran_int_t ldv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGEBAK( &job, &lapack_option< Side >::value, &n, &ilo, &ihi, scale,
|
||||
&m, v, &ldv, &info );
|
||||
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 gebak( const char job, const Side, const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi, const float* scale,
|
||||
const fortran_int_t m, std::complex<float>* v,
|
||||
const fortran_int_t ldv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGEBAK( &job, &lapack_option< Side >::value, &n, &ilo, &ihi, scale,
|
||||
&m, v, &ldv, &info );
|
||||
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 gebak( const char job, const Side, const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi, const double* scale,
|
||||
const fortran_int_t m, std::complex<double>* v,
|
||||
const fortran_int_t ldv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGEBAK( &job, &lapack_option< Side >::value, &n, &ilo, &ihi, scale,
|
||||
&m, v, &ldv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gebak.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gebak_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gebak_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 Side, typename VectorSCALE, typename MatrixV >
|
||||
static std::ptrdiff_t invoke( const char job, const Side side,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
const VectorSCALE& scale, MatrixV& v ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixV >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorSCALE >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixV >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixV >::value) );
|
||||
BOOST_ASSERT( bindings::size(scale) >= bindings::size_row(v) );
|
||||
BOOST_ASSERT( bindings::size_column(v) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(v) == 1 ||
|
||||
bindings::stride_minor(v) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(v) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(v) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(v)) );
|
||||
BOOST_ASSERT( job == 'N' || job == 'P' || job == 'S' || job == 'B' );
|
||||
return detail::gebak( job, side, bindings::size_row(v), ilo, ihi,
|
||||
bindings::begin_value(scale), bindings::size_column(v),
|
||||
bindings::begin_value(v), bindings::stride_major(v) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gebak_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 Side, typename VectorSCALE, typename MatrixV >
|
||||
static std::ptrdiff_t invoke( const char job, const Side side,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
const VectorSCALE& scale, MatrixV& v ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixV >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixV >::value) );
|
||||
BOOST_ASSERT( bindings::size(scale) >= bindings::size_row(v) );
|
||||
BOOST_ASSERT( bindings::size_column(v) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(v) == 1 ||
|
||||
bindings::stride_minor(v) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(v) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(v) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(v)) );
|
||||
BOOST_ASSERT( job == 'N' || job == 'P' || job == 'S' || job == 'B' );
|
||||
return detail::gebak( job, side, bindings::size_row(v), ilo, ihi,
|
||||
bindings::begin_value(scale), bindings::size_column(v),
|
||||
bindings::begin_value(v), bindings::stride_major(v) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 gebak_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gebak. Its overload differs for
|
||||
//
|
||||
template< typename Side, typename VectorSCALE, typename MatrixV >
|
||||
inline std::ptrdiff_t gebak( const char job, const Side side,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
const VectorSCALE& scale, MatrixV& v ) {
|
||||
return gebak_impl< typename bindings::value_type<
|
||||
MatrixV >::type >::invoke( job, side, ilo, ihi, scale, v );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
209
sdk/boost/numeric/bindings/lapack/computational/gebal.hpp
Normal file
209
sdk/boost/numeric/bindings/lapack/computational/gebal.hpp
Normal file
@@ -0,0 +1,209 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GEBAL_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GEBAL_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 gebal 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 gebal( const char job, const fortran_int_t n, float* a,
|
||||
const fortran_int_t lda, fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
float* scale ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGEBAL( &job, &n, a, &lda, &ilo, &ihi, scale, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gebal( const char job, const fortran_int_t n, double* a,
|
||||
const fortran_int_t lda, fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
double* scale ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGEBAL( &job, &n, a, &lda, &ilo, &ihi, scale, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gebal( const char job, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda, fortran_int_t& ilo,
|
||||
fortran_int_t& ihi, float* scale ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGEBAL( &job, &n, a, &lda, &ilo, &ihi, scale, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gebal( const char job, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda, fortran_int_t& ilo,
|
||||
fortran_int_t& ihi, double* scale ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGEBAL( &job, &n, a, &lda, &ilo, &ihi, scale, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gebal.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gebal_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gebal_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 VectorSCALE >
|
||||
static std::ptrdiff_t invoke( const char job, MatrixA& a,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
VectorSCALE& scale ) {
|
||||
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<
|
||||
VectorSCALE >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorSCALE >::value) );
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( job == 'N' || job == 'P' || job == 'S' || job == 'B' );
|
||||
return detail::gebal( job, bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a), ilo, ihi,
|
||||
bindings::begin_value(scale) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gebal_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 VectorSCALE >
|
||||
static std::ptrdiff_t invoke( const char job, MatrixA& a,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
VectorSCALE& scale ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorSCALE >::value) );
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( job == 'N' || job == 'P' || job == 'S' || job == 'B' );
|
||||
return detail::gebal( job, bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a), ilo, ihi,
|
||||
bindings::begin_value(scale) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 gebal_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gebal. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorSCALE >
|
||||
inline std::ptrdiff_t gebal( const char job, MatrixA& a,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi, VectorSCALE& scale ) {
|
||||
return gebal_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( job, a, ilo, ihi, scale );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
391
sdk/boost/numeric/bindings/lapack/computational/gebrd.hpp
Normal file
391
sdk/boost/numeric/bindings/lapack/computational/gebrd.hpp
Normal file
@@ -0,0 +1,391 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GEBRD_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GEBRD_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/traits/detail/utils.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 gebrd 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 gebrd( const fortran_int_t m, const fortran_int_t n,
|
||||
float* a, const fortran_int_t lda, float* d, float* e, float* tauq,
|
||||
float* taup, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGEBRD( &m, &n, a, &lda, d, e, tauq, taup, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gebrd( const fortran_int_t m, const fortran_int_t n,
|
||||
double* a, const fortran_int_t lda, double* d, double* e,
|
||||
double* tauq, double* taup, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGEBRD( &m, &n, a, &lda, d, e, tauq, taup, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gebrd( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda, float* d, float* e,
|
||||
std::complex<float>* tauq, std::complex<float>* taup,
|
||||
std::complex<float>* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGEBRD( &m, &n, a, &lda, d, e, tauq, taup, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gebrd( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda, double* d,
|
||||
double* e, std::complex<double>* tauq, std::complex<double>* taup,
|
||||
std::complex<double>* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGEBRD( &m, &n, a, &lda, d, e, tauq, taup, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gebrd.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gebrd_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gebrd_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 VectorD, typename VectorE,
|
||||
typename VectorTAUQ, typename VectorTAUP, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAUQ& tauq, VectorTAUP& taup, 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<
|
||||
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( (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_ASSERT( bindings::size(d) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(taup) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(tauq) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_row(a),
|
||||
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::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::gebrd( bindings::size_row(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(work.select(real_type())),
|
||||
bindings::size(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 VectorD, typename VectorE,
|
||||
typename VectorTAUQ, typename VectorTAUP >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAUQ& tauq, VectorTAUP& taup, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_row(a), bindings::size_column(a) ) );
|
||||
return invoke( a, d, e, tauq, taup, 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 VectorD, typename VectorE,
|
||||
typename VectorTAUQ, typename VectorTAUP >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAUQ& tauq, VectorTAUP& taup, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::gebrd( bindings::size_row(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),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, d, e, tauq, taup, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work( const std::ptrdiff_t m,
|
||||
const std::ptrdiff_t n ) {
|
||||
return std::max< std::ptrdiff_t >(1,std::max< std::ptrdiff_t >(m,n));
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gebrd_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 VectorD, typename VectorE,
|
||||
typename VectorTAUQ, typename VectorTAUP, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAUQ& tauq, VectorTAUP& taup, 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< 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( (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_ASSERT( bindings::size(d) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(taup) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(tauq) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_row(a),
|
||||
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::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::gebrd( bindings::size_row(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(work.select(value_type())),
|
||||
bindings::size(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 VectorD, typename VectorE,
|
||||
typename VectorTAUQ, typename VectorTAUP >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAUQ& tauq, VectorTAUP& taup, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_row(a), bindings::size_column(a) ) );
|
||||
return invoke( a, d, e, tauq, taup, 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 VectorD, typename VectorE,
|
||||
typename VectorTAUQ, typename VectorTAUP >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAUQ& tauq, VectorTAUP& taup, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
value_type opt_size_work;
|
||||
detail::gebrd( bindings::size_row(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),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, d, e, tauq, taup, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work( const std::ptrdiff_t m,
|
||||
const std::ptrdiff_t n ) {
|
||||
return std::max< std::ptrdiff_t >(1,std::max< std::ptrdiff_t >(m,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 gebrd_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gebrd. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorD, typename VectorE,
|
||||
typename VectorTAUQ, typename VectorTAUP, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
gebrd( MatrixA& a, VectorD& d, VectorE& e, VectorTAUQ& tauq,
|
||||
VectorTAUP& taup, Workspace work ) {
|
||||
return gebrd_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, d, e, tauq, taup, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gebrd. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorD, typename VectorE,
|
||||
typename VectorTAUQ, typename VectorTAUP >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorTAUP >,
|
||||
std::ptrdiff_t >::type
|
||||
gebrd( MatrixA& a, VectorD& d, VectorE& e, VectorTAUQ& tauq,
|
||||
VectorTAUP& taup ) {
|
||||
return gebrd_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, d, e, tauq, taup,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
333
sdk/boost/numeric/bindings/lapack/computational/gecon.hpp
Normal file
333
sdk/boost/numeric/bindings/lapack/computational/gecon.hpp
Normal file
@@ -0,0 +1,333 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GECON_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GECON_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 gecon 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 gecon( const char norm, const fortran_int_t n,
|
||||
const float* a, const fortran_int_t lda, const float anorm,
|
||||
float& rcond, float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGECON( &norm, &n, a, &lda, &anorm, &rcond, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gecon( const char norm, const fortran_int_t n,
|
||||
const double* a, const fortran_int_t lda, const double anorm,
|
||||
double& rcond, double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGECON( &norm, &n, a, &lda, &anorm, &rcond, 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 gecon( const char norm, const fortran_int_t n,
|
||||
const std::complex<float>* a, const fortran_int_t lda,
|
||||
const float anorm, float& rcond, std::complex<float>* work,
|
||||
float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGECON( &norm, &n, a, &lda, &anorm, &rcond, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gecon( const char norm, const fortran_int_t n,
|
||||
const std::complex<double>* a, const fortran_int_t lda,
|
||||
const double anorm, double& rcond, std::complex<double>* work,
|
||||
double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGECON( &norm, &n, a, &lda, &anorm, &rcond, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gecon.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gecon_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gecon_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 WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
|
||||
const real_type anorm, real_type& rcond, detail::workspace2< WORK,
|
||||
IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( norm == '1' || norm == 'O' || norm == 'I' );
|
||||
return detail::gecon( norm, bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a), anorm,
|
||||
rcond, 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 MatrixA >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
|
||||
const real_type anorm, real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(a) ) );
|
||||
return invoke( norm, a, anorm, rcond, 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 MatrixA >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( norm, a, anorm, rcond, 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 4*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gecon_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 WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const char norm, const MatrixA& a,
|
||||
const real_type anorm, real_type& rcond, detail::workspace2< WORK,
|
||||
RWORK > 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_rwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( norm == '1' || norm == 'O' || norm == 'I' );
|
||||
return detail::gecon( norm, bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a), anorm,
|
||||
rcond, bindings::begin_value(work.select(value_type())),
|
||||
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,
|
||||
const real_type anorm, real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( norm, a, anorm, rcond, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( norm, a, anorm, rcond, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 gecon_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gecon. 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
|
||||
gecon( const char norm, const MatrixA& a,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type& rcond,
|
||||
Workspace work ) {
|
||||
return gecon_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( norm, a, anorm, rcond, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gecon. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixA >,
|
||||
std::ptrdiff_t >::type
|
||||
gecon( const char norm, const MatrixA& a,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type& rcond ) {
|
||||
return gecon_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( norm, a, anorm, rcond,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
221
sdk/boost/numeric/bindings/lapack/computational/geequ.hpp
Normal file
221
sdk/boost/numeric/bindings/lapack/computational/geequ.hpp
Normal file
@@ -0,0 +1,221 @@
|
||||
//
|
||||
// Copyright (c) 2002--2010
|
||||
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
|
||||
// Thomas Klimpel and Rutger ter Borg
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED
|
||||
// PLEASE DO NOT EDIT!
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GEEQU_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GEEQU_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 geequ 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 geequ( const fortran_int_t m, const fortran_int_t n,
|
||||
const float* a, const fortran_int_t lda, float* r, float* c,
|
||||
float& rowcnd, float& colcnd, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGEEQU( &m, &n, a, &lda, r, c, &rowcnd, &colcnd, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geequ( const fortran_int_t m, const fortran_int_t n,
|
||||
const double* a, const fortran_int_t lda, double* r, double* c,
|
||||
double& rowcnd, double& colcnd, double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGEEQU( &m, &n, a, &lda, r, c, &rowcnd, &colcnd, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geequ( const fortran_int_t m, const fortran_int_t n,
|
||||
const std::complex<float>* a, const fortran_int_t lda, float* r,
|
||||
float* c, float& rowcnd, float& colcnd, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGEEQU( &m, &n, a, &lda, r, c, &rowcnd, &colcnd, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geequ( const fortran_int_t m, const fortran_int_t n,
|
||||
const std::complex<double>* a, const fortran_int_t lda, double* r,
|
||||
double* c, double& rowcnd, double& colcnd, double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGEEQU( &m, &n, a, &lda, r, c, &rowcnd, &colcnd, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to geequ.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct geequ_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct geequ_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 VectorR, typename VectorC >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, VectorR& r, VectorC& c,
|
||||
real_type& rowcnd, real_type& colcnd, real_type& amax ) {
|
||||
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<
|
||||
VectorR >::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<
|
||||
VectorC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorC >::value) );
|
||||
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::geequ( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(r), bindings::begin_value(c), rowcnd,
|
||||
colcnd, amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct geequ_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 VectorR, typename VectorC >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, VectorR& r, VectorC& c,
|
||||
real_type& rowcnd, real_type& colcnd, real_type& amax ) {
|
||||
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< VectorR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorC >::value) );
|
||||
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::geequ( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(r), bindings::begin_value(c), rowcnd,
|
||||
colcnd, amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 geequ_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for geequ. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorR, typename VectorC >
|
||||
inline std::ptrdiff_t geequ( const MatrixA& a, VectorR& r, VectorC& c,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type& rowcnd, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type& colcnd,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type& amax ) {
|
||||
return geequ_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, r, c, rowcnd, colcnd, amax );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
332
sdk/boost/numeric/bindings/lapack/computational/gehrd.hpp
Normal file
332
sdk/boost/numeric/bindings/lapack/computational/gehrd.hpp
Normal 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_COMPUTATIONAL_GEHRD_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GEHRD_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/traits/detail/utils.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 gehrd 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 gehrd( const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, float* a, const fortran_int_t lda,
|
||||
float* tau, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGEHRD( &n, &ilo, &ihi, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gehrd( const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, double* a, const fortran_int_t lda,
|
||||
double* tau, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGEHRD( &n, &ilo, &ihi, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gehrd( const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, std::complex<float>* a,
|
||||
const fortran_int_t lda, std::complex<float>* tau,
|
||||
std::complex<float>* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGEHRD( &n, &ilo, &ihi, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gehrd( const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, std::complex<double>* a,
|
||||
const fortran_int_t lda, std::complex<double>* tau,
|
||||
std::complex<double>* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGEHRD( &n, &ilo, &ihi, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gehrd.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gehrd_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gehrd_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( const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, 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_column(a)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::gehrd( bindings::size_column(a), ilo, ihi,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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( const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixA& a, VectorTAU& tau,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( ilo, ihi, 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( const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixA& a, VectorTAU& tau,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::gehrd( bindings::size_column(a), ilo, ihi,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( ilo, ihi, a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,n);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gehrd_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( const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, 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_column(a)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::gehrd( bindings::size_column(a), ilo, ihi,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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( const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixA& a, VectorTAU& tau,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( ilo, ihi, 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( const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixA& a, VectorTAU& tau,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
value_type opt_size_work;
|
||||
detail::gehrd( bindings::size_column(a), ilo, ihi,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( ilo, ihi, a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,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 gehrd_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gehrd. 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
|
||||
gehrd( const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixA& a, VectorTAU& tau, Workspace work ) {
|
||||
return gehrd_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( ilo, ihi, a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gehrd. 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
|
||||
gehrd( const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixA& a, VectorTAU& tau ) {
|
||||
return gehrd_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( ilo, ihi, a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
330
sdk/boost/numeric/bindings/lapack/computational/gelqf.hpp
Normal file
330
sdk/boost/numeric/bindings/lapack/computational/gelqf.hpp
Normal file
@@ -0,0 +1,330 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GELQF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GELQF_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/traits/detail/utils.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 gelqf 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 gelqf( const fortran_int_t m, const fortran_int_t n,
|
||||
float* a, const fortran_int_t lda, float* tau, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGELQF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gelqf( const fortran_int_t m, const fortran_int_t n,
|
||||
double* a, const fortran_int_t lda, double* tau, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGELQF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gelqf( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda,
|
||||
std::complex<float>* tau, std::complex<float>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGELQF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gelqf( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda,
|
||||
std::complex<double>* tau, std::complex<double>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGELQF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gelqf.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gelqf_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gelqf_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) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(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_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::gelqf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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;
|
||||
real_type opt_size_work;
|
||||
detail::gelqf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,m);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gelqf_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) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(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_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::gelqf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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;
|
||||
value_type opt_size_work;
|
||||
detail::gelqf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,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 gelqf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gelqf. 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
|
||||
gelqf( MatrixA& a, VectorTAU& tau, Workspace work ) {
|
||||
return gelqf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gelqf. 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
|
||||
gelqf( MatrixA& a, VectorTAU& tau ) {
|
||||
return gelqf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
330
sdk/boost/numeric/bindings/lapack/computational/geqlf.hpp
Normal file
330
sdk/boost/numeric/bindings/lapack/computational/geqlf.hpp
Normal file
@@ -0,0 +1,330 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GEQLF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GEQLF_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/traits/detail/utils.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 geqlf 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 geqlf( const fortran_int_t m, const fortran_int_t n,
|
||||
float* a, const fortran_int_t lda, float* tau, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGEQLF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geqlf( const fortran_int_t m, const fortran_int_t n,
|
||||
double* a, const fortran_int_t lda, double* tau, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGEQLF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geqlf( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda,
|
||||
std::complex<float>* tau, std::complex<float>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGEQLF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geqlf( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda,
|
||||
std::complex<double>* tau, std::complex<double>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGEQLF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to geqlf.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct geqlf_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct geqlf_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) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::geqlf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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_column(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;
|
||||
real_type opt_size_work;
|
||||
detail::geqlf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,n);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct geqlf_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) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::geqlf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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_column(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;
|
||||
value_type opt_size_work;
|
||||
detail::geqlf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,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 geqlf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for geqlf. 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
|
||||
geqlf( MatrixA& a, VectorTAU& tau, Workspace work ) {
|
||||
return geqlf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for geqlf. 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
|
||||
geqlf( MatrixA& a, VectorTAU& tau ) {
|
||||
return geqlf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
352
sdk/boost/numeric/bindings/lapack/computational/geqp3.hpp
Normal file
352
sdk/boost/numeric/bindings/lapack/computational/geqp3.hpp
Normal file
@@ -0,0 +1,352 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GEQP3_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GEQP3_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/traits/detail/utils.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 geqp3 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 geqp3( const fortran_int_t m, const fortran_int_t n,
|
||||
float* a, const fortran_int_t lda, fortran_int_t* jpvt, float* tau,
|
||||
float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGEQP3( &m, &n, a, &lda, jpvt, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geqp3( const fortran_int_t m, const fortran_int_t n,
|
||||
double* a, const fortran_int_t lda, fortran_int_t* jpvt, double* tau,
|
||||
double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGEQP3( &m, &n, a, &lda, jpvt, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geqp3( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda, fortran_int_t* jpvt,
|
||||
std::complex<float>* tau, std::complex<float>* work,
|
||||
const fortran_int_t lwork, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGEQP3( &m, &n, a, &lda, jpvt, tau, work, &lwork, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geqp3( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda, fortran_int_t* jpvt,
|
||||
std::complex<double>* tau, std::complex<double>* work,
|
||||
const fortran_int_t lwork, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGEQP3( &m, &n, a, &lda, jpvt, tau, work, &lwork, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to geqp3.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct geqp3_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct geqp3_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 VectorJPVT, typename VectorTAU,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorJPVT& jpvt, 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< VectorJPVT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAU >::value) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::geqp3( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(jpvt), bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 VectorJPVT, typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorJPVT& jpvt, VectorTAU& tau,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, jpvt, 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 VectorJPVT, typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorJPVT& jpvt, VectorTAU& tau,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::geqp3( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(jpvt), bindings::begin_value(tau),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, jpvt, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 3*n+1;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct geqp3_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 VectorJPVT, typename VectorTAU,
|
||||
typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorJPVT& jpvt, VectorTAU& tau,
|
||||
detail::workspace2< WORK, RWORK > 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< VectorJPVT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAU >::value) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::geqp3( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(jpvt), bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(work.select(value_type())),
|
||||
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 VectorJPVT, typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorJPVT& jpvt, VectorTAU& tau,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, jpvt, tau, workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 VectorJPVT, typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorJPVT& jpvt, VectorTAU& tau,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
value_type opt_size_work;
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(a) ) );
|
||||
detail::geqp3( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(jpvt), bindings::begin_value(tau),
|
||||
&opt_size_work, -1, bindings::begin_value(tmp_rwork) );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, jpvt, tau, workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 n+1;
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 geqp3_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for geqp3. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorJPVT, typename VectorTAU,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
geqp3( MatrixA& a, VectorJPVT& jpvt, VectorTAU& tau, Workspace work ) {
|
||||
return geqp3_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, jpvt, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for geqp3. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorJPVT, typename VectorTAU >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorTAU >,
|
||||
std::ptrdiff_t >::type
|
||||
geqp3( MatrixA& a, VectorJPVT& jpvt, VectorTAU& tau ) {
|
||||
return geqp3_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, jpvt, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
330
sdk/boost/numeric/bindings/lapack/computational/geqrf.hpp
Normal file
330
sdk/boost/numeric/bindings/lapack/computational/geqrf.hpp
Normal file
@@ -0,0 +1,330 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GEQRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GEQRF_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/traits/detail/utils.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 geqrf 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 geqrf( const fortran_int_t m, const fortran_int_t n,
|
||||
float* a, const fortran_int_t lda, float* tau, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGEQRF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geqrf( const fortran_int_t m, const fortran_int_t n,
|
||||
double* a, const fortran_int_t lda, double* tau, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGEQRF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geqrf( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda,
|
||||
std::complex<float>* tau, std::complex<float>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGEQRF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t geqrf( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda,
|
||||
std::complex<double>* tau, std::complex<double>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGEQRF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to geqrf.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct geqrf_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct geqrf_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) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::geqrf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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_column(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;
|
||||
real_type opt_size_work;
|
||||
detail::geqrf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,n);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct geqrf_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) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::geqrf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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_column(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;
|
||||
value_type opt_size_work;
|
||||
detail::geqrf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,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 geqrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for geqrf. 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
|
||||
geqrf( MatrixA& a, VectorTAU& tau, Workspace work ) {
|
||||
return geqrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for geqrf. 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
|
||||
geqrf( MatrixA& a, VectorTAU& tau ) {
|
||||
return geqrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
469
sdk/boost/numeric/bindings/lapack/computational/gerfs.hpp
Normal file
469
sdk/boost/numeric/bindings/lapack/computational/gerfs.hpp
Normal file
@@ -0,0 +1,469 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GERFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GERFS_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/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 gerfs 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 >
|
||||
inline std::ptrdiff_t gerfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* a, const fortran_int_t lda,
|
||||
const float* af, const fortran_int_t ldaf, const fortran_int_t* ipiv,
|
||||
const float* b, const fortran_int_t ldb, float* x,
|
||||
const fortran_int_t ldx, float* ferr, float* berr, float* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGERFS( &lapack_option< Trans >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, ipiv, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gerfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* a, const fortran_int_t lda,
|
||||
const double* af, const fortran_int_t ldaf, const fortran_int_t* ipiv,
|
||||
const double* b, const fortran_int_t ldb, double* x,
|
||||
const fortran_int_t ldx, double* ferr, double* berr, double* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGERFS( &lapack_option< Trans >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, ipiv, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gerfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* a,
|
||||
const fortran_int_t lda, const std::complex<float>* af,
|
||||
const fortran_int_t ldaf, const fortran_int_t* ipiv,
|
||||
const std::complex<float>* b, const fortran_int_t ldb,
|
||||
std::complex<float>* x, const fortran_int_t ldx, float* ferr,
|
||||
float* berr, std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGERFS( &lapack_option< Trans >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, ipiv, b, &ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gerfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* a,
|
||||
const fortran_int_t lda, const std::complex<double>* af,
|
||||
const fortran_int_t ldaf, const fortran_int_t* ipiv,
|
||||
const std::complex<double>* b, const fortran_int_t ldb,
|
||||
std::complex<double>* x, const fortran_int_t ldx, double* ferr,
|
||||
double* berr, std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGERFS( &lapack_option< Trans >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, ipiv, b, &ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gerfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gerfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gerfs_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 MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAF >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAF >::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<
|
||||
MatrixB >::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<
|
||||
VectorFERR >::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<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column_op(a,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column_op(a, trans()) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column_op(a, trans()) ));
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column_op(a, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(af) == 1 ||
|
||||
bindings::stride_minor(af) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(a, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(af) >= std::max<
|
||||
std::ptrdiff_t >(1,bindings::size_column_op(a, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(a, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(a, trans())) );
|
||||
return detail::gerfs( trans(), bindings::size_column_op(a, trans()),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(af),
|
||||
bindings::stride_major(af), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
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 MatrixA, typename MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAF >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column_op(a, trans()) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column_op(a, trans()) ) );
|
||||
return invoke( a, af, ipiv, b, x, ferr, berr, 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 MatrixA, typename MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAF >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
return invoke( a, af, ipiv, b, x, ferr, berr, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gerfs_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 MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAF >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorFERR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::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<
|
||||
MatrixAF >::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<
|
||||
MatrixB >::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( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column_op(a,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column_op(a, trans()) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column_op(a, trans()) ));
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column_op(a, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(af) == 1 ||
|
||||
bindings::stride_minor(af) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(a, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(af) >= std::max<
|
||||
std::ptrdiff_t >(1,bindings::size_column_op(a, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(a, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(a, trans())) );
|
||||
return detail::gerfs( trans(), bindings::size_column_op(a, trans()),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(af),
|
||||
bindings::stride_major(af), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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 MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAF >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column_op(a, trans()) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column_op(a, trans()) ) );
|
||||
return invoke( a, af, ipiv, b, x, ferr, berr, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAF >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
return invoke( a, af, ipiv, b, x, ferr, berr, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 gerfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gerfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
gerfs( const MatrixA& a, const MatrixAF& af, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
Workspace work ) {
|
||||
return gerfs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, af, ipiv, b, x, ferr, berr, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gerfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
gerfs( const MatrixA& a, const MatrixAF& af, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return gerfs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, af, ipiv, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
330
sdk/boost/numeric/bindings/lapack/computational/gerqf.hpp
Normal file
330
sdk/boost/numeric/bindings/lapack/computational/gerqf.hpp
Normal file
@@ -0,0 +1,330 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GERQF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GERQF_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/traits/detail/utils.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 gerqf 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 gerqf( const fortran_int_t m, const fortran_int_t n,
|
||||
float* a, const fortran_int_t lda, float* tau, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGERQF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gerqf( const fortran_int_t m, const fortran_int_t n,
|
||||
double* a, const fortran_int_t lda, double* tau, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGERQF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gerqf( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda,
|
||||
std::complex<float>* tau, std::complex<float>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGERQF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gerqf( const fortran_int_t m, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda,
|
||||
std::complex<double>* tau, std::complex<double>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGERQF( &m, &n, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gerqf.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gerqf_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gerqf_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) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(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_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::gerqf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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;
|
||||
real_type opt_size_work;
|
||||
detail::gerqf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,m);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gerqf_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) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(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_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::gerqf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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;
|
||||
value_type opt_size_work;
|
||||
detail::gerqf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,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 gerqf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gerqf. 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
|
||||
gerqf( MatrixA& a, VectorTAU& tau, Workspace work ) {
|
||||
return gerqf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gerqf. 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
|
||||
gerqf( MatrixA& a, VectorTAU& tau ) {
|
||||
return gerqf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
228
sdk/boost/numeric/bindings/lapack/computational/getrf.hpp
Normal file
228
sdk/boost/numeric/bindings/lapack/computational/getrf.hpp
Normal file
@@ -0,0 +1,228 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GETRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GETRF_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.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 getrf is selected by defining a pre-processor
|
||||
// variable, which can be one of
|
||||
// * for ATLAS's CLAPACK, define BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
// * netlib-compatible LAPACK is the default
|
||||
//
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack_option.hpp>
|
||||
#else
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
|
||||
#endif
|
||||
|
||||
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 {
|
||||
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getrf( Order, const int m, const int n, float* a,
|
||||
const int lda, int* ipiv ) {
|
||||
return clapack_sgetrf( clapack_option< Order >::value, m, n, a, lda,
|
||||
ipiv );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getrf( Order, const int m, const int n, double* a,
|
||||
const int lda, int* ipiv ) {
|
||||
return clapack_dgetrf( clapack_option< Order >::value, m, n, a, lda,
|
||||
ipiv );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getrf( Order, const int m, const int n,
|
||||
std::complex<float>* a, const int lda, int* ipiv ) {
|
||||
return clapack_cgetrf( clapack_option< Order >::value, m, n, a, lda,
|
||||
ipiv );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getrf( Order, const int m, const int n,
|
||||
std::complex<double>* a, const int lda, int* ipiv ) {
|
||||
return clapack_zgetrf( clapack_option< Order >::value, m, n, a, lda,
|
||||
ipiv );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getrf( Order, const fortran_int_t m,
|
||||
const fortran_int_t n, float* a, const fortran_int_t lda,
|
||||
fortran_int_t* ipiv ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGETRF( &m, &n, a, &lda, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getrf( Order, const fortran_int_t m,
|
||||
const fortran_int_t n, double* a, const fortran_int_t lda,
|
||||
fortran_int_t* ipiv ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGETRF( &m, &n, a, &lda, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getrf( Order, const fortran_int_t m,
|
||||
const fortran_int_t n, std::complex<float>* a,
|
||||
const fortran_int_t lda, fortran_int_t* ipiv ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGETRF( &m, &n, a, &lda, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getrf( Order, const fortran_int_t m,
|
||||
const fortran_int_t n, std::complex<double>* a,
|
||||
const fortran_int_t lda, fortran_int_t* ipiv ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGETRF( &m, &n, a, &lda, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to getrf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct getrf_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 MatrixA, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorIPIV& ipiv ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIPIV >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
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::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::getrf( order(), bindings::size_row(a),
|
||||
bindings::size_column(a), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(ipiv) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 getrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for getrf. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV >
|
||||
inline std::ptrdiff_t getrf( MatrixA& a, VectorIPIV& ipiv ) {
|
||||
return getrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
399
sdk/boost/numeric/bindings/lapack/computational/getri.hpp
Normal file
399
sdk/boost/numeric/bindings/lapack/computational/getri.hpp
Normal file
@@ -0,0 +1,399 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GETRI_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GETRI_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/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/traits/detail/utils.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 getri is selected by defining a pre-processor
|
||||
// variable, which can be one of
|
||||
// * for ATLAS's CLAPACK, define BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
// * netlib-compatible LAPACK is the default
|
||||
//
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack_option.hpp>
|
||||
#else
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
|
||||
#endif
|
||||
|
||||
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 {
|
||||
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getri( Order, const int n, float* a, const int lda,
|
||||
const int* ipiv, float* work, const int lwork ) {
|
||||
return clapack_sgetri( clapack_option< Order >::value, n, a, lda, ipiv );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getri( Order, const int n, double* a, const int lda,
|
||||
const int* ipiv, double* work, const int lwork ) {
|
||||
return clapack_dgetri( clapack_option< Order >::value, n, a, lda, ipiv );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getri( Order, const int n, std::complex<float>* a,
|
||||
const int lda, const int* ipiv, std::complex<float>* work,
|
||||
const int lwork ) {
|
||||
return clapack_cgetri( clapack_option< Order >::value, n, a, lda, ipiv );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getri( Order, const int n, std::complex<double>* a,
|
||||
const int lda, const int* ipiv, std::complex<double>* work,
|
||||
const int lwork ) {
|
||||
return clapack_zgetri( clapack_option< Order >::value, n, a, lda, ipiv );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getri( Order, const fortran_int_t n, float* a,
|
||||
const fortran_int_t lda, const fortran_int_t* ipiv, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGETRI( &n, a, &lda, ipiv, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getri( Order, const fortran_int_t n, double* a,
|
||||
const fortran_int_t lda, const fortran_int_t* ipiv, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGETRI( &n, a, &lda, ipiv, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getri( Order, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, std::complex<float>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGETRI( &n, a, &lda, ipiv, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline std::ptrdiff_t getri( Order, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, std::complex<double>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGETRI( &n, a, &lda, ipiv, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to getri.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct getri_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct getri_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 VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::getri( order(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, ipiv, 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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
bindings::detail::array< real_type > tmp_work( 0 );
|
||||
#else
|
||||
real_type opt_size_work;
|
||||
detail::getri( order(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
#endif
|
||||
return invoke( a, ipiv, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work( const std::ptrdiff_t n ) {
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
return 0;
|
||||
#else
|
||||
return std::max< std::ptrdiff_t >(1,n);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct getri_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 VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::getri( order(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, ipiv, 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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
bindings::detail::array< value_type > tmp_work( 0 );
|
||||
#else
|
||||
value_type opt_size_work;
|
||||
detail::getri( order(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
#endif
|
||||
return invoke( a, ipiv, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work( const std::ptrdiff_t n ) {
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
return 0;
|
||||
#else
|
||||
return std::max< std::ptrdiff_t >(1,n);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 getri_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for getri. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
getri( MatrixA& a, const VectorIPIV& ipiv, Workspace work ) {
|
||||
return getri_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for getri. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
getri( MatrixA& a, const VectorIPIV& ipiv ) {
|
||||
return getri_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
255
sdk/boost/numeric/bindings/lapack/computational/getrs.hpp
Normal file
255
sdk/boost/numeric/bindings/lapack/computational/getrs.hpp
Normal file
@@ -0,0 +1,255 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GETRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GETRS_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.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/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for getrs is selected by defining a pre-processor
|
||||
// variable, which can be one of
|
||||
// * for ATLAS's CLAPACK, define BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
// * netlib-compatible LAPACK is the default
|
||||
//
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack_option.hpp>
|
||||
#else
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
|
||||
#endif
|
||||
|
||||
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 {
|
||||
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline std::ptrdiff_t getrs( Order, const Trans, const int n, const int nrhs,
|
||||
const float* a, const int lda, const int* ipiv, float* b,
|
||||
const int ldb ) {
|
||||
return clapack_sgetrs
|
||||
( clapack_option< Order >::value, clapack_option< Trans >::value, n, nrhs,
|
||||
a, lda, ipiv, b, ldb );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline std::ptrdiff_t getrs( Order, const Trans, const int n, const int nrhs,
|
||||
const double* a, const int lda, const int* ipiv, double* b,
|
||||
const int ldb ) {
|
||||
return clapack_dgetrs
|
||||
( clapack_option< Order >::value, clapack_option< Trans >::value, n, nrhs,
|
||||
a, lda, ipiv, b, ldb );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline std::ptrdiff_t getrs( Order, const Trans, const int n, const int nrhs,
|
||||
const std::complex<float>* a, const int lda, const int* ipiv,
|
||||
std::complex<float>* b, const int ldb ) {
|
||||
return clapack_cgetrs
|
||||
( clapack_option< Order >::value, clapack_option< Trans >::value, n, nrhs,
|
||||
a, lda, ipiv, b, ldb );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline std::ptrdiff_t getrs( Order, const Trans, const int n, const int nrhs,
|
||||
const std::complex<double>* a, const int lda, const int* ipiv,
|
||||
std::complex<double>* b, const int ldb ) {
|
||||
return clapack_zgetrs
|
||||
( clapack_option< Order >::value, clapack_option< Trans >::value, n, nrhs,
|
||||
a, lda, ipiv, b, ldb );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline std::ptrdiff_t getrs( Order, const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, float* b, const fortran_int_t ldb ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGETRS( &lapack_option< Trans >::value, &n, &nrhs, a, &lda, ipiv,
|
||||
b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline std::ptrdiff_t getrs( Order, const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, double* b, const fortran_int_t ldb ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGETRS( &lapack_option< Trans >::value, &n, &nrhs, a, &lda, ipiv,
|
||||
b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline std::ptrdiff_t getrs( Order, const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* a,
|
||||
const fortran_int_t lda, const fortran_int_t* ipiv,
|
||||
std::complex<float>* b, const fortran_int_t ldb ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGETRS( &lapack_option< Trans >::value, &n, &nrhs, a, &lda, ipiv,
|
||||
b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline std::ptrdiff_t getrs( Order, const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* a,
|
||||
const fortran_int_t lda, const fortran_int_t* ipiv,
|
||||
std::complex<double>* b, const fortran_int_t ldb ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGETRS( &lapack_option< Trans >::value, &n, &nrhs, a, &lda, ipiv,
|
||||
b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to getrs.
|
||||
//
|
||||
template< typename Value >
|
||||
struct getrs_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 MatrixA, typename VectorIPIV, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixB >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column_op(a,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column_op(a, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(a, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(a, trans())) );
|
||||
return detail::getrs( order(), trans(), bindings::size_column_op(a,
|
||||
trans()), bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the getrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for getrs. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV, typename MatrixB >
|
||||
inline std::ptrdiff_t getrs( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
return getrs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
242
sdk/boost/numeric/bindings/lapack/computational/ggbak.hpp
Normal file
242
sdk/boost/numeric/bindings/lapack/computational/ggbak.hpp
Normal file
@@ -0,0 +1,242 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GGBAK_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GGBAK_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 ggbak 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 ggbak( const char job, const Side, const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi, const float* lscale,
|
||||
const float* rscale, const fortran_int_t m, float* v,
|
||||
const fortran_int_t ldv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGGBAK( &job, &lapack_option< Side >::value, &n, &ilo, &ihi,
|
||||
lscale, rscale, &m, v, &ldv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Side >
|
||||
inline std::ptrdiff_t ggbak( const char job, const Side, const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
const double* lscale, const double* rscale, const fortran_int_t m,
|
||||
double* v, const fortran_int_t ldv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGGBAK( &job, &lapack_option< Side >::value, &n, &ilo, &ihi,
|
||||
lscale, rscale, &m, v, &ldv, &info );
|
||||
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 ggbak( const char job, const Side, const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi, const float* lscale,
|
||||
const float* rscale, const fortran_int_t m, std::complex<float>* v,
|
||||
const fortran_int_t ldv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGGBAK( &job, &lapack_option< Side >::value, &n, &ilo, &ihi,
|
||||
lscale, rscale, &m, v, &ldv, &info );
|
||||
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 ggbak( const char job, const Side, const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
const double* lscale, const double* rscale, const fortran_int_t m,
|
||||
std::complex<double>* v, const fortran_int_t ldv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGGBAK( &job, &lapack_option< Side >::value, &n, &ilo, &ihi,
|
||||
lscale, rscale, &m, v, &ldv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ggbak.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct ggbak_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggbak_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 Side, typename VectorLSCALE, typename VectorRSCALE,
|
||||
typename MatrixV >
|
||||
static std::ptrdiff_t invoke( const char job, const Side side,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
const VectorLSCALE& lscale, const VectorRSCALE& rscale,
|
||||
MatrixV& v ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixV >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorLSCALE >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorRSCALE >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorLSCALE >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixV >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixV >::value) );
|
||||
BOOST_ASSERT( bindings::size(lscale) >= bindings::size_row(v) );
|
||||
BOOST_ASSERT( bindings::size(rscale) >= bindings::size_row(v) );
|
||||
BOOST_ASSERT( bindings::size_column(v) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(v) == 1 ||
|
||||
bindings::stride_minor(v) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(v) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(v) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(v)) );
|
||||
BOOST_ASSERT( job == 'N' || job == 'P' || job == 'S' || job == 'B' );
|
||||
return detail::ggbak( job, side, bindings::size_row(v), ilo, ihi,
|
||||
bindings::begin_value(lscale), bindings::begin_value(rscale),
|
||||
bindings::size_column(v), bindings::begin_value(v),
|
||||
bindings::stride_major(v) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggbak_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 Side, typename VectorLSCALE, typename VectorRSCALE,
|
||||
typename MatrixV >
|
||||
static std::ptrdiff_t invoke( const char job, const Side side,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
const VectorLSCALE& lscale, const VectorRSCALE& rscale,
|
||||
MatrixV& v ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixV >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorLSCALE >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorRSCALE >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixV >::value) );
|
||||
BOOST_ASSERT( bindings::size(lscale) >= bindings::size_row(v) );
|
||||
BOOST_ASSERT( bindings::size(rscale) >= bindings::size_row(v) );
|
||||
BOOST_ASSERT( bindings::size_column(v) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(v) == 1 ||
|
||||
bindings::stride_minor(v) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(v) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(v) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(v)) );
|
||||
BOOST_ASSERT( job == 'N' || job == 'P' || job == 'S' || job == 'B' );
|
||||
return detail::ggbak( job, side, bindings::size_row(v), ilo, ihi,
|
||||
bindings::begin_value(lscale), bindings::begin_value(rscale),
|
||||
bindings::size_column(v), bindings::begin_value(v),
|
||||
bindings::stride_major(v) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 ggbak_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ggbak. Its overload differs for
|
||||
//
|
||||
template< typename Side, typename VectorLSCALE, typename VectorRSCALE,
|
||||
typename MatrixV >
|
||||
inline std::ptrdiff_t ggbak( const char job, const Side side,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
const VectorLSCALE& lscale, const VectorRSCALE& rscale, MatrixV& v ) {
|
||||
return ggbak_impl< typename bindings::value_type<
|
||||
MatrixV >::type >::invoke( job, side, ilo, ihi, lscale, rscale,
|
||||
v );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
376
sdk/boost/numeric/bindings/lapack/computational/ggbal.hpp
Normal file
376
sdk/boost/numeric/bindings/lapack/computational/ggbal.hpp
Normal file
@@ -0,0 +1,376 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GGBAL_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GGBAL_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 ggbal 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 ggbal( const char job, const fortran_int_t n, float* a,
|
||||
const fortran_int_t lda, float* b, const fortran_int_t ldb,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi, float* lscale, float* rscale,
|
||||
float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGGBAL( &job, &n, a, &lda, b, &ldb, &ilo, &ihi, lscale, rscale,
|
||||
work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggbal( const char job, const fortran_int_t n, double* a,
|
||||
const fortran_int_t lda, double* b, const fortran_int_t ldb,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi, double* lscale,
|
||||
double* rscale, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGGBAL( &job, &n, a, &lda, b, &ldb, &ilo, &ihi, lscale, rscale,
|
||||
work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggbal( const char job, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda,
|
||||
std::complex<float>* b, const fortran_int_t ldb, fortran_int_t& ilo,
|
||||
fortran_int_t& ihi, float* lscale, float* rscale, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGGBAL( &job, &n, a, &lda, b, &ldb, &ilo, &ihi, lscale, rscale,
|
||||
work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggbal( const char job, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda,
|
||||
std::complex<double>* b, const fortran_int_t ldb, fortran_int_t& ilo,
|
||||
fortran_int_t& ihi, double* lscale, double* rscale, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGGBAL( &job, &n, a, &lda, b, &ldb, &ilo, &ihi, lscale, rscale,
|
||||
work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ggbal.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct ggbal_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggbal_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 MatrixB, typename VectorLSCALE,
|
||||
typename VectorRSCALE, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char job, MatrixA& a, MatrixB& b,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
VectorLSCALE& lscale, VectorRSCALE& rscale, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorLSCALE >::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<
|
||||
VectorRSCALE >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorLSCALE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorRSCALE >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( job, 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::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( job == 'N' || job == 'P' || job == 'S' || job == 'B' );
|
||||
return detail::ggbal( job, bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(b), bindings::stride_major(b), ilo, ihi,
|
||||
bindings::begin_value(lscale), bindings::begin_value(rscale),
|
||||
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 MatrixB, typename VectorLSCALE,
|
||||
typename VectorRSCALE >
|
||||
static std::ptrdiff_t invoke( const char job, MatrixA& a, MatrixB& b,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
VectorLSCALE& lscale, VectorRSCALE& rscale, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( job,
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( job, a, b, ilo, ihi, lscale, rscale,
|
||||
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 MatrixB, typename VectorLSCALE,
|
||||
typename VectorRSCALE >
|
||||
static std::ptrdiff_t invoke( const char job, MatrixA& a, MatrixB& b,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
VectorLSCALE& lscale, VectorRSCALE& rscale, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( job, a, b, ilo, ihi, lscale, rscale,
|
||||
minimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work( const char job,
|
||||
const std::ptrdiff_t n ) {
|
||||
if ( job == 'S' || job == 'B' )
|
||||
return std::max< std::ptrdiff_t >(1, 6*n);
|
||||
else // if ( job == 'N' || job == 'P' )
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggbal_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 MatrixB, typename VectorLSCALE,
|
||||
typename VectorRSCALE, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char job, MatrixA& a, MatrixB& b,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
VectorLSCALE& lscale, VectorRSCALE& rscale, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorLSCALE >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorRSCALE >::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<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorLSCALE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorRSCALE >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( job, 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::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( job == 'N' || job == 'P' || job == 'S' || job == 'B' );
|
||||
return detail::ggbal( job, bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(b), bindings::stride_major(b), ilo, ihi,
|
||||
bindings::begin_value(lscale), bindings::begin_value(rscale),
|
||||
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 MatrixB, typename VectorLSCALE,
|
||||
typename VectorRSCALE >
|
||||
static std::ptrdiff_t invoke( const char job, MatrixA& a, MatrixB& b,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
VectorLSCALE& lscale, VectorRSCALE& rscale, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( job,
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( job, a, b, ilo, ihi, lscale, rscale,
|
||||
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 MatrixB, typename VectorLSCALE,
|
||||
typename VectorRSCALE >
|
||||
static std::ptrdiff_t invoke( const char job, MatrixA& a, MatrixB& b,
|
||||
fortran_int_t& ilo, fortran_int_t& ihi,
|
||||
VectorLSCALE& lscale, VectorRSCALE& rscale, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( job, a, b, ilo, ihi, lscale, rscale,
|
||||
minimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work( const char job,
|
||||
const std::ptrdiff_t n ) {
|
||||
if ( job == 'S' || job == 'B' )
|
||||
return std::max< std::ptrdiff_t >(1, 6*n);
|
||||
else // if ( job == 'N' || job == 'P' )
|
||||
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 ggbal_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ggbal. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename MatrixB, typename VectorLSCALE,
|
||||
typename VectorRSCALE, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ggbal( const char job, MatrixA& a, MatrixB& b, fortran_int_t& ilo,
|
||||
fortran_int_t& ihi, VectorLSCALE& lscale, VectorRSCALE& rscale,
|
||||
Workspace work ) {
|
||||
return ggbal_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( job, a, b, ilo, ihi, lscale, rscale,
|
||||
work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ggbal. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename MatrixB, typename VectorLSCALE,
|
||||
typename VectorRSCALE >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorRSCALE >,
|
||||
std::ptrdiff_t >::type
|
||||
ggbal( const char job, MatrixA& a, MatrixB& b, fortran_int_t& ilo,
|
||||
fortran_int_t& ihi, VectorLSCALE& lscale, VectorRSCALE& rscale ) {
|
||||
return ggbal_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( job, a, b, ilo, ihi, lscale, rscale,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
209
sdk/boost/numeric/bindings/lapack/computational/gghrd.hpp
Normal file
209
sdk/boost/numeric/bindings/lapack/computational/gghrd.hpp
Normal file
@@ -0,0 +1,209 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GGHRD_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GGHRD_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 gghrd 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 gghrd( const char compq, const char compz,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, float* a, const fortran_int_t lda, float* b,
|
||||
const fortran_int_t ldb, float* q, const fortran_int_t ldq, float* z,
|
||||
const fortran_int_t ldz ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGGHRD( &compq, &compz, &n, &ilo, &ihi, a, &lda, b, &ldb, q, &ldq,
|
||||
z, &ldz, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gghrd( const char compq, const char compz,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, double* a, const fortran_int_t lda,
|
||||
double* b, const fortran_int_t ldb, double* q,
|
||||
const fortran_int_t ldq, double* z, const fortran_int_t ldz ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGGHRD( &compq, &compz, &n, &ilo, &ihi, a, &lda, b, &ldb, q, &ldq,
|
||||
z, &ldz, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gghrd( const char compq, const char compz,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, std::complex<float>* a,
|
||||
const fortran_int_t lda, std::complex<float>* b,
|
||||
const fortran_int_t ldb, std::complex<float>* q,
|
||||
const fortran_int_t ldq, std::complex<float>* z,
|
||||
const fortran_int_t ldz ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGGHRD( &compq, &compz, &n, &ilo, &ihi, a, &lda, b, &ldb, q, &ldq,
|
||||
z, &ldz, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t gghrd( const char compq, const char compz,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, std::complex<double>* a,
|
||||
const fortran_int_t lda, std::complex<double>* b,
|
||||
const fortran_int_t ldb, std::complex<double>* q,
|
||||
const fortran_int_t ldq, std::complex<double>* z,
|
||||
const fortran_int_t ldz ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGGHRD( &compq, &compz, &n, &ilo, &ihi, a, &lda, b, &ldb, q, &ldq,
|
||||
z, &ldz, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gghrd.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gghrd_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 MatrixA, typename MatrixB, typename MatrixQ,
|
||||
typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char compq, const char compz,
|
||||
const fortran_int_t ilo, MatrixA& a, MatrixB& b, MatrixQ& q,
|
||||
MatrixZ& z ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixZ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixQ >::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<
|
||||
MatrixZ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixZ >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(z) == 1 ||
|
||||
bindings::stride_minor(z) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( compq == 'N' || compq == 'I' || compq == 'V' );
|
||||
BOOST_ASSERT( compz == 'N' || compz == 'I' || compz == 'V' );
|
||||
return detail::gghrd( compq, compz, bindings::size_column(a), ilo,
|
||||
bindings::size_column(a), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(b),
|
||||
bindings::stride_major(b), bindings::begin_value(q),
|
||||
bindings::stride_major(q), bindings::begin_value(z),
|
||||
bindings::stride_major(z) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 gghrd_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gghrd. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename MatrixB, typename MatrixQ,
|
||||
typename MatrixZ >
|
||||
inline std::ptrdiff_t gghrd( const char compq, const char compz,
|
||||
const fortran_int_t ilo, MatrixA& a, MatrixB& b, MatrixQ& q,
|
||||
MatrixZ& z ) {
|
||||
return gghrd_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( compq, compz, ilo, a, b, q, z );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
403
sdk/boost/numeric/bindings/lapack/computational/ggqrf.hpp
Normal file
403
sdk/boost/numeric/bindings/lapack/computational/ggqrf.hpp
Normal file
@@ -0,0 +1,403 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GGQRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GGQRF_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/traits/detail/utils.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 ggqrf 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 ggqrf( const fortran_int_t n, const fortran_int_t m,
|
||||
const fortran_int_t p, float* a, const fortran_int_t lda, float* taua,
|
||||
float* b, const fortran_int_t ldb, float* taub, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGGQRF( &n, &m, &p, a, &lda, taua, b, &ldb, taub, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggqrf( const fortran_int_t n, const fortran_int_t m,
|
||||
const fortran_int_t p, double* a, const fortran_int_t lda,
|
||||
double* taua, double* b, const fortran_int_t ldb, double* taub,
|
||||
double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGGQRF( &n, &m, &p, a, &lda, taua, b, &ldb, taub, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggqrf( const fortran_int_t n, const fortran_int_t m,
|
||||
const fortran_int_t p, std::complex<float>* a,
|
||||
const fortran_int_t lda, std::complex<float>* taua,
|
||||
std::complex<float>* b, const fortran_int_t ldb,
|
||||
std::complex<float>* taub, std::complex<float>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGGQRF( &n, &m, &p, a, &lda, taua, b, &ldb, taub, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggqrf( const fortran_int_t n, const fortran_int_t m,
|
||||
const fortran_int_t p, std::complex<double>* a,
|
||||
const fortran_int_t lda, std::complex<double>* taua,
|
||||
std::complex<double>* b, const fortran_int_t ldb,
|
||||
std::complex<double>* taub, std::complex<double>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGGQRF( &n, &m, &p, a, &lda, taua, b, &ldb, taub, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ggqrf.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct ggqrf_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggqrf_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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorTAUA >::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<
|
||||
MatrixB >::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<
|
||||
VectorTAUB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUB >::value) );
|
||||
BOOST_ASSERT( bindings::size(taua) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(taub) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(b)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_row(a),
|
||||
bindings::size_column(a), bindings::size_column(b) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::ggqrf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(taua),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(taub),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size_column(b) ) );
|
||||
return invoke( a, taua, b, taub, 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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::ggqrf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(taua),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(taub), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, taua, b, taub, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 m, const std::ptrdiff_t p ) {
|
||||
return std::max< std::ptrdiff_t >(1,std::max< std::ptrdiff_t >(n,
|
||||
std::max< std::ptrdiff_t >(m,p)));
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggqrf_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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorTAUA >::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<
|
||||
MatrixB >::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<
|
||||
VectorTAUB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUB >::value) );
|
||||
BOOST_ASSERT( bindings::size(taua) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(taub) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(b)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_row(a),
|
||||
bindings::size_column(a), bindings::size_column(b) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
return detail::ggqrf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(taua),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(taub),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size_column(b) ) );
|
||||
return invoke( a, taua, b, taub, 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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
value_type opt_size_work;
|
||||
detail::ggqrf( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(taua),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(taub), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, taua, b, taub, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 m, const std::ptrdiff_t p ) {
|
||||
return std::max< std::ptrdiff_t >(1,std::max< std::ptrdiff_t >(n,
|
||||
std::max< std::ptrdiff_t >(m,p)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 ggqrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ggqrf. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ggqrf( MatrixA& a, VectorTAUA& taua, MatrixB& b, VectorTAUB& taub,
|
||||
Workspace work ) {
|
||||
return ggqrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, taua, b, taub, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ggqrf. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorTAUB >,
|
||||
std::ptrdiff_t >::type
|
||||
ggqrf( MatrixA& a, VectorTAUA& taua, MatrixB& b, VectorTAUB& taub ) {
|
||||
return ggqrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, taua, b, taub, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
403
sdk/boost/numeric/bindings/lapack/computational/ggrqf.hpp
Normal file
403
sdk/boost/numeric/bindings/lapack/computational/ggrqf.hpp
Normal file
@@ -0,0 +1,403 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GGRQF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GGRQF_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/traits/detail/utils.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 ggrqf 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 ggrqf( const fortran_int_t m, const fortran_int_t p,
|
||||
const fortran_int_t n, float* a, const fortran_int_t lda, float* taua,
|
||||
float* b, const fortran_int_t ldb, float* taub, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGGRQF( &m, &p, &n, a, &lda, taua, b, &ldb, taub, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggrqf( const fortran_int_t m, const fortran_int_t p,
|
||||
const fortran_int_t n, double* a, const fortran_int_t lda,
|
||||
double* taua, double* b, const fortran_int_t ldb, double* taub,
|
||||
double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGGRQF( &m, &p, &n, a, &lda, taua, b, &ldb, taub, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggrqf( const fortran_int_t m, const fortran_int_t p,
|
||||
const fortran_int_t n, std::complex<float>* a,
|
||||
const fortran_int_t lda, std::complex<float>* taua,
|
||||
std::complex<float>* b, const fortran_int_t ldb,
|
||||
std::complex<float>* taub, std::complex<float>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGGRQF( &m, &p, &n, a, &lda, taua, b, &ldb, taub, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggrqf( const fortran_int_t m, const fortran_int_t p,
|
||||
const fortran_int_t n, std::complex<double>* a,
|
||||
const fortran_int_t lda, std::complex<double>* taua,
|
||||
std::complex<double>* b, const fortran_int_t ldb,
|
||||
std::complex<double>* taub, std::complex<double>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGGRQF( &m, &p, &n, a, &lda, taua, b, &ldb, taub, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ggrqf.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct ggrqf_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggrqf_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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorTAUA >::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<
|
||||
MatrixB >::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<
|
||||
VectorTAUB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUB >::value) );
|
||||
BOOST_ASSERT( bindings::size(taua) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(taub) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(b),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(a),
|
||||
bindings::size_row(a), bindings::size_row(b) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_row(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(b)) );
|
||||
return detail::ggrqf( bindings::size_row(a), bindings::size_row(b),
|
||||
bindings::size_column(a), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(taua),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(taub),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a), bindings::size_row(a),
|
||||
bindings::size_row(b) ) );
|
||||
return invoke( a, taua, b, taub, 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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::ggrqf( bindings::size_row(a), bindings::size_row(b),
|
||||
bindings::size_column(a), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(taua),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(taub), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, taua, b, taub, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 m, const std::ptrdiff_t p ) {
|
||||
return std::max< std::ptrdiff_t >(1,std::max< std::ptrdiff_t >(n,
|
||||
std::max< std::ptrdiff_t >(m,p)));
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggrqf_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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorTAUA >::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<
|
||||
MatrixB >::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<
|
||||
VectorTAUB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAUB >::value) );
|
||||
BOOST_ASSERT( bindings::size(taua) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(a),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(taub) >= std::min<
|
||||
std::ptrdiff_t >(bindings::size_row(b),
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(a),
|
||||
bindings::size_row(a), bindings::size_row(b) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_row(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(b)) );
|
||||
return detail::ggrqf( bindings::size_row(a), bindings::size_row(b),
|
||||
bindings::size_column(a), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(taua),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(taub),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a), bindings::size_row(a),
|
||||
bindings::size_row(b) ) );
|
||||
return invoke( a, taua, b, taub, 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 VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorTAUA& taua, MatrixB& b,
|
||||
VectorTAUB& taub, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
value_type opt_size_work;
|
||||
detail::ggrqf( bindings::size_row(a), bindings::size_row(b),
|
||||
bindings::size_column(a), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(taua),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(taub), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, taua, b, taub, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 m, const std::ptrdiff_t p ) {
|
||||
return std::max< std::ptrdiff_t >(1,std::max< std::ptrdiff_t >(n,
|
||||
std::max< std::ptrdiff_t >(m,p)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 ggrqf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ggrqf. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ggrqf( MatrixA& a, VectorTAUA& taua, MatrixB& b, VectorTAUB& taub,
|
||||
Workspace work ) {
|
||||
return ggrqf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, taua, b, taub, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ggrqf. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorTAUA, typename MatrixB,
|
||||
typename VectorTAUB >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorTAUB >,
|
||||
std::ptrdiff_t >::type
|
||||
ggrqf( MatrixA& a, VectorTAUA& taua, MatrixB& b, VectorTAUB& taub ) {
|
||||
return ggrqf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, taua, b, taub, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
525
sdk/boost/numeric/bindings/lapack/computational/ggsvp.hpp
Normal file
525
sdk/boost/numeric/bindings/lapack/computational/ggsvp.hpp
Normal file
@@ -0,0 +1,525 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GGSVP_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GGSVP_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 ggsvp 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 ggsvp( const char jobu, const char jobv, const char jobq,
|
||||
const fortran_int_t m, const fortran_int_t p, const fortran_int_t n,
|
||||
float* a, const fortran_int_t lda, float* b, const fortran_int_t ldb,
|
||||
const float tola, const float tolb, fortran_int_t& k,
|
||||
fortran_int_t& l, float* u, const fortran_int_t ldu, float* v,
|
||||
const fortran_int_t ldv, float* q, const fortran_int_t ldq,
|
||||
fortran_int_t* iwork, float* tau, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGGSVP( &jobu, &jobv, &jobq, &m, &p, &n, a, &lda, b, &ldb, &tola,
|
||||
&tolb, &k, &l, u, &ldu, v, &ldv, q, &ldq, iwork, tau, work,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggsvp( const char jobu, const char jobv, const char jobq,
|
||||
const fortran_int_t m, const fortran_int_t p, const fortran_int_t n,
|
||||
double* a, const fortran_int_t lda, double* b,
|
||||
const fortran_int_t ldb, const double tola, const double tolb,
|
||||
fortran_int_t& k, fortran_int_t& l, double* u,
|
||||
const fortran_int_t ldu, double* v, const fortran_int_t ldv,
|
||||
double* q, const fortran_int_t ldq, fortran_int_t* iwork, double* tau,
|
||||
double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGGSVP( &jobu, &jobv, &jobq, &m, &p, &n, a, &lda, b, &ldb, &tola,
|
||||
&tolb, &k, &l, u, &ldu, v, &ldv, q, &ldq, iwork, tau, work,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggsvp( const char jobu, const char jobv, const char jobq,
|
||||
const fortran_int_t m, const fortran_int_t p, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda,
|
||||
std::complex<float>* b, const fortran_int_t ldb, const float tola,
|
||||
const float tolb, fortran_int_t& k, fortran_int_t& l,
|
||||
std::complex<float>* u, const fortran_int_t ldu,
|
||||
std::complex<float>* v, const fortran_int_t ldv,
|
||||
std::complex<float>* q, const fortran_int_t ldq, fortran_int_t* iwork,
|
||||
float* rwork, std::complex<float>* tau, std::complex<float>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGGSVP( &jobu, &jobv, &jobq, &m, &p, &n, a, &lda, b, &ldb, &tola,
|
||||
&tolb, &k, &l, u, &ldu, v, &ldv, q, &ldq, iwork, rwork, tau, work,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ggsvp( const char jobu, const char jobv, const char jobq,
|
||||
const fortran_int_t m, const fortran_int_t p, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda,
|
||||
std::complex<double>* b, const fortran_int_t ldb, const double tola,
|
||||
const double tolb, fortran_int_t& k, fortran_int_t& l,
|
||||
std::complex<double>* u, const fortran_int_t ldu,
|
||||
std::complex<double>* v, const fortran_int_t ldv,
|
||||
std::complex<double>* q, const fortran_int_t ldq,
|
||||
fortran_int_t* iwork, double* rwork, std::complex<double>* tau,
|
||||
std::complex<double>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGGSVP( &jobu, &jobv, &jobq, &m, &p, &n, a, &lda, b, &ldb, &tola,
|
||||
&tolb, &k, &l, u, &ldu, v, &ldv, q, &ldq, iwork, rwork, tau, work,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ggsvp.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct ggsvp_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggsvp_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 MatrixB, typename MatrixU,
|
||||
typename MatrixV, typename MatrixQ, typename IWORK, typename TAU,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( const char jobu, const char jobv,
|
||||
const char jobq, MatrixA& a, MatrixB& b, const real_type tola,
|
||||
const real_type tolb, fortran_int_t& k, fortran_int_t& l,
|
||||
MatrixU& u, MatrixV& v, MatrixQ& q, detail::workspace3< IWORK,
|
||||
TAU, WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixV >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixU >::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<
|
||||
MatrixV >::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<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixV >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_tau( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(a),
|
||||
bindings::size_row(a), bindings::size_row(b) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(u) == 1 ||
|
||||
bindings::stride_minor(u) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(v) == 1 ||
|
||||
bindings::stride_minor(v) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_row(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(b)) );
|
||||
BOOST_ASSERT( jobq == 'Q' || jobq == 'N' );
|
||||
BOOST_ASSERT( jobu == 'U' || jobu == 'N' );
|
||||
BOOST_ASSERT( jobv == 'V' || jobv == 'N' );
|
||||
return detail::ggsvp( jobu, jobv, jobq, bindings::size_row(a),
|
||||
bindings::size_row(b), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(b), bindings::stride_major(b), tola,
|
||||
tolb, k, l, bindings::begin_value(u),
|
||||
bindings::stride_major(u), bindings::begin_value(v),
|
||||
bindings::stride_major(v), bindings::begin_value(q),
|
||||
bindings::stride_major(q),
|
||||
bindings::begin_value(work.select(fortran_int_t())),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
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 MatrixB, typename MatrixU,
|
||||
typename MatrixV, typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char jobu, const char jobv,
|
||||
const char jobq, MatrixA& a, MatrixB& b, const real_type tola,
|
||||
const real_type tolb, fortran_int_t& k, fortran_int_t& l,
|
||||
MatrixU& u, MatrixV& v, MatrixQ& q, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(a) ) );
|
||||
bindings::detail::array<
|
||||
real_type > tmp_tau( min_size_tau( bindings::size_column(a) ) );
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a), bindings::size_row(a),
|
||||
bindings::size_row(b) ) );
|
||||
return invoke( jobu, jobv, jobq, a, b, tola, tolb, k, l, u, v, q,
|
||||
workspace( tmp_iwork, tmp_tau, 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 MatrixB, typename MatrixU,
|
||||
typename MatrixV, typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char jobu, const char jobv,
|
||||
const char jobq, MatrixA& a, MatrixB& b, const real_type tola,
|
||||
const real_type tolb, fortran_int_t& k, fortran_int_t& l,
|
||||
MatrixU& u, MatrixV& v, MatrixQ& q, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( jobu, jobv, jobq, a, b, tola, tolb, k, l, u, v, q,
|
||||
minimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 n;
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array tau.
|
||||
//
|
||||
static std::ptrdiff_t min_size_tau( const std::ptrdiff_t n ) {
|
||||
return n;
|
||||
}
|
||||
|
||||
//
|
||||
// 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 m, const std::ptrdiff_t p ) {
|
||||
return std::max< std::ptrdiff_t >(3*n,std::max< std::ptrdiff_t >(m,p));
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ggsvp_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 MatrixB, typename MatrixU,
|
||||
typename MatrixV, typename MatrixQ, typename IWORK,
|
||||
typename RWORK, typename TAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char jobu, const char jobv,
|
||||
const char jobq, MatrixA& a, MatrixB& b, const real_type tola,
|
||||
const real_type tolb, fortran_int_t& k, fortran_int_t& l,
|
||||
MatrixU& u, MatrixV& v, MatrixQ& q, detail::workspace4< IWORK,
|
||||
RWORK, TAU, WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixV >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixU >::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<
|
||||
MatrixV >::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<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixU >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixV >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_tau( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(a),
|
||||
bindings::size_row(a), bindings::size_row(b) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(u) == 1 ||
|
||||
bindings::stride_minor(u) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(v) == 1 ||
|
||||
bindings::stride_minor(v) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_row(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(b)) );
|
||||
BOOST_ASSERT( jobq == 'Q' || jobq == 'N' );
|
||||
BOOST_ASSERT( jobu == 'U' || jobu == 'N' );
|
||||
BOOST_ASSERT( jobv == 'V' || jobv == 'N' );
|
||||
return detail::ggsvp( jobu, jobv, jobq, bindings::size_row(a),
|
||||
bindings::size_row(b), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(b), bindings::stride_major(b), tola,
|
||||
tolb, k, l, bindings::begin_value(u),
|
||||
bindings::stride_major(u), bindings::begin_value(v),
|
||||
bindings::stride_major(v), bindings::begin_value(q),
|
||||
bindings::stride_major(q),
|
||||
bindings::begin_value(work.select(fortran_int_t())),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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 MatrixB, typename MatrixU,
|
||||
typename MatrixV, typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char jobu, const char jobv,
|
||||
const char jobq, MatrixA& a, MatrixB& b, const real_type tola,
|
||||
const real_type tolb, fortran_int_t& k, fortran_int_t& l,
|
||||
MatrixU& u, MatrixV& v, MatrixQ& q, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(a) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array<
|
||||
value_type > tmp_tau( min_size_tau( bindings::size_column(a) ) );
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a), bindings::size_row(a),
|
||||
bindings::size_row(b) ) );
|
||||
return invoke( jobu, jobv, jobq, a, b, tola, tolb, k, l, u, v, q,
|
||||
workspace( tmp_iwork, tmp_rwork, tmp_tau, 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 MatrixB, typename MatrixU,
|
||||
typename MatrixV, typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char jobu, const char jobv,
|
||||
const char jobq, MatrixA& a, MatrixB& b, const real_type tola,
|
||||
const real_type tolb, fortran_int_t& k, fortran_int_t& l,
|
||||
MatrixU& u, MatrixV& v, MatrixQ& q, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( jobu, jobv, jobq, a, b, tola, tolb, k, l, u, v, q,
|
||||
minimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 n;
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( const std::ptrdiff_t n ) {
|
||||
return 2*n;
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array tau.
|
||||
//
|
||||
static std::ptrdiff_t min_size_tau( const std::ptrdiff_t n ) {
|
||||
return n;
|
||||
}
|
||||
|
||||
//
|
||||
// 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 m, const std::ptrdiff_t p ) {
|
||||
return std::max< std::ptrdiff_t >(3*n,std::max< std::ptrdiff_t >(m,p));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 ggsvp_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ggsvp. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename MatrixB, typename MatrixU,
|
||||
typename MatrixV, typename MatrixQ, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ggsvp( const char jobu, const char jobv, const char jobq, MatrixA& a,
|
||||
MatrixB& b, const typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type tola,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type tolb, fortran_int_t& k,
|
||||
fortran_int_t& l, MatrixU& u, MatrixV& v, MatrixQ& q,
|
||||
Workspace work ) {
|
||||
return ggsvp_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( jobu, jobv, jobq, a, b, tola, tolb, k,
|
||||
l, u, v, q, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ggsvp. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename MatrixB, typename MatrixU,
|
||||
typename MatrixV, typename MatrixQ >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixQ >,
|
||||
std::ptrdiff_t >::type
|
||||
ggsvp( const char jobu, const char jobv, const char jobq, MatrixA& a,
|
||||
MatrixB& b, const typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type tola,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type tolb, fortran_int_t& k,
|
||||
fortran_int_t& l, MatrixU& u, MatrixV& v, MatrixQ& q ) {
|
||||
return ggsvp_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( jobu, jobv, jobq, a, b, tola, tolb, k,
|
||||
l, u, v, q, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
561
sdk/boost/numeric/bindings/lapack/computational/gtrfs.hpp
Normal file
561
sdk/boost/numeric/bindings/lapack/computational/gtrfs.hpp
Normal file
@@ -0,0 +1,561 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GTRFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GTRFS_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 gtrfs 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 >
|
||||
inline std::ptrdiff_t gtrfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* dl, const float* d,
|
||||
const float* du, const float* dlf, const float* df, const float* duf,
|
||||
const float* du2, const fortran_int_t* ipiv, const float* b,
|
||||
const fortran_int_t ldb, float* x, const fortran_int_t ldx,
|
||||
float* ferr, float* berr, float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGTRFS( &lapack_option< Trans >::value, &n, &nrhs, dl, d, du, dlf,
|
||||
df, duf, du2, ipiv, b, &ldb, x, &ldx, ferr, berr, work, iwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gtrfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* dl, const double* d,
|
||||
const double* du, const double* dlf, const double* df,
|
||||
const double* duf, const double* du2, const fortran_int_t* ipiv,
|
||||
const double* b, const fortran_int_t ldb, double* x,
|
||||
const fortran_int_t ldx, double* ferr, double* berr, double* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGTRFS( &lapack_option< Trans >::value, &n, &nrhs, dl, d, du, dlf,
|
||||
df, duf, du2, ipiv, b, &ldb, x, &ldx, ferr, berr, work, iwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gtrfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* dl,
|
||||
const std::complex<float>* d, const std::complex<float>* du,
|
||||
const std::complex<float>* dlf, const std::complex<float>* df,
|
||||
const std::complex<float>* duf, const std::complex<float>* du2,
|
||||
const fortran_int_t* ipiv, const std::complex<float>* b,
|
||||
const fortran_int_t ldb, std::complex<float>* x,
|
||||
const fortran_int_t ldx, float* ferr, float* berr,
|
||||
std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGTRFS( &lapack_option< Trans >::value, &n, &nrhs, dl, d, du, dlf,
|
||||
df, duf, du2, ipiv, b, &ldb, x, &ldx, ferr, berr, work, rwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gtrfs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* dl,
|
||||
const std::complex<double>* d, const std::complex<double>* du,
|
||||
const std::complex<double>* dlf, const std::complex<double>* df,
|
||||
const std::complex<double>* duf, const std::complex<double>* du2,
|
||||
const fortran_int_t* ipiv, const std::complex<double>* b,
|
||||
const fortran_int_t ldb, std::complex<double>* x,
|
||||
const fortran_int_t ldx, double* ferr, double* berr,
|
||||
std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGTRFS( &lapack_option< Trans >::value, &n, &nrhs, dl, d, du, dlf,
|
||||
df, duf, du2, ipiv, b, &ldb, x, &ldx, ferr, berr, work, rwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gtrfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct gtrfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gtrfs_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 VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDLF, typename VectorDF, typename VectorDUF,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const VectorDL& dl, const VectorD& d,
|
||||
const VectorDU& du, const VectorDLF& dlf, const VectorDF& df,
|
||||
const VectorDUF& duf, const VectorDU2& du2,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorD, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::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< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDU >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDLF >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDF >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDUF >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDU2 >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::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< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorFERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column_op(d,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(df) >= bindings::size_column_op(d,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(dl) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(dlf) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(du) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(du2) >= bindings::size_column_op(d,
|
||||
trans())-2 );
|
||||
BOOST_ASSERT( bindings::size(duf) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column_op(d,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column_op(d, trans()) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column_op(d, trans()) ));
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column_op(d, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(d, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(d, trans())) );
|
||||
return detail::gtrfs( trans(), bindings::size_column_op(d, trans()),
|
||||
bindings::size_column(b), bindings::begin_value(dl),
|
||||
bindings::begin_value(d), bindings::begin_value(du),
|
||||
bindings::begin_value(dlf), bindings::begin_value(df),
|
||||
bindings::begin_value(duf), bindings::begin_value(du2),
|
||||
bindings::begin_value(ipiv), bindings::begin_value(b),
|
||||
bindings::stride_major(b), bindings::begin_value(x),
|
||||
bindings::stride_major(x), bindings::begin_value(ferr),
|
||||
bindings::begin_value(berr),
|
||||
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 VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDLF, typename VectorDF, typename VectorDUF,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const VectorDL& dl, const VectorD& d,
|
||||
const VectorDU& du, const VectorDLF& dlf, const VectorDF& df,
|
||||
const VectorDUF& duf, const VectorDU2& du2,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorD, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column_op(d, trans()) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column_op(d, trans()) ) );
|
||||
return invoke( dl, d, du, dlf, df, duf, du2, ipiv, b, x, ferr, berr,
|
||||
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 VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDLF, typename VectorDF, typename VectorDUF,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const VectorDL& dl, const VectorD& d,
|
||||
const VectorDU& du, const VectorDLF& dlf, const VectorDF& df,
|
||||
const VectorDUF& duf, const VectorDU2& du2,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorD, order >::type trans;
|
||||
return invoke( dl, d, du, dlf, df, duf, du2, ipiv, b, x, ferr, berr,
|
||||
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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gtrfs_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 VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDLF, typename VectorDF, typename VectorDUF,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const VectorDL& dl, const VectorD& d,
|
||||
const VectorDU& du, const VectorDLF& dlf, const VectorDF& df,
|
||||
const VectorDUF& duf, const VectorDU2& du2,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorD, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorFERR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::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< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDU >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDLF >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDF >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDUF >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDU2 >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column_op(d,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(df) >= bindings::size_column_op(d,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(dl) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(dlf) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(du) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(du2) >= bindings::size_column_op(d,
|
||||
trans())-2 );
|
||||
BOOST_ASSERT( bindings::size(duf) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column_op(d,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column_op(d, trans()) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column_op(d, trans()) ));
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column_op(d, trans()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(d, trans())) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(d, trans())) );
|
||||
return detail::gtrfs( trans(), bindings::size_column_op(d, trans()),
|
||||
bindings::size_column(b), bindings::begin_value(dl),
|
||||
bindings::begin_value(d), bindings::begin_value(du),
|
||||
bindings::begin_value(dlf), bindings::begin_value(df),
|
||||
bindings::begin_value(duf), bindings::begin_value(du2),
|
||||
bindings::begin_value(ipiv), bindings::begin_value(b),
|
||||
bindings::stride_major(b), bindings::begin_value(x),
|
||||
bindings::stride_major(x), bindings::begin_value(ferr),
|
||||
bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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 VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDLF, typename VectorDF, typename VectorDUF,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const VectorDL& dl, const VectorD& d,
|
||||
const VectorDU& du, const VectorDLF& dlf, const VectorDF& df,
|
||||
const VectorDUF& duf, const VectorDU2& du2,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorD, order >::type trans;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column_op(d, trans()) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column_op(d, trans()) ) );
|
||||
return invoke( dl, d, du, dlf, df, duf, du2, ipiv, b, x, ferr, berr,
|
||||
workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDLF, typename VectorDF, typename VectorDUF,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const VectorDL& dl, const VectorD& d,
|
||||
const VectorDU& du, const VectorDLF& dlf, const VectorDF& df,
|
||||
const VectorDUF& duf, const VectorDU2& du2,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorD, order >::type trans;
|
||||
return invoke( dl, d, du, dlf, df, duf, du2, ipiv, b, x, ferr, berr,
|
||||
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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 gtrfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gtrfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDLF, typename VectorDF, typename VectorDUF,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
gtrfs( const VectorDL& dl, const VectorD& d, const VectorDU& du,
|
||||
const VectorDLF& dlf, const VectorDF& df, const VectorDUF& duf,
|
||||
const VectorDU2& du2, const VectorIPIV& ipiv, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr, Workspace work ) {
|
||||
return gtrfs_impl< typename bindings::value_type<
|
||||
VectorDL >::type >::invoke( dl, d, du, dlf, df, duf, du2, ipiv, b,
|
||||
x, ferr, berr, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for gtrfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDLF, typename VectorDF, typename VectorDUF,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
gtrfs( const VectorDL& dl, const VectorD& d, const VectorDU& du,
|
||||
const VectorDLF& dlf, const VectorDF& df, const VectorDUF& duf,
|
||||
const VectorDU2& du2, const VectorIPIV& ipiv, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return gtrfs_impl< typename bindings::value_type<
|
||||
VectorDL >::type >::invoke( dl, d, du, dlf, df, duf, du2, ipiv, b,
|
||||
x, ferr, berr, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
206
sdk/boost/numeric/bindings/lapack/computational/gttrs.hpp
Normal file
206
sdk/boost/numeric/bindings/lapack/computational/gttrs.hpp
Normal file
@@ -0,0 +1,206 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_GTTRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_GTTRS_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 gttrs 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 >
|
||||
inline std::ptrdiff_t gttrs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* dl, const float* d,
|
||||
const float* du, const float* du2, const fortran_int_t* ipiv,
|
||||
float* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SGTTRS( &lapack_option< Trans >::value, &n, &nrhs, dl, d, du, du2,
|
||||
ipiv, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gttrs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* dl, const double* d,
|
||||
const double* du, const double* du2, const fortran_int_t* ipiv,
|
||||
double* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DGTTRS( &lapack_option< Trans >::value, &n, &nrhs, dl, d, du, du2,
|
||||
ipiv, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gttrs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* dl,
|
||||
const std::complex<float>* d, const std::complex<float>* du,
|
||||
const std::complex<float>* du2, const fortran_int_t* ipiv,
|
||||
std::complex<float>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CGTTRS( &lapack_option< Trans >::value, &n, &nrhs, dl, d, du, du2,
|
||||
ipiv, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Trans >
|
||||
inline std::ptrdiff_t gttrs( const Trans, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* dl,
|
||||
const std::complex<double>* d, const std::complex<double>* du,
|
||||
const std::complex<double>* du2, const fortran_int_t* ipiv,
|
||||
std::complex<double>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZGTTRS( &lapack_option< Trans >::value, &n, &nrhs, dl, d, du, du2,
|
||||
ipiv, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gttrs.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gttrs_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 VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const VectorDL& dl, const VectorD& d,
|
||||
const VectorDU& du, const VectorDU2& du2, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorD, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::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< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDU >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDU2 >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorDL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column_op(d,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size(dl) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(du) >= bindings::size_column_op(d,
|
||||
trans())-1 );
|
||||
BOOST_ASSERT( bindings::size(du2) >= bindings::size_column_op(d,
|
||||
trans())-2 );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column_op(d,
|
||||
trans()) );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(d, trans())) );
|
||||
return detail::gttrs( trans(), bindings::size_column_op(d, trans()),
|
||||
bindings::size_column(b), bindings::begin_value(dl),
|
||||
bindings::begin_value(d), bindings::begin_value(du),
|
||||
bindings::begin_value(du2), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the gttrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gttrs. Its overload differs for
|
||||
//
|
||||
template< typename VectorDL, typename VectorD, typename VectorDU,
|
||||
typename VectorDU2, typename VectorIPIV, typename MatrixB >
|
||||
inline std::ptrdiff_t gttrs( const VectorDL& dl, const VectorD& d,
|
||||
const VectorDU& du, const VectorDU2& du2, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
return gttrs_impl< typename bindings::value_type<
|
||||
VectorDL >::type >::invoke( dl, d, du, du2, ipiv, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
383
sdk/boost/numeric/bindings/lapack/computational/hbgst.hpp
Normal file
383
sdk/boost/numeric/bindings/lapack/computational/hbgst.hpp
Normal file
@@ -0,0 +1,383 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HBGST_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HBGST_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_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 hbgst 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 hbgst( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t ka, const fortran_int_t kb,
|
||||
float* ab, const fortran_int_t ldab, const float* bb,
|
||||
const fortran_int_t ldbb, float* x, const fortran_int_t ldx,
|
||||
float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSBGST( &vect, &lapack_option< UpLo >::value, &n, &ka, &kb, ab,
|
||||
&ldab, bb, &ldbb, x, &ldx, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hbgst( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t ka, const fortran_int_t kb,
|
||||
double* ab, const fortran_int_t ldab, const double* bb,
|
||||
const fortran_int_t ldbb, double* x, const fortran_int_t ldx,
|
||||
double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSBGST( &vect, &lapack_option< UpLo >::value, &n, &ka, &kb, ab,
|
||||
&ldab, bb, &ldbb, x, &ldx, work, &info );
|
||||
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 hbgst( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t ka, const fortran_int_t kb,
|
||||
std::complex<float>* ab, const fortran_int_t ldab,
|
||||
const std::complex<float>* bb, const fortran_int_t ldbb,
|
||||
std::complex<float>* x, const fortran_int_t ldx,
|
||||
std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHBGST( &vect, &lapack_option< UpLo >::value, &n, &ka, &kb, ab,
|
||||
&ldab, bb, &ldbb, x, &ldx, work, rwork, &info );
|
||||
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 hbgst( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t ka, const fortran_int_t kb,
|
||||
std::complex<double>* ab, const fortran_int_t ldab,
|
||||
const std::complex<double>* bb, const fortran_int_t ldbb,
|
||||
std::complex<double>* x, const fortran_int_t ldx,
|
||||
std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHBGST( &vect, &lapack_option< UpLo >::value, &n, &ka, &kb, ab,
|
||||
&ldab, bb, &ldbb, x, &ldx, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hbgst.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hbgst_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hbgst_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 MatrixAB, typename MatrixBB, typename MatrixX,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab,
|
||||
const MatrixBB& bb, MatrixX& x, 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_STATIC_ASSERT( (bindings::is_column_major< MatrixBB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixBB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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::size_minor(bb) == 1 ||
|
||||
bindings::stride_minor(bb) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(bb) >= bindings::bandwidth(bb,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( vect == 'N' || vect == 'V' );
|
||||
return detail::hbgst( vect, uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::bandwidth(bb,
|
||||
uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(bb),
|
||||
bindings::stride_major(bb), bindings::begin_value(x),
|
||||
bindings::stride_major(x),
|
||||
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, typename MatrixBB, typename MatrixX >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab,
|
||||
const MatrixBB& bb, MatrixX& x, 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(
|
||||
bindings::size_column(ab) ) );
|
||||
return invoke( vect, ab, bb, x, 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, typename MatrixBB, typename MatrixX >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab,
|
||||
const MatrixBB& bb, MatrixX& x, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( vect, ab, bb, x, 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;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hbgst_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 MatrixAB, typename MatrixBB, typename MatrixX,
|
||||
typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab,
|
||||
const MatrixBB& bb, MatrixX& x, detail::workspace2< WORK,
|
||||
RWORK > 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_STATIC_ASSERT( (bindings::is_column_major< MatrixBB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixBB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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::size_minor(bb) == 1 ||
|
||||
bindings::stride_minor(bb) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(bb) >= bindings::bandwidth(bb,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( vect == 'N' || vect == 'V' );
|
||||
return detail::hbgst( vect, uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::bandwidth(bb,
|
||||
uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(bb),
|
||||
bindings::stride_major(bb), bindings::begin_value(x),
|
||||
bindings::stride_major(x),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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, typename MatrixBB, typename MatrixX >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab,
|
||||
const MatrixBB& bb, MatrixX& x, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ab) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(ab) ) );
|
||||
return invoke( vect, ab, bb, x, workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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, typename MatrixBB, typename MatrixX >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab,
|
||||
const MatrixBB& bb, MatrixX& x, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( vect, ab, bb, x, 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 n;
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 hbgst_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hbgst. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAB, typename MatrixBB, typename MatrixX,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hbgst( const char vect, MatrixAB& ab, const MatrixBB& bb, MatrixX& x,
|
||||
Workspace work ) {
|
||||
return hbgst_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, bb, x, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hbgst. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAB, typename MatrixBB, typename MatrixX >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixX >,
|
||||
std::ptrdiff_t >::type
|
||||
hbgst( const char vect, MatrixAB& ab, const MatrixBB& bb, MatrixX& x ) {
|
||||
return hbgst_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, bb, x, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
370
sdk/boost/numeric/bindings/lapack/computational/hbtrd.hpp
Normal file
370
sdk/boost/numeric/bindings/lapack/computational/hbtrd.hpp
Normal 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_COMPUTATIONAL_HBTRD_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HBTRD_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_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 hbtrd 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 hbtrd( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t kd, float* ab,
|
||||
const fortran_int_t ldab, float* d, float* e, float* q,
|
||||
const fortran_int_t ldq, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSBTRD( &vect, &lapack_option< UpLo >::value, &n, &kd, ab, &ldab,
|
||||
d, e, q, &ldq, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hbtrd( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t kd, double* ab,
|
||||
const fortran_int_t ldab, double* d, double* e, double* q,
|
||||
const fortran_int_t ldq, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSBTRD( &vect, &lapack_option< UpLo >::value, &n, &kd, ab, &ldab,
|
||||
d, e, q, &ldq, work, &info );
|
||||
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 hbtrd( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t kd,
|
||||
std::complex<float>* ab, const fortran_int_t ldab, float* d, float* e,
|
||||
std::complex<float>* q, const fortran_int_t ldq,
|
||||
std::complex<float>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHBTRD( &vect, &lapack_option< UpLo >::value, &n, &kd, ab, &ldab,
|
||||
d, e, q, &ldq, work, &info );
|
||||
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 hbtrd( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t kd,
|
||||
std::complex<double>* ab, const fortran_int_t ldab, double* d,
|
||||
double* e, std::complex<double>* q, const fortran_int_t ldq,
|
||||
std::complex<double>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHBTRD( &vect, &lapack_option< UpLo >::value, &n, &kd, ab, &ldab,
|
||||
d, e, q, &ldq, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hbtrd.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hbtrd_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hbtrd_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 MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, 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_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::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< MatrixAB >::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< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(ab) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( vect == 'N' || vect == 'V' || vect == 'U' );
|
||||
return detail::hbtrd( vect, uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(d),
|
||||
bindings::begin_value(e), bindings::begin_value(q),
|
||||
bindings::stride_major(q),
|
||||
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, typename VectorD, typename VectorE,
|
||||
typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, 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(
|
||||
bindings::size_column(ab) ) );
|
||||
return invoke( vect, ab, d, e, q, 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, typename VectorD, typename VectorE,
|
||||
typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( vect, ab, d, e, q, 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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hbtrd_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 MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, 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_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::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< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(ab) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( vect == 'N' || vect == 'V' || vect == 'U' );
|
||||
return detail::hbtrd( vect, uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(d),
|
||||
bindings::begin_value(e), bindings::begin_value(q),
|
||||
bindings::stride_major(q),
|
||||
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 MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ab) ) );
|
||||
return invoke( vect, ab, d, e, q, 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, typename VectorD, typename VectorE,
|
||||
typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( vect, ab, d, e, q, 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 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 hbtrd_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hbtrd. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hbtrd( const char vect, MatrixAB& ab, VectorD& d, VectorE& e, MatrixQ& q,
|
||||
Workspace work ) {
|
||||
return hbtrd_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, d, e, q, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hbtrd. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixQ >,
|
||||
std::ptrdiff_t >::type
|
||||
hbtrd( const char vect, MatrixAB& ab, VectorD& d, VectorE& e,
|
||||
MatrixQ& q ) {
|
||||
return hbtrd_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, d, e, q,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
338
sdk/boost/numeric/bindings/lapack/computational/hecon.hpp
Normal file
338
sdk/boost/numeric/bindings/lapack/computational/hecon.hpp
Normal file
@@ -0,0 +1,338 @@
|
||||
//
|
||||
// Copyright (c) 2002--2010
|
||||
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
|
||||
// Thomas Klimpel and Rutger ter Borg
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED
|
||||
// PLEASE DO NOT EDIT!
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HECON_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HECON_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 hecon 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 hecon( const UpLo, const fortran_int_t n, const float* a,
|
||||
const fortran_int_t lda, const fortran_int_t* ipiv, const float anorm,
|
||||
float& rcond, float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSYCON( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, &anorm,
|
||||
&rcond, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hecon( const UpLo, const fortran_int_t n,
|
||||
const double* a, const fortran_int_t lda, const fortran_int_t* ipiv,
|
||||
const double anorm, double& rcond, double* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSYCON( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, &anorm,
|
||||
&rcond, work, iwork, &info );
|
||||
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 hecon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<float>* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, const float anorm, float& rcond,
|
||||
std::complex<float>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHECON( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, &anorm,
|
||||
&rcond, work, &info );
|
||||
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 hecon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<double>* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, const double anorm, double& rcond,
|
||||
std::complex<double>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHECON( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, &anorm,
|
||||
&rcond, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hecon.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hecon_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hecon_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 VectorIPIV, typename WORK,
|
||||
typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, detail::workspace2< WORK,
|
||||
IWORK > 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(ipiv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hecon( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv), anorm, rcond,
|
||||
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 MatrixA, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, 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(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(a) ) );
|
||||
return invoke( a, ipiv, anorm, rcond, 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 MatrixA, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, ipiv, anorm, rcond, 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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hecon_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 VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, 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(ipiv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hecon( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv), anorm, rcond,
|
||||
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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, ipiv, anorm, rcond, 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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, ipiv, anorm, rcond, 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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 hecon_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hecon. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hecon( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type& rcond,
|
||||
Workspace work ) {
|
||||
return hecon_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, anorm, rcond, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hecon. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
hecon( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type& rcond ) {
|
||||
return hecon_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, anorm, rcond,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
179
sdk/boost/numeric/bindings/lapack/computational/hegst.hpp
Normal file
179
sdk/boost/numeric/bindings/lapack/computational/hegst.hpp
Normal 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_COMPUTATIONAL_HEGST_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HEGST_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/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 hegst 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 hegst( const fortran_int_t itype, const UpLo,
|
||||
const fortran_int_t n, float* a, const fortran_int_t lda,
|
||||
const float* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSYGST( &itype, &lapack_option< UpLo >::value, &n, a, &lda, b,
|
||||
&ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hegst( const fortran_int_t itype, const UpLo,
|
||||
const fortran_int_t n, double* a, const fortran_int_t lda,
|
||||
const double* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSYGST( &itype, &lapack_option< UpLo >::value, &n, a, &lda, b,
|
||||
&ldb, &info );
|
||||
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 hegst( const fortran_int_t itype, const UpLo,
|
||||
const fortran_int_t n, std::complex<float>* a,
|
||||
const fortran_int_t lda, const std::complex<float>* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHEGST( &itype, &lapack_option< UpLo >::value, &n, a, &lda, b,
|
||||
&ldb, &info );
|
||||
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 hegst( const fortran_int_t itype, const UpLo,
|
||||
const fortran_int_t n, std::complex<double>* a,
|
||||
const fortran_int_t lda, const std::complex<double>* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHEGST( &itype, &lapack_option< UpLo >::value, &n, a, &lda, b,
|
||||
&ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hegst.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hegst_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 MatrixA, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const fortran_int_t itype, MatrixA& a,
|
||||
const MatrixB& b ) {
|
||||
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< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hegst( itype, uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(b), bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the hegst_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hegst. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename MatrixB >
|
||||
inline std::ptrdiff_t hegst( const fortran_int_t itype, MatrixA& a,
|
||||
const MatrixB& b ) {
|
||||
return hegst_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( itype, a, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
464
sdk/boost/numeric/bindings/lapack/computational/herfs.hpp
Normal file
464
sdk/boost/numeric/bindings/lapack/computational/herfs.hpp
Normal file
@@ -0,0 +1,464 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HERFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HERFS_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 herfs 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 herfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* a, const fortran_int_t lda,
|
||||
const float* af, const fortran_int_t ldaf, const fortran_int_t* ipiv,
|
||||
const float* b, const fortran_int_t ldb, float* x,
|
||||
const fortran_int_t ldx, float* ferr, float* berr, float* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSYRFS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, ipiv, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t herfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* a, const fortran_int_t lda,
|
||||
const double* af, const fortran_int_t ldaf, const fortran_int_t* ipiv,
|
||||
const double* b, const fortran_int_t ldb, double* x,
|
||||
const fortran_int_t ldx, double* ferr, double* berr, double* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSYRFS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, ipiv, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
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 herfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* a,
|
||||
const fortran_int_t lda, const std::complex<float>* af,
|
||||
const fortran_int_t ldaf, const fortran_int_t* ipiv,
|
||||
const std::complex<float>* b, const fortran_int_t ldb,
|
||||
std::complex<float>* x, const fortran_int_t ldx, float* ferr,
|
||||
float* berr, std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHERFS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, ipiv, b, &ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
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 herfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* a,
|
||||
const fortran_int_t lda, const std::complex<double>* af,
|
||||
const fortran_int_t ldaf, const fortran_int_t* ipiv,
|
||||
const std::complex<double>* b, const fortran_int_t ldb,
|
||||
std::complex<double>* x, const fortran_int_t ldx, double* ferr,
|
||||
double* berr, std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHERFS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, ipiv, b, &ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to herfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct herfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct herfs_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 MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
IWORK > 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_STATIC_ASSERT( (bindings::is_column_major< MatrixAF >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAF >::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<
|
||||
MatrixB >::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<
|
||||
VectorFERR >::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<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(af) == 1 ||
|
||||
bindings::stride_minor(af) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(af) >= std::max<
|
||||
std::ptrdiff_t >(1,bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::herfs( uplo(), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(af),
|
||||
bindings::stride_major(af), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
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 MatrixA, typename MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, 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(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(a) ) );
|
||||
return invoke( a, af, ipiv, b, x, ferr, berr, 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 MatrixA, typename MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, af, ipiv, b, x, ferr, berr, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct herfs_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 MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
RWORK > 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_STATIC_ASSERT( (bindings::is_column_major< MatrixAF >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorFERR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::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<
|
||||
MatrixAF >::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<
|
||||
MatrixB >::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( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(af) == 1 ||
|
||||
bindings::stride_minor(af) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(af) >= std::max<
|
||||
std::ptrdiff_t >(1,bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::herfs( uplo(), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(af),
|
||||
bindings::stride_major(af), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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 MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, af, ipiv, b, x, ferr, berr, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, af, ipiv, b, x, ferr, berr, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 herfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for herfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
herfs( const MatrixA& a, const MatrixAF& af, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
Workspace work ) {
|
||||
return herfs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, af, ipiv, b, x, ferr, berr, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for herfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename MatrixAF, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
herfs( const MatrixA& a, const MatrixAF& af, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return herfs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, af, ipiv, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
368
sdk/boost/numeric/bindings/lapack/computational/hetrd.hpp
Normal file
368
sdk/boost/numeric/bindings/lapack/computational/hetrd.hpp
Normal file
@@ -0,0 +1,368 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HETRD_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HETRD_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/traits/detail/utils.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 hetrd 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 hetrd( const UpLo, const fortran_int_t n, float* a,
|
||||
const fortran_int_t lda, float* d, float* e, float* tau, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSYTRD( &lapack_option< UpLo >::value, &n, a, &lda, d, e, tau,
|
||||
work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hetrd( const UpLo, const fortran_int_t n, double* a,
|
||||
const fortran_int_t lda, double* d, double* e, double* tau,
|
||||
double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSYTRD( &lapack_option< UpLo >::value, &n, a, &lda, d, e, tau,
|
||||
work, &lwork, &info );
|
||||
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 hetrd( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda, float* d, float* e,
|
||||
std::complex<float>* tau, std::complex<float>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHETRD( &lapack_option< UpLo >::value, &n, a, &lda, d, e, tau,
|
||||
work, &lwork, &info );
|
||||
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 hetrd( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda, double* d,
|
||||
double* e, std::complex<double>* tau, std::complex<double>* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHETRD( &lapack_option< UpLo >::value, &n, a, &lda, d, e, tau,
|
||||
work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hetrd.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hetrd_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hetrd_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 VectorD, typename VectorE,
|
||||
typename VectorTAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau, 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_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<
|
||||
VectorTAU >::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< VectorTAU >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size_column(a)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work());
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hetrd( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau, 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() );
|
||||
return invoke( a, d, e, 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 VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
real_type opt_size_work;
|
||||
detail::hetrd( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, d, e, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hetrd_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 VectorD, typename VectorE,
|
||||
typename VectorTAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau, 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_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<
|
||||
VectorTAU >::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< VectorTAU >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size_column(a)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work());
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hetrd( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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 VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work() );
|
||||
return invoke( a, d, e, 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 VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
value_type opt_size_work;
|
||||
detail::hetrd( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(tau), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, d, e, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work() {
|
||||
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 hetrd_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hetrd. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorD, typename VectorE,
|
||||
typename VectorTAU, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hetrd( MatrixA& a, VectorD& d, VectorE& e, VectorTAU& tau,
|
||||
Workspace work ) {
|
||||
return hetrd_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, d, e, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hetrd. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorTAU >,
|
||||
std::ptrdiff_t >::type
|
||||
hetrd( MatrixA& a, VectorD& d, VectorE& e, VectorTAU& tau ) {
|
||||
return hetrd_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, d, e, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
325
sdk/boost/numeric/bindings/lapack/computational/hetrf.hpp
Normal file
325
sdk/boost/numeric/bindings/lapack/computational/hetrf.hpp
Normal file
@@ -0,0 +1,325 @@
|
||||
//
|
||||
// Copyright (c) 2002--2010
|
||||
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
|
||||
// Thomas Klimpel and Rutger ter Borg
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED
|
||||
// PLEASE DO NOT EDIT!
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HETRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HETRF_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/traits/detail/utils.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 hetrf 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 hetrf( const UpLo, const fortran_int_t n, float* a,
|
||||
const fortran_int_t lda, fortran_int_t* ipiv, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSYTRF( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, work,
|
||||
&lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hetrf( const UpLo, const fortran_int_t n, double* a,
|
||||
const fortran_int_t lda, fortran_int_t* ipiv, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSYTRF( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, work,
|
||||
&lwork, &info );
|
||||
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 hetrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda, fortran_int_t* ipiv,
|
||||
std::complex<float>* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHETRF( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, work,
|
||||
&lwork, &info );
|
||||
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 hetrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda, fortran_int_t* ipiv,
|
||||
std::complex<double>* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHETRF( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, work,
|
||||
&lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hetrf.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hetrf_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hetrf_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 VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorIPIV& ipiv,
|
||||
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_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIPIV >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work());
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hetrf( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorIPIV& ipiv,
|
||||
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() );
|
||||
return invoke( a, ipiv, 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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
real_type opt_size_work;
|
||||
detail::hetrf( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, ipiv, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hetrf_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 VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorIPIV& ipiv,
|
||||
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_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIPIV >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work());
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hetrf( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorIPIV& ipiv,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work() );
|
||||
return invoke( a, ipiv, 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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
value_type opt_size_work;
|
||||
detail::hetrf( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, ipiv, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work() {
|
||||
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 hetrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hetrf. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hetrf( MatrixA& a, VectorIPIV& ipiv, Workspace work ) {
|
||||
return hetrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hetrf. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
hetrf( MatrixA& a, VectorIPIV& ipiv ) {
|
||||
return hetrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
310
sdk/boost/numeric/bindings/lapack/computational/hetri.hpp
Normal file
310
sdk/boost/numeric/bindings/lapack/computational/hetri.hpp
Normal file
@@ -0,0 +1,310 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HETRI_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HETRI_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 hetri 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 hetri( const UpLo, const fortran_int_t n, float* a,
|
||||
const fortran_int_t lda, const fortran_int_t* ipiv, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSYTRI( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, work,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hetri( const UpLo, const fortran_int_t n, double* a,
|
||||
const fortran_int_t lda, const fortran_int_t* ipiv, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSYTRI( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, work,
|
||||
&info );
|
||||
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 hetri( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, std::complex<float>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHETRI( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, work,
|
||||
&info );
|
||||
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 hetri( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, std::complex<double>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHETRI( &lapack_option< UpLo >::value, &n, a, &lda, ipiv, work,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hetri.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hetri_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hetri_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 VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
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_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hetri( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv),
|
||||
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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
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(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, ipiv, 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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, ipiv, 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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hetri_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 VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
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_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hetri( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(ipiv),
|
||||
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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, ipiv, 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 VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, ipiv, 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 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 hetri_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hetri. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hetri( MatrixA& a, const VectorIPIV& ipiv, Workspace work ) {
|
||||
return hetri_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hetri. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
hetri( MatrixA& a, const VectorIPIV& ipiv ) {
|
||||
return hetri_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
182
sdk/boost/numeric/bindings/lapack/computational/hetrs.hpp
Normal file
182
sdk/boost/numeric/bindings/lapack/computational/hetrs.hpp
Normal file
@@ -0,0 +1,182 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HETRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HETRS_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/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 hetrs 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 hetrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, float* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSYTRS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, ipiv, b,
|
||||
&ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hetrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* a, const fortran_int_t lda,
|
||||
const fortran_int_t* ipiv, double* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSYTRS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, ipiv, b,
|
||||
&ldb, &info );
|
||||
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 hetrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* a,
|
||||
const fortran_int_t lda, const fortran_int_t* ipiv,
|
||||
std::complex<float>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHETRS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, ipiv, b,
|
||||
&ldb, &info );
|
||||
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 hetrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* a,
|
||||
const fortran_int_t lda, const fortran_int_t* ipiv,
|
||||
std::complex<double>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHETRS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, ipiv, b,
|
||||
&ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hetrs.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hetrs_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 MatrixA, typename VectorIPIV, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
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< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::hetrs( uplo(), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the hetrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hetrs. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorIPIV, typename MatrixB >
|
||||
inline std::ptrdiff_t hetrs( const MatrixA& a, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
return hetrs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, ipiv, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
525
sdk/boost/numeric/bindings/lapack/computational/hgeqz.hpp
Normal file
525
sdk/boost/numeric/bindings/lapack/computational/hgeqz.hpp
Normal file
@@ -0,0 +1,525 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HGEQZ_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HGEQZ_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/traits/detail/utils.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 hgeqz 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 hgeqz( const char job, const char compq,
|
||||
const char compz, const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, float* h, const fortran_int_t ldh, float* t,
|
||||
const fortran_int_t ldt, float* alphar, float* alphai, float* beta,
|
||||
float* q, const fortran_int_t ldq, float* z, const fortran_int_t ldz,
|
||||
float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SHGEQZ( &job, &compq, &compz, &n, &ilo, &ihi, h, &ldh, t, &ldt,
|
||||
alphar, alphai, beta, q, &ldq, z, &ldz, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t hgeqz( const char job, const char compq,
|
||||
const char compz, const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, double* h, const fortran_int_t ldh,
|
||||
double* t, const fortran_int_t ldt, double* alphar, double* alphai,
|
||||
double* beta, double* q, const fortran_int_t ldq, double* z,
|
||||
const fortran_int_t ldz, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DHGEQZ( &job, &compq, &compz, &n, &ilo, &ihi, h, &ldh, t, &ldt,
|
||||
alphar, alphai, beta, q, &ldq, z, &ldz, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t hgeqz( const char job, const char compq,
|
||||
const char compz, const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, std::complex<float>* h,
|
||||
const fortran_int_t ldh, std::complex<float>* t,
|
||||
const fortran_int_t ldt, std::complex<float>* alpha,
|
||||
std::complex<float>* beta, std::complex<float>* q,
|
||||
const fortran_int_t ldq, std::complex<float>* z,
|
||||
const fortran_int_t ldz, std::complex<float>* work,
|
||||
const fortran_int_t lwork, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHGEQZ( &job, &compq, &compz, &n, &ilo, &ihi, h, &ldh, t, &ldt,
|
||||
alpha, beta, q, &ldq, z, &ldz, work, &lwork, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t hgeqz( const char job, const char compq,
|
||||
const char compz, const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, std::complex<double>* h,
|
||||
const fortran_int_t ldh, std::complex<double>* t,
|
||||
const fortran_int_t ldt, std::complex<double>* alpha,
|
||||
std::complex<double>* beta, std::complex<double>* q,
|
||||
const fortran_int_t ldq, std::complex<double>* z,
|
||||
const fortran_int_t ldz, std::complex<double>* work,
|
||||
const fortran_int_t lwork, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHGEQZ( &job, &compq, &compz, &n, &ilo, &ihi, h, &ldh, t, &ldt,
|
||||
alpha, beta, q, &ldq, z, &ldz, work, &lwork, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hgeqz.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hgeqz_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hgeqz_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 MatrixH, typename MatrixT, typename VectorALPHAR,
|
||||
typename VectorALPHAI, typename VectorBETA, typename MatrixQ,
|
||||
typename MatrixZ, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char job, const char compq,
|
||||
const char compz, const fortran_int_t ilo, MatrixH& h,
|
||||
MatrixT& t, VectorALPHAR& alphar, VectorALPHAI& alphai,
|
||||
VectorBETA& beta, MatrixQ& q, MatrixZ& z, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixZ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::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< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorALPHAR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorALPHAI >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBETA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixZ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorALPHAR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorALPHAI >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBETA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixZ >::value) );
|
||||
BOOST_ASSERT( bindings::size(alphar) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size(beta) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(h) ));
|
||||
BOOST_ASSERT( bindings::size_column(h) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(h) == 1 ||
|
||||
bindings::stride_minor(h) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(t) == 1 ||
|
||||
bindings::stride_minor(t) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(z) == 1 ||
|
||||
bindings::stride_minor(z) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(h) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(h)) );
|
||||
BOOST_ASSERT( bindings::stride_major(t) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(h)) );
|
||||
BOOST_ASSERT( compq == 'N' || compq == 'I' || compq == 'V' );
|
||||
BOOST_ASSERT( compz == 'N' || compz == 'I' || compz == 'V' );
|
||||
BOOST_ASSERT( job == 'E' || job == 'S' );
|
||||
return detail::hgeqz( job, compq, compz, bindings::size_column(h),
|
||||
ilo, bindings::size_column(h), bindings::begin_value(h),
|
||||
bindings::stride_major(h), bindings::begin_value(t),
|
||||
bindings::stride_major(t), bindings::begin_value(alphar),
|
||||
bindings::begin_value(alphai), bindings::begin_value(beta),
|
||||
bindings::begin_value(q), bindings::stride_major(q),
|
||||
bindings::begin_value(z), bindings::stride_major(z),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixH, typename MatrixT, typename VectorALPHAR,
|
||||
typename VectorALPHAI, typename VectorBETA, typename MatrixQ,
|
||||
typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char job, const char compq,
|
||||
const char compz, const fortran_int_t ilo, MatrixH& h,
|
||||
MatrixT& t, VectorALPHAR& alphar, VectorALPHAI& alphai,
|
||||
VectorBETA& beta, MatrixQ& q, MatrixZ& z, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(h) ) );
|
||||
return invoke( job, compq, compz, ilo, h, t, alphar, alphai, beta, q,
|
||||
z, 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 MatrixH, typename MatrixT, typename VectorALPHAR,
|
||||
typename VectorALPHAI, typename VectorBETA, typename MatrixQ,
|
||||
typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char job, const char compq,
|
||||
const char compz, const fortran_int_t ilo, MatrixH& h,
|
||||
MatrixT& t, VectorALPHAR& alphar, VectorALPHAI& alphai,
|
||||
VectorBETA& beta, MatrixQ& q, MatrixZ& z, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::hgeqz( job, compq, compz, bindings::size_column(h), ilo,
|
||||
bindings::size_column(h), bindings::begin_value(h),
|
||||
bindings::stride_major(h), bindings::begin_value(t),
|
||||
bindings::stride_major(t), bindings::begin_value(alphar),
|
||||
bindings::begin_value(alphai), bindings::begin_value(beta),
|
||||
bindings::begin_value(q), bindings::stride_major(q),
|
||||
bindings::begin_value(z), bindings::stride_major(z),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( job, compq, compz, ilo, h, t, alphar, alphai, beta, q,
|
||||
z, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,n);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hgeqz_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 MatrixH, typename MatrixT, typename VectorALPHA,
|
||||
typename VectorBETA, typename MatrixQ, typename MatrixZ,
|
||||
typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const char job, const char compq,
|
||||
const char compz, const fortran_int_t ilo, MatrixH& h,
|
||||
MatrixT& t, VectorALPHA& alpha, VectorBETA& beta, MatrixQ& q,
|
||||
MatrixZ& z, detail::workspace2< WORK, RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixZ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::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< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorALPHA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBETA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixZ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorALPHA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBETA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixZ >::value) );
|
||||
BOOST_ASSERT( bindings::size(alpha) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size(beta) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(h) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(h) ));
|
||||
BOOST_ASSERT( bindings::size_column(h) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(h) == 1 ||
|
||||
bindings::stride_minor(h) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(t) == 1 ||
|
||||
bindings::stride_minor(t) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(z) == 1 ||
|
||||
bindings::stride_minor(z) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(h) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(h)) );
|
||||
BOOST_ASSERT( bindings::stride_major(t) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(h)) );
|
||||
BOOST_ASSERT( compq == 'N' || compq == 'I' || compq == 'V' );
|
||||
BOOST_ASSERT( compz == 'N' || compz == 'I' || compz == 'V' );
|
||||
BOOST_ASSERT( job == 'E' || job == 'S' );
|
||||
return detail::hgeqz( job, compq, compz, bindings::size_column(h),
|
||||
ilo, bindings::size_column(h), bindings::begin_value(h),
|
||||
bindings::stride_major(h), bindings::begin_value(t),
|
||||
bindings::stride_major(t), bindings::begin_value(alpha),
|
||||
bindings::begin_value(beta), bindings::begin_value(q),
|
||||
bindings::stride_major(q), bindings::begin_value(z),
|
||||
bindings::stride_major(z),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(work.select(value_type())),
|
||||
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 MatrixH, typename MatrixT, typename VectorALPHA,
|
||||
typename VectorBETA, typename MatrixQ, typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char job, const char compq,
|
||||
const char compz, const fortran_int_t ilo, MatrixH& h,
|
||||
MatrixT& t, VectorALPHA& alpha, VectorBETA& beta, MatrixQ& q,
|
||||
MatrixZ& z, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(h) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(h) ) );
|
||||
return invoke( job, compq, compz, ilo, h, t, alpha, beta, q, z,
|
||||
workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 MatrixH, typename MatrixT, typename VectorALPHA,
|
||||
typename VectorBETA, typename MatrixQ, typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char job, const char compq,
|
||||
const char compz, const fortran_int_t ilo, MatrixH& h,
|
||||
MatrixT& t, VectorALPHA& alpha, VectorBETA& beta, MatrixQ& q,
|
||||
MatrixZ& z, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
value_type opt_size_work;
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(h) ) );
|
||||
detail::hgeqz( job, compq, compz, bindings::size_column(h), ilo,
|
||||
bindings::size_column(h), bindings::begin_value(h),
|
||||
bindings::stride_major(h), bindings::begin_value(t),
|
||||
bindings::stride_major(t), bindings::begin_value(alpha),
|
||||
bindings::begin_value(beta), bindings::begin_value(q),
|
||||
bindings::stride_major(q), bindings::begin_value(z),
|
||||
bindings::stride_major(z), &opt_size_work, -1,
|
||||
bindings::begin_value(tmp_rwork) );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( job, compq, compz, ilo, h, t, alpha, beta, q, z,
|
||||
workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,n);
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 hgeqz_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hgeqz. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixH, typename MatrixT, typename VectorALPHAR,
|
||||
typename VectorALPHAI, typename VectorBETA, typename MatrixQ,
|
||||
typename MatrixZ, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hgeqz( const char job, const char compq, const char compz,
|
||||
const fortran_int_t ilo, MatrixH& h, MatrixT& t,
|
||||
VectorALPHAR& alphar, VectorALPHAI& alphai, VectorBETA& beta,
|
||||
MatrixQ& q, MatrixZ& z, Workspace work ) {
|
||||
return hgeqz_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compq, compz, ilo, h, t, alphar,
|
||||
alphai, beta, q, z, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hgeqz. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixH, typename MatrixT, typename VectorALPHAR,
|
||||
typename VectorALPHAI, typename VectorBETA, typename MatrixQ,
|
||||
typename MatrixZ >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixZ >,
|
||||
std::ptrdiff_t >::type
|
||||
hgeqz( const char job, const char compq, const char compz,
|
||||
const fortran_int_t ilo, MatrixH& h, MatrixT& t,
|
||||
VectorALPHAR& alphar, VectorALPHAI& alphai, VectorBETA& beta,
|
||||
MatrixQ& q, MatrixZ& z ) {
|
||||
return hgeqz_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compq, compz, ilo, h, t, alphar,
|
||||
alphai, beta, q, z, optimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hgeqz. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixH, typename MatrixT, typename VectorALPHA,
|
||||
typename VectorBETA, typename MatrixQ, typename MatrixZ,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hgeqz( const char job, const char compq, const char compz,
|
||||
const fortran_int_t ilo, MatrixH& h, MatrixT& t,
|
||||
VectorALPHA& alpha, VectorBETA& beta, MatrixQ& q, MatrixZ& z,
|
||||
Workspace work ) {
|
||||
return hgeqz_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compq, compz, ilo, h, t, alpha,
|
||||
beta, q, z, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hgeqz. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixH, typename MatrixT, typename VectorALPHA,
|
||||
typename VectorBETA, typename MatrixQ, typename MatrixZ >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixZ >,
|
||||
std::ptrdiff_t >::type
|
||||
hgeqz( const char job, const char compq, const char compz,
|
||||
const fortran_int_t ilo, MatrixH& h, MatrixT& t,
|
||||
VectorALPHA& alpha, VectorBETA& beta, MatrixQ& q, MatrixZ& z ) {
|
||||
return hgeqz_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compq, compz, ilo, h, t, alpha,
|
||||
beta, q, z, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
322
sdk/boost/numeric/bindings/lapack/computational/hpcon.hpp
Normal file
322
sdk/boost/numeric/bindings/lapack/computational/hpcon.hpp
Normal file
@@ -0,0 +1,322 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HPCON_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HPCON_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/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 hpcon 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 hpcon( const UpLo, const fortran_int_t n,
|
||||
const float* ap, const fortran_int_t* ipiv, const float anorm,
|
||||
float& rcond, float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPCON( &lapack_option< UpLo >::value, &n, ap, ipiv, &anorm,
|
||||
&rcond, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hpcon( const UpLo, const fortran_int_t n,
|
||||
const double* ap, const fortran_int_t* ipiv, const double anorm,
|
||||
double& rcond, double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPCON( &lapack_option< UpLo >::value, &n, ap, ipiv, &anorm,
|
||||
&rcond, work, iwork, &info );
|
||||
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 hpcon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<float>* ap, const fortran_int_t* ipiv,
|
||||
const float anorm, float& rcond, std::complex<float>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHPCON( &lapack_option< UpLo >::value, &n, ap, ipiv, &anorm,
|
||||
&rcond, work, &info );
|
||||
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 hpcon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<double>* ap, const fortran_int_t* ipiv,
|
||||
const double anorm, double& rcond, std::complex<double>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHPCON( &lapack_option< UpLo >::value, &n, ap, ipiv, &anorm,
|
||||
&rcond, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hpcon.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hpcon_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hpcon_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 MatrixAP, typename VectorIPIV, typename WORK,
|
||||
typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, detail::workspace2< WORK,
|
||||
IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::hpcon( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv), anorm,
|
||||
rcond, 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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, 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(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(ap) ) );
|
||||
return invoke( ap, ipiv, anorm, rcond, 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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, ipiv, anorm, rcond, 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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hpcon_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 MatrixAP, typename VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::hpcon( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv), anorm,
|
||||
rcond, 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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, ipiv, anorm, rcond, 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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, ipiv, anorm, rcond, 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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 hpcon_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hpcon. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hpcon( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAP >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAP >::type >::type& rcond,
|
||||
Workspace work ) {
|
||||
return hpcon_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv, anorm, rcond, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hpcon. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
hpcon( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAP >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAP >::type >::type& rcond ) {
|
||||
return hpcon_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv, anorm, rcond,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
439
sdk/boost/numeric/bindings/lapack/computational/hprfs.hpp
Normal file
439
sdk/boost/numeric/bindings/lapack/computational/hprfs.hpp
Normal file
@@ -0,0 +1,439 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HPRFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HPRFS_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 hprfs 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 hprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* ap, const float* afp,
|
||||
const fortran_int_t* ipiv, const float* b, const fortran_int_t ldb,
|
||||
float* x, const fortran_int_t ldx, float* ferr, float* berr,
|
||||
float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, ipiv, b,
|
||||
&ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* ap, const double* afp,
|
||||
const fortran_int_t* ipiv, const double* b, const fortran_int_t ldb,
|
||||
double* x, const fortran_int_t ldx, double* ferr, double* berr,
|
||||
double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, ipiv, b,
|
||||
&ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
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 hprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* ap,
|
||||
const std::complex<float>* afp, const fortran_int_t* ipiv,
|
||||
const std::complex<float>* b, const fortran_int_t ldb,
|
||||
std::complex<float>* x, const fortran_int_t ldx, float* ferr,
|
||||
float* berr, std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, ipiv, b,
|
||||
&ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
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 hprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* ap,
|
||||
const std::complex<double>* afp, const fortran_int_t* ipiv,
|
||||
const std::complex<double>* b, const fortran_int_t ldb,
|
||||
std::complex<double>* x, const fortran_int_t ldx, double* ferr,
|
||||
double* berr, std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, ipiv, b,
|
||||
&ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hprfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hprfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hprfs_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 MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::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< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorFERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
return detail::hprfs( uplo(), bindings::size_column(ap),
|
||||
bindings::size_column(b), bindings::begin_value(ap),
|
||||
bindings::begin_value(afp), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
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 MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, 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(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(ap) ) );
|
||||
return invoke( ap, afp, ipiv, b, x, ferr, berr, 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 MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, afp, ipiv, b, x, ferr, berr, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hprfs_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 MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorFERR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
return detail::hprfs( uplo(), bindings::size_column(ap),
|
||||
bindings::size_column(b), bindings::begin_value(ap),
|
||||
bindings::begin_value(afp), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, afp, ipiv, b, x, ferr, berr, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, afp, ipiv, b, x, ferr, berr, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 hprfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hprfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hprfs( const MatrixAP& ap, const MatrixAFP& afp, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
Workspace work ) {
|
||||
return hprfs_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, afp, ipiv, b, x, ferr, berr,
|
||||
work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hprfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
hprfs( const MatrixAP& ap, const MatrixAFP& afp, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return hprfs_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, afp, ipiv, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
226
sdk/boost/numeric/bindings/lapack/computational/hptrd.hpp
Normal file
226
sdk/boost/numeric/bindings/lapack/computational/hptrd.hpp
Normal file
@@ -0,0 +1,226 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HPTRD_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HPTRD_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/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 hptrd 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 hptrd( const UpLo, const fortran_int_t n, float* ap,
|
||||
float* d, float* e, float* tau ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPTRD( &lapack_option< UpLo >::value, &n, ap, d, e, tau, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hptrd( const UpLo, const fortran_int_t n, double* ap,
|
||||
double* d, double* e, double* tau ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPTRD( &lapack_option< UpLo >::value, &n, ap, d, e, tau, &info );
|
||||
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 hptrd( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* ap, float* d, float* e,
|
||||
std::complex<float>* tau ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHPTRD( &lapack_option< UpLo >::value, &n, ap, d, e, tau, &info );
|
||||
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 hptrd( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* ap, double* d, double* e,
|
||||
std::complex<double>* tau ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHPTRD( &lapack_option< UpLo >::value, &n, ap, d, e, tau, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hptrd.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hptrd_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hptrd_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 MatrixAP, typename VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::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< MatrixAP >::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< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorTAU >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAU >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size_column(ap)-1 );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::hptrd( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(d),
|
||||
bindings::begin_value(e), bindings::begin_value(tau) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hptrd_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 MatrixAP, typename VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
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< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorTAU >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAU >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size_column(ap)-1 );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::hptrd( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(d),
|
||||
bindings::begin_value(e), bindings::begin_value(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 hptrd_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hptrd. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
inline std::ptrdiff_t hptrd( MatrixAP& ap, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau ) {
|
||||
return hptrd_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, d, e, tau );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
152
sdk/boost/numeric/bindings/lapack/computational/hptrf.hpp
Normal file
152
sdk/boost/numeric/bindings/lapack/computational/hptrf.hpp
Normal file
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HPTRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HPTRF_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/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 hptrf 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 hptrf( const UpLo, const fortran_int_t n, float* ap,
|
||||
fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPTRF( &lapack_option< UpLo >::value, &n, ap, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hptrf( const UpLo, const fortran_int_t n, double* ap,
|
||||
fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPTRF( &lapack_option< UpLo >::value, &n, ap, ipiv, &info );
|
||||
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 hptrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* ap, fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHPTRF( &lapack_option< UpLo >::value, &n, ap, ipiv, &info );
|
||||
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 hptrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* ap, fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHPTRF( &lapack_option< UpLo >::value, &n, ap, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hptrf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hptrf_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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, VectorIPIV& ipiv ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIPIV >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::hptrf( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 hptrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hptrf. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV >
|
||||
inline std::ptrdiff_t hptrf( MatrixAP& ap, VectorIPIV& ipiv ) {
|
||||
return hptrf_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
293
sdk/boost/numeric/bindings/lapack/computational/hptri.hpp
Normal file
293
sdk/boost/numeric/bindings/lapack/computational/hptri.hpp
Normal file
@@ -0,0 +1,293 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HPTRI_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HPTRI_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/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 hptri 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 hptri( const UpLo, const fortran_int_t n, float* ap,
|
||||
const fortran_int_t* ipiv, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPTRI( &lapack_option< UpLo >::value, &n, ap, ipiv, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hptri( const UpLo, const fortran_int_t n, double* ap,
|
||||
const fortran_int_t* ipiv, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPTRI( &lapack_option< UpLo >::value, &n, ap, ipiv, work, &info );
|
||||
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 hptri( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* ap, const fortran_int_t* ipiv,
|
||||
std::complex<float>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHPTRI( &lapack_option< UpLo >::value, &n, ap, ipiv, work, &info );
|
||||
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 hptri( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* ap, const fortran_int_t* ipiv,
|
||||
std::complex<double>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHPTRI( &lapack_option< UpLo >::value, &n, ap, ipiv, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hptri.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hptri_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hptri_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 MatrixAP, typename VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::hptri( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv),
|
||||
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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
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(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, ipiv, 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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, ipiv, 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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hptri_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 MatrixAP, typename VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::hptri( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv),
|
||||
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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, ipiv, 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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, ipiv, 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 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 hptri_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hptri. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hptri( MatrixAP& ap, const VectorIPIV& ipiv, Workspace work ) {
|
||||
return hptri_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hptri. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
hptri( MatrixAP& ap, const VectorIPIV& ipiv ) {
|
||||
return hptri_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
177
sdk/boost/numeric/bindings/lapack/computational/hptrs.hpp
Normal file
177
sdk/boost/numeric/bindings/lapack/computational/hptrs.hpp
Normal file
@@ -0,0 +1,177 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HPTRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HPTRS_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/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 hptrs 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 hptrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* ap, const fortran_int_t* ipiv,
|
||||
float* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPTRS( &lapack_option< UpLo >::value, &n, &nrhs, ap, ipiv, b,
|
||||
&ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t hptrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* ap, const fortran_int_t* ipiv,
|
||||
double* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPTRS( &lapack_option< UpLo >::value, &n, &nrhs, ap, ipiv, b,
|
||||
&ldb, &info );
|
||||
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 hptrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* ap,
|
||||
const fortran_int_t* ipiv, std::complex<float>* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHPTRS( &lapack_option< UpLo >::value, &n, &nrhs, ap, ipiv, b,
|
||||
&ldb, &info );
|
||||
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 hptrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* ap,
|
||||
const fortran_int_t* ipiv, std::complex<double>* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHPTRS( &lapack_option< UpLo >::value, &n, &nrhs, ap, ipiv, b,
|
||||
&ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hptrs.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hptrs_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 MatrixAP, typename VectorIPIV, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
return detail::hptrs( uplo(), bindings::size_column(ap),
|
||||
bindings::size_column(b), bindings::begin_value(ap),
|
||||
bindings::begin_value(ipiv), bindings::begin_value(b),
|
||||
bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the hptrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hptrs. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV, typename MatrixB >
|
||||
inline std::ptrdiff_t hptrs( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
MatrixB& b ) {
|
||||
return hptrs_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
500
sdk/boost/numeric/bindings/lapack/computational/hsein.hpp
Normal file
500
sdk/boost/numeric/bindings/lapack/computational/hsein.hpp
Normal file
@@ -0,0 +1,500 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HSEIN_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HSEIN_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 hsein 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 hsein( const Side, const char eigsrc, const char initv,
|
||||
fortran_bool_t* select, const fortran_int_t n, const float* h,
|
||||
const fortran_int_t ldh, float* wr, const float* wi, float* vl,
|
||||
const fortran_int_t ldvl, float* vr, const fortran_int_t ldvr,
|
||||
const fortran_int_t mm, fortran_int_t& m, float* work,
|
||||
fortran_int_t* ifaill, fortran_int_t* ifailr ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SHSEIN( &lapack_option< Side >::value, &eigsrc, &initv, select, &n,
|
||||
h, &ldh, wr, wi, vl, &ldvl, vr, &ldvr, &mm, &m, work, ifaill,
|
||||
ifailr, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Side >
|
||||
inline std::ptrdiff_t hsein( const Side, const char eigsrc, const char initv,
|
||||
fortran_bool_t* select, const fortran_int_t n, const double* h,
|
||||
const fortran_int_t ldh, double* wr, const double* wi, double* vl,
|
||||
const fortran_int_t ldvl, double* vr, const fortran_int_t ldvr,
|
||||
const fortran_int_t mm, fortran_int_t& m, double* work,
|
||||
fortran_int_t* ifaill, fortran_int_t* ifailr ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DHSEIN( &lapack_option< Side >::value, &eigsrc, &initv, select, &n,
|
||||
h, &ldh, wr, wi, vl, &ldvl, vr, &ldvr, &mm, &m, work, ifaill,
|
||||
ifailr, &info );
|
||||
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 hsein( const Side, const char eigsrc, const char initv,
|
||||
const fortran_bool_t* select, const fortran_int_t n,
|
||||
const std::complex<float>* h, const fortran_int_t ldh,
|
||||
std::complex<float>* w, std::complex<float>* vl,
|
||||
const fortran_int_t ldvl, std::complex<float>* vr,
|
||||
const fortran_int_t ldvr, const fortran_int_t mm, fortran_int_t& m,
|
||||
std::complex<float>* work, float* rwork, fortran_int_t* ifaill,
|
||||
fortran_int_t* ifailr ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHSEIN( &lapack_option< Side >::value, &eigsrc, &initv, select, &n,
|
||||
h, &ldh, w, vl, &ldvl, vr, &ldvr, &mm, &m, work, rwork, ifaill,
|
||||
ifailr, &info );
|
||||
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 hsein( const Side, const char eigsrc, const char initv,
|
||||
const fortran_bool_t* select, const fortran_int_t n,
|
||||
const std::complex<double>* h, const fortran_int_t ldh,
|
||||
std::complex<double>* w, std::complex<double>* vl,
|
||||
const fortran_int_t ldvl, std::complex<double>* vr,
|
||||
const fortran_int_t ldvr, const fortran_int_t mm, fortran_int_t& m,
|
||||
std::complex<double>* work, double* rwork, fortran_int_t* ifaill,
|
||||
fortran_int_t* ifailr ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHSEIN( &lapack_option< Side >::value, &eigsrc, &initv, select, &n,
|
||||
h, &ldh, w, vl, &ldvl, vr, &ldvr, &mm, &m, work, rwork, ifaill,
|
||||
ifailr, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hsein.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hsein_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hsein_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 VectorSELECT, typename MatrixH,
|
||||
typename VectorWR, typename VectorWI, typename MatrixVL,
|
||||
typename MatrixVR, typename VectorIFAILL, typename VectorIFAILR,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( const Side side, const char eigsrc,
|
||||
const char initv, VectorSELECT& select, const MatrixH& h,
|
||||
VectorWR& wr, const VectorWI& wi, MatrixVL& vl, MatrixVR& vr,
|
||||
const fortran_int_t mm, fortran_int_t& m,
|
||||
VectorIFAILL& ifaill, VectorIFAILR& ifailr, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVL >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVR >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorWR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorWI >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixVL >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixVR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorIFAILL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorIFAILR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorSELECT >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorWR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixVL >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixVR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIFAILL >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIFAILR >::value) );
|
||||
BOOST_ASSERT( bindings::size(select) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size(wi) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(h) ));
|
||||
BOOST_ASSERT( bindings::size(wr) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size_column(h) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(h) == 1 ||
|
||||
bindings::stride_minor(h) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(vl) == 1 ||
|
||||
bindings::stride_minor(vl) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(vr) == 1 ||
|
||||
bindings::stride_minor(vr) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(h) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(h)) );
|
||||
BOOST_ASSERT( eigsrc == 'Q' || eigsrc == 'N' );
|
||||
BOOST_ASSERT( initv == 'N' || initv == 'U' );
|
||||
return detail::hsein( side, eigsrc, initv,
|
||||
bindings::begin_value(select), bindings::size_column(h),
|
||||
bindings::begin_value(h), bindings::stride_major(h),
|
||||
bindings::begin_value(wr), bindings::begin_value(wi),
|
||||
bindings::begin_value(vl), bindings::stride_major(vl),
|
||||
bindings::begin_value(vr), bindings::stride_major(vr), mm, m,
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::begin_value(ifaill), bindings::begin_value(ifailr) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 VectorSELECT, typename MatrixH,
|
||||
typename VectorWR, typename VectorWI, typename MatrixVL,
|
||||
typename MatrixVR, typename VectorIFAILL, typename VectorIFAILR >
|
||||
static std::ptrdiff_t invoke( const Side side, const char eigsrc,
|
||||
const char initv, VectorSELECT& select, const MatrixH& h,
|
||||
VectorWR& wr, const VectorWI& wi, MatrixVL& vl, MatrixVR& vr,
|
||||
const fortran_int_t mm, fortran_int_t& m,
|
||||
VectorIFAILL& ifaill, VectorIFAILR& ifailr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(h) ) );
|
||||
return invoke( side, eigsrc, initv, select, h, wr, wi, vl, vr, mm, m,
|
||||
ifaill, ifailr, 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 VectorSELECT, typename MatrixH,
|
||||
typename VectorWR, typename VectorWI, typename MatrixVL,
|
||||
typename MatrixVR, typename VectorIFAILL, typename VectorIFAILR >
|
||||
static std::ptrdiff_t invoke( const Side side, const char eigsrc,
|
||||
const char initv, VectorSELECT& select, const MatrixH& h,
|
||||
VectorWR& wr, const VectorWI& wi, MatrixVL& vl, MatrixVR& vr,
|
||||
const fortran_int_t mm, fortran_int_t& m,
|
||||
VectorIFAILL& ifaill, VectorIFAILR& ifailr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( side, eigsrc, initv, select, h, wr, wi, vl, vr, mm, m,
|
||||
ifaill, ifailr, 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 (n+2)*n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hsein_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 VectorSELECT, typename MatrixH,
|
||||
typename VectorW, typename MatrixVL, typename MatrixVR,
|
||||
typename VectorIFAILL, typename VectorIFAILR, typename WORK,
|
||||
typename RWORK >
|
||||
static std::ptrdiff_t invoke( const Side side, const char eigsrc,
|
||||
const char initv, const VectorSELECT& select, const MatrixH& h,
|
||||
VectorW& w, MatrixVL& vl, MatrixVR& vr,
|
||||
const fortran_int_t mm, fortran_int_t& m,
|
||||
VectorIFAILL& ifaill, VectorIFAILR& ifailr, detail::workspace2<
|
||||
WORK, RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVL >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVR >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorIFAILL >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorIFAILR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::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< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixVL >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixVR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorW >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixVL >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixVR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIFAILL >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIFAILR >::value) );
|
||||
BOOST_ASSERT( bindings::size(select) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size(w) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(h) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(h) ));
|
||||
BOOST_ASSERT( bindings::size_column(h) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(h) == 1 ||
|
||||
bindings::stride_minor(h) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(vl) == 1 ||
|
||||
bindings::stride_minor(vl) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(vr) == 1 ||
|
||||
bindings::stride_minor(vr) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(h) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(h)) );
|
||||
BOOST_ASSERT( eigsrc == 'Q' || eigsrc == 'N' );
|
||||
BOOST_ASSERT( initv == 'N' || initv == 'U' );
|
||||
return detail::hsein( side, eigsrc, initv,
|
||||
bindings::begin_value(select), bindings::size_column(h),
|
||||
bindings::begin_value(h), bindings::stride_major(h),
|
||||
bindings::begin_value(w), bindings::begin_value(vl),
|
||||
bindings::stride_major(vl), bindings::begin_value(vr),
|
||||
bindings::stride_major(vr), mm, m,
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::begin_value(ifaill), bindings::begin_value(ifailr) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 VectorSELECT, typename MatrixH,
|
||||
typename VectorW, typename MatrixVL, typename MatrixVR,
|
||||
typename VectorIFAILL, typename VectorIFAILR >
|
||||
static std::ptrdiff_t invoke( const Side side, const char eigsrc,
|
||||
const char initv, const VectorSELECT& select, const MatrixH& h,
|
||||
VectorW& w, MatrixVL& vl, MatrixVR& vr,
|
||||
const fortran_int_t mm, fortran_int_t& m,
|
||||
VectorIFAILL& ifaill, VectorIFAILR& ifailr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(h) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(h) ) );
|
||||
return invoke( side, eigsrc, initv, select, h, w, vl, vr, mm, m,
|
||||
ifaill, ifailr, workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 VectorSELECT, typename MatrixH,
|
||||
typename VectorW, typename MatrixVL, typename MatrixVR,
|
||||
typename VectorIFAILL, typename VectorIFAILR >
|
||||
static std::ptrdiff_t invoke( const Side side, const char eigsrc,
|
||||
const char initv, const VectorSELECT& select, const MatrixH& h,
|
||||
VectorW& w, MatrixVL& vl, MatrixVR& vr,
|
||||
const fortran_int_t mm, fortran_int_t& m,
|
||||
VectorIFAILL& ifaill, VectorIFAILR& ifailr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( side, eigsrc, initv, select, h, w, vl, vr, mm, m,
|
||||
ifaill, ifailr, 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 n*n;
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 hsein_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hsein. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename VectorSELECT, typename MatrixH,
|
||||
typename VectorWR, typename VectorWI, typename MatrixVL,
|
||||
typename MatrixVR, typename VectorIFAILL, typename VectorIFAILR,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hsein( const Side side, const char eigsrc, const char initv,
|
||||
VectorSELECT& select, const MatrixH& h, VectorWR& wr,
|
||||
const VectorWI& wi, MatrixVL& vl, MatrixVR& vr,
|
||||
const fortran_int_t mm, fortran_int_t& m,
|
||||
VectorIFAILL& ifaill, VectorIFAILR& ifailr, Workspace work ) {
|
||||
return hsein_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( side, eigsrc, initv, select, h, wr, wi,
|
||||
vl, vr, mm, m, ifaill, ifailr, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hsein. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename VectorSELECT, typename MatrixH,
|
||||
typename VectorWR, typename VectorWI, typename MatrixVL,
|
||||
typename MatrixVR, typename VectorIFAILL, typename VectorIFAILR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIFAILR >,
|
||||
std::ptrdiff_t >::type
|
||||
hsein( const Side side, const char eigsrc, const char initv,
|
||||
VectorSELECT& select, const MatrixH& h, VectorWR& wr,
|
||||
const VectorWI& wi, MatrixVL& vl, MatrixVR& vr,
|
||||
const fortran_int_t mm, fortran_int_t& m,
|
||||
VectorIFAILL& ifaill, VectorIFAILR& ifailr ) {
|
||||
return hsein_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( side, eigsrc, initv, select, h, wr, wi,
|
||||
vl, vr, mm, m, ifaill, ifailr, optimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hsein. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename VectorSELECT, typename MatrixH,
|
||||
typename VectorW, typename MatrixVL, typename MatrixVR,
|
||||
typename VectorIFAILL, typename VectorIFAILR, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hsein( const Side side, const char eigsrc, const char initv,
|
||||
const VectorSELECT& select, const MatrixH& h, VectorW& w,
|
||||
MatrixVL& vl, MatrixVR& vr, const fortran_int_t mm,
|
||||
fortran_int_t& m, VectorIFAILL& ifaill, VectorIFAILR& ifailr,
|
||||
Workspace work ) {
|
||||
return hsein_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( side, eigsrc, initv, select, h, w, vl,
|
||||
vr, mm, m, ifaill, ifailr, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hsein. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename VectorSELECT, typename MatrixH,
|
||||
typename VectorW, typename MatrixVL, typename MatrixVR,
|
||||
typename VectorIFAILL, typename VectorIFAILR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIFAILR >,
|
||||
std::ptrdiff_t >::type
|
||||
hsein( const Side side, const char eigsrc, const char initv,
|
||||
const VectorSELECT& select, const MatrixH& h, VectorW& w,
|
||||
MatrixVL& vl, MatrixVR& vr, const fortran_int_t mm,
|
||||
fortran_int_t& m, VectorIFAILL& ifaill, VectorIFAILR& ifailr ) {
|
||||
return hsein_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( side, eigsrc, initv, select, h, w, vl,
|
||||
vr, mm, m, ifaill, ifailr, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
463
sdk/boost/numeric/bindings/lapack/computational/hseqr.hpp
Normal file
463
sdk/boost/numeric/bindings/lapack/computational/hseqr.hpp
Normal file
@@ -0,0 +1,463 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_HSEQR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_HSEQR_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/array.hpp>
|
||||
#include <boost/numeric/bindings/detail/complex_utils.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/traits/detail/utils.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 hseqr 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 hseqr( const char job, const char compz,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, float* h, const fortran_int_t ldh, float* wr,
|
||||
float* wi, float* z, const fortran_int_t ldz, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SHSEQR( &job, &compz, &n, &ilo, &ihi, h, &ldh, wr, wi, z, &ldz,
|
||||
work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t hseqr( const char job, const char compz,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, double* h, const fortran_int_t ldh,
|
||||
double* wr, double* wi, double* z, const fortran_int_t ldz,
|
||||
double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DHSEQR( &job, &compz, &n, &ilo, &ihi, h, &ldh, wr, wi, z, &ldz,
|
||||
work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t hseqr( const char job, const char compz,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, std::complex<float>* h,
|
||||
const fortran_int_t ldh, std::complex<float>* w,
|
||||
std::complex<float>* z, const fortran_int_t ldz,
|
||||
std::complex<float>* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CHSEQR( &job, &compz, &n, &ilo, &ihi, h, &ldh, w, z, &ldz, work,
|
||||
&lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t hseqr( const char job, const char compz,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, std::complex<double>* h,
|
||||
const fortran_int_t ldh, std::complex<double>* w,
|
||||
std::complex<double>* z, const fortran_int_t ldz,
|
||||
std::complex<double>* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZHSEQR( &job, &compz, &n, &ilo, &ihi, h, &ldh, w, z, &ldz, work,
|
||||
&lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hseqr.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct hseqr_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hseqr_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 MatrixH, typename VectorWR, typename VectorWI,
|
||||
typename MatrixZ, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char job, const char compz,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixH& h, VectorWR& wr, VectorWI& wi, MatrixZ& z,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixZ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorWR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorWI >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixZ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorWR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorWI >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixZ >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(h) ));
|
||||
BOOST_ASSERT( bindings::size(wr) >= bindings::size_column(h) );
|
||||
BOOST_ASSERT( bindings::size_column(h) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(h) == 1 ||
|
||||
bindings::stride_minor(h) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(z) == 1 ||
|
||||
bindings::stride_minor(z) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(h) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(h)) );
|
||||
BOOST_ASSERT( compz == 'N' || compz == 'I' || compz == 'V' );
|
||||
BOOST_ASSERT( job == 'E' || job == 'S' );
|
||||
return detail::hseqr( job, compz, bindings::size_column(h), ilo, ihi,
|
||||
bindings::begin_value(h), bindings::stride_major(h),
|
||||
bindings::begin_value(wr), bindings::begin_value(wi),
|
||||
bindings::begin_value(z), bindings::stride_major(z),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixH, typename VectorWR, typename VectorWI,
|
||||
typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char job, const char compz,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixH& h, VectorWR& wr, VectorWI& wi, MatrixZ& z,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(h) ) );
|
||||
return invoke( job, compz, ilo, ihi, h, wr, wi, z,
|
||||
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 MatrixH, typename VectorWR, typename VectorWI,
|
||||
typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char job, const char compz,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixH& h, VectorWR& wr, VectorWI& wi, MatrixZ& z,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::hseqr( job, compz, bindings::size_column(h), ilo, ihi,
|
||||
bindings::begin_value(h), bindings::stride_major(h),
|
||||
bindings::begin_value(wr), bindings::begin_value(wi),
|
||||
bindings::begin_value(z), bindings::stride_major(z),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( job, compz, ilo, ihi, h, wr, wi, z,
|
||||
workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,n);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hseqr_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 MatrixH, typename VectorW, typename MatrixZ,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( const char job, const char compz,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixH& h, VectorW& w, MatrixZ& z, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixZ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixH >::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< MatrixH >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixZ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixH >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorW >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixZ >::value) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(h) ));
|
||||
BOOST_ASSERT( bindings::size_column(h) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(h) == 1 ||
|
||||
bindings::stride_minor(h) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(z) == 1 ||
|
||||
bindings::stride_minor(z) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(h) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(h)) );
|
||||
BOOST_ASSERT( compz == 'N' || compz == 'I' || compz == 'V' );
|
||||
BOOST_ASSERT( job == 'E' || job == 'S' );
|
||||
return detail::hseqr( job, compz, bindings::size_column(h), ilo, ihi,
|
||||
bindings::begin_value(h), bindings::stride_major(h),
|
||||
bindings::begin_value(w), bindings::begin_value(z),
|
||||
bindings::stride_major(z),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
bindings::size(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 MatrixH, typename VectorW, typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char job, const char compz,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixH& h, VectorW& w, MatrixZ& z, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(h) ) );
|
||||
return invoke( job, compz, ilo, ihi, h, w, z, 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 MatrixH, typename VectorW, typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char job, const char compz,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixH& h, VectorW& w, MatrixZ& z, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
value_type opt_size_work;
|
||||
detail::hseqr( job, compz, bindings::size_column(h), ilo, ihi,
|
||||
bindings::begin_value(h), bindings::stride_major(h),
|
||||
bindings::begin_value(w), bindings::begin_value(z),
|
||||
bindings::stride_major(z), &opt_size_work, -1 );
|
||||
bindings::detail::array< value_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( job, compz, ilo, ihi, h, w, z, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,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 hseqr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hseqr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixH, typename VectorWR, typename VectorWI,
|
||||
typename MatrixZ, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
hseqr( const char job, const char compz, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixH& h, VectorWR& wr, VectorWI& wi,
|
||||
MatrixZ& z, Workspace work ) {
|
||||
return hseqr_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compz, ilo, ihi, h, wr, wi, z,
|
||||
work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hseqr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixH, typename VectorWR, typename VectorWI,
|
||||
typename MatrixZ >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixZ >,
|
||||
std::ptrdiff_t >::type
|
||||
hseqr( const char job, const char compz, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixH& h, VectorWR& wr, VectorWI& wi,
|
||||
MatrixZ& z ) {
|
||||
return hseqr_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compz, ilo, ihi, h, wr, wi, z,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hseqr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixH, typename VectorW, typename MatrixZ,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< mpl::and_< is_complex<
|
||||
typename bindings::value_type< MatrixH >::type >,
|
||||
detail::is_workspace< Workspace > >,
|
||||
std::ptrdiff_t >::type
|
||||
hseqr( const char job, const char compz, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixH& h, VectorW& w, MatrixZ& z,
|
||||
Workspace work ) {
|
||||
return hseqr_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compz, ilo, ihi, h, w, z, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hseqr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixH, typename VectorW, typename MatrixZ >
|
||||
inline typename boost::disable_if< mpl::or_< is_real<
|
||||
typename bindings::value_type< MatrixH >::type >,
|
||||
detail::is_workspace< MatrixZ > >,
|
||||
std::ptrdiff_t >::type
|
||||
hseqr( const char job, const char compz, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixH& h, VectorW& w, MatrixZ& z ) {
|
||||
return hseqr_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compz, ilo, ihi, h, w, z,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hseqr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixH, typename VectorW, typename MatrixZ,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< mpl::and_< is_real<
|
||||
typename bindings::value_type< MatrixH >::type >,
|
||||
detail::is_workspace< Workspace > >,
|
||||
std::ptrdiff_t >::type
|
||||
hseqr( const char job, const char compz, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixH& h, VectorW& w, MatrixZ& z,
|
||||
Workspace work ) {
|
||||
std::ptrdiff_t info = hseqr_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compz, ilo, ihi, h,
|
||||
bindings::detail::real_part_view(w), bindings::detail::imag_part_view(w),
|
||||
z, work );
|
||||
bindings::detail::interlace(w);
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for hseqr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixH, typename VectorW, typename MatrixZ >
|
||||
inline typename boost::disable_if< mpl::or_< is_complex<
|
||||
typename bindings::value_type< MatrixH >::type >,
|
||||
detail::is_workspace< MatrixZ > >,
|
||||
std::ptrdiff_t >::type
|
||||
hseqr( const char job, const char compz, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixH& h, VectorW& w, MatrixZ& z ) {
|
||||
std::ptrdiff_t info = hseqr_impl< typename bindings::value_type<
|
||||
MatrixH >::type >::invoke( job, compz, ilo, ihi, h,
|
||||
bindings::detail::real_part_view(w), bindings::detail::imag_part_view(w),
|
||||
z, optimal_workspace() );
|
||||
bindings::detail::interlace(w);
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
206
sdk/boost/numeric/bindings/lapack/computational/opgtr.hpp
Normal file
206
sdk/boost/numeric/bindings/lapack/computational/opgtr.hpp
Normal file
@@ -0,0 +1,206 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_OPGTR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_OPGTR_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 opgtr 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 opgtr( const char uplo, const fortran_int_t n,
|
||||
const float* ap, const float* tau, float* q, const fortran_int_t ldq,
|
||||
float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SOPGTR( &uplo, &n, ap, tau, q, &ldq, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t opgtr( const char uplo, const fortran_int_t n,
|
||||
const double* ap, const double* tau, double* q,
|
||||
const fortran_int_t ldq, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DOPGTR( &uplo, &n, ap, tau, q, &ldq, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to opgtr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct opgtr_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 VectorAP, typename VectorTAU, typename MatrixQ,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( const char uplo, const VectorAP& ap,
|
||||
const VectorTAU& tau, MatrixQ& q, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorAP >::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< VectorAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_ASSERT( bindings::size(ap) >=
|
||||
bindings::size_column(q)*(bindings::size_column(q)+1)/2 );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size_column(q)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(q) ));
|
||||
BOOST_ASSERT( bindings::size_column(q) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(q) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(q)) );
|
||||
return detail::opgtr( uplo, bindings::size_column(q),
|
||||
bindings::begin_value(ap), bindings::begin_value(tau),
|
||||
bindings::begin_value(q), bindings::stride_major(q),
|
||||
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 VectorAP, typename VectorTAU, typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char uplo, const VectorAP& ap,
|
||||
const VectorTAU& tau, MatrixQ& q, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(q) ) );
|
||||
return invoke( uplo, ap, tau, q, 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 VectorAP, typename VectorTAU, typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char uplo, const VectorAP& ap,
|
||||
const VectorTAU& tau, MatrixQ& q, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( uplo, ap, tau, q, 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 n-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 opgtr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for opgtr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename VectorAP, typename VectorTAU, typename MatrixQ,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
opgtr( const char uplo, const VectorAP& ap, const VectorTAU& tau,
|
||||
MatrixQ& q, Workspace work ) {
|
||||
return opgtr_impl< typename bindings::value_type<
|
||||
VectorAP >::type >::invoke( uplo, ap, tau, q, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for opgtr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename VectorAP, typename VectorTAU, typename MatrixQ >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixQ >,
|
||||
std::ptrdiff_t >::type
|
||||
opgtr( const char uplo, const VectorAP& ap, const VectorTAU& tau,
|
||||
MatrixQ& q ) {
|
||||
return opgtr_impl< typename bindings::value_type<
|
||||
VectorAP >::type >::invoke( uplo, ap, tau, q,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
225
sdk/boost/numeric/bindings/lapack/computational/opmtr.hpp
Normal file
225
sdk/boost/numeric/bindings/lapack/computational/opmtr.hpp
Normal file
@@ -0,0 +1,225 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_OPMTR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_OPMTR_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_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 opmtr 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 opmtr( const Side, const char uplo, const Trans,
|
||||
const fortran_int_t m, const fortran_int_t n, const float* ap,
|
||||
const float* tau, float* c, const fortran_int_t ldc, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SOPMTR( &lapack_option< Side >::value, &uplo, &lapack_option<
|
||||
Trans >::value, &m, &n, ap, tau, c, &ldc, work, &info );
|
||||
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 opmtr( const Side, const char uplo, const Trans,
|
||||
const fortran_int_t m, const fortran_int_t n, const double* ap,
|
||||
const double* tau, double* c, const fortran_int_t ldc, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DOPMTR( &lapack_option< Side >::value, &uplo, &lapack_option<
|
||||
Trans >::value, &m, &n, ap, tau, c, &ldc, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to opmtr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct opmtr_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 Side, typename VectorAP, typename VectorTAU,
|
||||
typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const Side side, const char uplo,
|
||||
const VectorAP& ap, const VectorTAU& tau, MatrixC& c,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorAP, 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< VectorAP >::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< VectorAP >::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_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(c)) );
|
||||
return detail::opmtr( side, uplo, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::begin_value(ap),
|
||||
bindings::begin_value(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 VectorAP, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const char uplo,
|
||||
const VectorAP& ap, const VectorTAU& tau, MatrixC& c,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorAP, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( side,
|
||||
bindings::size_row(c), bindings::size_column(c) ) );
|
||||
return invoke( side, uplo, ap, 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 VectorAP, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const char uplo,
|
||||
const VectorAP& ap, const VectorTAU& tau, MatrixC& c,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef tag::column_major order;
|
||||
typedef typename result_of::trans_tag< VectorAP, order >::type trans;
|
||||
return invoke( side, uplo, ap, 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 opmtr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for opmtr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename VectorAP, typename VectorTAU,
|
||||
typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
opmtr( const Side side, const char uplo, const VectorAP& ap,
|
||||
const VectorTAU& tau, MatrixC& c, Workspace work ) {
|
||||
return opmtr_impl< typename bindings::value_type<
|
||||
VectorAP >::type >::invoke( side, uplo, ap, tau, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for opmtr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename VectorAP, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
opmtr( const Side side, const char uplo, const VectorAP& ap,
|
||||
const VectorTAU& tau, MatrixC& c ) {
|
||||
return opmtr_impl< typename bindings::value_type<
|
||||
VectorAP >::type >::invoke( side, uplo, ap, tau, c,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
212
sdk/boost/numeric/bindings/lapack/computational/orgbr.hpp
Normal file
212
sdk/boost/numeric/bindings/lapack/computational/orgbr.hpp
Normal file
@@ -0,0 +1,212 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORGBR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORGBR_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/traits/detail/utils.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 orgbr 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 orgbr( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, float* a,
|
||||
const fortran_int_t lda, const float* tau, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORGBR( &vect, &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t orgbr( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, double* a,
|
||||
const fortran_int_t lda, const double* tau, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORGBR( &vect, &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to orgbr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct orgbr_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 VectorTAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, MatrixA& a,
|
||||
const 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_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( m, n ));
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
m) );
|
||||
BOOST_ASSERT( k >= 0 );
|
||||
BOOST_ASSERT( m >= 0 );
|
||||
BOOST_ASSERT( vect == 'Q' || vect == 'P' );
|
||||
return detail::orgbr( vect, m, n, k, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, MatrixA& a,
|
||||
const VectorTAU& tau, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( m, n ) );
|
||||
return invoke( vect, m, n, k, 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( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, MatrixA& a,
|
||||
const VectorTAU& tau, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::orgbr( vect, m, n, k, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( vect, m, n, k, a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work( const std::ptrdiff_t m,
|
||||
const std::ptrdiff_t n ) {
|
||||
return std::max< std::ptrdiff_t >( 1, std::min< std::ptrdiff_t >( m,
|
||||
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 orgbr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for orgbr. 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
|
||||
orgbr( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, MatrixA& a,
|
||||
const VectorTAU& tau, Workspace work ) {
|
||||
return orgbr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( vect, m, n, k, a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for orgbr. 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
|
||||
orgbr( const char vect, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, MatrixA& a,
|
||||
const VectorTAU& tau ) {
|
||||
return orgbr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( vect, m, n, k, a, tau,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
209
sdk/boost/numeric/bindings/lapack/computational/orghr.hpp
Normal file
209
sdk/boost/numeric/bindings/lapack/computational/orghr.hpp
Normal file
@@ -0,0 +1,209 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORGHR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORGHR_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/traits/detail/utils.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 orghr 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 orghr( const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, float* a, const fortran_int_t lda,
|
||||
const float* tau, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORGHR( &n, &ilo, &ihi, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t orghr( const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, double* a, const fortran_int_t lda,
|
||||
const double* tau, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORGHR( &n, &ilo, &ihi, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to orghr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct orghr_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 VectorTAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixA& a, const 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_ASSERT( bindings::size(tau) >= n-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( ihi, ilo ));
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
n) );
|
||||
BOOST_ASSERT( n >= 0 );
|
||||
return detail::orghr( n, ilo, ihi, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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( const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixA& a, const VectorTAU& tau, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( ihi,
|
||||
ilo ) );
|
||||
return invoke( n, ilo, ihi, 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( const fortran_int_t n,
|
||||
const fortran_int_t ilo, const fortran_int_t ihi,
|
||||
MatrixA& a, const VectorTAU& tau, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::orghr( n, ilo, ihi, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( n, ilo, ihi, a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array work.
|
||||
//
|
||||
static std::ptrdiff_t min_size_work( const std::ptrdiff_t ihi,
|
||||
const std::ptrdiff_t ilo ) {
|
||||
return ihi-ilo;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 orghr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for orghr. 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
|
||||
orghr( const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixA& a, const VectorTAU& tau,
|
||||
Workspace work ) {
|
||||
return orghr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( n, ilo, ihi, a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for orghr. 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
|
||||
orghr( const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, MatrixA& a, const VectorTAU& tau ) {
|
||||
return orghr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( n, ilo, ihi, a, tau,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
203
sdk/boost/numeric/bindings/lapack/computational/orglq.hpp
Normal file
203
sdk/boost/numeric/bindings/lapack/computational/orglq.hpp
Normal 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_COMPUTATIONAL_ORGLQ_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORGLQ_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/traits/detail/utils.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 orglq 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 orglq( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t k, float* a, const fortran_int_t lda,
|
||||
const float* tau, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORGLQ( &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t orglq( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t k, double* a, const fortran_int_t lda,
|
||||
const double* tau, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORGLQ( &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to orglq.
|
||||
//
|
||||
template< typename Value >
|
||||
struct orglq_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 VectorTAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const 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_ASSERT( bindings::size(tau) >= bindings::size(tau) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_row(a) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= bindings::size_row(a) );
|
||||
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::orglq( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size(tau), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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, const 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, const VectorTAU& tau,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::orglq( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size(tau), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >( 1, 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 orglq_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for orglq. 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
|
||||
orglq( MatrixA& a, const VectorTAU& tau, Workspace work ) {
|
||||
return orglq_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for orglq. 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
|
||||
orglq( MatrixA& a, const VectorTAU& tau ) {
|
||||
return orglq_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
202
sdk/boost/numeric/bindings/lapack/computational/orgql.hpp
Normal file
202
sdk/boost/numeric/bindings/lapack/computational/orgql.hpp
Normal file
@@ -0,0 +1,202 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORGQL_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORGQL_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/traits/detail/utils.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 orgql 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 orgql( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t k, float* a, const fortran_int_t lda,
|
||||
const float* tau, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORGQL( &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t orgql( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t k, double* a, const fortran_int_t lda,
|
||||
const double* tau, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORGQL( &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to orgql.
|
||||
//
|
||||
template< typename Value >
|
||||
struct orgql_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 VectorTAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const 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_ASSERT( bindings::size(tau) >= bindings::size(tau) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(a) ));
|
||||
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::orgql( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size(tau), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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, const VectorTAU& tau,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(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, const VectorTAU& tau,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::orgql( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size(tau), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >( 1, 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 orgql_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for orgql. 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
|
||||
orgql( MatrixA& a, const VectorTAU& tau, Workspace work ) {
|
||||
return orgql_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for orgql. 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
|
||||
orgql( MatrixA& a, const VectorTAU& tau ) {
|
||||
return orgql_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
202
sdk/boost/numeric/bindings/lapack/computational/orgqr.hpp
Normal file
202
sdk/boost/numeric/bindings/lapack/computational/orgqr.hpp
Normal file
@@ -0,0 +1,202 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORGQR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORGQR_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/traits/detail/utils.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 orgqr 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 orgqr( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t k, float* a, const fortran_int_t lda,
|
||||
const float* tau, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORGQR( &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t orgqr( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t k, double* a, const fortran_int_t lda,
|
||||
const double* tau, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORGQR( &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to orgqr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct orgqr_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 VectorTAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const 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_ASSERT( bindings::size(tau) >= bindings::size(tau) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(a) ));
|
||||
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::orgqr( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size(tau), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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, const VectorTAU& tau,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size_column(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, const VectorTAU& tau,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::orgqr( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size(tau), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >( 1, 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 orgqr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for orgqr. 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
|
||||
orgqr( MatrixA& a, const VectorTAU& tau, Workspace work ) {
|
||||
return orgqr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for orgqr. 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
|
||||
orgqr( MatrixA& a, const VectorTAU& tau ) {
|
||||
return orgqr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
203
sdk/boost/numeric/bindings/lapack/computational/orgrq.hpp
Normal file
203
sdk/boost/numeric/bindings/lapack/computational/orgrq.hpp
Normal 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_COMPUTATIONAL_ORGRQ_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORGRQ_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/traits/detail/utils.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 orgrq 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 orgrq( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t k, float* a, const fortran_int_t lda,
|
||||
const float* tau, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORGRQ( &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t orgrq( const fortran_int_t m, const fortran_int_t n,
|
||||
const fortran_int_t k, double* a, const fortran_int_t lda,
|
||||
const double* tau, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORGRQ( &m, &n, &k, a, &lda, tau, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to orgrq.
|
||||
//
|
||||
template< typename Value >
|
||||
struct orgrq_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 VectorTAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, const 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_ASSERT( bindings::size(tau) >= bindings::size(tau) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_row(a) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= bindings::size_row(a) );
|
||||
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::orgrq( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size(tau), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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, const 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, const VectorTAU& tau,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
real_type opt_size_work;
|
||||
detail::orgrq( bindings::size_row(a), bindings::size_column(a),
|
||||
bindings::size(tau), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >( 1, 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 orgrq_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for orgrq. 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
|
||||
orgrq( MatrixA& a, const VectorTAU& tau, Workspace work ) {
|
||||
return orgrq_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for orgrq. 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
|
||||
orgrq( MatrixA& a, const VectorTAU& tau ) {
|
||||
return orgrq_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
208
sdk/boost/numeric/bindings/lapack/computational/orgtr.hpp
Normal file
208
sdk/boost/numeric/bindings/lapack/computational/orgtr.hpp
Normal file
@@ -0,0 +1,208 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORGTR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORGTR_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/traits/detail/utils.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 orgtr 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 orgtr( const UpLo, const fortran_int_t n, float* a,
|
||||
const fortran_int_t lda, const float* tau, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORGTR( &lapack_option< UpLo >::value, &n, a, &lda, tau, work,
|
||||
&lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t orgtr( const UpLo, const fortran_int_t n, double* a,
|
||||
const fortran_int_t lda, const double* tau, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORGTR( &lapack_option< UpLo >::value, &n, a, &lda, tau, work,
|
||||
&lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to orgtr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct orgtr_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 VectorTAU, typename WORK >
|
||||
static std::ptrdiff_t invoke( const fortran_int_t n, MatrixA& a,
|
||||
const VectorTAU& tau, 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_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_ASSERT( bindings::size(tau) >= n-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( n ));
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
n) );
|
||||
BOOST_ASSERT( n >= 0 );
|
||||
return detail::orgtr( uplo(), n, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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( const fortran_int_t n, MatrixA& a,
|
||||
const VectorTAU& tau, 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( n ) );
|
||||
return invoke( n, 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( const fortran_int_t n, MatrixA& a,
|
||||
const VectorTAU& tau, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
real_type opt_size_work;
|
||||
detail::orgtr( uplo(), n, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( n, a, tau, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 std::max< std::ptrdiff_t >(1,n-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 orgtr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for orgtr. 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
|
||||
orgtr( const fortran_int_t n, MatrixA& a, const VectorTAU& tau,
|
||||
Workspace work ) {
|
||||
return orgtr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( n, a, tau, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for orgtr. 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
|
||||
orgtr( const fortran_int_t n, MatrixA& a, const VectorTAU& tau ) {
|
||||
return orgtr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( n, a, tau, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
244
sdk/boost/numeric/bindings/lapack/computational/ormbr.hpp
Normal file
244
sdk/boost/numeric/bindings/lapack/computational/ormbr.hpp
Normal 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_COMPUTATIONAL_ORMBR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORMBR_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_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/traits/detail/utils.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for ormbr 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 ormbr( const char vect, const Side, const Trans,
|
||||
const fortran_int_t m, const fortran_int_t n, const fortran_int_t k,
|
||||
const float* a, const fortran_int_t lda, const float* tau, float* c,
|
||||
const fortran_int_t ldc, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORMBR( &vect, &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
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 ormbr( const char vect, const Side, const Trans,
|
||||
const fortran_int_t m, const fortran_int_t n, const fortran_int_t k,
|
||||
const double* a, const fortran_int_t lda, const double* tau,
|
||||
double* c, const fortran_int_t ldc, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORMBR( &vect, &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ormbr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ormbr_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 Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char vect, const Side side,
|
||||
const MatrixA& a, const VectorTAU& tau, MatrixC& c,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
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<
|
||||
MatrixC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( side, bindings::size_row(c),
|
||||
bindings::size_column(c) ));
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(c)) );
|
||||
BOOST_ASSERT( vect == 'Q' || vect == 'P' );
|
||||
return detail::ormbr( vect, side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char vect, const Side side,
|
||||
const MatrixA& a, const VectorTAU& tau, MatrixC& c,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( side,
|
||||
bindings::size_row(c), bindings::size_column(c) ) );
|
||||
return invoke( vect, side, a, 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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const char vect, const Side side,
|
||||
const MatrixA& a, const VectorTAU& tau, MatrixC& c,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
real_type opt_size_work;
|
||||
detail::ormbr( vect, side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( vect, side, a, tau, c, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ormbr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ormbr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ormbr( const char vect, const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, Workspace work ) {
|
||||
return ormbr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( vect, side, a, tau, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ormbr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
ormbr( const char vect, const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c ) {
|
||||
return ormbr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( vect, side, a, tau, c,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
245
sdk/boost/numeric/bindings/lapack/computational/ormhr.hpp
Normal file
245
sdk/boost/numeric/bindings/lapack/computational/ormhr.hpp
Normal file
@@ -0,0 +1,245 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORMHR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORMHR_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_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/traits/detail/utils.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for ormhr 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 ormhr( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, const float* a, const fortran_int_t lda,
|
||||
const float* tau, float* c, const fortran_int_t ldc, float* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORMHR( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &ilo, &ihi, a, &lda, tau, c, &ldc, work,
|
||||
&lwork, &info );
|
||||
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 ormhr( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, const double* a, const fortran_int_t lda,
|
||||
const double* tau, double* c, const fortran_int_t ldc, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORMHR( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &ilo, &ihi, a, &lda, tau, c, &ldc, work,
|
||||
&lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ormhr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ormhr_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 Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const Side side, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
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<
|
||||
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_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(c)) );
|
||||
return detail::ormhr( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), ilo, ihi, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(c), bindings::stride_major(c),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( side,
|
||||
bindings::size_row(c), bindings::size_column(c) ) );
|
||||
return invoke( side, ilo, ihi, a, 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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
real_type opt_size_work;
|
||||
detail::ormhr( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), ilo, ihi, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(c), bindings::stride_major(c),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( side, ilo, ihi, a, tau, c, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ormhr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ormhr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ormhr( const Side side, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c, Workspace work ) {
|
||||
return ormhr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, ilo, ihi, a, tau, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ormhr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
ormhr( const Side side, const fortran_int_t ilo,
|
||||
const fortran_int_t ihi, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c ) {
|
||||
return ormhr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, ilo, ihi, a, tau, c,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
241
sdk/boost/numeric/bindings/lapack/computational/ormlq.hpp
Normal file
241
sdk/boost/numeric/bindings/lapack/computational/ormlq.hpp
Normal file
@@ -0,0 +1,241 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORMLQ_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORMLQ_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_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/traits/detail/utils.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for ormlq 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 ormlq( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, const float* a,
|
||||
const fortran_int_t lda, const float* tau, float* c,
|
||||
const fortran_int_t ldc, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORMLQ( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
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 ormlq( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, const double* a,
|
||||
const fortran_int_t lda, const double* tau, double* c,
|
||||
const fortran_int_t ldc, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORMLQ( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ormlq.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ormlq_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 Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
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<
|
||||
MatrixC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size(tau) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( side, bindings::size_row(c),
|
||||
bindings::size_column(c) ));
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size(tau)) );
|
||||
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(c)) );
|
||||
return detail::ormlq( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( side,
|
||||
bindings::size_row(c), bindings::size_column(c) ) );
|
||||
return invoke( side, a, 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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
real_type opt_size_work;
|
||||
detail::ormlq( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( side, a, tau, c, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ormlq_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ormlq. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ormlq( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c, Workspace work ) {
|
||||
return ormlq_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ormlq. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
ormlq( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c ) {
|
||||
return ormlq_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
239
sdk/boost/numeric/bindings/lapack/computational/ormql.hpp
Normal file
239
sdk/boost/numeric/bindings/lapack/computational/ormql.hpp
Normal file
@@ -0,0 +1,239 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORMQL_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORMQL_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_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/traits/detail/utils.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for ormql 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 ormql( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, float* a,
|
||||
const fortran_int_t lda, const float* tau, float* c,
|
||||
const fortran_int_t ldc, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORMQL( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
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 ormql( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, double* a,
|
||||
const fortran_int_t lda, const double* tau, double* c,
|
||||
const fortran_int_t ldc, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORMQL( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ormql.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ormql_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 Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const Side side, MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
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<
|
||||
MatrixC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size(tau) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( side, bindings::size_row(c),
|
||||
bindings::size_column(c) ));
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(c)) );
|
||||
return detail::ormql( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( side,
|
||||
bindings::size_row(c), bindings::size_column(c) ) );
|
||||
return invoke( side, a, 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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
real_type opt_size_work;
|
||||
detail::ormql( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( side, a, tau, c, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ormql_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ormql. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ormql( const Side side, MatrixA& a, const VectorTAU& tau, MatrixC& c,
|
||||
Workspace work ) {
|
||||
return ormql_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ormql. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
ormql( const Side side, MatrixA& a, const VectorTAU& tau, MatrixC& c ) {
|
||||
return ormql_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
239
sdk/boost/numeric/bindings/lapack/computational/ormqr.hpp
Normal file
239
sdk/boost/numeric/bindings/lapack/computational/ormqr.hpp
Normal file
@@ -0,0 +1,239 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORMQR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORMQR_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_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/traits/detail/utils.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for ormqr 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 ormqr( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, const float* a,
|
||||
const fortran_int_t lda, const float* tau, float* c,
|
||||
const fortran_int_t ldc, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORMQR( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
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 ormqr( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, const double* a,
|
||||
const fortran_int_t lda, const double* tau, double* c,
|
||||
const fortran_int_t ldc, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORMQR( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ormqr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ormqr_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 Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
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<
|
||||
MatrixC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size(tau) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( side, bindings::size_row(c),
|
||||
bindings::size_column(c) ));
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(c)) );
|
||||
return detail::ormqr( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( side,
|
||||
bindings::size_row(c), bindings::size_column(c) ) );
|
||||
return invoke( side, a, 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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
real_type opt_size_work;
|
||||
detail::ormqr( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( side, a, tau, c, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ormqr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ormqr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ormqr( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c, Workspace work ) {
|
||||
return ormqr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ormqr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
ormqr( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c ) {
|
||||
return ormqr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
241
sdk/boost/numeric/bindings/lapack/computational/ormrq.hpp
Normal file
241
sdk/boost/numeric/bindings/lapack/computational/ormrq.hpp
Normal file
@@ -0,0 +1,241 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORMRQ_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORMRQ_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_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/traits/detail/utils.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for ormrq 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 ormrq( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, const float* a,
|
||||
const fortran_int_t lda, const float* tau, float* c,
|
||||
const fortran_int_t ldc, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORMRQ( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
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 ormrq( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, const double* a,
|
||||
const fortran_int_t lda, const double* tau, double* c,
|
||||
const fortran_int_t ldc, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORMRQ( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ormrq.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ormrq_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 Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
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<
|
||||
MatrixC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size(tau) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( side, bindings::size_row(c),
|
||||
bindings::size_column(c) ));
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size(tau)) );
|
||||
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(c)) );
|
||||
return detail::ormrq( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( side,
|
||||
bindings::size_row(c), bindings::size_column(c) ) );
|
||||
return invoke( side, a, 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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
real_type opt_size_work;
|
||||
detail::ormrq( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( side, a, tau, c, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ormrq_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ormrq. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ormrq( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c, Workspace work ) {
|
||||
return ormrq_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ormrq. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
ormrq( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c ) {
|
||||
return ormrq_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
244
sdk/boost/numeric/bindings/lapack/computational/ormrz.hpp
Normal file
244
sdk/boost/numeric/bindings/lapack/computational/ormrz.hpp
Normal 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_COMPUTATIONAL_ORMRZ_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORMRZ_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_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/traits/detail/utils.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for ormrz 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 ormrz( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, const fortran_int_t l,
|
||||
const float* a, const fortran_int_t lda, const float* tau, float* c,
|
||||
const fortran_int_t ldc, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORMRZ( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, &l, a, &lda, tau, c, &ldc, work,
|
||||
&lwork, &info );
|
||||
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 ormrz( const Side, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t k, const fortran_int_t l,
|
||||
const double* a, const fortran_int_t lda, const double* tau,
|
||||
double* c, const fortran_int_t ldc, double* work,
|
||||
const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORMRZ( &lapack_option< Side >::value, &lapack_option<
|
||||
Trans >::value, &m, &n, &k, &l, a, &lda, tau, c, &ldc, work,
|
||||
&lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ormrz.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ormrz_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 Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
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<
|
||||
MatrixC >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size(tau) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( side, bindings::size_row(c),
|
||||
bindings::size_column(c) ));
|
||||
BOOST_ASSERT( bindings::size_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size(tau)) );
|
||||
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(c)) );
|
||||
return detail::ormrz( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::size_column_op(a, trans()),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( side,
|
||||
bindings::size_row(c), bindings::size_column(c) ) );
|
||||
return invoke( side, a, 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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
real_type opt_size_work;
|
||||
detail::ormrz( side, trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::size(tau),
|
||||
bindings::size_column_op(a, trans()),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(tau), bindings::begin_value(c),
|
||||
bindings::stride_major(c), &opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( side, a, tau, c, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ormrz_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ormrz. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ormrz( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c, Workspace work ) {
|
||||
return ormrz_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ormrz. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
ormrz( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c ) {
|
||||
return ormrz_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
241
sdk/boost/numeric/bindings/lapack/computational/ormtr.hpp
Normal file
241
sdk/boost/numeric/bindings/lapack/computational/ormtr.hpp
Normal file
@@ -0,0 +1,241 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_ORMTR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_ORMTR_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_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/traits/detail/utils.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for ormtr 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 UpLo, typename Trans >
|
||||
inline std::ptrdiff_t ormtr( const Side, const UpLo, const Trans,
|
||||
const fortran_int_t m, const fortran_int_t n, const float* a,
|
||||
const fortran_int_t lda, const float* tau, float* c,
|
||||
const fortran_int_t ldc, float* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SORMTR( &lapack_option< Side >::value, &lapack_option<
|
||||
UpLo >::value, &lapack_option< Trans >::value, &m, &n, a, &lda,
|
||||
tau, c, &ldc, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Side, typename UpLo, typename Trans >
|
||||
inline std::ptrdiff_t ormtr( const Side, const UpLo, const Trans,
|
||||
const fortran_int_t m, const fortran_int_t n, const double* a,
|
||||
const fortran_int_t lda, const double* tau, double* c,
|
||||
const fortran_int_t ldc, double* work, const fortran_int_t lwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DORMTR( &lapack_option< Side >::value, &lapack_option<
|
||||
UpLo >::value, &lapack_option< Trans >::value, &m, &n, a, &lda,
|
||||
tau, c, &ldc, work, &lwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ormtr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ormtr_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 Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename WORK >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
|
||||
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<
|
||||
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_column(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
|
||||
bindings::stride_minor(c) == 1 );
|
||||
BOOST_ASSERT( bindings::size_row(c) >= 0 );
|
||||
BOOST_ASSERT( bindings::stride_major(c) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_row(c)) );
|
||||
return detail::ormtr( side, uplo(), trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(c), bindings::stride_major(c),
|
||||
bindings::begin_value(work.select(real_type())),
|
||||
bindings::size(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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work( side,
|
||||
bindings::size_row(c), bindings::size_column(c) ) );
|
||||
return invoke( side, a, 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 MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
static std::ptrdiff_t invoke( const Side side, const MatrixA& a,
|
||||
const VectorTAU& tau, MatrixC& c, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixC >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
|
||||
real_type opt_size_work;
|
||||
detail::ormtr( side, uplo(), trans(), bindings::size_row(c),
|
||||
bindings::size_column(c), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(tau),
|
||||
bindings::begin_value(c), bindings::stride_major(c),
|
||||
&opt_size_work, -1 );
|
||||
bindings::detail::array< real_type > tmp_work(
|
||||
traits::detail::to_int( opt_size_work ) );
|
||||
return invoke( side, a, tau, c, workspace( tmp_work ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ormtr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ormtr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ormtr( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c, Workspace work ) {
|
||||
return ormtr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ormtr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename Side, typename MatrixA, typename VectorTAU,
|
||||
typename MatrixC >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixC >,
|
||||
std::ptrdiff_t >::type
|
||||
ormtr( const Side side, const MatrixA& a, const VectorTAU& tau,
|
||||
MatrixC& c ) {
|
||||
return ormtr_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( side, a, tau, c, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
347
sdk/boost/numeric/bindings/lapack/computational/pbcon.hpp
Normal file
347
sdk/boost/numeric/bindings/lapack/computational/pbcon.hpp
Normal file
@@ -0,0 +1,347 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PBCON_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBCON_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_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 pbcon 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 pbcon( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const float* ab, const fortran_int_t ldab,
|
||||
const float anorm, float& rcond, float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPBCON( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &anorm,
|
||||
&rcond, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pbcon( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const double* ab, const fortran_int_t ldab,
|
||||
const double anorm, double& rcond, double* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPBCON( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &anorm,
|
||||
&rcond, work, iwork, &info );
|
||||
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 pbcon( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const std::complex<float>* ab,
|
||||
const fortran_int_t ldab, const float anorm, float& rcond,
|
||||
std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPBCON( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &anorm,
|
||||
&rcond, work, rwork, &info );
|
||||
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 pbcon( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const std::complex<double>* ab,
|
||||
const fortran_int_t ldab, const double anorm, double& rcond,
|
||||
std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPBCON( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &anorm,
|
||||
&rcond, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pbcon.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct pbcon_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pbcon_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 MatrixAB, typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const real_type anorm,
|
||||
real_type& rcond, detail::workspace2< WORK, IWORK > 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(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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(ab,
|
||||
uplo())+1 );
|
||||
return detail::pbcon( uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), anorm, rcond,
|
||||
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 MatrixAB >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const real_type anorm,
|
||||
real_type& rcond, 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(
|
||||
bindings::size_column(ab) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(ab) ) );
|
||||
return invoke( ab, anorm, rcond, 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 MatrixAB >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const real_type anorm,
|
||||
real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( ab, anorm, rcond, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pbcon_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 MatrixAB, typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const real_type anorm,
|
||||
real_type& rcond, detail::workspace2< WORK, RWORK > 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_upper(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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_upper(ab)+1 );
|
||||
return detail::pbcon( uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth_upper(ab), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), anorm, rcond,
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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 MatrixAB& ab, const real_type anorm,
|
||||
real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ab) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(ab) ) );
|
||||
return invoke( ab, anorm, rcond, workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 MatrixAB& ab, const real_type anorm,
|
||||
real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( ab, anorm, rcond, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 pbcon_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pbcon. 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
|
||||
pbcon( const MatrixAB& ab, const typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAB >::type >::type anorm,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAB >::type >::type& rcond, Workspace work ) {
|
||||
return pbcon_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, anorm, rcond, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for pbcon. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAB >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixAB >,
|
||||
std::ptrdiff_t >::type
|
||||
pbcon( const MatrixAB& ab, const typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAB >::type >::type anorm,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAB >::type >::type& rcond ) {
|
||||
return pbcon_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, anorm, rcond,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
221
sdk/boost/numeric/bindings/lapack/computational/pbequ.hpp
Normal file
221
sdk/boost/numeric/bindings/lapack/computational/pbequ.hpp
Normal file
@@ -0,0 +1,221 @@
|
||||
//
|
||||
// Copyright (c) 2002--2010
|
||||
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
|
||||
// Thomas Klimpel and Rutger ter Borg
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED
|
||||
// PLEASE DO NOT EDIT!
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBEQU_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBEQU_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.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 pbequ 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 pbequ( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const float* ab, const fortran_int_t ldab,
|
||||
float* s, float& scond, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPBEQU( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, s,
|
||||
&scond, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pbequ( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const double* ab, const fortran_int_t ldab,
|
||||
double* s, double& scond, double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPBEQU( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, s,
|
||||
&scond, &amax, &info );
|
||||
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 pbequ( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const std::complex<float>* ab,
|
||||
const fortran_int_t ldab, float* s, float& scond, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPBEQU( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, s,
|
||||
&scond, &amax, &info );
|
||||
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 pbequ( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const std::complex<double>* ab,
|
||||
const fortran_int_t ldab, double* s, double& scond, double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPBEQU( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, s,
|
||||
&scond, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pbequ.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct pbequ_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pbequ_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 MatrixAB, typename VectorS >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, VectorS& s,
|
||||
real_type& scond, real_type& amax ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorS >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorS >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
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(ab,
|
||||
uplo())+1 );
|
||||
return detail::pbequ( uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(s), scond,
|
||||
amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pbequ_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 MatrixAB, typename VectorS >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, VectorS& s,
|
||||
real_type& scond, real_type& amax ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorS >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
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(ab,
|
||||
uplo())+1 );
|
||||
return detail::pbequ( uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(s), scond,
|
||||
amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 pbequ_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pbequ. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAB, typename VectorS >
|
||||
inline std::ptrdiff_t pbequ( const MatrixAB& ab, VectorS& s,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAB >::type >::type& scond, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAB >::type >::type& amax ) {
|
||||
return pbequ_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, s, scond, amax );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
457
sdk/boost/numeric/bindings/lapack/computational/pbrfs.hpp
Normal file
457
sdk/boost/numeric/bindings/lapack/computational/pbrfs.hpp
Normal file
@@ -0,0 +1,457 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PBRFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBRFS_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_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 pbrfs 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 pbrfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const fortran_int_t nrhs, const float* ab,
|
||||
const fortran_int_t ldab, const float* afb, const fortran_int_t ldafb,
|
||||
const float* b, const fortran_int_t ldb, float* x,
|
||||
const fortran_int_t ldx, float* ferr, float* berr, float* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPBRFS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
|
||||
afb, &ldafb, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pbrfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const fortran_int_t nrhs, const double* ab,
|
||||
const fortran_int_t ldab, const double* afb,
|
||||
const fortran_int_t ldafb, const double* b, const fortran_int_t ldb,
|
||||
double* x, const fortran_int_t ldx, double* ferr, double* berr,
|
||||
double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPBRFS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
|
||||
afb, &ldafb, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
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 pbrfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const fortran_int_t nrhs,
|
||||
const std::complex<float>* ab, const fortran_int_t ldab,
|
||||
const std::complex<float>* afb, const fortran_int_t ldafb,
|
||||
const std::complex<float>* b, const fortran_int_t ldb,
|
||||
std::complex<float>* x, const fortran_int_t ldx, float* ferr,
|
||||
float* berr, std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPBRFS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
|
||||
afb, &ldafb, b, &ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
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 pbrfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const fortran_int_t nrhs,
|
||||
const std::complex<double>* ab, const fortran_int_t ldab,
|
||||
const std::complex<double>* afb, const fortran_int_t ldafb,
|
||||
const std::complex<double>* b, const fortran_int_t ldb,
|
||||
std::complex<double>* x, const fortran_int_t ldx, double* ferr,
|
||||
double* berr, std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPBRFS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
|
||||
afb, &ldafb, b, &ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pbrfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct pbrfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pbrfs_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 MatrixAB, typename MatrixAFB, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
detail::workspace2< WORK, IWORK > 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_STATIC_ASSERT( (bindings::is_column_major< MatrixAFB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::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< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorFERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(afb) == 1 ||
|
||||
bindings::stride_minor(afb) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(afb) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ab)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ab)) );
|
||||
return detail::pbrfs( uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::size_column(b),
|
||||
bindings::begin_value(ab), bindings::stride_major(ab),
|
||||
bindings::begin_value(afb), bindings::stride_major(afb),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
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 MatrixAB, typename MatrixAFB, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
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(
|
||||
bindings::size_column(ab) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(ab) ) );
|
||||
return invoke( ab, afb, b, x, ferr, berr, 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 MatrixAB, typename MatrixAFB, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( ab, afb, b, x, ferr, berr, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pbrfs_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 MatrixAB, typename MatrixAFB, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
detail::workspace2< WORK, RWORK > 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_STATIC_ASSERT( (bindings::is_column_major< MatrixAFB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorFERR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(ab) ));
|
||||
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(afb) == 1 ||
|
||||
bindings::stride_minor(afb) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(afb) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ab)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ab)) );
|
||||
return detail::pbrfs( uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::size_column(b),
|
||||
bindings::begin_value(ab), bindings::stride_major(ab),
|
||||
bindings::begin_value(afb), bindings::stride_major(afb),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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, typename MatrixAFB, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ab) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(ab) ) );
|
||||
return invoke( ab, afb, b, x, ferr, berr, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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, typename MatrixAFB, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, const MatrixAFB& afb,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( ab, afb, b, x, ferr, berr, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 pbrfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pbrfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAB, typename MatrixAFB, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
pbrfs( const MatrixAB& ab, const MatrixAFB& afb, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr, Workspace work ) {
|
||||
return pbrfs_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, afb, b, x, ferr, berr, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for pbrfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAB, typename MatrixAFB, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
pbrfs( const MatrixAB& ab, const MatrixAFB& afb, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return pbrfs_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, afb, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
162
sdk/boost/numeric/bindings/lapack/computational/pbstf.hpp
Normal file
162
sdk/boost/numeric/bindings/lapack/computational/pbstf.hpp
Normal file
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PBSTF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBSTF_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.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/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 pbstf 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 pbstf( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, float* ab, const fortran_int_t ldab ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPBSTF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pbstf( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, double* ab, const fortran_int_t ldab ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPBSTF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
|
||||
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 pbstf( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, std::complex<float>* ab,
|
||||
const fortran_int_t ldab ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPBSTF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
|
||||
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 pbstf( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, std::complex<double>* ab,
|
||||
const fortran_int_t ldab ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPBSTF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pbstf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pbstf_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 MatrixAB >
|
||||
static std::ptrdiff_t invoke( MatrixAB& ab ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
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(ab,
|
||||
uplo())+1 );
|
||||
return detail::pbstf( uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 pbstf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pbstf. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAB >
|
||||
inline std::ptrdiff_t pbstf( MatrixAB& ab ) {
|
||||
return pbstf_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
162
sdk/boost/numeric/bindings/lapack/computational/pbtrf.hpp
Normal file
162
sdk/boost/numeric/bindings/lapack/computational/pbtrf.hpp
Normal file
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PBTRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBTRF_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.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/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 pbtrf 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 pbtrf( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, float* ab, const fortran_int_t ldab ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPBTRF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pbtrf( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, double* ab, const fortran_int_t ldab ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPBTRF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
|
||||
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 pbtrf( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, std::complex<float>* ab,
|
||||
const fortran_int_t ldab ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPBTRF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
|
||||
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 pbtrf( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, std::complex<double>* ab,
|
||||
const fortran_int_t ldab ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPBTRF( &lapack_option< UpLo >::value, &n, &kd, ab, &ldab, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pbtrf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pbtrf_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 MatrixAB >
|
||||
static std::ptrdiff_t invoke( MatrixAB& ab ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
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(ab,
|
||||
uplo())+1 );
|
||||
return detail::pbtrf( uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 pbtrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pbtrf. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAB >
|
||||
inline std::ptrdiff_t pbtrf( MatrixAB& ab ) {
|
||||
return pbtrf_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
181
sdk/boost/numeric/bindings/lapack/computational/pbtrs.hpp
Normal file
181
sdk/boost/numeric/bindings/lapack/computational/pbtrs.hpp
Normal file
@@ -0,0 +1,181 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PBTRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PBTRS_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.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/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 pbtrs 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 pbtrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const fortran_int_t nrhs, const float* ab,
|
||||
const fortran_int_t ldab, float* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPBTRS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
|
||||
b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pbtrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const fortran_int_t nrhs, const double* ab,
|
||||
const fortran_int_t ldab, double* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPBTRS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
|
||||
b, &ldb, &info );
|
||||
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 pbtrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const fortran_int_t nrhs,
|
||||
const std::complex<float>* ab, const fortran_int_t ldab,
|
||||
std::complex<float>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPBTRS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
|
||||
b, &ldb, &info );
|
||||
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 pbtrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t kd, const fortran_int_t nrhs,
|
||||
const std::complex<double>* ab, const fortran_int_t ldab,
|
||||
std::complex<double>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPBTRS( &lapack_option< UpLo >::value, &n, &kd, &nrhs, ab, &ldab,
|
||||
b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pbtrs.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pbtrs_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 MatrixAB, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const MatrixAB& ab, MatrixB& b ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
|
||||
bindings::stride_minor(ab) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ab)) );
|
||||
return detail::pbtrs( uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::size_column(b),
|
||||
bindings::begin_value(ab), bindings::stride_major(ab),
|
||||
bindings::begin_value(b), bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the pbtrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pbtrs. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAB, typename MatrixB >
|
||||
inline std::ptrdiff_t pbtrs( const MatrixAB& ab, MatrixB& b ) {
|
||||
return pbtrs_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( ab, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
154
sdk/boost/numeric/bindings/lapack/computational/pftrf.hpp
Normal file
154
sdk/boost/numeric/bindings/lapack/computational/pftrf.hpp
Normal file
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PFTRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PFTRF_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/is_mutable.hpp>
|
||||
#include <boost/numeric/bindings/remove_imaginary.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for pftrf 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 TransR >
|
||||
inline std::ptrdiff_t pftrf( const TransR, const char uplo,
|
||||
const fortran_int_t n, float* a ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPFTRF( &lapack_option< TransR >::value, &uplo, &n, a, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename TransR >
|
||||
inline std::ptrdiff_t pftrf( const TransR, const char uplo,
|
||||
const fortran_int_t n, double* a ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPFTRF( &lapack_option< TransR >::value, &uplo, &n, a, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename TransR >
|
||||
inline std::ptrdiff_t pftrf( const TransR, const char uplo,
|
||||
const fortran_int_t n, std::complex<float>* a ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPFTRF( &lapack_option< TransR >::value, &uplo, &n, a, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename TransR >
|
||||
inline std::ptrdiff_t pftrf( const TransR, const char uplo,
|
||||
const fortran_int_t n, std::complex<double>* a ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPFTRF( &lapack_option< TransR >::value, &uplo, &n, a, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pftrf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pftrf_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 MatrixA >
|
||||
static std::ptrdiff_t invoke( const char uplo, MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename blas::detail::default_order< MatrixA >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type transr;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_column_op(a, transr()) >= 0 );
|
||||
return detail::pftrf( transr(), uplo, bindings::size_column_op(a,
|
||||
transr()), bindings::begin_value(a) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 pftrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pftrf. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA >
|
||||
inline std::ptrdiff_t pftrf( const char uplo, MatrixA& a ) {
|
||||
return pftrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( uplo, a );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
159
sdk/boost/numeric/bindings/lapack/computational/pftri.hpp
Normal file
159
sdk/boost/numeric/bindings/lapack/computational/pftri.hpp
Normal file
@@ -0,0 +1,159 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PFTRI_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PFTRI_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/is_mutable.hpp>
|
||||
#include <boost/numeric/bindings/remove_imaginary.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for pftri 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 TransR, typename UpLo >
|
||||
inline std::ptrdiff_t pftri( const TransR, const UpLo, const fortran_int_t n,
|
||||
float* a ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPFTRI( &lapack_option< TransR >::value, &lapack_option<
|
||||
UpLo >::value, &n, a, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename TransR, typename UpLo >
|
||||
inline std::ptrdiff_t pftri( const TransR, const UpLo, const fortran_int_t n,
|
||||
double* a ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPFTRI( &lapack_option< TransR >::value, &lapack_option<
|
||||
UpLo >::value, &n, a, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename TransR, typename UpLo >
|
||||
inline std::ptrdiff_t pftri( const TransR, const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* a ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPFTRI( &lapack_option< TransR >::value, &lapack_option<
|
||||
UpLo >::value, &n, a, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename TransR, typename UpLo >
|
||||
inline std::ptrdiff_t pftri( const TransR, const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* a ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPFTRI( &lapack_option< TransR >::value, &lapack_option<
|
||||
UpLo >::value, &n, a, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pftri.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pftri_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 MatrixA >
|
||||
static std::ptrdiff_t invoke( MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename blas::detail::default_order< MatrixA >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type transr;
|
||||
typedef typename result_of::uplo_tag< MatrixA, transr >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_column_op(a, transr()) >= 0 );
|
||||
return detail::pftri( transr(), uplo(), bindings::size_column_op(a,
|
||||
transr()), bindings::begin_value(a) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 pftri_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pftri. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA >
|
||||
inline std::ptrdiff_t pftri( MatrixA& a ) {
|
||||
return pftri_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
173
sdk/boost/numeric/bindings/lapack/computational/pftrs.hpp
Normal file
173
sdk/boost/numeric/bindings/lapack/computational/pftrs.hpp
Normal file
@@ -0,0 +1,173 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PFTRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PFTRS_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/is_mutable.hpp>
|
||||
#include <boost/numeric/bindings/remove_imaginary.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
#include <boost/numeric/bindings/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for pftrs 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 TransR, typename UpLo >
|
||||
inline std::ptrdiff_t pftrs( const TransR, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* a, float* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPFTRS( &lapack_option< TransR >::value, &lapack_option<
|
||||
UpLo >::value, &n, &nrhs, a, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename TransR, typename UpLo >
|
||||
inline std::ptrdiff_t pftrs( const TransR, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* a, double* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPFTRS( &lapack_option< TransR >::value, &lapack_option<
|
||||
UpLo >::value, &n, &nrhs, a, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename TransR, typename UpLo >
|
||||
inline std::ptrdiff_t pftrs( const TransR, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* a,
|
||||
std::complex<float>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPFTRS( &lapack_option< TransR >::value, &lapack_option<
|
||||
UpLo >::value, &n, &nrhs, a, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename TransR, typename UpLo >
|
||||
inline std::ptrdiff_t pftrs( const TransR, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* a,
|
||||
std::complex<double>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPFTRS( &lapack_option< TransR >::value, &lapack_option<
|
||||
UpLo >::value, &n, &nrhs, a, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pftrs.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pftrs_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 MatrixA, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, MatrixB& b ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixB >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type transr;
|
||||
typedef typename result_of::uplo_tag< MatrixA, transr >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column_op(a, transr()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column_op(a, transr())) );
|
||||
return detail::pftrs( transr(), uplo(), bindings::size_column_op(a,
|
||||
transr()), bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::begin_value(b), bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the pftrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pftrs. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename MatrixB >
|
||||
inline std::ptrdiff_t pftrs( const MatrixA& a, MatrixB& b ) {
|
||||
return pftrs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
340
sdk/boost/numeric/bindings/lapack/computational/pocon.hpp
Normal file
340
sdk/boost/numeric/bindings/lapack/computational/pocon.hpp
Normal file
@@ -0,0 +1,340 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_POCON_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_POCON_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 pocon 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 pocon( const UpLo, const fortran_int_t n, const float* a,
|
||||
const fortran_int_t lda, const float anorm, float& rcond, float* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPOCON( &lapack_option< UpLo >::value, &n, a, &lda, &anorm, &rcond,
|
||||
work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pocon( const UpLo, const fortran_int_t n,
|
||||
const double* a, const fortran_int_t lda, const double anorm,
|
||||
double& rcond, double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPOCON( &lapack_option< UpLo >::value, &n, a, &lda, &anorm, &rcond,
|
||||
work, iwork, &info );
|
||||
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 pocon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<float>* a, const fortran_int_t lda,
|
||||
const float anorm, float& rcond, std::complex<float>* work,
|
||||
float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPOCON( &lapack_option< UpLo >::value, &n, a, &lda, &anorm, &rcond,
|
||||
work, rwork, &info );
|
||||
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 pocon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<double>* a, const fortran_int_t lda,
|
||||
const double anorm, double& rcond, std::complex<double>* work,
|
||||
double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPOCON( &lapack_option< UpLo >::value, &n, a, &lda, &anorm, &rcond,
|
||||
work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pocon.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct pocon_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pocon_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 WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const real_type anorm,
|
||||
real_type& rcond, detail::workspace2< WORK, IWORK > 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(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::pocon( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a), anorm,
|
||||
rcond, 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 MatrixA >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const real_type anorm,
|
||||
real_type& rcond, 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(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(a) ) );
|
||||
return invoke( a, anorm, rcond, 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 MatrixA >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const real_type anorm,
|
||||
real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, anorm, rcond, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pocon_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 WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const real_type anorm,
|
||||
real_type& rcond, detail::workspace2< WORK, RWORK > 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_rwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::pocon( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a), anorm,
|
||||
rcond, bindings::begin_value(work.select(value_type())),
|
||||
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 MatrixA& a, const real_type anorm,
|
||||
real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, anorm, rcond, workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 MatrixA& a, const real_type anorm,
|
||||
real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, anorm, rcond, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 pocon_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pocon. 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
|
||||
pocon( const MatrixA& a, const typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type anorm,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type& rcond, Workspace work ) {
|
||||
return pocon_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, anorm, rcond, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for pocon. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixA >,
|
||||
std::ptrdiff_t >::type
|
||||
pocon( const MatrixA& a, const typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type anorm,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type& rcond ) {
|
||||
return pocon_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, anorm, rcond, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
203
sdk/boost/numeric/bindings/lapack/computational/poequ.hpp
Normal file
203
sdk/boost/numeric/bindings/lapack/computational/poequ.hpp
Normal 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_COMPUTATIONAL_POEQU_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_POEQU_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 poequ 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 poequ( const fortran_int_t n, const float* a,
|
||||
const fortran_int_t lda, float* s, float& scond, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPOEQU( &n, a, &lda, s, &scond, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t poequ( const fortran_int_t n, const double* a,
|
||||
const fortran_int_t lda, double* s, double& scond, double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPOEQU( &n, a, &lda, s, &scond, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t poequ( const fortran_int_t n,
|
||||
const std::complex<float>* a, const fortran_int_t lda, float* s,
|
||||
float& scond, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPOEQU( &n, a, &lda, s, &scond, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t poequ( const fortran_int_t n,
|
||||
const std::complex<double>* a, const fortran_int_t lda, double* s,
|
||||
double& scond, double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPOEQU( &n, a, &lda, s, &scond, &amax, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to poequ.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct poequ_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct poequ_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 VectorS >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, VectorS& s,
|
||||
real_type& scond, real_type& amax ) {
|
||||
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<
|
||||
VectorS >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorS >::value) );
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::poequ( bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(s), scond, amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct poequ_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 VectorS >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, VectorS& s,
|
||||
real_type& scond, real_type& amax ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorS >::value) );
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::poequ( bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(s), scond, amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 poequ_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for poequ. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorS >
|
||||
inline std::ptrdiff_t poequ( const MatrixA& a, VectorS& s,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type& scond, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixA >::type >::type& amax ) {
|
||||
return poequ_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, s, scond, amax );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
452
sdk/boost/numeric/bindings/lapack/computational/porfs.hpp
Normal file
452
sdk/boost/numeric/bindings/lapack/computational/porfs.hpp
Normal file
@@ -0,0 +1,452 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PORFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PORFS_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 porfs 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 porfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* a, const fortran_int_t lda,
|
||||
const float* af, const fortran_int_t ldaf, const float* b,
|
||||
const fortran_int_t ldb, float* x, const fortran_int_t ldx,
|
||||
float* ferr, float* berr, float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPORFS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t porfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* a, const fortran_int_t lda,
|
||||
const double* af, const fortran_int_t ldaf, const double* b,
|
||||
const fortran_int_t ldb, double* x, const fortran_int_t ldx,
|
||||
double* ferr, double* berr, double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPORFS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
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 porfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* a,
|
||||
const fortran_int_t lda, const std::complex<float>* af,
|
||||
const fortran_int_t ldaf, const std::complex<float>* b,
|
||||
const fortran_int_t ldb, std::complex<float>* x,
|
||||
const fortran_int_t ldx, float* ferr, float* berr,
|
||||
std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPORFS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, b, &ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
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 porfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* a,
|
||||
const fortran_int_t lda, const std::complex<double>* af,
|
||||
const fortran_int_t ldaf, const std::complex<double>* b,
|
||||
const fortran_int_t ldb, std::complex<double>* x,
|
||||
const fortran_int_t ldx, double* ferr, double* berr,
|
||||
std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPORFS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, af,
|
||||
&ldaf, b, &ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to porfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct porfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct porfs_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 MatrixAF, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
detail::workspace2< WORK, IWORK > 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_STATIC_ASSERT( (bindings::is_column_major< MatrixAF >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAF >::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<
|
||||
MatrixB >::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<
|
||||
VectorFERR >::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<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(af) == 1 ||
|
||||
bindings::stride_minor(af) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(af) >= std::max<
|
||||
std::ptrdiff_t >(1,bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::porfs( uplo(), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(af),
|
||||
bindings::stride_major(af), bindings::begin_value(b),
|
||||
bindings::stride_major(b), bindings::begin_value(x),
|
||||
bindings::stride_major(x), bindings::begin_value(ferr),
|
||||
bindings::begin_value(berr),
|
||||
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 MatrixA, typename MatrixAF, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
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(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(a) ) );
|
||||
return invoke( a, af, b, x, ferr, berr, 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 MatrixA, typename MatrixAF, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, af, b, x, ferr, berr, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct porfs_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 MatrixAF, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
detail::workspace2< WORK, RWORK > 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_STATIC_ASSERT( (bindings::is_column_major< MatrixAF >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorFERR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::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<
|
||||
MatrixAF >::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<
|
||||
MatrixB >::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( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(a) ));
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(af) == 1 ||
|
||||
bindings::stride_minor(af) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(af) >= std::max<
|
||||
std::ptrdiff_t >(1,bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::porfs( uplo(), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(af),
|
||||
bindings::stride_major(af), bindings::begin_value(b),
|
||||
bindings::stride_major(b), bindings::begin_value(x),
|
||||
bindings::stride_major(x), bindings::begin_value(ferr),
|
||||
bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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 MatrixAF, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(a) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, af, b, x, ferr, berr, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 MatrixAF, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, const MatrixAF& af,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, af, b, x, ferr, berr, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 porfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for porfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename MatrixAF, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
porfs( const MatrixA& a, const MatrixAF& af, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr, Workspace work ) {
|
||||
return porfs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, af, b, x, ferr, berr, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for porfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename MatrixAF, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
porfs( const MatrixA& a, const MatrixAF& af, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return porfs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, af, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
220
sdk/boost/numeric/bindings/lapack/computational/potrf.hpp
Normal file
220
sdk/boost/numeric/bindings/lapack/computational/potrf.hpp
Normal file
@@ -0,0 +1,220 @@
|
||||
//
|
||||
// Copyright (c) 2002--2010
|
||||
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
|
||||
// Thomas Klimpel and Rutger ter Borg
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED
|
||||
// PLEASE DO NOT EDIT!
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_POTRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_POTRF_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/is_mutable.hpp>
|
||||
#include <boost/numeric/bindings/remove_imaginary.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for potrf is selected by defining a pre-processor
|
||||
// variable, which can be one of
|
||||
// * for ATLAS's CLAPACK, define BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
// * netlib-compatible LAPACK is the default
|
||||
//
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack_option.hpp>
|
||||
#else
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
|
||||
#endif
|
||||
|
||||
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 {
|
||||
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrf( Order, const UpLo, const int n, float* a,
|
||||
const int lda ) {
|
||||
return clapack_spotrf( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrf( Order, const UpLo, const int n, double* a,
|
||||
const int lda ) {
|
||||
return clapack_dpotrf( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrf( Order, const UpLo, const int n,
|
||||
std::complex<float>* a, const int lda ) {
|
||||
return clapack_cpotrf( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrf( Order, const UpLo, const int n,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
return clapack_zpotrf( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, a, lda );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrf( Order, const UpLo, const fortran_int_t n,
|
||||
float* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPOTRF( &lapack_option< UpLo >::value, &n, a, &lda, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrf( Order, const UpLo, const fortran_int_t n,
|
||||
double* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPOTRF( &lapack_option< UpLo >::value, &n, a, &lda, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrf( Order, const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPOTRF( &lapack_option< UpLo >::value, &n, a, &lda, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrf( Order, const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPOTRF( &lapack_option< UpLo >::value, &n, a, &lda, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to potrf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct potrf_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 MatrixA >
|
||||
static std::ptrdiff_t invoke( MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::potrf( order(), uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the potrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for potrf. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA >
|
||||
inline std::ptrdiff_t potrf( MatrixA& a ) {
|
||||
return potrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
220
sdk/boost/numeric/bindings/lapack/computational/potri.hpp
Normal file
220
sdk/boost/numeric/bindings/lapack/computational/potri.hpp
Normal file
@@ -0,0 +1,220 @@
|
||||
//
|
||||
// Copyright (c) 2002--2010
|
||||
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
|
||||
// Thomas Klimpel and Rutger ter Borg
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED
|
||||
// PLEASE DO NOT EDIT!
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_POTRI_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_POTRI_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/is_mutable.hpp>
|
||||
#include <boost/numeric/bindings/remove_imaginary.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
//
|
||||
// The LAPACK-backend for potri is selected by defining a pre-processor
|
||||
// variable, which can be one of
|
||||
// * for ATLAS's CLAPACK, define BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
// * netlib-compatible LAPACK is the default
|
||||
//
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack_option.hpp>
|
||||
#else
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
|
||||
#endif
|
||||
|
||||
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 {
|
||||
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potri( Order, const UpLo, const int n, float* a,
|
||||
const int lda ) {
|
||||
return clapack_spotri( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potri( Order, const UpLo, const int n, double* a,
|
||||
const int lda ) {
|
||||
return clapack_dpotri( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potri( Order, const UpLo, const int n,
|
||||
std::complex<float>* a, const int lda ) {
|
||||
return clapack_cpotri( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potri( Order, const UpLo, const int n,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
return clapack_zpotri( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, a, lda );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potri( Order, const UpLo, const fortran_int_t n,
|
||||
float* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPOTRI( &lapack_option< UpLo >::value, &n, a, &lda, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potri( Order, const UpLo, const fortran_int_t n,
|
||||
double* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPOTRI( &lapack_option< UpLo >::value, &n, a, &lda, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potri( Order, const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPOTRI( &lapack_option< UpLo >::value, &n, a, &lda, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potri( Order, const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPOTRI( &lapack_option< UpLo >::value, &n, a, &lda, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to potri.
|
||||
//
|
||||
template< typename Value >
|
||||
struct potri_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 MatrixA >
|
||||
static std::ptrdiff_t invoke( MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::potri( order(), uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the potri_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for potri. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA >
|
||||
inline std::ptrdiff_t potri( MatrixA& a ) {
|
||||
return potri_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
245
sdk/boost/numeric/bindings/lapack/computational/potrs.hpp
Normal file
245
sdk/boost/numeric/bindings/lapack/computational/potrs.hpp
Normal file
@@ -0,0 +1,245 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_POTRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_POTRS_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.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/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 potrs is selected by defining a pre-processor
|
||||
// variable, which can be one of
|
||||
// * for ATLAS's CLAPACK, define BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
// * netlib-compatible LAPACK is the default
|
||||
//
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/clapack_option.hpp>
|
||||
#else
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack.h>
|
||||
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
|
||||
#endif
|
||||
|
||||
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 {
|
||||
|
||||
#if defined BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrs( Order, const UpLo, const int n, const int nrhs,
|
||||
const float* a, const int lda, float* b, const int ldb ) {
|
||||
return clapack_spotrs( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, nrhs, a, lda, b, ldb );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrs( Order, const UpLo, const int n, const int nrhs,
|
||||
const double* a, const int lda, double* b, const int ldb ) {
|
||||
return clapack_dpotrs( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, nrhs, a, lda, b, ldb );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrs( Order, const UpLo, const int n, const int nrhs,
|
||||
const std::complex<float>* a, const int lda, std::complex<float>* b,
|
||||
const int ldb ) {
|
||||
return clapack_cpotrs( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, nrhs, a, lda, b, ldb );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * ATLAS's CLAPACK backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrs( Order, const UpLo, const int n, const int nrhs,
|
||||
const std::complex<double>* a, const int lda, std::complex<double>* b,
|
||||
const int ldb ) {
|
||||
return clapack_zpotrs( clapack_option< Order >::value, clapack_option<
|
||||
UpLo >::value, n, nrhs, a, lda, b, ldb );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrs( Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* a, const fortran_int_t lda,
|
||||
float* b, const fortran_int_t ldb ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPOTRS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, b, &ldb,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrs( Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* a, const fortran_int_t lda,
|
||||
double* b, const fortran_int_t ldb ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPOTRS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, b, &ldb,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrs( Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* a,
|
||||
const fortran_int_t lda, std::complex<float>* b,
|
||||
const fortran_int_t ldb ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPOTRS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, b, &ldb,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline std::ptrdiff_t potrs( Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* a,
|
||||
const fortran_int_t lda, std::complex<double>* b,
|
||||
const fortran_int_t ldb ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPOTRS( &lapack_option< UpLo >::value, &n, &nrhs, a, &lda, b, &ldb,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to potrs.
|
||||
//
|
||||
template< typename Value >
|
||||
struct potrs_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 MatrixA, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const MatrixA& a, MatrixB& b ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(a) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::potrs( order(), uplo(), bindings::size_column(a),
|
||||
bindings::size_column(b), bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(b),
|
||||
bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the potrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for potrs. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename MatrixB >
|
||||
inline std::ptrdiff_t potrs( const MatrixA& a, MatrixB& b ) {
|
||||
return potrs_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
328
sdk/boost/numeric/bindings/lapack/computational/ppcon.hpp
Normal file
328
sdk/boost/numeric/bindings/lapack/computational/ppcon.hpp
Normal file
@@ -0,0 +1,328 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PPCON_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PPCON_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/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 ppcon 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 ppcon( const UpLo, const fortran_int_t n,
|
||||
const float* ap, const float anorm, float& rcond, float* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPPCON( &lapack_option< UpLo >::value, &n, ap, &anorm, &rcond,
|
||||
work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t ppcon( const UpLo, const fortran_int_t n,
|
||||
const double* ap, const double anorm, double& rcond, double* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPPCON( &lapack_option< UpLo >::value, &n, ap, &anorm, &rcond,
|
||||
work, iwork, &info );
|
||||
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 ppcon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<float>* ap, const float anorm, float& rcond,
|
||||
std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPPCON( &lapack_option< UpLo >::value, &n, ap, &anorm, &rcond,
|
||||
work, rwork, &info );
|
||||
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 ppcon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<double>* ap, const double anorm, double& rcond,
|
||||
std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPPCON( &lapack_option< UpLo >::value, &n, ap, &anorm, &rcond,
|
||||
work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ppcon.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct ppcon_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ppcon_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 MatrixAP, typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const real_type anorm,
|
||||
real_type& rcond, detail::workspace2< WORK, IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::ppcon( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), anorm, rcond,
|
||||
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 MatrixAP >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const real_type anorm,
|
||||
real_type& rcond, 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(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(ap) ) );
|
||||
return invoke( ap, anorm, rcond, 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 MatrixAP >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const real_type anorm,
|
||||
real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, anorm, rcond, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ppcon_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 MatrixAP, typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const real_type anorm,
|
||||
real_type& rcond, detail::workspace2< WORK, RWORK > 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_rwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::ppcon( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), anorm, rcond,
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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 MatrixAP& ap, const real_type anorm,
|
||||
real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, anorm, rcond, workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 MatrixAP& ap, const real_type anorm,
|
||||
real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, anorm, rcond, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 ppcon_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ppcon. 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
|
||||
ppcon( const MatrixAP& ap, const typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAP >::type >::type anorm,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAP >::type >::type& rcond, Workspace work ) {
|
||||
return ppcon_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, anorm, rcond, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ppcon. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAP >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixAP >,
|
||||
std::ptrdiff_t >::type
|
||||
ppcon( const MatrixAP& ap, const typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAP >::type >::type anorm,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAP >::type >::type& rcond ) {
|
||||
return ppcon_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, anorm, rcond,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
202
sdk/boost/numeric/bindings/lapack/computational/ppequ.hpp
Normal file
202
sdk/boost/numeric/bindings/lapack/computational/ppequ.hpp
Normal file
@@ -0,0 +1,202 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PPEQU_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PPEQU_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/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 ppequ 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 ppequ( const UpLo, const fortran_int_t n,
|
||||
const float* ap, float* s, float& scond, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPPEQU( &lapack_option< UpLo >::value, &n, ap, s, &scond, &amax,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t ppequ( const UpLo, const fortran_int_t n,
|
||||
const double* ap, double* s, double& scond, double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPPEQU( &lapack_option< UpLo >::value, &n, ap, s, &scond, &amax,
|
||||
&info );
|
||||
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 ppequ( const UpLo, const fortran_int_t n,
|
||||
const std::complex<float>* ap, float* s, float& scond, float& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPPEQU( &lapack_option< UpLo >::value, &n, ap, s, &scond, &amax,
|
||||
&info );
|
||||
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 ppequ( const UpLo, const fortran_int_t n,
|
||||
const std::complex<double>* ap, double* s, double& scond,
|
||||
double& amax ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPPEQU( &lapack_option< UpLo >::value, &n, ap, s, &scond, &amax,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ppequ.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct ppequ_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ppequ_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 MatrixAP, typename VectorS >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, VectorS& s,
|
||||
real_type& scond, real_type& amax ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorS >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorS >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::ppequ( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(s), scond,
|
||||
amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ppequ_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 MatrixAP, typename VectorS >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, VectorS& s,
|
||||
real_type& scond, real_type& amax ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorS >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::ppequ( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(s), scond,
|
||||
amax );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 ppequ_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ppequ. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorS >
|
||||
inline std::ptrdiff_t ppequ( const MatrixAP& ap, VectorS& s,
|
||||
typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAP >::type >::type& scond, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAP >::type >::type& amax ) {
|
||||
return ppequ_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, s, scond, amax );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
428
sdk/boost/numeric/bindings/lapack/computational/pprfs.hpp
Normal file
428
sdk/boost/numeric/bindings/lapack/computational/pprfs.hpp
Normal file
@@ -0,0 +1,428 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PPRFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PPRFS_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 pprfs 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 pprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* ap, const float* afp,
|
||||
const float* b, const fortran_int_t ldb, float* x,
|
||||
const fortran_int_t ldx, float* ferr, float* berr, float* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, b, &ldb,
|
||||
x, &ldx, ferr, berr, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* ap, const double* afp,
|
||||
const double* b, const fortran_int_t ldb, double* x,
|
||||
const fortran_int_t ldx, double* ferr, double* berr, double* work,
|
||||
fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, b, &ldb,
|
||||
x, &ldx, ferr, berr, work, iwork, &info );
|
||||
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 pprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* ap,
|
||||
const std::complex<float>* afp, const std::complex<float>* b,
|
||||
const fortran_int_t ldb, std::complex<float>* x,
|
||||
const fortran_int_t ldx, float* ferr, float* berr,
|
||||
std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, b, &ldb,
|
||||
x, &ldx, ferr, berr, work, rwork, &info );
|
||||
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 pprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* ap,
|
||||
const std::complex<double>* afp, const std::complex<double>* b,
|
||||
const fortran_int_t ldb, std::complex<double>* x,
|
||||
const fortran_int_t ldx, double* ferr, double* berr,
|
||||
std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, b, &ldb,
|
||||
x, &ldx, ferr, berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pprfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct pprfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pprfs_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 MatrixAP, typename MatrixAFP, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
detail::workspace2< WORK, IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::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< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorFERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
return detail::pprfs( uplo(), bindings::size_column(ap),
|
||||
bindings::size_column(b), bindings::begin_value(ap),
|
||||
bindings::begin_value(afp), bindings::begin_value(b),
|
||||
bindings::stride_major(b), bindings::begin_value(x),
|
||||
bindings::stride_major(x), bindings::begin_value(ferr),
|
||||
bindings::begin_value(berr),
|
||||
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 MatrixAP, typename MatrixAFP, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
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(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(ap) ) );
|
||||
return invoke( ap, afp, b, x, ferr, berr, 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 MatrixAP, typename MatrixAFP, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, afp, b, x, ferr, berr, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pprfs_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 MatrixAP, typename MatrixAFP, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
detail::workspace2< WORK, RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorFERR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
return detail::pprfs( uplo(), bindings::size_column(ap),
|
||||
bindings::size_column(b), bindings::begin_value(ap),
|
||||
bindings::begin_value(afp), bindings::begin_value(b),
|
||||
bindings::stride_major(b), bindings::begin_value(x),
|
||||
bindings::stride_major(x), bindings::begin_value(ferr),
|
||||
bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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, typename MatrixAFP, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, afp, b, x, ferr, berr, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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, typename MatrixAFP, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, afp, b, x, ferr, berr, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 pprfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pprfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAP, typename MatrixAFP, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
pprfs( const MatrixAP& ap, const MatrixAFP& afp, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr, Workspace work ) {
|
||||
return pprfs_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, afp, b, x, ferr, berr, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for pprfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAP, typename MatrixAFP, typename MatrixB,
|
||||
typename MatrixX, typename VectorFERR, typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
pprfs( const MatrixAP& ap, const MatrixAFP& afp, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return pprfs_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, afp, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
149
sdk/boost/numeric/bindings/lapack/computational/pptrf.hpp
Normal file
149
sdk/boost/numeric/bindings/lapack/computational/pptrf.hpp
Normal 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_COMPUTATIONAL_PPTRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PPTRF_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/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 pptrf 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 pptrf( const UpLo, const fortran_int_t n, float* ap ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPPTRF( &lapack_option< UpLo >::value, &n, ap, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pptrf( const UpLo, const fortran_int_t n, double* ap ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPPTRF( &lapack_option< UpLo >::value, &n, ap, &info );
|
||||
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 pptrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* ap ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPPTRF( &lapack_option< UpLo >::value, &n, ap, &info );
|
||||
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 pptrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* ap ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPPTRF( &lapack_option< UpLo >::value, &n, ap, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pptrf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pptrf_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 MatrixAP >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::pptrf( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the pptrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pptrf. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP >
|
||||
inline std::ptrdiff_t pptrf( MatrixAP& ap ) {
|
||||
return pptrf_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
149
sdk/boost/numeric/bindings/lapack/computational/pptri.hpp
Normal file
149
sdk/boost/numeric/bindings/lapack/computational/pptri.hpp
Normal 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_COMPUTATIONAL_PPTRI_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PPTRI_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/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 pptri 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 pptri( const UpLo, const fortran_int_t n, float* ap ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPPTRI( &lapack_option< UpLo >::value, &n, ap, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pptri( const UpLo, const fortran_int_t n, double* ap ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPPTRI( &lapack_option< UpLo >::value, &n, ap, &info );
|
||||
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 pptri( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* ap ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPPTRI( &lapack_option< UpLo >::value, &n, ap, &info );
|
||||
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 pptri( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* ap ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPPTRI( &lapack_option< UpLo >::value, &n, ap, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pptri.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pptri_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 MatrixAP >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::pptri( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the pptri_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pptri. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP >
|
||||
inline std::ptrdiff_t pptri( MatrixAP& ap ) {
|
||||
return pptri_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
171
sdk/boost/numeric/bindings/lapack/computational/pptrs.hpp
Normal file
171
sdk/boost/numeric/bindings/lapack/computational/pptrs.hpp
Normal file
@@ -0,0 +1,171 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PPTRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PPTRS_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/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 pptrs 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 pptrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* ap, float* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPPTRS( &lapack_option< UpLo >::value, &n, &nrhs, ap, b, &ldb,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pptrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* ap, double* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPPTRS( &lapack_option< UpLo >::value, &n, &nrhs, ap, b, &ldb,
|
||||
&info );
|
||||
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 pptrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* ap,
|
||||
std::complex<float>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPPTRS( &lapack_option< UpLo >::value, &n, &nrhs, ap, b, &ldb,
|
||||
&info );
|
||||
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 pptrs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* ap,
|
||||
std::complex<double>* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPPTRS( &lapack_option< UpLo >::value, &n, &nrhs, ap, b, &ldb,
|
||||
&info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pptrs.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pptrs_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 MatrixAP, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, MatrixB& b ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
return detail::pptrs( uplo(), bindings::size_column(ap),
|
||||
bindings::size_column(b), bindings::begin_value(ap),
|
||||
bindings::begin_value(b), bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the pptrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pptrs. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename MatrixB >
|
||||
inline std::ptrdiff_t pptrs( const MatrixAP& ap, MatrixB& b ) {
|
||||
return pptrs_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
234
sdk/boost/numeric/bindings/lapack/computational/pstrf.hpp
Normal file
234
sdk/boost/numeric/bindings/lapack/computational/pstrf.hpp
Normal file
@@ -0,0 +1,234 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PSTRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PSTRF_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 pstrf 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 pstrf( const UpLo, const fortran_int_t n, float* a,
|
||||
const fortran_int_t lda, fortran_int_t* piv, fortran_int_t& rank,
|
||||
const float tol, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPSTRF( &lapack_option< UpLo >::value, &n, a, &lda, piv, &rank,
|
||||
&tol, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t pstrf( const UpLo, const fortran_int_t n, double* a,
|
||||
const fortran_int_t lda, fortran_int_t* piv, fortran_int_t& rank,
|
||||
const double tol, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPSTRF( &lapack_option< UpLo >::value, &n, a, &lda, piv, &rank,
|
||||
&tol, work, &info );
|
||||
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 pstrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* a, const fortran_int_t lda, fortran_int_t* piv,
|
||||
fortran_int_t& rank, const float tol, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPSTRF( &lapack_option< UpLo >::value, &n, a, &lda, piv, &rank,
|
||||
&tol, work, &info );
|
||||
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 pstrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* a, const fortran_int_t lda, fortran_int_t* piv,
|
||||
fortran_int_t& rank, const double tol, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPSTRF( &lapack_option< UpLo >::value, &n, a, &lda, piv, &rank,
|
||||
&tol, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pstrf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pstrf_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 VectorPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorPIV& piv,
|
||||
fortran_int_t& rank, const real_type tol, 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_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorPIV >::value) );
|
||||
BOOST_ASSERT( bindings::size(piv) >= bindings::size_column(a) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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 >(1,
|
||||
bindings::size_column(a)) );
|
||||
return detail::pstrf( uplo(), bindings::size_column(a),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(piv), rank, tol,
|
||||
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 VectorPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorPIV& piv,
|
||||
fortran_int_t& rank, const real_type tol, 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(
|
||||
bindings::size_column(a) ) );
|
||||
return invoke( a, piv, rank, tol, 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 VectorPIV >
|
||||
static std::ptrdiff_t invoke( MatrixA& a, VectorPIV& piv,
|
||||
fortran_int_t& rank, const real_type tol, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
return invoke( a, piv, rank, tol, 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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 pstrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pstrf. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixA, typename VectorPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
pstrf( MatrixA& a, VectorPIV& piv, fortran_int_t& rank,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type tol, Workspace work ) {
|
||||
return pstrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, piv, rank, tol, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for pstrf. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixA, typename VectorPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
pstrf( MatrixA& a, VectorPIV& piv, fortran_int_t& rank,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type tol ) {
|
||||
return pstrf_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, piv, rank, tol,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
296
sdk/boost/numeric/bindings/lapack/computational/ptcon.hpp
Normal file
296
sdk/boost/numeric/bindings/lapack/computational/ptcon.hpp
Normal 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_COMPUTATIONAL_PTCON_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PTCON_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 ptcon 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 ptcon( const fortran_int_t n, const float* d,
|
||||
const float* e, const float anorm, float& rcond, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPTCON( &n, d, e, &anorm, &rcond, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ptcon( const fortran_int_t n, const double* d,
|
||||
const double* e, const double anorm, double& rcond, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPTCON( &n, d, e, &anorm, &rcond, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ptcon( const fortran_int_t n, const float* d,
|
||||
const std::complex<float>* e, const float anorm, float& rcond,
|
||||
float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPTCON( &n, d, e, &anorm, &rcond, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ptcon( const fortran_int_t n, const double* d,
|
||||
const std::complex<double>* e, const double anorm, double& rcond,
|
||||
double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPTCON( &n, d, e, &anorm, &rcond, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ptcon.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct ptcon_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ptcon_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 WORK >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
const real_type anorm, real_type& rcond, detail::workspace1<
|
||||
WORK > 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_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(e) >= bindings::size(d)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size(d) ));
|
||||
return detail::ptcon( bindings::size(d), bindings::begin_value(d),
|
||||
bindings::begin_value(e), anorm, rcond,
|
||||
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 VectorD, typename VectorE >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
const real_type anorm, real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size(d) ) );
|
||||
return invoke( d, e, anorm, rcond, 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 VectorD, typename VectorE >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( d, e, anorm, rcond, 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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ptcon_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 RWORK >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
const real_type anorm, real_type& rcond, detail::workspace1<
|
||||
RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(e) >= bindings::size(d)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size(d) ));
|
||||
return detail::ptcon( bindings::size(d), bindings::begin_value(d),
|
||||
bindings::begin_value(e), anorm, rcond,
|
||||
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 VectorD, typename VectorE >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
const real_type anorm, real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size(d) ) );
|
||||
return invoke( d, e, anorm, rcond, workspace( tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( d, e, anorm, rcond, minimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 ptcon_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ptcon. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ptcon( const VectorD& d, const VectorE& e,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
VectorE >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< VectorE >::type >::type& rcond,
|
||||
Workspace work ) {
|
||||
return ptcon_impl< typename bindings::value_type<
|
||||
VectorE >::type >::invoke( d, e, anorm, rcond, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ptcon. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename VectorD, typename VectorE >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorE >,
|
||||
std::ptrdiff_t >::type
|
||||
ptcon( const VectorD& d, const VectorE& e,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
VectorE >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< VectorE >::type >::type& rcond ) {
|
||||
return ptcon_impl< typename bindings::value_type<
|
||||
VectorE >::type >::invoke( d, e, anorm, rcond,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
316
sdk/boost/numeric/bindings/lapack/computational/pteqr.hpp
Normal file
316
sdk/boost/numeric/bindings/lapack/computational/pteqr.hpp
Normal file
@@ -0,0 +1,316 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PTEQR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PTEQR_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 pteqr 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 pteqr( const char compz, const fortran_int_t n, float* d,
|
||||
float* e, float* z, const fortran_int_t ldz, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPTEQR( &compz, &n, d, e, z, &ldz, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t pteqr( const char compz, const fortran_int_t n,
|
||||
double* d, double* e, double* z, const fortran_int_t ldz,
|
||||
double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPTEQR( &compz, &n, d, e, z, &ldz, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t pteqr( const char compz, const fortran_int_t n, float* d,
|
||||
float* e, std::complex<float>* z, const fortran_int_t ldz,
|
||||
float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPTEQR( &compz, &n, d, e, z, &ldz, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t pteqr( const char compz, const fortran_int_t n,
|
||||
double* d, double* e, std::complex<double>* z,
|
||||
const fortran_int_t ldz, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPTEQR( &compz, &n, d, e, z, &ldz, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pteqr.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct pteqr_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pteqr_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 MatrixZ,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( const char compz, VectorD& d, VectorE& e,
|
||||
MatrixZ& z, detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixZ >::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<
|
||||
MatrixZ >::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< MatrixZ >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(e) >= bindings::size(d)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size(d) ));
|
||||
BOOST_ASSERT( bindings::size_minor(z) == 1 ||
|
||||
bindings::stride_minor(z) == 1 );
|
||||
BOOST_ASSERT( compz == 'N' || compz == 'V' || compz == 'I' );
|
||||
return detail::pteqr( compz, bindings::size(d),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(z), bindings::stride_major(z),
|
||||
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 VectorD, typename VectorE, typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char compz, VectorD& d, VectorE& e,
|
||||
MatrixZ& z, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size(d) ) );
|
||||
return invoke( compz, d, e, z, 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 VectorD, typename VectorE, typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char compz, VectorD& d, VectorE& e,
|
||||
MatrixZ& z, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( compz, d, e, z, 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 4*n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pteqr_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 MatrixZ,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( const char compz, VectorD& d, VectorE& e,
|
||||
MatrixZ& z, detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixZ >::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< MatrixZ >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(e) >= bindings::size(d)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size(d) ));
|
||||
BOOST_ASSERT( bindings::size_minor(z) == 1 ||
|
||||
bindings::stride_minor(z) == 1 );
|
||||
BOOST_ASSERT( compz == 'N' || compz == 'V' || compz == 'I' );
|
||||
return detail::pteqr( compz, bindings::size(d),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(z), bindings::stride_major(z),
|
||||
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 VectorD, typename VectorE, typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char compz, VectorD& d, VectorE& e,
|
||||
MatrixZ& z, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size(d) ) );
|
||||
return invoke( compz, d, e, z, 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 VectorD, typename VectorE, typename MatrixZ >
|
||||
static std::ptrdiff_t invoke( const char compz, VectorD& d, VectorE& e,
|
||||
MatrixZ& z, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( compz, d, e, z, 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 4*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 pteqr_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pteqr. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename MatrixZ,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
pteqr( const char compz, VectorD& d, VectorE& e, MatrixZ& z,
|
||||
Workspace work ) {
|
||||
return pteqr_impl< typename bindings::value_type<
|
||||
MatrixZ >::type >::invoke( compz, d, e, z, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for pteqr. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename MatrixZ >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixZ >,
|
||||
std::ptrdiff_t >::type
|
||||
pteqr( const char compz, VectorD& d, VectorE& e, MatrixZ& z ) {
|
||||
return pteqr_impl< typename bindings::value_type<
|
||||
MatrixZ >::type >::invoke( compz, d, e, z, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
478
sdk/boost/numeric/bindings/lapack/computational/ptrfs.hpp
Normal file
478
sdk/boost/numeric/bindings/lapack/computational/ptrfs.hpp
Normal file
@@ -0,0 +1,478 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PTRFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PTRFS_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 ptrfs 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 ptrfs( const fortran_int_t n, const fortran_int_t nrhs,
|
||||
const float* d, const float* e, const float* df, const float* ef,
|
||||
const float* b, const fortran_int_t ldb, float* x,
|
||||
const fortran_int_t ldx, float* ferr, float* berr, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPTRFS( &n, &nrhs, d, e, df, ef, b, &ldb, x, &ldx, ferr, berr,
|
||||
work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ptrfs( const fortran_int_t n, const fortran_int_t nrhs,
|
||||
const double* d, const double* e, const double* df, const double* ef,
|
||||
const double* b, const fortran_int_t ldb, double* x,
|
||||
const fortran_int_t ldx, double* ferr, double* berr, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPTRFS( &n, &nrhs, d, e, df, ef, b, &ldb, x, &ldx, ferr, berr,
|
||||
work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ptrfs( const char uplo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* d,
|
||||
const std::complex<float>* e, const float* df,
|
||||
const std::complex<float>* ef, const std::complex<float>* b,
|
||||
const fortran_int_t ldb, std::complex<float>* x,
|
||||
const fortran_int_t ldx, float* ferr, float* berr,
|
||||
std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPTRFS( &uplo, &n, &nrhs, d, e, df, ef, b, &ldb, x, &ldx, ferr,
|
||||
berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t ptrfs( const char uplo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* d,
|
||||
const std::complex<double>* e, const double* df,
|
||||
const std::complex<double>* ef, const std::complex<double>* b,
|
||||
const fortran_int_t ldb, std::complex<double>* x,
|
||||
const fortran_int_t ldx, double* ferr, double* berr,
|
||||
std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPTRFS( &uplo, &n, &nrhs, d, e, df, ef, b, &ldb, x, &ldx, ferr,
|
||||
berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ptrfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct ptrfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ptrfs_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 VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR, typename WORK >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
const VectorDF& df, const VectorEF& ef, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::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<
|
||||
VectorDF >::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<
|
||||
VectorEF >::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( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorD >::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< VectorD >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorFERR >::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<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(df) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(e) >= bindings::size(d)-1 );
|
||||
BOOST_ASSERT( bindings::size(ef) >= bindings::size(d)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size(d) ));
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size(d)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size(d)) );
|
||||
return detail::ptrfs( bindings::size(d), bindings::size_column(b),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(df), bindings::begin_value(ef),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
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 VectorD, typename VectorE, typename VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
const VectorDF& df, const VectorEF& ef, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< real_type > tmp_work( min_size_work(
|
||||
bindings::size(d) ) );
|
||||
return invoke( d, e, df, ef, b, x, ferr, berr, 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 VectorD, typename VectorE, typename VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
const VectorDF& df, const VectorEF& ef, const MatrixB& b,
|
||||
MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( d, e, df, ef, b, x, ferr, berr, 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;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ptrfs_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 VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR, typename WORK,
|
||||
typename RWORK >
|
||||
static std::ptrdiff_t invoke( const char uplo, const VectorD& d,
|
||||
const VectorE& e, const VectorDF& df, const VectorEF& ef,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
detail::workspace2< WORK, RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorD >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorDF >::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<
|
||||
VectorFERR >::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<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorE >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorEF >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorE >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorE >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(df) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(e) >= bindings::size(d)-1 );
|
||||
BOOST_ASSERT( bindings::size(ef) >= bindings::size(d)-1 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size(d) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size(d) ));
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size(d)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size(d)) );
|
||||
return detail::ptrfs( uplo, bindings::size(d),
|
||||
bindings::size_column(b), bindings::begin_value(d),
|
||||
bindings::begin_value(e), bindings::begin_value(df),
|
||||
bindings::begin_value(ef), bindings::begin_value(b),
|
||||
bindings::stride_major(b), bindings::begin_value(x),
|
||||
bindings::stride_major(x), bindings::begin_value(ferr),
|
||||
bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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 VectorD, typename VectorE, typename VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const char uplo, const VectorD& d,
|
||||
const VectorE& e, const VectorDF& df, const VectorEF& ef,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size(d) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size(d) ) );
|
||||
return invoke( uplo, d, e, df, ef, b, x, ferr, berr,
|
||||
workspace( tmp_work, tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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 VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const char uplo, const VectorD& d,
|
||||
const VectorE& e, const VectorDF& df, const VectorEF& ef,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
return invoke( uplo, d, e, df, ef, b, x, ferr, berr,
|
||||
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 n;
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that returns the minimum size of
|
||||
// workspace-array rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 ptrfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ptrfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ptrfs( const VectorD& d, const VectorE& e, const VectorDF& df,
|
||||
const VectorEF& ef, const MatrixB& b, MatrixX& x, VectorFERR& ferr,
|
||||
VectorBERR& berr, Workspace work ) {
|
||||
return ptrfs_impl< typename bindings::value_type<
|
||||
VectorE >::type >::invoke( d, e, df, ef, b, x, ferr, berr, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ptrfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
ptrfs( const VectorD& d, const VectorE& e, const VectorDF& df,
|
||||
const VectorEF& ef, const MatrixB& b, MatrixX& x, VectorFERR& ferr,
|
||||
VectorBERR& berr ) {
|
||||
return ptrfs_impl< typename bindings::value_type<
|
||||
VectorE >::type >::invoke( d, e, df, ef, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ptrfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
ptrfs( const char uplo, const VectorD& d, const VectorE& e,
|
||||
const VectorDF& df, const VectorEF& ef, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, Workspace work ) {
|
||||
return ptrfs_impl< typename bindings::value_type<
|
||||
VectorE >::type >::invoke( uplo, d, e, df, ef, b, x, ferr, berr,
|
||||
work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for ptrfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename VectorDF,
|
||||
typename VectorEF, typename MatrixB, typename MatrixX,
|
||||
typename VectorFERR, typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
ptrfs( const char uplo, const VectorD& d, const VectorE& e,
|
||||
const VectorDF& df, const VectorEF& ef, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return ptrfs_impl< typename bindings::value_type<
|
||||
VectorE >::type >::invoke( uplo, d, e, df, ef, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
187
sdk/boost/numeric/bindings/lapack/computational/pttrf.hpp
Normal file
187
sdk/boost/numeric/bindings/lapack/computational/pttrf.hpp
Normal file
@@ -0,0 +1,187 @@
|
||||
//
|
||||
// Copyright (c) 2002--2010
|
||||
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
|
||||
// Thomas Klimpel and Rutger ter Borg
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED
|
||||
// PLEASE DO NOT EDIT!
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PTTRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PTTRF_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 pttrf 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 pttrf( const fortran_int_t n, float* d, float* e ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPTTRF( &n, d, e, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t pttrf( const fortran_int_t n, double* d, double* e ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPTTRF( &n, d, e, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t pttrf( const fortran_int_t n, float* d,
|
||||
std::complex<float>* e ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPTTRF( &n, d, e, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t pttrf( const fortran_int_t n, double* d,
|
||||
std::complex<double>* e ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPTTRF( &n, d, e, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pttrf.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct pttrf_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pttrf_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 VectorD, typename VectorE >
|
||||
static std::ptrdiff_t invoke( VectorD& d, VectorE& e ) {
|
||||
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( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(e) >= bindings::size(d)-1 );
|
||||
return detail::pttrf( bindings::size(d), bindings::begin_value(d),
|
||||
bindings::begin_value(e) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pttrf_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 VectorD, typename VectorE >
|
||||
static std::ptrdiff_t invoke( VectorD& d, VectorE& e ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(e) >= bindings::size(d)-1 );
|
||||
return detail::pttrf( bindings::size(d), bindings::begin_value(d),
|
||||
bindings::begin_value(e) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 pttrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pttrf. Its overload differs for
|
||||
//
|
||||
template< typename VectorD, typename VectorE >
|
||||
inline std::ptrdiff_t pttrf( VectorD& d, VectorE& e ) {
|
||||
return pttrf_impl< typename bindings::value_type<
|
||||
VectorE >::type >::invoke( d, e );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
229
sdk/boost/numeric/bindings/lapack/computational/pttrs.hpp
Normal file
229
sdk/boost/numeric/bindings/lapack/computational/pttrs.hpp
Normal file
@@ -0,0 +1,229 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_PTTRS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_PTTRS_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 pttrs 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 pttrs( const fortran_int_t n, const fortran_int_t nrhs,
|
||||
const float* d, const float* e, float* b, const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SPTTRS( &n, &nrhs, d, e, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
inline std::ptrdiff_t pttrs( const fortran_int_t n, const fortran_int_t nrhs,
|
||||
const double* d, const double* e, double* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DPTTRS( &n, &nrhs, d, e, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t pttrs( const char uplo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* d,
|
||||
const std::complex<float>* e, std::complex<float>* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CPTTRS( &uplo, &n, &nrhs, d, e, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
inline std::ptrdiff_t pttrs( const char uplo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* d,
|
||||
const std::complex<double>* e, std::complex<double>* b,
|
||||
const fortran_int_t ldb ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZPTTRS( &uplo, &n, &nrhs, d, e, b, &ldb, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to pttrs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct pttrs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pttrs_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 VectorD, typename VectorE, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const VectorD& d, const VectorE& e,
|
||||
MatrixB& b ) {
|
||||
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< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(e) >= bindings::size(d)-1 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size(d)) );
|
||||
return detail::pttrs( bindings::size(d), bindings::size_column(b),
|
||||
bindings::begin_value(d), bindings::begin_value(e),
|
||||
bindings::begin_value(b), bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct pttrs_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 VectorD, typename VectorE, typename MatrixB >
|
||||
static std::ptrdiff_t invoke( const char uplo, const VectorD& d,
|
||||
const VectorE& e, MatrixB& b ) {
|
||||
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< VectorE >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size(d) );
|
||||
BOOST_ASSERT( bindings::size(d) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size(d)) );
|
||||
return detail::pttrs( uplo, bindings::size(d),
|
||||
bindings::size_column(b), bindings::begin_value(d),
|
||||
bindings::begin_value(e), bindings::begin_value(b),
|
||||
bindings::stride_major(b) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Functions for direct use. These functions are overloaded for temporaries,
|
||||
// so that wrapped types can still be passed and used for write-access. In
|
||||
// addition, if applicable, they are overloaded for user-defined workspaces.
|
||||
// Calls to these functions are passed to the pttrs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for pttrs. Its overload differs for
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename MatrixB >
|
||||
inline std::ptrdiff_t pttrs( const VectorD& d, const VectorE& e,
|
||||
MatrixB& b ) {
|
||||
return pttrs_impl< typename bindings::value_type<
|
||||
VectorE >::type >::invoke( d, e, b );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for pttrs. Its overload differs for
|
||||
//
|
||||
template< typename VectorD, typename VectorE, typename MatrixB >
|
||||
inline std::ptrdiff_t pttrs( const char uplo, const VectorD& d,
|
||||
const VectorE& e, MatrixB& b ) {
|
||||
return pttrs_impl< typename bindings::value_type<
|
||||
VectorE >::type >::invoke( uplo, d, e, b );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
226
sdk/boost/numeric/bindings/lapack/computational/sbgst.hpp
Normal file
226
sdk/boost/numeric/bindings/lapack/computational/sbgst.hpp
Normal file
@@ -0,0 +1,226 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_SBGST_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_SBGST_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 sbgst 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 sbgst( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t ka, const fortran_int_t kb,
|
||||
float* ab, const fortran_int_t ldab, const float* bb,
|
||||
const fortran_int_t ldbb, float* x, const fortran_int_t ldx,
|
||||
float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSBGST( &vect, &lapack_option< UpLo >::value, &n, &ka, &kb, ab,
|
||||
&ldab, bb, &ldbb, x, &ldx, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t sbgst( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t ka, const fortran_int_t kb,
|
||||
double* ab, const fortran_int_t ldab, const double* bb,
|
||||
const fortran_int_t ldbb, double* x, const fortran_int_t ldx,
|
||||
double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSBGST( &vect, &lapack_option< UpLo >::value, &n, &ka, &kb, ab,
|
||||
&ldab, bb, &ldbb, x, &ldx, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to sbgst.
|
||||
//
|
||||
template< typename Value >
|
||||
struct sbgst_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 MatrixBB, typename MatrixX,
|
||||
typename WORK >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab,
|
||||
const MatrixBB& bb, MatrixX& x, 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_STATIC_ASSERT( (bindings::is_column_major< MatrixBB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixBB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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::size_minor(bb) == 1 ||
|
||||
bindings::stride_minor(bb) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( bindings::stride_major(bb) >= bindings::bandwidth(bb,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( vect == 'N' || vect == 'V' );
|
||||
return detail::sbgst( vect, uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::bandwidth(bb,
|
||||
uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(bb),
|
||||
bindings::stride_major(bb), bindings::begin_value(x),
|
||||
bindings::stride_major(x),
|
||||
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, typename MatrixBB, typename MatrixX >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab,
|
||||
const MatrixBB& bb, MatrixX& x, 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(
|
||||
bindings::size_column(ab) ) );
|
||||
return invoke( vect, ab, bb, x, 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, typename MatrixBB, typename MatrixX >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab,
|
||||
const MatrixBB& bb, MatrixX& x, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( vect, ab, bb, x, 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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 sbgst_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for sbgst. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAB, typename MatrixBB, typename MatrixX,
|
||||
typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
sbgst( const char vect, MatrixAB& ab, const MatrixBB& bb, MatrixX& x,
|
||||
Workspace work ) {
|
||||
return sbgst_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, bb, x, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for sbgst. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAB, typename MatrixBB, typename MatrixX >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixX >,
|
||||
std::ptrdiff_t >::type
|
||||
sbgst( const char vect, MatrixAB& ab, const MatrixBB& bb, MatrixX& x ) {
|
||||
return sbgst_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, bb, x, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
230
sdk/boost/numeric/bindings/lapack/computational/sbtrd.hpp
Normal file
230
sdk/boost/numeric/bindings/lapack/computational/sbtrd.hpp
Normal file
@@ -0,0 +1,230 @@
|
||||
//
|
||||
// Copyright (c) 2002--2010
|
||||
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
|
||||
// Thomas Klimpel and Rutger ter Borg
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED
|
||||
// PLEASE DO NOT EDIT!
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_SBTRD_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_SBTRD_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 sbtrd 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 sbtrd( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t kd, float* ab,
|
||||
const fortran_int_t ldab, float* d, float* e, float* q,
|
||||
const fortran_int_t ldq, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSBTRD( &vect, &lapack_option< UpLo >::value, &n, &kd, ab, &ldab,
|
||||
d, e, q, &ldq, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t sbtrd( const char vect, const UpLo,
|
||||
const fortran_int_t n, const fortran_int_t kd, double* ab,
|
||||
const fortran_int_t ldab, double* d, double* e, double* q,
|
||||
const fortran_int_t ldq, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSBTRD( &vect, &lapack_option< UpLo >::value, &n, &kd, ab, &ldab,
|
||||
d, e, q, &ldq, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to sbtrd.
|
||||
//
|
||||
template< typename Value >
|
||||
struct sbtrd_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 VectorD, typename VectorE,
|
||||
typename MatrixQ, typename WORK >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, 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_STATIC_ASSERT( (bindings::is_column_major< MatrixQ >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAB >::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< MatrixAB >::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< MatrixAB >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixQ >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixQ >::value) );
|
||||
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(ab) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( 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::size_minor(q) == 1 ||
|
||||
bindings::stride_minor(q) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
|
||||
uplo())+1 );
|
||||
BOOST_ASSERT( vect == 'N' || vect == 'V' || vect == 'U' );
|
||||
return detail::sbtrd( vect, uplo(), bindings::size_column(ab),
|
||||
bindings::bandwidth(ab, uplo()), bindings::begin_value(ab),
|
||||
bindings::stride_major(ab), bindings::begin_value(d),
|
||||
bindings::begin_value(e), bindings::begin_value(q),
|
||||
bindings::stride_major(q),
|
||||
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, typename VectorD, typename VectorE,
|
||||
typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, 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(
|
||||
bindings::size_column(ab) ) );
|
||||
return invoke( vect, ab, d, e, q, 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, typename VectorD, typename VectorE,
|
||||
typename MatrixQ >
|
||||
static std::ptrdiff_t invoke( const char vect, MatrixAB& ab, VectorD& d,
|
||||
VectorE& e, MatrixQ& q, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
|
||||
return invoke( vect, ab, d, e, q, 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 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 sbtrd_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for sbtrd. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
sbtrd( const char vect, MatrixAB& ab, VectorD& d, VectorE& e, MatrixQ& q,
|
||||
Workspace work ) {
|
||||
return sbtrd_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, d, e, q, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for sbtrd. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAB, typename VectorD, typename VectorE,
|
||||
typename MatrixQ >
|
||||
inline typename boost::disable_if< detail::is_workspace< MatrixQ >,
|
||||
std::ptrdiff_t >::type
|
||||
sbtrd( const char vect, MatrixAB& ab, VectorD& d, VectorE& e,
|
||||
MatrixQ& q ) {
|
||||
return sbtrd_impl< typename bindings::value_type<
|
||||
MatrixAB >::type >::invoke( vect, ab, d, e, q,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
322
sdk/boost/numeric/bindings/lapack/computational/spcon.hpp
Normal file
322
sdk/boost/numeric/bindings/lapack/computational/spcon.hpp
Normal file
@@ -0,0 +1,322 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_SPCON_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_SPCON_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/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 spcon 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 spcon( const UpLo, const fortran_int_t n,
|
||||
const float* ap, const fortran_int_t* ipiv, const float anorm,
|
||||
float& rcond, float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPCON( &lapack_option< UpLo >::value, &n, ap, ipiv, &anorm,
|
||||
&rcond, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t spcon( const UpLo, const fortran_int_t n,
|
||||
const double* ap, const fortran_int_t* ipiv, const double anorm,
|
||||
double& rcond, double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPCON( &lapack_option< UpLo >::value, &n, ap, ipiv, &anorm,
|
||||
&rcond, work, iwork, &info );
|
||||
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 spcon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<float>* ap, const fortran_int_t* ipiv,
|
||||
const float anorm, float& rcond, std::complex<float>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CSPCON( &lapack_option< UpLo >::value, &n, ap, ipiv, &anorm,
|
||||
&rcond, work, &info );
|
||||
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 spcon( const UpLo, const fortran_int_t n,
|
||||
const std::complex<double>* ap, const fortran_int_t* ipiv,
|
||||
const double anorm, double& rcond, std::complex<double>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZSPCON( &lapack_option< UpLo >::value, &n, ap, ipiv, &anorm,
|
||||
&rcond, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to spcon.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct spcon_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct spcon_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 MatrixAP, typename VectorIPIV, typename WORK,
|
||||
typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, detail::workspace2< WORK,
|
||||
IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::spcon( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv), anorm,
|
||||
rcond, 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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, 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(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(ap) ) );
|
||||
return invoke( ap, ipiv, anorm, rcond, 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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, ipiv, anorm, rcond, 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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct spcon_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 MatrixAP, typename VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, detail::workspace1<
|
||||
WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::spcon( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv), anorm,
|
||||
rcond, 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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, ipiv, anorm, rcond, 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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const real_type anorm, real_type& rcond, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, ipiv, anorm, rcond, 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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 spcon_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for spcon. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
spcon( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAP >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAP >::type >::type& rcond,
|
||||
Workspace work ) {
|
||||
return spcon_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv, anorm, rcond, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for spcon. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
spcon( const MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAP >::type >::type anorm, typename remove_imaginary<
|
||||
typename bindings::value_type< MatrixAP >::type >::type& rcond ) {
|
||||
return spcon_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv, anorm, rcond,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
439
sdk/boost/numeric/bindings/lapack/computational/sprfs.hpp
Normal file
439
sdk/boost/numeric/bindings/lapack/computational/sprfs.hpp
Normal file
@@ -0,0 +1,439 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_SPRFS_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_SPRFS_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 sprfs 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 sprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const float* ap, const float* afp,
|
||||
const fortran_int_t* ipiv, const float* b, const fortran_int_t ldb,
|
||||
float* x, const fortran_int_t ldx, float* ferr, float* berr,
|
||||
float* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, ipiv, b,
|
||||
&ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t sprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const double* ap, const double* afp,
|
||||
const fortran_int_t* ipiv, const double* b, const fortran_int_t ldb,
|
||||
double* x, const fortran_int_t ldx, double* ferr, double* berr,
|
||||
double* work, fortran_int_t* iwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, ipiv, b,
|
||||
&ldb, x, &ldx, ferr, berr, work, iwork, &info );
|
||||
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 sprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<float>* ap,
|
||||
const std::complex<float>* afp, const fortran_int_t* ipiv,
|
||||
const std::complex<float>* b, const fortran_int_t ldb,
|
||||
std::complex<float>* x, const fortran_int_t ldx, float* ferr,
|
||||
float* berr, std::complex<float>* work, float* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CSPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, ipiv, b,
|
||||
&ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
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 sprfs( const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t nrhs, const std::complex<double>* ap,
|
||||
const std::complex<double>* afp, const fortran_int_t* ipiv,
|
||||
const std::complex<double>* b, const fortran_int_t ldb,
|
||||
std::complex<double>* x, const fortran_int_t ldx, double* ferr,
|
||||
double* berr, std::complex<double>* work, double* rwork ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZSPRFS( &lapack_option< UpLo >::value, &n, &nrhs, ap, afp, ipiv, b,
|
||||
&ldb, x, &ldx, ferr, berr, work, rwork, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to sprfs.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct sprfs_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct sprfs_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 MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename IWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
IWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::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< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorFERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(fortran_int_t())) >=
|
||||
min_size_iwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
return detail::sprfs( uplo(), bindings::size_column(ap),
|
||||
bindings::size_column(b), bindings::begin_value(ap),
|
||||
bindings::begin_value(afp), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
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 MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, 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(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< fortran_int_t > tmp_iwork(
|
||||
min_size_iwork( bindings::size_column(ap) ) );
|
||||
return invoke( ap, afp, ipiv, b, x, ferr, berr, 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 MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, afp, ipiv, b, x, ferr, berr, 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 3*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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct sprfs_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 MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename WORK, typename RWORK >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, detail::workspace2< WORK,
|
||||
RWORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorFERR >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorBERR >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAFP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixB >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorFERR >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBERR >::value) );
|
||||
BOOST_ASSERT( bindings::size(berr) >= bindings::size_column(b) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_rwork( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_column(b) >= 0 );
|
||||
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
|
||||
bindings::stride_minor(b) == 1 );
|
||||
BOOST_ASSERT( bindings::size_minor(x) == 1 ||
|
||||
bindings::stride_minor(x) == 1 );
|
||||
BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
BOOST_ASSERT( bindings::stride_major(x) >= std::max< std::ptrdiff_t >(1,
|
||||
bindings::size_column(ap)) );
|
||||
return detail::sprfs( uplo(), bindings::size_column(ap),
|
||||
bindings::size_column(b), bindings::begin_value(ap),
|
||||
bindings::begin_value(afp), bindings::begin_value(ipiv),
|
||||
bindings::begin_value(b), bindings::stride_major(b),
|
||||
bindings::begin_value(x), bindings::stride_major(x),
|
||||
bindings::begin_value(ferr), bindings::begin_value(berr),
|
||||
bindings::begin_value(work.select(value_type())),
|
||||
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, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ap) ) );
|
||||
bindings::detail::array< real_type > tmp_rwork( min_size_rwork(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, afp, ipiv, b, x, ferr, berr, workspace( tmp_work,
|
||||
tmp_rwork ) );
|
||||
}
|
||||
|
||||
//
|
||||
// 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, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
static std::ptrdiff_t invoke( const MatrixAP& ap, const MatrixAFP& afp,
|
||||
const VectorIPIV& ipiv, const MatrixB& b, MatrixX& x,
|
||||
VectorFERR& ferr, VectorBERR& berr, optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, afp, ipiv, b, x, ferr, berr, 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 rwork.
|
||||
//
|
||||
static std::ptrdiff_t min_size_rwork( 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 sprfs_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for sprfs. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
sprfs( const MatrixAP& ap, const MatrixAFP& afp, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr,
|
||||
Workspace work ) {
|
||||
return sprfs_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, afp, ipiv, b, x, ferr, berr,
|
||||
work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for sprfs. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAP, typename MatrixAFP, typename VectorIPIV,
|
||||
typename MatrixB, typename MatrixX, typename VectorFERR,
|
||||
typename VectorBERR >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorBERR >,
|
||||
std::ptrdiff_t >::type
|
||||
sprfs( const MatrixAP& ap, const MatrixAFP& afp, const VectorIPIV& ipiv,
|
||||
const MatrixB& b, MatrixX& x, VectorFERR& ferr, VectorBERR& berr ) {
|
||||
return sprfs_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, afp, ipiv, b, x, ferr, berr,
|
||||
optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
147
sdk/boost/numeric/bindings/lapack/computational/sptrd.hpp
Normal file
147
sdk/boost/numeric/bindings/lapack/computational/sptrd.hpp
Normal file
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_SPTRD_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_SPTRD_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/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 sptrd 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 sptrd( const UpLo, const fortran_int_t n, float* ap,
|
||||
float* d, float* e, float* tau ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPTRD( &lapack_option< UpLo >::value, &n, ap, d, e, tau, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t sptrd( const UpLo, const fortran_int_t n, double* ap,
|
||||
double* d, double* e, double* tau ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPTRD( &lapack_option< UpLo >::value, &n, ap, d, e, tau, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to sptrd.
|
||||
//
|
||||
template< typename Value >
|
||||
struct sptrd_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 MatrixAP, typename VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::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< MatrixAP >::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< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorTAU >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorD >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorE >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorTAU >::value) );
|
||||
BOOST_ASSERT( bindings::size(d) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(tau) >= bindings::size_column(ap)-1 );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::sptrd( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(d),
|
||||
bindings::begin_value(e), bindings::begin_value(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 sptrd_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for sptrd. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorD, typename VectorE,
|
||||
typename VectorTAU >
|
||||
inline std::ptrdiff_t sptrd( MatrixAP& ap, VectorD& d, VectorE& e,
|
||||
VectorTAU& tau ) {
|
||||
return sptrd_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, d, e, tau );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
152
sdk/boost/numeric/bindings/lapack/computational/sptrf.hpp
Normal file
152
sdk/boost/numeric/bindings/lapack/computational/sptrf.hpp
Normal file
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_SPTRF_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_SPTRF_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/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 sptrf 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 sptrf( const UpLo, const fortran_int_t n, float* ap,
|
||||
fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPTRF( &lapack_option< UpLo >::value, &n, ap, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t sptrf( const UpLo, const fortran_int_t n, double* ap,
|
||||
fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPTRF( &lapack_option< UpLo >::value, &n, ap, ipiv, &info );
|
||||
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 sptrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* ap, fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CSPTRF( &lapack_option< UpLo >::value, &n, ap, ipiv, &info );
|
||||
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 sptrf( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* ap, fortran_int_t* ipiv ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZSPTRF( &lapack_option< UpLo >::value, &n, ap, ipiv, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to sptrf.
|
||||
//
|
||||
template< typename Value >
|
||||
struct sptrf_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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, VectorIPIV& ipiv ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorIPIV >::value) );
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::sptrf( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv) );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 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 sptrf_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for sptrf. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV >
|
||||
inline std::ptrdiff_t sptrf( MatrixAP& ap, VectorIPIV& ipiv ) {
|
||||
return sptrf_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
293
sdk/boost/numeric/bindings/lapack/computational/sptri.hpp
Normal file
293
sdk/boost/numeric/bindings/lapack/computational/sptri.hpp
Normal file
@@ -0,0 +1,293 @@
|
||||
//
|
||||
// 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_COMPUTATIONAL_SPTRI_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_LAPACK_COMPUTATIONAL_SPTRI_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/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 sptri 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 sptri( const UpLo, const fortran_int_t n, float* ap,
|
||||
const fortran_int_t* ipiv, float* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_SSPTRI( &lapack_option< UpLo >::value, &n, ap, ipiv, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible LAPACK backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename UpLo >
|
||||
inline std::ptrdiff_t sptri( const UpLo, const fortran_int_t n, double* ap,
|
||||
const fortran_int_t* ipiv, double* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_DSPTRI( &lapack_option< UpLo >::value, &n, ap, ipiv, work, &info );
|
||||
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 sptri( const UpLo, const fortran_int_t n,
|
||||
std::complex<float>* ap, const fortran_int_t* ipiv,
|
||||
std::complex<float>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_CSPTRI( &lapack_option< UpLo >::value, &n, ap, ipiv, work, &info );
|
||||
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 sptri( const UpLo, const fortran_int_t n,
|
||||
std::complex<double>* ap, const fortran_int_t* ipiv,
|
||||
std::complex<double>* work ) {
|
||||
fortran_int_t info(0);
|
||||
LAPACK_ZSPTRI( &lapack_option< UpLo >::value, &n, ap, ipiv, work, &info );
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to sptri.
|
||||
//
|
||||
template< typename Value, typename Enable = void >
|
||||
struct sptri_impl {};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a real type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct sptri_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 MatrixAP, typename VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::sptri( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv),
|
||||
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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
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(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, ipiv, 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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, ipiv, 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 n;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// This implementation is enabled if Value is a complex type.
|
||||
//
|
||||
template< typename Value >
|
||||
struct sptri_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 MatrixAP, typename VectorIPIV, typename WORK >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
detail::workspace1< WORK > work ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
BOOST_ASSERT( bindings::size(ipiv) >= bindings::size_column(ap) );
|
||||
BOOST_ASSERT( bindings::size(work.select(value_type())) >=
|
||||
min_size_work( bindings::size_column(ap) ));
|
||||
BOOST_ASSERT( bindings::size_column(ap) >= 0 );
|
||||
return detail::sptri( uplo(), bindings::size_column(ap),
|
||||
bindings::begin_value(ap), bindings::begin_value(ipiv),
|
||||
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 MatrixAP, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
minimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
bindings::detail::array< value_type > tmp_work( min_size_work(
|
||||
bindings::size_column(ap) ) );
|
||||
return invoke( ap, ipiv, 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, typename VectorIPIV >
|
||||
static std::ptrdiff_t invoke( MatrixAP& ap, const VectorIPIV& ipiv,
|
||||
optimal_workspace ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
return invoke( ap, ipiv, 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 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 sptri_impl classes. In the
|
||||
// documentation, most overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for sptri. Its overload differs for
|
||||
// * User-defined workspace
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV, typename Workspace >
|
||||
inline typename boost::enable_if< detail::is_workspace< Workspace >,
|
||||
std::ptrdiff_t >::type
|
||||
sptri( MatrixAP& ap, const VectorIPIV& ipiv, Workspace work ) {
|
||||
return sptri_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv, work );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for sptri. Its overload differs for
|
||||
// * Default workspace-type (optimal)
|
||||
//
|
||||
template< typename MatrixAP, typename VectorIPIV >
|
||||
inline typename boost::disable_if< detail::is_workspace< VectorIPIV >,
|
||||
std::ptrdiff_t >::type
|
||||
sptri( MatrixAP& ap, const VectorIPIV& ipiv ) {
|
||||
return sptri_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, ipiv, optimal_workspace() );
|
||||
}
|
||||
|
||||
} // namespace lapack
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user