multi_array_conv.h

Go to the documentation of this file.
00001 #ifndef ARRAY_CONVOLUTION_H
00002 #define ARRAY_CONVOLUTION_H
00003 
00004 // For compatibility with boost <1.31 when apply_if replaced with eval_if
00005 #include <boost/version.hpp>
00006 #if BOOST_VERSION<=103100
00007 #include <boost/mpl/apply_if.hpp>
00008 #ifndef eval_if
00009 #define eval_if apply_if
00010 #endif
00011 #else
00012 #include <boost/mpl/eval_if.hpp>
00013 #endif
00014 
00015 #include <boost/array.hpp>
00016 #include <boost/multi_array.hpp>
00017 #include <map>
00018 #include <vector>
00019 #include "mimasconfig.h"
00020 #include "linalg.h"
00021 
00022 namespace mimas {
00023 
00045 template< class _Array1, class _Array2 >
00046 boost::multi_array< typename _Array1::element, _Array1::dimensionality >
00047   correlate( const _Array1 &x, const _Array2 &y );
00048 
00057 template< typename T >
00058 boost::multi_array< T, 2 > correlate_separable
00059   ( const boost::const_multi_array_ref< T, 2 > &x,
00060     const std::vector< boost::multi_array< T, 2 > > &f )
00061 {
00062   assert( f.size() == 2 );
00063   return correlate( correlate( x, f[0] ), f[1] );
00064 }
00065 
00066 #ifdef HAVE_LIBLAPACK
00067 
00077 template< typename T >
00078 std::vector< boost::multi_array< T, 2 > > separate
00079    ( const boost::const_multi_array_ref< T, 2 > &array );
00080 
00083 template< typename T >
00084 boost::multi_array< T, 2 > correlate_separable
00085   ( const boost::const_multi_array_ref< T, 2 > &x,
00086     const boost::const_multi_array_ref< T, 2 > &f )
00087 {
00088   boost::multi_array< T, 2 > result( boost::extents[ x.shape()[0] ]
00089                                                    [ x.shape()[1] ] );
00090   std::vector< boost::multi_array< T, 2 > > components( separate( f ) );
00091   return correlate_separable< T >( x, components );
00092 }
00093 
00094 #endif
00095 
00097 
00098 };
00099 
00100 #include "multi_array_conv.tcc"
00101 
00102 #endif

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:17 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...