aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/FFT
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-10-20 23:25:49 -0400
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-10-20 23:25:49 -0400
commitc3180b7ffbc98d69764b3c1ab17b36e289f7cf7e (patch)
treea6744a712b9a226ea8436a75b3c0b5985570f65b /unsupported/Eigen/FFT
parent471b4d509234cbcbd4a1cd45d48fe10efcc2bcf1 (diff)
MatrixBase:
* support resize() to same size (nop). The case of FFT was another case where that make one's life far easier. hope that's ok with you Gael. but indeed, i don't use it in the ReturnByValue stuff. FFT: * Support MatrixBase (well, in the case with direct memory access such as Map) * adapt unit test
Diffstat (limited to 'unsupported/Eigen/FFT')
-rw-r--r--unsupported/Eigen/FFT32
1 files changed, 31 insertions, 1 deletions
diff --git a/unsupported/Eigen/FFT b/unsupported/Eigen/FFT
index dc7e85908..fafdb829b 100644
--- a/unsupported/Eigen/FFT
+++ b/unsupported/Eigen/FFT
@@ -36,7 +36,7 @@
#define DEFAULT_FFT_IMPL ei_fftw_impl
#endif
-// intel Math Kernel Library: fastest, commerical -- incompatible with Eigen in GPL form
+// intel Math Kernel Library: fastest, commercial -- incompatible with Eigen in GPL form
#ifdef _MKL_DFTI_H_ // mkl_dfti.h has been included, we can use MKL FFT routines
// TODO
// #include "src/FFT/ei_imkl_impl.h"
@@ -70,6 +70,20 @@ class FFT
fwd( &dst[0],&src[0],src.size() );
}
+ template<typename InputDerived, typename ComplexDerived>
+ void fwd( MatrixBase<ComplexDerived> & dst, const MatrixBase<InputDerived> & src)
+ {
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(InputDerived)
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(ComplexDerived)
+ EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ComplexDerived,InputDerived) // size at compile-time
+ EIGEN_STATIC_ASSERT((ei_is_same_type<typename ComplexDerived::Scalar, Complex>::ret),
+ YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
+ EIGEN_STATIC_ASSERT(int(InputDerived::Flags)&int(ComplexDerived::Flags)&DirectAccessBit,
+ THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES)
+ dst.derived().resize( src.size() );
+ fwd( &dst[0],&src[0],src.size() );
+ }
+
template <typename _Output>
void inv( _Output * dst, const Complex * src, int nfft)
{
@@ -83,8 +97,24 @@ class FFT
inv( &dst[0],&src[0],src.size() );
}
+ template<typename OutputDerived, typename ComplexDerived>
+ void inv( MatrixBase<OutputDerived> & dst, const MatrixBase<ComplexDerived> & src)
+ {
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(OutputDerived)
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(ComplexDerived)
+ EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ComplexDerived,OutputDerived) // size at compile-time
+ EIGEN_STATIC_ASSERT((ei_is_same_type<typename ComplexDerived::Scalar, Complex>::ret),
+ YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
+ EIGEN_STATIC_ASSERT(int(OutputDerived::Flags)&int(ComplexDerived::Flags)&DirectAccessBit,
+ THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES)
+ dst.derived().resize( src.size() );
+ inv( &dst[0],&src[0],src.size() );
+ }
+
// TODO: multi-dimensional FFTs
+
// TODO: handle Eigen MatrixBase
+ // ---> i added fwd and inv specializations above + unit test, is this enough? (bjacob)
traits_type & traits() {return m_traits;}
private: