Re: [eigen] Eigen::FFT and Eigen::Complex in repo

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


I know it is 'unsupported', but I was looking at the Complex class and had two questions.

First a small omission, this line is missing I think around line 200, only real was present.
template<class T> T imag(const Complex<T>&x) {return imag(ei_to_std(x));}

Second, I was expecting code like this to work. All is fine with std::complex but not Eigen::Complex.

#include <Eigen/Core>
#include <unsupported/Eigen/Complex>
#include <iostream>

typedef double Real;
typedef Eigen::Complex<Real> rComplex;
// Works with std::complex
// typedef std::complex<Real> rComplex;
typedef Eigen::Matrix<Real, 3, 1> Vector3r;
typedef Eigen::Matrix<rComplex, 3, 1> Vector3cr;

int main() {
   
    Vector3cr comp;
    comp << rComplex(1,2), rComplex(3,4), rComplex(5,6);

    Vector3r vreal;
    Vector3r vimag;

    vreal = comp.real();
    vimag = comp.imag();

    std::cout << comp << std::endl;
    std::cout << vreal  << std::endl;
    std::cout << vimag << std::endl;

}

Or am I missing something?

Thanks,

-Trevor

First errors compiling with gcc, (way above my head):

/home/tirons/src/eigen/Eigen/src/Core/Functors.h: In member function ‘typename Eigen::NumTraits<_Real>::Real Eigen::ei_scalar_real_op<Scalar>::operator()(const Scalar&) const [with Scalar = Eigen::Complex<double>]’:
/home/tirons/src/eigen/Eigen/src/Core/CwiseUnaryView.h:110:   instantiated from ‘const typename Eigen::ei_traits<Eigen::CwiseUnaryView<ViewOp, MatrixType> >::Scalar Eigen::CwiseUnaryViewImpl<ViewOp, MatrixType, Eigen::Dense>::coeff(int) const [with ViewOp = Eigen::ei_scalar_real_op<Eigen::Complex<double> >, MatrixType = Eigen::Matrix<Eigen::Complex<double>, 3, 1, 0, 3, 1>]’
/home/tirons/src/eigen/Eigen/src/Core/Coeffs.h:346:   instantiated from ‘void Eigen::DenseBase<Derived>::copyCoeff(int, const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::CwiseUnaryView<Eigen::ei_scalar_real_op<Eigen::Complex<double> >, Eigen::Matrix<Eigen::Complex<double>, 3, 1, 0, 3, 1> >, Derived = Eigen::Matrix<double, 3, 1, 0, 3, 1>]’
/home/tirons/src/eigen/Eigen/src/Core/Assign.h:189:   instantiated from ‘static void Eigen::ei_assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Index, Stop>::run(Derived1&, const Derived2&) [with Derived1 = Eigen::Matrix<double, 3, 1, 0, 3, 1>, Derived2 = Eigen::CwiseUnaryView<Eigen::ei_scalar_real_op<Eigen::Complex<double> >, Eigen::Matrix<Eigen::Complex<double>, 3, 1, 0, 3, 1> >, int Index = 0, int Stop = 3]’


2009/10/29 Stjepan Rajko <stjepan..rajko@xxxxxxxxx>
On Tue, Oct 20, 2009 at 6:38 PM, Mark Borgerding <mark@xxxxxxxxxxxxxx> wrote:
The FFT module has been pushed into the eigen2 repository.

It currently lives in "unsupported".   The interface is still somewhat fluid.

Also of interest is the unsupported/Complex class.

Comments & code changes welcome.


Mark,

Today I had a need for a quick FFT calculation in a project that was already using Eigen, and I came across your post about the FFT module.  I was able to get the module from the repository and slap it on top of a recent Eigen release, and it just worked.  THANK YOU so much for doing this, it helped me out a lot.

Best,

Stjepan




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/