mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
merge
This commit is contained in:
commit
ea684af6b4
@ -317,7 +317,7 @@ class Map<Quaternion<_Scalar>, PacketAccess >
|
||||
* The pointer \a coeffs must reference the four coeffecients of Quaternion in the following order:
|
||||
* \code *coeffs == {x, y, z, w} \endcode
|
||||
*
|
||||
* If the template paramter PacketAccess is set to Aligned, then the pointer coeffs must be aligned. */
|
||||
* If the template parameter PacketAccess is set to Aligned, then the pointer coeffs must be aligned. */
|
||||
EIGEN_STRONG_INLINE Map(const Scalar* coeffs) : m_coeffs(coeffs) {}
|
||||
|
||||
inline Coefficients& coeffs() { return m_coeffs;}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#ifndef EIGEN_AUTODIFF_MODULE
|
||||
#define EIGEN_AUTODIFF_MODULE
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Array>
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
|
@ -160,7 +160,7 @@ struct ei_kiss_cpx_fft
|
||||
scratch[0]=scratch[1]-scratch[2];
|
||||
tw1 += fstride;
|
||||
tw2 += fstride*2;
|
||||
Fout[m] = Complex( Fout->real() - .5*scratch[3].real() , Fout->imag() - .5*scratch[3].imag() );
|
||||
Fout[m] = Complex( Fout->real() - Scalar(.5)*scratch[3].real() , Fout->imag() - Scalar(.5)*scratch[3].imag() );
|
||||
scratch[0] *= epi3.imag();
|
||||
*Fout += scratch[3];
|
||||
Fout[m2] = Complex( Fout[m].real() + scratch[0].imag() , Fout[m].imag() - scratch[0].real() );
|
||||
@ -377,10 +377,10 @@ struct ei_kissfft_impl
|
||||
std::vector<Complex> m_tmpBuf2;
|
||||
|
||||
inline
|
||||
int PlanKey(int nfft,bool isinverse) const { return (nfft<<1) | isinverse; }
|
||||
int PlanKey(int nfft, bool isinverse) const { return (nfft<<1) | int(isinverse); }
|
||||
|
||||
inline
|
||||
PlanData & get_plan(int nfft,bool inverse)
|
||||
PlanData & get_plan(int nfft, bool inverse)
|
||||
{
|
||||
// TODO look for PlanKey(nfft, ! inverse) and conjugate the twiddles
|
||||
PlanData & pd = m_plans[ PlanKey(nfft,inverse) ];
|
||||
@ -400,7 +400,7 @@ struct ei_kissfft_impl
|
||||
int ncfft= ncfft2<<1;
|
||||
Scalar pi = acos( Scalar(-1) );
|
||||
for (int k=1;k<=ncfft2;++k)
|
||||
twidref[k-1] = exp( Complex(0,-pi * ((double) (k) / ncfft + .5) ) );
|
||||
twidref[k-1] = exp( Complex(0,-pi * (Scalar(k) / ncfft + Scalar(.5)) ) );
|
||||
}
|
||||
return &twidref[0];
|
||||
}
|
||||
|
@ -45,10 +45,11 @@ enum NumericalDiffMode {
|
||||
*
|
||||
* Currently only "Forward" and "Central" scheme are implemented.
|
||||
*/
|
||||
template<typename Functor, NumericalDiffMode mode=Forward>
|
||||
class NumericalDiff : public Functor
|
||||
template<typename _Functor, NumericalDiffMode mode=Forward>
|
||||
class NumericalDiff : public _Functor
|
||||
{
|
||||
public:
|
||||
typedef _Functor Functor;
|
||||
typedef typename Functor::Scalar Scalar;
|
||||
typedef typename Functor::InputType InputType;
|
||||
typedef typename Functor::ValueType ValueType;
|
||||
|
@ -45,13 +45,10 @@ complex<long double> promote(long double x) { return complex<long double>( x);
|
||||
long double totalpower=0;
|
||||
long double difpower=0;
|
||||
cerr <<"idx\ttruth\t\tvalue\t|dif|=\n";
|
||||
long double pi = acos((long double)-1);
|
||||
for (size_t k0=0;k0<size_t(fftbuf.size());++k0) {
|
||||
complex<long double> acc = 0;
|
||||
#ifdef _GNU_SOURCE
|
||||
long double phinc = -2.*k0* M_PIl / timebuf.size();
|
||||
#else
|
||||
long double phinc = -2.*k0* M_PI / timebuf.size();
|
||||
#endif
|
||||
long double phinc = -2.*k0* pi / timebuf.size();
|
||||
for (size_t k1=0;k1<size_t(timebuf.size());++k1) {
|
||||
acc += promote( timebuf[k1] ) * exp( complex<long double>(0,k1*phinc) );
|
||||
}
|
||||
|
@ -45,10 +45,11 @@ complex<long double> promote(long double x) { return complex<long double>( x);
|
||||
{
|
||||
long double totalpower=0;
|
||||
long double difpower=0;
|
||||
long double pi = acos((long double)-1 );
|
||||
cerr <<"idx\ttruth\t\tvalue\t|dif|=\n";
|
||||
for (size_t k0=0;k0<fftbuf.size();++k0) {
|
||||
complex<long double> acc = 0;
|
||||
long double phinc = -2.*k0* M_PIl / timebuf.size();
|
||||
long double phinc = -2.*k0* pi / timebuf.size();
|
||||
for (size_t k1=0;k1<timebuf.size();++k1) {
|
||||
acc += promote( timebuf[k1] ) * exp( complex<long double>(0,k1*phinc) );
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ EIGEN_DONT_INLINE Scalar foo(const Scalar& x, const Scalar& y)
|
||||
// return x+std::sin(y);
|
||||
EIGEN_ASM_COMMENT("mybegin");
|
||||
return static_cast<Scalar>(x*2 - std::pow(x,2) + 2*std::sqrt(y*y) - 4 * std::sin(x) + 2 * std::cos(y) - std::exp(-0.5*x*x));
|
||||
// return y/x;// - y*2;
|
||||
// return x - y;//x*2 -std::pow(x,2);//(2*y/x);// - y*2;
|
||||
EIGEN_ASM_COMMENT("myend");
|
||||
}
|
||||
|
||||
@ -137,10 +137,12 @@ template<typename Func> void forward_jacobian(const Func& f)
|
||||
void test_autodiff_scalar()
|
||||
{
|
||||
std::cerr << foo<float>(1,2) << "\n";
|
||||
AutoDiffScalar<Vector2f> ax(1,Vector2f::UnitX());
|
||||
AutoDiffScalar<Vector2f> ay(2,Vector2f::UnitY());
|
||||
std::cerr << foo<AutoDiffScalar<Vector2f> >(ax,ay).value() << " <> "
|
||||
<< foo<AutoDiffScalar<Vector2f> >(ax,ay).derivatives().transpose() << "\n\n";
|
||||
typedef AutoDiffScalar<Vector2f> AD;
|
||||
AD ax(1,Vector2f::UnitX());
|
||||
AD ay(2,Vector2f::UnitY());
|
||||
foo<AD>(ax,ay);
|
||||
std::cerr << foo<AD>(ax,ay).value() << " <> "
|
||||
<< foo<AD>(ax,ay).derivatives().transpose() << "\n\n";
|
||||
}
|
||||
|
||||
void test_autodiff_jacobian()
|
||||
|
Loading…
x
Reference in New Issue
Block a user