amos.hpp

Go to the documentation of this file.
00001 //
00002 //  Copyright Toon Knapen
00003 //
00004 // Distributed under the Boost Software License, Version 1.0.
00005 // (See accompanying file LICENSE_1_0.txt or copy at
00006 // http://www.boost.org/LICENSE_1_0.txt)
00007 //
00008 
00009 #ifndef BOOST_NUMERIC_BINDINGS_AMOS_AMOS_HPP
00010 #define BOOST_NUMERIC_BINDINGS_AMOS_AMOS_HPP
00011 
00012 #include <boost/numeric/bindings/amos/amos_overloads.hpp>
00013 #include <boost/numeric/bindings/traits/type_traits.hpp>
00014 #include <boost/numeric/bindings/traits/vector_traits.hpp>
00015 #include <boost/static_assert.hpp>
00016 #include <boost/type_traits.hpp>
00017 
00018 namespace boost { namespace numeric { namespace bindings { namespace amos {
00019 
00020   template < typename vector_type, typename value_type >
00021   int besi(const value_type&                                             z,   // std::complex< float > or std::complex< double >
00022            const typename traits::type_traits< value_type >::real_type   fnu, // float or double
00023            int                                                           kode, 
00024            vector_type&                                                  cy, 
00025            int&                                                          nz) 
00026   {
00027 #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
00028     BOOST_STATIC_ASSERT( ( boost::is_same< value_type, typename traits::vector_traits<vector_type>::value_type >::value ) ) ;
00029 #else
00030     BOOST_STATIC_ASSERT( ( boost::is_same< value_type, typename vector_type::value_type >::value ) ) ;
00031 #endif
00032 
00033     int n = traits::vector_size( cy ) ;
00034     value_type * cy_ptr = traits::vector_storage( cy ) ;
00035 
00036     int error = 0 ;
00037     detail::besi( z, fnu, kode, n, cy_ptr, nz, error ) ;
00038     return error ;
00039   }
00040 
00041   template < typename vector_type, typename value_type >
00042   int besj(const value_type&                                            z, 
00043            const typename traits::type_traits< value_type >::real_type  fnu, 
00044            int                                                          kode, 
00045            vector_type&                                                 cy, 
00046            int&                                                         nz) 
00047   {
00048 #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
00049     BOOST_STATIC_ASSERT( ( boost::is_same< value_type, typename traits::vector_traits<vector_type>::value_type >::value ) ) ;
00050 #else
00051     BOOST_STATIC_ASSERT( ( boost::is_same< value_type, typename vector_type::value_type >::value ) ) ;
00052 #endif
00053 
00054     int n = traits::vector_size( cy ) ;
00055     value_type * cy_ptr = traits::vector_storage( cy ) ;
00056 
00057     int error = 0 ;
00058     detail::besj( z, fnu, kode, n, cy_ptr, nz, error ) ;
00059     return error ;
00060   }
00061 
00062   template < typename vector_type, typename value_type >
00063   int besy(const value_type&                                           z, 
00064            const typename traits::type_traits< value_type >::real_type fnu, 
00065            int                                                         kode, 
00066            vector_type&                                                cy, 
00067            int&                                                        nz) 
00068   {
00069 #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
00070     BOOST_STATIC_ASSERT( ( boost::is_same< value_type, typename traits::vector_traits<vector_type>::value_type >::value ) ) ;
00071 #else
00072     BOOST_STATIC_ASSERT( ( boost::is_same< value_type, typename vector_type::value_type >::value ) ) ;
00073 #endif
00074 
00075     int n = traits::vector_size( cy ) ;
00076     value_type * cy_ptr = traits::vector_storage( cy ) ;
00077 
00078     int error = 0 ;
00079     value_type * cwrk = new value_type[n];
00080     detail::besy( z, fnu, kode, n, cy_ptr, nz, cwrk, error ) ;
00081     delete[] cwrk ;
00082     return error ;
00083   }
00084 
00085 }}}}
00086 
00087 #endif // BOOST_NUMERIC_BINDINGS_AMOS_AMOS_HPP

Generated on Wed Nov 23 18:59:54 2011 for FreeCAD by  doxygen 1.6.1