mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Merged eigen/eigen into default
This commit is contained in:
@@ -101,7 +101,7 @@ class AutoDiffScalar
|
||||
template<typename OtherDerType>
|
||||
AutoDiffScalar(const AutoDiffScalar<OtherDerType>& other
|
||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||
, typename internal::enable_if<internal::is_same<Scalar,typename OtherDerType::Scalar>::value,void*>::type = 0
|
||||
, typename internal::enable_if<internal::is_same<Scalar, typename internal::traits<typename internal::remove_all<OtherDerType>::type>::Scalar>::value,void*>::type = 0
|
||||
#endif
|
||||
)
|
||||
: m_value(other.value()), m_derivatives(other.derivatives())
|
||||
@@ -548,13 +548,25 @@ inline const AutoDiffScalar<DerType>& real(const AutoDiffScalar<DerType>& x) {
|
||||
template<typename DerType>
|
||||
inline typename DerType::Scalar imag(const AutoDiffScalar<DerType>&) { return 0.; }
|
||||
template<typename DerType, typename T>
|
||||
inline AutoDiffScalar<DerType> (min)(const AutoDiffScalar<DerType>& x, const T& y) { return (x <= y ? x : y); }
|
||||
inline AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> (min)(const AutoDiffScalar<DerType>& x, const T& y) {
|
||||
typedef AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> ADS;
|
||||
return (x <= y ? ADS(x) : ADS(y));
|
||||
}
|
||||
template<typename DerType, typename T>
|
||||
inline AutoDiffScalar<DerType> (max)(const AutoDiffScalar<DerType>& x, const T& y) { return (x >= y ? x : y); }
|
||||
inline AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> (max)(const AutoDiffScalar<DerType>& x, const T& y) {
|
||||
typedef AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> ADS;
|
||||
return (x >= y ? ADS(x) : ADS(y));
|
||||
}
|
||||
template<typename DerType, typename T>
|
||||
inline AutoDiffScalar<DerType> (min)(const T& x, const AutoDiffScalar<DerType>& y) { return (x < y ? x : y); }
|
||||
inline AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> (min)(const T& x, const AutoDiffScalar<DerType>& y) {
|
||||
typedef AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> ADS;
|
||||
return (x < y ? ADS(x) : ADS(y));
|
||||
}
|
||||
template<typename DerType, typename T>
|
||||
inline AutoDiffScalar<DerType> (max)(const T& x, const AutoDiffScalar<DerType>& y) { return (x > y ? x : y); }
|
||||
inline AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> (max)(const T& x, const AutoDiffScalar<DerType>& y) {
|
||||
typedef AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> ADS;
|
||||
return (x > y ? ADS(x) : ADS(y));
|
||||
}
|
||||
|
||||
EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(abs,
|
||||
using std::abs;
|
||||
@@ -589,23 +601,24 @@ EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(log,
|
||||
return ReturnType(log(x.value()),x.derivatives() * (Scalar(1)/x.value()));)
|
||||
|
||||
template<typename DerType>
|
||||
inline const Eigen::AutoDiffScalar<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<typename Eigen::internal::traits<DerType>::Scalar>, const DerType> >
|
||||
pow(const Eigen::AutoDiffScalar<DerType>& x, typename Eigen::internal::traits<DerType>::Scalar y)
|
||||
inline const Eigen::AutoDiffScalar<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<typename internal::traits<typename internal::remove_all<DerType>::type>::Scalar>, const typename internal::remove_all<DerType>::type> >
|
||||
pow(const Eigen::AutoDiffScalar<DerType>& x, const typename internal::traits<typename internal::remove_all<DerType>::type>::Scalar &y)
|
||||
{
|
||||
using namespace Eigen;
|
||||
typedef typename Eigen::internal::traits<DerType>::Scalar Scalar;
|
||||
return AutoDiffScalar<CwiseUnaryOp<Eigen::internal::scalar_multiple_op<Scalar>, const DerType> >(
|
||||
typedef typename internal::remove_all<DerType>::type DerTypeCleaned;
|
||||
typedef typename Eigen::internal::traits<DerTypeCleaned>::Scalar Scalar;
|
||||
return AutoDiffScalar<CwiseUnaryOp<Eigen::internal::scalar_multiple_op<Scalar>, const DerTypeCleaned> >(
|
||||
std::pow(x.value(),y),
|
||||
x.derivatives() * (y * std::pow(x.value(),y-1)));
|
||||
}
|
||||
|
||||
|
||||
template<typename DerTypeA,typename DerTypeB>
|
||||
inline const AutoDiffScalar<Matrix<typename internal::traits<DerTypeA>::Scalar,Dynamic,1> >
|
||||
inline const AutoDiffScalar<Matrix<typename internal::traits<typename internal::remove_all<DerTypeA>::type>::Scalar,Dynamic,1> >
|
||||
atan2(const AutoDiffScalar<DerTypeA>& a, const AutoDiffScalar<DerTypeB>& b)
|
||||
{
|
||||
using std::atan2;
|
||||
typedef typename internal::traits<DerTypeA>::Scalar Scalar;
|
||||
typedef typename internal::traits<typename internal::remove_all<DerTypeA>::type>::Scalar Scalar;
|
||||
typedef AutoDiffScalar<Matrix<Scalar,Dynamic,1> > PlainADS;
|
||||
PlainADS ret;
|
||||
ret.value() = atan2(a.value(), b.value());
|
||||
|
||||
@@ -62,7 +62,7 @@ bool gmres(const MatrixType & mat, const Rhs & rhs, Dest & x, const Precondition
|
||||
typedef typename Dest::RealScalar RealScalar;
|
||||
typedef typename Dest::Scalar Scalar;
|
||||
typedef Matrix < Scalar, Dynamic, 1 > VectorType;
|
||||
typedef Matrix < Scalar, Dynamic, Dynamic > FMatrixType;
|
||||
typedef Matrix < Scalar, Dynamic, Dynamic, ColMajor> FMatrixType;
|
||||
|
||||
RealScalar tol = tol_error;
|
||||
const Index maxIters = iters;
|
||||
@@ -157,7 +157,8 @@ bool gmres(const MatrixType & mat, const Rhs & rhs, Dest & x, const Precondition
|
||||
// insert coefficients into upper matrix triangle
|
||||
H.col(k-1).head(k) = v.head(k);
|
||||
|
||||
bool stop = (k==m || abs(w(k)) < tol * r0Norm || iters == maxIters);
|
||||
tol_error = abs(w(k)) / r0Norm;
|
||||
bool stop = (k==m || tol_error < tol || iters == maxIters);
|
||||
|
||||
if (stop || k == restart)
|
||||
{
|
||||
|
||||
@@ -239,7 +239,7 @@ struct traits<KroneckerProductSparse<_Lhs,_Rhs> >
|
||||
RemovedBits = ~(EvalToRowMajor ? 0 : RowMajorBit),
|
||||
|
||||
Flags = ((LhsFlags | RhsFlags) & HereditaryBits & RemovedBits)
|
||||
| EvalBeforeNestingBit | EvalBeforeAssigningBit,
|
||||
| EvalBeforeNestingBit,
|
||||
CoeffReadCost = HugeCost
|
||||
};
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ LevenbergMarquardt<FunctorType>::minimizeInit(FVectorType &x)
|
||||
// m_fjac.reserve(VectorXi::Constant(n,5)); // FIXME Find a better alternative
|
||||
if (!m_useExternalScaling)
|
||||
m_diag.resize(n);
|
||||
eigen_assert( (!m_useExternalScaling || m_diag.size()==n) || "When m_useExternalScaling is set, the caller must provide a valid 'm_diag'");
|
||||
eigen_assert( (!m_useExternalScaling || m_diag.size()==n) && "When m_useExternalScaling is set, the caller must provide a valid 'm_diag'");
|
||||
m_qtf.resize(n);
|
||||
|
||||
/* Function Body */
|
||||
|
||||
@@ -65,7 +65,7 @@ template <typename MatrixType>
|
||||
void matrix_exp_pade3(const MatrixType &A, MatrixType &U, MatrixType &V)
|
||||
{
|
||||
typedef typename NumTraits<typename traits<MatrixType>::Scalar>::Real RealScalar;
|
||||
const RealScalar b[] = {120., 60., 12., 1.};
|
||||
const RealScalar b[] = {120.L, 60.L, 12.L, 1.L};
|
||||
const MatrixType A2 = A * A;
|
||||
const MatrixType tmp = b[3] * A2 + b[1] * MatrixType::Identity(A.rows(), A.cols());
|
||||
U.noalias() = A * tmp;
|
||||
@@ -81,7 +81,7 @@ template <typename MatrixType>
|
||||
void matrix_exp_pade5(const MatrixType &A, MatrixType &U, MatrixType &V)
|
||||
{
|
||||
typedef typename NumTraits<typename traits<MatrixType>::Scalar>::Real RealScalar;
|
||||
const RealScalar b[] = {30240., 15120., 3360., 420., 30., 1.};
|
||||
const RealScalar b[] = {30240.L, 15120.L, 3360.L, 420.L, 30.L, 1.L};
|
||||
const MatrixType A2 = A * A;
|
||||
const MatrixType A4 = A2 * A2;
|
||||
const MatrixType tmp = b[5] * A4 + b[3] * A2 + b[1] * MatrixType::Identity(A.rows(), A.cols());
|
||||
@@ -98,7 +98,7 @@ template <typename MatrixType>
|
||||
void matrix_exp_pade7(const MatrixType &A, MatrixType &U, MatrixType &V)
|
||||
{
|
||||
typedef typename NumTraits<typename traits<MatrixType>::Scalar>::Real RealScalar;
|
||||
const RealScalar b[] = {17297280., 8648640., 1995840., 277200., 25200., 1512., 56., 1.};
|
||||
const RealScalar b[] = {17297280.L, 8648640.L, 1995840.L, 277200.L, 25200.L, 1512.L, 56.L, 1.L};
|
||||
const MatrixType A2 = A * A;
|
||||
const MatrixType A4 = A2 * A2;
|
||||
const MatrixType A6 = A4 * A2;
|
||||
@@ -118,8 +118,8 @@ template <typename MatrixType>
|
||||
void matrix_exp_pade9(const MatrixType &A, MatrixType &U, MatrixType &V)
|
||||
{
|
||||
typedef typename NumTraits<typename traits<MatrixType>::Scalar>::Real RealScalar;
|
||||
const RealScalar b[] = {17643225600., 8821612800., 2075673600., 302702400., 30270240.,
|
||||
2162160., 110880., 3960., 90., 1.};
|
||||
const RealScalar b[] = {17643225600.L, 8821612800.L, 2075673600.L, 302702400.L, 30270240.L,
|
||||
2162160.L, 110880.L, 3960.L, 90.L, 1.L};
|
||||
const MatrixType A2 = A * A;
|
||||
const MatrixType A4 = A2 * A2;
|
||||
const MatrixType A6 = A4 * A2;
|
||||
@@ -139,9 +139,9 @@ template <typename MatrixType>
|
||||
void matrix_exp_pade13(const MatrixType &A, MatrixType &U, MatrixType &V)
|
||||
{
|
||||
typedef typename NumTraits<typename traits<MatrixType>::Scalar>::Real RealScalar;
|
||||
const RealScalar b[] = {64764752532480000., 32382376266240000., 7771770303897600.,
|
||||
1187353796428800., 129060195264000., 10559470521600., 670442572800.,
|
||||
33522128640., 1323241920., 40840800., 960960., 16380., 182., 1.};
|
||||
const RealScalar b[] = {64764752532480000.L, 32382376266240000.L, 7771770303897600.L,
|
||||
1187353796428800.L, 129060195264000.L, 10559470521600.L, 670442572800.L,
|
||||
33522128640.L, 1323241920.L, 40840800.L, 960960.L, 16380.L, 182.L, 1.L};
|
||||
const MatrixType A2 = A * A;
|
||||
const MatrixType A4 = A2 * A2;
|
||||
const MatrixType A6 = A4 * A2;
|
||||
@@ -210,9 +210,9 @@ struct matrix_exp_computeUV<MatrixType, float>
|
||||
using std::pow;
|
||||
const float l1norm = arg.cwiseAbs().colwise().sum().maxCoeff();
|
||||
squarings = 0;
|
||||
if (l1norm < 4.258730016922831e-001) {
|
||||
if (l1norm < 4.258730016922831e-001f) {
|
||||
matrix_exp_pade3(arg, U, V);
|
||||
} else if (l1norm < 1.880152677804762e+000) {
|
||||
} else if (l1norm < 1.880152677804762e+000f) {
|
||||
matrix_exp_pade5(arg, U, V);
|
||||
} else {
|
||||
const float maxnorm = 3.925724783138660f;
|
||||
@@ -257,7 +257,6 @@ struct matrix_exp_computeUV<MatrixType, long double>
|
||||
static void run(const MatrixType& arg, MatrixType& U, MatrixType& V, int& squarings)
|
||||
{
|
||||
#if LDBL_MANT_DIG == 53 // double precision
|
||||
|
||||
matrix_exp_computeUV<MatrixType, double>::run(arg, U, V, squarings);
|
||||
|
||||
#else
|
||||
|
||||
@@ -132,6 +132,7 @@ template <typename EivalsType, typename Cluster>
|
||||
void matrix_function_partition_eigenvalues(const EivalsType& eivals, std::list<Cluster>& clusters)
|
||||
{
|
||||
typedef typename EivalsType::Index Index;
|
||||
typedef typename EivalsType::RealScalar RealScalar;
|
||||
for (Index i=0; i<eivals.rows(); ++i) {
|
||||
// Find cluster containing i-th ei'val, adding a new cluster if necessary
|
||||
typename std::list<Cluster>::iterator qi = matrix_function_find_cluster(i, clusters);
|
||||
@@ -145,7 +146,7 @@ void matrix_function_partition_eigenvalues(const EivalsType& eivals, std::list<C
|
||||
|
||||
// Look for other element to add to the set
|
||||
for (Index j=i+1; j<eivals.rows(); ++j) {
|
||||
if (abs(eivals(j) - eivals(i)) <= matrix_function_separation
|
||||
if (abs(eivals(j) - eivals(i)) <= RealScalar(matrix_function_separation)
|
||||
&& std::find(qi->begin(), qi->end(), j) == qi->end()) {
|
||||
typename std::list<Cluster>::iterator qj = matrix_function_find_cluster(j, clusters);
|
||||
if (qj == clusters.end()) {
|
||||
@@ -403,11 +404,10 @@ struct matrix_function_compute<MatrixType, 0>
|
||||
typedef internal::traits<MatrixType> Traits;
|
||||
typedef typename Traits::Scalar Scalar;
|
||||
static const int Rows = Traits::RowsAtCompileTime, Cols = Traits::ColsAtCompileTime;
|
||||
static const int Options = MatrixType::Options;
|
||||
static const int MaxRows = Traits::MaxRowsAtCompileTime, MaxCols = Traits::MaxColsAtCompileTime;
|
||||
|
||||
typedef std::complex<Scalar> ComplexScalar;
|
||||
typedef Matrix<ComplexScalar, Rows, Cols, Options, MaxRows, MaxCols> ComplexMatrix;
|
||||
typedef Matrix<ComplexScalar, Rows, Cols, 0, MaxRows, MaxCols> ComplexMatrix;
|
||||
|
||||
ComplexMatrix CA = A.template cast<ComplexScalar>();
|
||||
ComplexMatrix Cresult;
|
||||
@@ -508,9 +508,8 @@ template<typename Derived> class MatrixFunctionReturnValue
|
||||
typedef internal::traits<NestedEvalTypeClean> Traits;
|
||||
static const int RowsAtCompileTime = Traits::RowsAtCompileTime;
|
||||
static const int ColsAtCompileTime = Traits::ColsAtCompileTime;
|
||||
static const int Options = NestedEvalTypeClean::Options;
|
||||
typedef std::complex<typename NumTraits<Scalar>::Real> ComplexScalar;
|
||||
typedef Matrix<ComplexScalar, Dynamic, Dynamic, Options, RowsAtCompileTime, ColsAtCompileTime> DynMatrixType;
|
||||
typedef Matrix<ComplexScalar, Dynamic, Dynamic, 0, RowsAtCompileTime, ColsAtCompileTime> DynMatrixType;
|
||||
|
||||
typedef internal::MatrixFunctionAtomic<DynMatrixType> AtomicType;
|
||||
AtomicType atomic(m_f);
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
#ifndef EIGEN_MATRIX_LOGARITHM
|
||||
#define EIGEN_MATRIX_LOGARITHM
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.141592653589793238462643383279503L
|
||||
#endif
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
namespace internal {
|
||||
@@ -41,6 +37,7 @@ template <typename MatrixType>
|
||||
void matrix_log_compute_2x2(const MatrixType& A, MatrixType& result)
|
||||
{
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
using std::abs;
|
||||
using std::ceil;
|
||||
using std::imag;
|
||||
@@ -58,15 +55,15 @@ void matrix_log_compute_2x2(const MatrixType& A, MatrixType& result)
|
||||
{
|
||||
result(0,1) = A(0,1) / A(0,0);
|
||||
}
|
||||
else if ((abs(A(0,0)) < 0.5*abs(A(1,1))) || (abs(A(0,0)) > 2*abs(A(1,1))))
|
||||
else if ((abs(A(0,0)) < RealScalar(0.5)*abs(A(1,1))) || (abs(A(0,0)) > 2*abs(A(1,1))))
|
||||
{
|
||||
result(0,1) = A(0,1) * (logA11 - logA00) / y;
|
||||
}
|
||||
else
|
||||
{
|
||||
// computation in previous branch is inaccurate if A(1,1) \approx A(0,0)
|
||||
int unwindingNumber = static_cast<int>(ceil((imag(logA11 - logA00) - M_PI) / (2*M_PI)));
|
||||
result(0,1) = A(0,1) * (numext::log1p(y/A(0,0)) + Scalar(0,2*M_PI*unwindingNumber)) / y;
|
||||
int unwindingNumber = static_cast<int>(ceil((imag(logA11 - logA00) - RealScalar(EIGEN_PI)) / RealScalar(2*EIGEN_PI)));
|
||||
result(0,1) = A(0,1) * (numext::log1p(y/A(0,0)) + Scalar(0,2*EIGEN_PI*unwindingNumber)) / y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,8 +233,8 @@ void matrix_log_compute_big(const MatrixType& A, MatrixType& result)
|
||||
MatrixType T = A, sqrtT;
|
||||
|
||||
int maxPadeDegree = matrix_log_max_pade_degree<Scalar>::value;
|
||||
const RealScalar maxNormForPade = maxPadeDegree<= 5? 5.3149729967117310e-1: // single precision
|
||||
maxPadeDegree<= 7? 2.6429608311114350e-1: // double precision
|
||||
const RealScalar maxNormForPade = maxPadeDegree<= 5? 5.3149729967117310e-1L: // single precision
|
||||
maxPadeDegree<= 7? 2.6429608311114350e-1L: // double precision
|
||||
maxPadeDegree<= 8? 2.32777776523703892094e-1L: // extended precision
|
||||
maxPadeDegree<=10? 1.05026503471351080481093652651105e-1L: // double-double
|
||||
1.1880960220216759245467951592883642e-1L; // quadruple precision
|
||||
@@ -337,9 +334,8 @@ public:
|
||||
typedef internal::traits<DerivedEvalTypeClean> Traits;
|
||||
static const int RowsAtCompileTime = Traits::RowsAtCompileTime;
|
||||
static const int ColsAtCompileTime = Traits::ColsAtCompileTime;
|
||||
static const int Options = DerivedEvalTypeClean::Options;
|
||||
typedef std::complex<typename NumTraits<Scalar>::Real> ComplexScalar;
|
||||
typedef Matrix<ComplexScalar, Dynamic, Dynamic, Options, RowsAtCompileTime, ColsAtCompileTime> DynMatrixType;
|
||||
typedef Matrix<ComplexScalar, Dynamic, Dynamic, 0, RowsAtCompileTime, ColsAtCompileTime> DynMatrixType;
|
||||
typedef internal::MatrixLogarithmAtomic<DynMatrixType> AtomicType;
|
||||
AtomicType atomic;
|
||||
|
||||
|
||||
@@ -196,11 +196,11 @@ void MatrixPowerAtomic<MatrixType>::computeBig(ResultType& res) const
|
||||
{
|
||||
using std::ldexp;
|
||||
const int digits = std::numeric_limits<RealScalar>::digits;
|
||||
const RealScalar maxNormForPade = digits <= 24? 4.3386528e-1f: // sigle precision
|
||||
digits <= 53? 2.789358995219730e-1: // double precision
|
||||
digits <= 64? 2.4471944416607995472e-1L: // extended precision
|
||||
digits <= 106? 1.1016843812851143391275867258512e-1L: // double-double
|
||||
9.134603732914548552537150753385375e-2L; // quadruple precision
|
||||
const RealScalar maxNormForPade = digits <= 24? 4.3386528e-1L // single precision
|
||||
: digits <= 53? 2.789358995219730e-1L // double precision
|
||||
: digits <= 64? 2.4471944416607995472e-1L // extended precision
|
||||
: digits <= 106? 1.1016843812851143391275867258512e-1L // double-double
|
||||
: 9.134603732914548552537150753385375e-2L; // quadruple precision
|
||||
MatrixType IminusT, sqrtT, T = m_A.template triangularView<Upper>();
|
||||
RealScalar normIminusT;
|
||||
int degree, degree2, numberOfSquareRoots = 0;
|
||||
@@ -264,7 +264,7 @@ inline int MatrixPowerAtomic<MatrixType>::getPadeDegree(long double normIminusT)
|
||||
1.999045567181744e-1L, 2.789358995219730e-1L };
|
||||
#elif LDBL_MANT_DIG <= 64
|
||||
const int maxPadeDegree = 8;
|
||||
const double maxNormForPade[] = { 6.3854693117491799460e-3L /* degree = 3 */ , 2.6394893435456973676e-2L,
|
||||
const long double maxNormForPade[] = { 6.3854693117491799460e-3L /* degree = 3 */ , 2.6394893435456973676e-2L,
|
||||
6.4216043030404063729e-2L, 1.1701165502926694307e-1L, 1.7904284231268670284e-1L, 2.4471944416607995472e-1L };
|
||||
#elif LDBL_MANT_DIG <= 106
|
||||
const int maxPadeDegree = 10;
|
||||
@@ -298,8 +298,8 @@ MatrixPowerAtomic<MatrixType>::computeSuperDiag(const ComplexScalar& curr, const
|
||||
|
||||
ComplexScalar logCurr = log(curr);
|
||||
ComplexScalar logPrev = log(prev);
|
||||
int unwindingNumber = ceil((numext::imag(logCurr - logPrev) - M_PI) / (2*M_PI));
|
||||
ComplexScalar w = numext::log1p((curr-prev)/prev)/RealScalar(2) + ComplexScalar(0, M_PI*unwindingNumber);
|
||||
int unwindingNumber = ceil((numext::imag(logCurr - logPrev) - RealScalar(EIGEN_PI)) / RealScalar(2*EIGEN_PI));
|
||||
ComplexScalar w = numext::log1p((curr-prev)/prev)/RealScalar(2) + ComplexScalar(0, EIGEN_PI*unwindingNumber);
|
||||
return RealScalar(2) * exp(RealScalar(0.5) * p * (logCurr + logPrev)) * sinh(p * w) / (curr - prev);
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ class MatrixPower : internal::noncopyable
|
||||
|
||||
private:
|
||||
typedef std::complex<RealScalar> ComplexScalar;
|
||||
typedef Matrix<ComplexScalar, Dynamic, Dynamic, MatrixType::Options,
|
||||
typedef Matrix<ComplexScalar, Dynamic, Dynamic, 0,
|
||||
MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> ComplexMatrix;
|
||||
|
||||
/** \brief Reference to the base of matrix power. */
|
||||
|
||||
@@ -150,7 +150,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveInit(FVectorType &x)
|
||||
fjac.resize(n, n);
|
||||
if (!useExternalScaling)
|
||||
diag.resize(n);
|
||||
eigen_assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'");
|
||||
eigen_assert( (!useExternalScaling || diag.size()==n) && "When useExternalScaling is set, the caller must provide a valid 'diag'");
|
||||
|
||||
/* Function Body */
|
||||
nfev = 0;
|
||||
@@ -390,7 +390,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffInit(FVectorType &
|
||||
fvec.resize(n);
|
||||
if (!useExternalScaling)
|
||||
diag.resize(n);
|
||||
eigen_assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'");
|
||||
eigen_assert( (!useExternalScaling || diag.size()==n) && "When useExternalScaling is set, the caller must provide a valid 'diag'");
|
||||
|
||||
/* Function Body */
|
||||
nfev = 0;
|
||||
|
||||
@@ -179,7 +179,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeInit(FVectorType &x)
|
||||
fjac.resize(m, n);
|
||||
if (!useExternalScaling)
|
||||
diag.resize(n);
|
||||
eigen_assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'");
|
||||
eigen_assert( (!useExternalScaling || diag.size()==n) && "When useExternalScaling is set, the caller must provide a valid 'diag'");
|
||||
qtf.resize(n);
|
||||
|
||||
/* Function Body */
|
||||
@@ -215,7 +215,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOneStep(FVectorType &x)
|
||||
{
|
||||
using std::abs;
|
||||
using std::sqrt;
|
||||
|
||||
|
||||
eigen_assert(x.size()==n); // check the caller is not cheating us
|
||||
|
||||
/* calculate the jacobian matrix. */
|
||||
@@ -398,7 +398,7 @@ LevenbergMarquardt<FunctorType,Scalar>::minimizeOptimumStorageInit(FVectorType
|
||||
fjac.resize(n, n);
|
||||
if (!useExternalScaling)
|
||||
diag.resize(n);
|
||||
eigen_assert( (!useExternalScaling || diag.size()==n) || "When useExternalScaling is set, the caller must provide a valid 'diag'");
|
||||
eigen_assert( (!useExternalScaling || diag.size()==n) && "When useExternalScaling is set, the caller must provide a valid 'diag'");
|
||||
qtf.resize(n);
|
||||
|
||||
/* Function Body */
|
||||
|
||||
@@ -95,10 +95,10 @@ template<typename Scalar> struct GoogleSparseHashMapTraits
|
||||
*
|
||||
* \brief The RandomSetter is a wrapper object allowing to set/update a sparse matrix with random access
|
||||
*
|
||||
* \param SparseMatrixType the type of the sparse matrix we are updating
|
||||
* \param MapTraits a traits class representing the map implementation used for the temporary sparse storage.
|
||||
* \tparam SparseMatrixType the type of the sparse matrix we are updating
|
||||
* \tparam MapTraits a traits class representing the map implementation used for the temporary sparse storage.
|
||||
* Its default value depends on the system.
|
||||
* \param OuterPacketBits defines the number of rows (or columns) manage by a single map object
|
||||
* \tparam OuterPacketBits defines the number of rows (or columns) manage by a single map object
|
||||
* as a power of two exponent.
|
||||
*
|
||||
* This class temporarily represents a sparse matrix object using a generic map implementation allowing for
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace Eigen
|
||||
|
||||
Matrix<Scalar,Order,Order> ndu(p+1,p+1);
|
||||
|
||||
double saved, temp;
|
||||
Scalar saved, temp; // FIXME These were double instead of Scalar. Was there a reason for that?
|
||||
|
||||
ndu(0,0) = 1.0;
|
||||
|
||||
@@ -433,7 +433,7 @@ namespace Eigen
|
||||
// Compute the k-th derivative
|
||||
for (DenseIndex k=1; k<=static_cast<DenseIndex>(n); ++k)
|
||||
{
|
||||
double d = 0.0;
|
||||
Scalar d = 0.0;
|
||||
DenseIndex rk,pk,j1,j2;
|
||||
rk = r-k; pk = p-k;
|
||||
|
||||
|
||||
@@ -130,12 +130,12 @@ namespace Eigen
|
||||
|
||||
ParameterVectorType temporaryParameters(numParameters + 1);
|
||||
KnotVectorType derivativeKnots(numInternalDerivatives);
|
||||
for (unsigned int i = 0; i < numAverageKnots - 1; ++i)
|
||||
for (DenseIndex i = 0; i < numAverageKnots - 1; ++i)
|
||||
{
|
||||
temporaryParameters[0] = averageKnots[i];
|
||||
ParameterVectorType parameterIndices(numParameters);
|
||||
int temporaryParameterIndex = 1;
|
||||
for (int j = 0; j < numParameters; ++j)
|
||||
for (DenseIndex j = 0; j < numParameters; ++j)
|
||||
{
|
||||
Scalar parameter = parameters[j];
|
||||
if (parameter >= averageKnots[i] && parameter < averageKnots[i + 1])
|
||||
@@ -167,7 +167,7 @@ namespace Eigen
|
||||
derivativeKnots.data(), derivativeKnots.data() + derivativeKnots.size(),
|
||||
temporaryKnots.data());
|
||||
|
||||
// Number of control points (one for each point and derivative) plus spline order.
|
||||
// Number of knots (one for each point and derivative) plus spline order.
|
||||
DenseIndex numKnots = numParameters + numDerivatives + degree + 1;
|
||||
knots.resize(numKnots);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user