Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added original Eigen #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Eigen/Eigenvalues
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

#include "Core"

#include "src/Core/util/DisableStupidWarnings.h"

#include "Cholesky"
#include "Jacobi"
#include "Householder"
#include "LU"
#include "Geometry"

#include "src/Core/util/DisableStupidWarnings.h"

/** \defgroup Eigenvalues_Module Eigenvalues module
*
*
Expand Down
4 changes: 2 additions & 2 deletions Eigen/Geometry
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

#include "Core"

#include "src/Core/util/DisableStupidWarnings.h"

#include "SVD"
#include "LU"
#include <limits>

#include "src/Core/util/DisableStupidWarnings.h"

/** \defgroup Geometry_Module Geometry module
*
* This module provides support for:
Expand Down
Empty file modified Eigen/PardisoSupport
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions Eigen/QR
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

#include "Core"

#include "src/Core/util/DisableStupidWarnings.h"

#include "Cholesky"
#include "Jacobi"
#include "Householder"

#include "src/Core/util/DisableStupidWarnings.h"

/** \defgroup QR_Module QR module
*
*
Expand Down
1 change: 1 addition & 0 deletions Eigen/SparseQR
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*
*/

#include "OrderingMethods"
#include "src/SparseCore/SparseColEtree.h"
#include "src/SparseQR/SparseQR.h"

Expand Down
4 changes: 2 additions & 2 deletions Eigen/src/Core/ArrayBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ template<typename Derived> class ArrayBase
// inline void evalTo(Dest& dst) const { dst = matrix(); }

protected:
EIGEN_DEFAULT_COPY_CONSTRUCTOR(ArrayBase)
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(ArrayBase)
EIGEN_DEVICE_FUNC
ArrayBase() : Base() {}

private:
explicit ArrayBase(Index);
Expand Down
Empty file modified Eigen/src/Core/Assign_MKL.h
100644 → 100755
Empty file.
2 changes: 0 additions & 2 deletions Eigen/src/Core/CwiseUnaryView.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense>
{
return derived().nestedExpression().outerStride() * sizeof(typename internal::traits<MatrixType>::Scalar) / sizeof(Scalar);
}
protected:
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(CwiseUnaryViewImpl)
};

} // end namespace Eigen
Expand Down
7 changes: 3 additions & 4 deletions Eigen/src/Core/DenseBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static inline void check_DenseIndex_is_signed() {
*/
template<typename Derived> class DenseBase
#ifndef EIGEN_PARSED_BY_DOXYGEN
: public DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value>
: public DenseCoeffsBase<Derived>
#else
: public DenseCoeffsBase<Derived,DirectWriteAccessors>
#endif // not EIGEN_PARSED_BY_DOXYGEN
Expand Down Expand Up @@ -71,7 +71,7 @@ template<typename Derived> class DenseBase
typedef Scalar value_type;

typedef typename NumTraits<Scalar>::Real RealScalar;
typedef DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value> Base;
typedef DenseCoeffsBase<Derived> Base;

using Base::derived;
using Base::const_cast_derived;
Expand Down Expand Up @@ -587,12 +587,11 @@ template<typename Derived> class DenseBase
}

protected:
EIGEN_DEFAULT_COPY_CONSTRUCTOR(DenseBase)
/** Default constructor. Do nothing. */
EIGEN_DEVICE_FUNC DenseBase()
{
/* Just checks for self-consistency of the flags.
* Only do it when debugging Eigen, as this borders on paranoia and could slow compilation down
* Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down
*/
#ifdef EIGEN_INTERNAL_DEBUGGING
EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor))
Expand Down
7 changes: 3 additions & 4 deletions Eigen/src/Core/DenseStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,8 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
if(size != m_rows*m_cols)
{
internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols);
if (size>0) { // >0 and not simply !=0 to let the compiler knows that size cannot be negative
if (size)
m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size);
}
else
m_data = 0;
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
Expand Down Expand Up @@ -480,7 +479,7 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
if(size != _Rows*m_cols)
{
internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols);
if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative
if (size)
m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size);
else
m_data = 0;
Expand Down Expand Up @@ -554,7 +553,7 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
if(size != m_rows*_Cols)
{
internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows);
if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative
if (size)
m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size);
else
m_data = 0;
Expand Down
9 changes: 6 additions & 3 deletions Eigen/src/Core/GenericPacketMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ template<typename Packet> EIGEN_DEVICE_FUNC inline Packet preverse(const Packet&
/** \internal \returns \a a with real and imaginary part flipped (for complex type only) */
template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pcplxflip(const Packet& a)
{
return Packet(a.imag(),a.real());
// FIXME: uncomment the following in case we drop the internal imag and real functions.
// using std::imag;
// using std::real;
return Packet(imag(a),real(a));
}

/**************************
Expand Down Expand Up @@ -521,10 +524,10 @@ inline void palign(PacketType& first, const PacketType& second)
#ifndef __CUDACC__

template<> inline std::complex<float> pmul(const std::complex<float>& a, const std::complex<float>& b)
{ return std::complex<float>(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); }
{ return std::complex<float>(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); }

template<> inline std::complex<double> pmul(const std::complex<double>& a, const std::complex<double>& b)
{ return std::complex<double>(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); }
{ return std::complex<double>(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); }

#endif

Expand Down
5 changes: 0 additions & 5 deletions Eigen/src/Core/MapBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors>
#endif

protected:
EIGEN_DEFAULT_COPY_CONSTRUCTOR(MapBase)
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MapBase)

template<typename T>
EIGEN_DEVICE_FUNC
Expand Down Expand Up @@ -296,9 +294,6 @@ template<typename Derived> class MapBase<Derived, WriteAccessors>
// In theory we could simply refer to Base:Base::operator=, but MSVC does not like Base::Base,
// see bugs 821 and 920.
using ReadOnlyMapBase::Base::operator=;
protected:
EIGEN_DEFAULT_COPY_CONSTRUCTOR(MapBase)
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MapBase)
};

#undef EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS
Expand Down
16 changes: 5 additions & 11 deletions Eigen/src/Core/MathFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ struct abs2_impl_default<Scalar, true> // IsComplex
EIGEN_DEVICE_FUNC
static inline RealScalar run(const Scalar& x)
{
return x.real()*x.real() + x.imag()*x.imag();
return real(x)*real(x) + imag(x)*imag(x);
}
};

Expand All @@ -313,17 +313,14 @@ struct abs2_retval
****************************************************************************/

template<typename Scalar, bool IsComplex>
struct norm1_default_impl;

template<typename Scalar>
struct norm1_default_impl<Scalar,true>
struct norm1_default_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
EIGEN_DEVICE_FUNC
static inline RealScalar run(const Scalar& x)
{
EIGEN_USING_STD_MATH(abs);
return abs(x.real()) + abs(x.imag());
return abs(real(x)) + abs(imag(x));
}
};

Expand Down Expand Up @@ -665,8 +662,8 @@ struct random_default_impl<Scalar, true, false>
{
static inline Scalar run(const Scalar& x, const Scalar& y)
{
return Scalar(random(x.real(), y.real()),
random(x.imag(), y.imag()));
return Scalar(random(real(x), real(y)),
random(imag(x), imag(y)));
}
static inline Scalar run()
{
Expand Down Expand Up @@ -919,9 +916,6 @@ inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x)
return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x);
}

EIGEN_DEVICE_FUNC
inline bool abs2(bool x) { return x; }

template<typename Scalar>
EIGEN_DEVICE_FUNC
inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x)
Expand Down
8 changes: 1 addition & 7 deletions Eigen/src/Core/MatrixBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,6 @@ template<typename Derived> class MatrixBase
void applyHouseholderOnTheLeft(const EssentialPart& essential,
const Scalar& tau,
Scalar* workspace);
template<typename EssentialPart, typename Temp>
void applyHouseholderOnTheLeft(const EssentialPart& essential,
const Scalar& tau,
Scalar* workspace,
Temp* ess_temp);
template<typename EssentialPart>
void applyHouseholderOnTheRight(const EssentialPart& essential,
const Scalar& tau,
Expand Down Expand Up @@ -469,8 +464,7 @@ template<typename Derived> class MatrixBase
EIGEN_MATRIX_FUNCTION_1(MatrixComplexPowerReturnValue, pow, power to \c p, const std::complex<RealScalar>& p)

protected:
EIGEN_DEFAULT_COPY_CONSTRUCTOR(MatrixBase)
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MatrixBase)
EIGEN_DEVICE_FUNC MatrixBase() : Base() {}

private:
EIGEN_DEVICE_FUNC explicit MatrixBase(int);
Expand Down
12 changes: 5 additions & 7 deletions Eigen/src/Core/PlainObjectBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,8 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0)
{
const bool t0_is_integer_alike = internal::is_valid_index_type<T0>::value;
const bool t1_is_integer_alike = internal::is_valid_index_type<T1>::value;
EIGEN_STATIC_ASSERT(t0_is_integer_alike &&
t1_is_integer_alike,
EIGEN_STATIC_ASSERT(bool(NumTraits<T0>::IsInteger) &&
bool(NumTraits<T1>::IsInteger),
FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
resize(rows,cols);
}
Expand Down Expand Up @@ -775,9 +773,9 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
&& ((!internal::is_same<typename internal::traits<Derived>::XprKind,ArrayXpr>::value || Base::SizeAtCompileTime==Dynamic)),T>::type* = 0)
{
// NOTE MSVC 2008 complains if we directly put bool(NumTraits<T>::IsInteger) as the EIGEN_STATIC_ASSERT argument.
const bool is_integer_alike = internal::is_valid_index_type<T>::value;
EIGEN_UNUSED_VARIABLE(is_integer_alike);
EIGEN_STATIC_ASSERT(is_integer_alike,
const bool is_integer = NumTraits<T>::IsInteger;
EIGEN_UNUSED_VARIABLE(is_integer);
EIGEN_STATIC_ASSERT(is_integer,
FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
resize(size);
}
Expand Down
28 changes: 1 addition & 27 deletions Eigen/src/Core/ProductEvaluators.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,CoeffBasedProductMode>
// but easier on the compiler side
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::assign_op<typename Dst::Scalar,Scalar>());
}

template<typename Dst>
static EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{
Expand All @@ -410,32 +410,6 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,CoeffBasedProductMode>
// dst.noalias() -= lhs.lazyProduct(rhs);
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::sub_assign_op<typename Dst::Scalar,Scalar>());
}

// Catch "dst {,+,-}= (s*A)*B" and evaluate it lazily by moving out the scalar factor:
// dst {,+,-}= s * (A.lazyProduct(B))
// This is a huge benefit for heap-allocated matrix types as it save one costly allocation.
// For them, this strategy is also faster than simply by-passing the heap allocation through
// stack allocation.
// For fixed sizes matrices, this is less obvious, it is sometimes x2 faster, but sometimes x3 slower,
// and the behavior depends also a lot on the compiler... so let's be conservative and enable them for dynamic-size only,
// that is when coming from generic_product_impl<...,GemmProduct> in file GeneralMatrixMatrix.h
template<typename Dst, typename Scalar1, typename Scalar2, typename Plain1, typename Xpr2, typename Func>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void eval_dynamic(Dst& dst, const CwiseBinaryOp<internal::scalar_product_op<Scalar1,Scalar2>,
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>, Xpr2>& lhs, const Rhs& rhs, const Func &func)
{
call_assignment_no_alias(dst, lhs.lhs().functor().m_other * lhs.rhs().lazyProduct(rhs), func);
}

// Here, we we always have LhsT==Lhs, but we need to make it a template type to make the above
// overload more specialized.
template<typename Dst, typename LhsT, typename Func>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void eval_dynamic(Dst& dst, const LhsT& lhs, const Rhs& rhs, const Func &func)
{
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), func);
}


// template<typename Dst>
// static inline void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
Expand Down
5 changes: 2 additions & 3 deletions Eigen/src/Core/Ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ struct traits<Ref<_PlainObjectType, _Options, _StrideType> >

template<typename Derived> struct match {
enum {
IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime,
HasDirectAccess = internal::has_direct_access<Derived>::ret,
StorageOrderMatch = IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)),
StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)),
InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic)
|| int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime)
|| (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1),
OuterStrideMatch = IsVectorAtCompileTime
OuterStrideMatch = Derived::IsVectorAtCompileTime
|| int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime),
// NOTE, this indirection of evaluator<Derived>::Alignment is needed
// to workaround a very strange bug in MSVC related to the instantiation
Expand Down
6 changes: 3 additions & 3 deletions Eigen/src/Core/SolveTriangular.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace internal {
template<typename LhsScalar, typename RhsScalar, typename Index, int Side, int Mode, bool Conjugate, int StorageOrder>
struct triangular_solve_vector;

template <typename Scalar, typename Index, int Side, int Mode, bool Conjugate, int TriStorageOrder, int OtherStorageOrder, int OtherInnerStride>
template <typename Scalar, typename Index, int Side, int Mode, bool Conjugate, int TriStorageOrder, int OtherStorageOrder>
struct triangular_solve_matrix;

// small helper struct extracting some traits on the underlying solver operation
Expand Down Expand Up @@ -98,8 +98,8 @@ struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,Dynamic>
BlockingType blocking(rhs.rows(), rhs.cols(), size, 1, false);

triangular_solve_matrix<Scalar,Index,Side,Mode,LhsProductTraits::NeedToConjugate,(int(Lhs::Flags) & RowMajorBit) ? RowMajor : ColMajor,
(Rhs::Flags&RowMajorBit) ? RowMajor : ColMajor, Rhs::InnerStrideAtCompileTime>
::run(size, othersize, &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.innerStride(), rhs.outerStride(), blocking);
(Rhs::Flags&RowMajorBit) ? RowMajor : ColMajor>
::run(size, othersize, &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride(), blocking);
}
};

Expand Down
2 changes: 0 additions & 2 deletions Eigen/src/Core/Transpose.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Dense>
{
return derived().nestedExpression().coeffRef(index);
}
protected:
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(TransposeImpl)
};

/** \returns an expression of the transpose of *this.
Expand Down
8 changes: 3 additions & 5 deletions Eigen/src/Core/TriangularMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
explicit inline TriangularView(MatrixType& matrix) : m_matrix(matrix)
{}

EIGEN_INHERIT_ASSIGNMENT_OPERATORS(TriangularView)
using Base::operator=;
TriangularView& operator=(const TriangularView &other)
{ return Base::operator=(other); }

/** \copydoc EigenBase::rows() */
EIGEN_DEVICE_FUNC
Expand Down Expand Up @@ -542,10 +544,6 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularViewImpl<_Mat
template<typename ProductType>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE TriangularViewType& _assignProduct(const ProductType& prod, const Scalar& alpha, bool beta);
protected:
EIGEN_DEFAULT_COPY_CONSTRUCTOR(TriangularViewImpl)
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(TriangularViewImpl)

};

/***************************************************************************
Expand Down
Empty file modified Eigen/src/Core/arch/AltiVec/PacketMath.h
100644 → 100755
Empty file.
Empty file modified Eigen/src/Core/arch/SSE/PacketMath.h
100644 → 100755
Empty file.
Empty file modified Eigen/src/Core/arch/ZVector/PacketMath.h
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion Eigen/src/Core/functors/UnaryFunctors.h
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ struct scalar_sign_op<Scalar,true> {
if (aa==real_type(0))
return Scalar(0);
aa = real_type(1)/aa;
return Scalar(a.real()*aa, a.imag()*aa );
return Scalar(real(a)*aa, imag(a)*aa );
}
//TODO
//template <typename Packet>
Expand Down
Loading