namespace std { template < typename _CharT > struct char_traits; template < typename _CharT, typename = char_traits < _CharT > >class basic_ostream; typedef basic_ostream < char >ostream; template < typename, typename _Traits > class basic_ostream { public:basic_ostream & operator<< (const void *); }; template < typename _Tp > class complex; template <> struct complex { typedef __complex__ double _ComplexT; complex (int = 0) { __real__ _M_value = 0; } _ComplexT _M_value; }; } typedef int __m128d __attribute__ ((__vector_size__ (16))); enum { InnerUnrolling, CompleteUnrolling }; enum { ReadOnlyAccessors, WriteAccessors, DirectWriteAccessors }; enum { InnerProduct }; struct has_direct_access { enum { ret = 1 }; }; struct accessors_level { enum { has_direct_access, has_write_access, value }; }; template < typename Derived > struct EigenBase; template < typename Derived > class DenseBase; template < typename, int = accessors_level::value > class DenseCoeffsBase; template < typename, int, int, int = 0 ? : 0, int = 0, int = 0 > class Matrix; template < typename Derived > class MatrixBase; template < typename, int BlockRows = 0, int BlockCols = 0, bool = 0, bool = has_direct_access::ret > class Block; template < typename, typename, typename Rhs > class CwiseBinaryOp; template < typename, typename, int Mode > class GeneralProduct; template < typename, int = accessors_level::has_write_access ? : 0 > class MapBase; template < typename Rhs > struct product_type; template < typename Rhs, int = product_type < Rhs >::value > struct ProductReturnType; template < typename Derived > class MatrixFunctionReturnValue; template < typename T > struct result_of; template < typename Func, typename ArgType > struct result_of < Func (ArgType) > { typedef ArgType type; }; template < typename Func, typename ArgType0, typename ArgType1 > struct result_of < Func (ArgType0, ArgType1) > { typedef ArgType0 type; }; template < typename T > struct packet_traits; template < typename T > struct unpacket_traits; template < int _Cols > struct size_at_compile_time { enum { ret = _Cols == 0 ? 0 : 1 }; }; template < typename Derived > struct dense_xpr_base { typedef MatrixBase < Derived > type; }; struct GenericNumTraits { enum { IsComplex }; }; template < typename T > struct NumTraits: GenericNumTraits { }; template < typename _Real > struct NumTraits < std::complex < _Real > > { enum { IsComplex = 1 }; }; template < typename Packet > Packet pload (const typename unpacket_traits < Packet >::type *); template <> struct packet_traits { typedef __m128d type; }; template <> struct packet_traits { typedef int type; }; struct Packet1cd { Packet1cd (__m128d & p1):v (p1) { } __m128d v; }; template <> struct packet_traits < std::complex < double >> { typedef Packet1cd type; }; template <> struct unpacket_traits { typedef std::complex < double >type; }; template < typename Derived > class DenseCoeffsBase < Derived, ReadOnlyAccessors >:public EigenBase < Derived > { }; template < typename Derived > class DenseCoeffsBase < Derived, DirectWriteAccessors >:public DenseCoeffsBase < Derived, WriteAccessors > { }; template < typename Derived > class MatrixBase:public DenseBase < Derived > { public:typedef MatrixBase StorageBaseType; DenseBase < Derived >::derived; typedef Derived PlainObject; template < typename NewType > Derived cast () { } template < typename OtherDerived > CwiseBinaryOp < int, Derived, OtherDerived > cwiseProduct (MatrixBase < OtherDerived >); template < typename OtherDerived > void operator= (const DenseBase < OtherDerived > &); template < typename OtherDerived > const typename ProductReturnType < OtherDerived >::Type operator* (const MatrixBase < OtherDerived > &p1) const; const MatrixFunctionReturnValue < Derived > matrixFunction () const; }; template < typename Derived > struct assign_traits { enum { MayUnrollCompletely = Derived::SizeAtCompileTime }; enum { Unrolling = 0 || 0 ? 0 ? : 0 ? : 0 : 1 ? MayUnrollCompletely ? : 0 : 0 ? : 0 }; }; template < typename Derived1 > struct assign_innervec_CompleteUnrolling { enum { JointAlignment }; static void run (Derived1 & p1, const Matrix < std::complex < double >, 1, 1, 0, 0, 0 > &p2) { p1.template copyPacketByOuterInner < Matrix < std::complex < double >, 1, 1, 0, 0, 0 >, 0, JointAlignment > (0, 0, p2); }}; template < typename Derived1, typename, int = assign_traits < Derived1 >::Unrolling > struct assign_impl; template < typename Derived1, typename Derived2 > struct assign_impl { static void run (Derived1 & p1, const Derived2 & p2) { assign_innervec_CompleteUnrolling < Derived1 >::run (p1, p2); }}; template < typename Derived1, typename Derived2 > struct assign_impl { static void run (Derived1, Derived2); }; template < typename Derived, typename OtherDerived, int = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime && 0 && 1 > struct assign_selector; template < typename Derived, typename OtherDerived > struct assign_selector < Derived, OtherDerived, false > { static Derived & run (Derived & p1, const OtherDerived & p2) { p1.lazyAssign (p2.derived ()); }}; template < typename T, int = 0 ? : 1 * sizeof (T) % 16 == 0 ? 16 : 0 > struct plain_array { }; template < typename T > class DenseStorage { plain_array < T > m_data; public:const T * data () const { return m_data. array; } T * data () { return m_data.array; } }; template < typename Derived > class ReturnByValue:public dense_xpr_base < ReturnByValue < Derived > >::type { public:typedef Derived ReturnType; template < typename Dest > void evalTo (Dest & p1) const { static_cast < const Derived *>(0)-> evalTo (p1); }}; template < typename, typename, typename, typename StorageKind > class CwiseBinaryOpImpl; template < typename BinaryOp, typename Lhs, typename Rhs > class CwiseBinaryOpImpl < BinaryOp, Lhs, Rhs, int >: public dense_xpr_base < CwiseBinaryOp < BinaryOp, Lhs, Rhs > >::type { }; template < typename Derived > class MapBase < Derived, ReadOnlyAccessors >:public dense_xpr_base < Derived >::type { public:typedef typename dense_xpr_base < Derived >::type Base; }; template < typename Derived > class MapBase < Derived, WriteAccessors >:public MapBase < Derived, ReadOnlyAccessors > { public:MapBase::Base::operator=; }; template < typename XprType, int BlockRows, int BlockCols, bool InnerPanel > class Block < XprType, BlockRows, BlockCols, InnerPanel, true >: public MapBase < Block < XprType, 0, 0, 0, true > > { public:typedef MapBase < Block > Base; Base::operator =; }; template < typename Rhs > struct product_type { enum { value }; }; template < typename Rhs, int ProductType > struct ProductReturnType { typedef GeneralProduct < Matrix < std::complex < double >, 0, 0, 0, 0, 0 >, Matrix < std::complex < double >, 0, 0, 0, 0, 0 >, ProductType > Type; }; template < typename Lhs, typename Rhs > class GeneralProduct < Lhs, Rhs, InnerProduct >:public Matrix < typename Rhs::Scalar, 1, 1 > { public:GeneralProduct (const Lhs & p1, const Rhs & p2) { Matrix < typename Rhs::Scalar, 1, 1 >::coeffRef (0, 0) = p1.transpose ().cwiseProduct (p2).sum (); }}; class MatrixFunctionAtomic { public:MatrixFunctionAtomic (int) { }}; void __assert_fail (); template < typename T > struct traits: traits < T > { }; template < typename Packet, int LoadMode > Packet ploadt (const typename unpacket_traits < Packet >::type * p1) { return pload < Packet > (p1); } template <> Packet1cd pload (const std::complex < double >*p1) { return *(__m128d *) p1; } template < typename Derived > class DenseCoeffsBase < Derived, WriteAccessors >:public DenseCoeffsBase < Derived, ReadOnlyAccessors > { public:typedef typename traits < Derived >::Index Index; DenseCoeffsBase < Derived, ReadOnlyAccessors >::derived; template < typename OtherDerived, int StoreMode, int LoadMode > void copyPacket (Index, Index, const DenseBase < OtherDerived > &p3) { derived ().template writePacket < StoreMode > (0, 0, p3.derived (). template packet < LoadMode > (0, 0)); } template < typename OtherDerived, int, int LoadMode > void copyPacketByOuterInner (Index, Index, const DenseBase < OtherDerived > &p3) { derived ().template copyPacket < OtherDerived, 0, LoadMode > (0, 0, p3); }}; template < typename Derived > class DenseBase:public DenseCoeffsBase < Derived > { public:typedef typename traits < Derived >::Index Index; typedef DenseCoeffsBase < Derived > Base; Base::derived; Base::size; enum { SizeAtCompileTime = size_at_compile_time < traits < Derived >::ColsAtCompileTime >::ret, MaxSizeAtCompileTime, IsVectorAtCompileTime }; template < typename OtherDerived > Derived & lazyAssign (const DenseBase < OtherDerived > &); Derived transpose () const; typedef Derived ConstSegmentReturnType; DenseBase::ConstSegmentReturnType head (Index); Derived eval () const { } typename traits < Derived >::Scalar sum () const; template < typename BinaryOp > typename result_of < BinaryOp (typename traits < Derived >::Scalar) >::type redux (const BinaryOp &) const; Derived col (Index) const; Derived row (Index); }; template < typename Derived > struct EigenBase { typedef typename traits < Derived >::Index Index; Derived & derived (); const Derived & derived () const { return * static_cast < const Derived *>(this); } Index rows () const { } Index size () const; }; template < typename Derived > template < typename OtherDerived > inline Derived & DenseBase < Derived >::lazyAssign (const DenseBase < OtherDerived > &p1) { assign_impl < Derived, OtherDerived >::run (derived (), p1.derived ()); } template < typename PtrType > inline PtrType eigen_unaligned_array_assert_workaround_gcc47 (PtrType p1) { return p1; } template < typename T > struct plain_array < T, 16 > { T array[1]; plain_array () { (reinterpret_cast < unsigned int >(eigen_unaligned_array_assert_workaround_gcc47 (array)) & 1) == 0 && "" ? static_cast < void >(0) : __assert_fail (); }}; template < typename Derived > struct traits < ReturnByValue < Derived > >: traits < typename traits < Derived >::ReturnType > { }; template < typename Derived > class PlainObjectBase:public dense_xpr_base < Derived >::type { public:typedef typename traits < Derived >::Index Index; typedef typename traits < Derived >::Scalar Scalar; typedef typename packet_traits < Scalar >::type PacketScalar; DenseStorage < Scalar > m_storage; Scalar & coeffRef (Index, Index) { return m_storage.data ()[0]; } template < int LoadMode > PacketScalar packet (Index, Index) const { return ploadt < PacketScalar, LoadMode > (m_storage.data ()); } template < int StoreMode > void writePacket (Index, Index, const PacketScalar &); template < typename OtherDerived > void _set_noalias (const DenseBase < OtherDerived > &p1) { assign_selector < Derived, OtherDerived >::run (this->derived (), p1.derived ()); }}; template < typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols > struct traits < Matrix < _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > > { typedef _Scalar Scalar; typedef int StorageKind; typedef int Index; enum { ColsAtCompileTime = _Cols, MaxColsAtCompileTime }; }; template < typename _Scalar, int _Rows, int _Cols, int, int, int _MaxCols > class Matrix: public PlainObjectBase < Matrix < _Scalar, _Rows, _Cols, 0, 0, _MaxCols > > { public:typedef PlainObjectBase < Matrix > Base; Matrix () { } template < typename OtherDerived > Matrix (const MatrixBase < OtherDerived > &) { } Matrix (const Matrix & p1) { Base::_set_noalias (p1); } template < typename OtherDerived > Matrix (const ReturnByValue < OtherDerived > &p1) { p1.evalTo (*this); }}; template < typename BinaryOp, typename Lhs, typename Rhs > struct traits < CwiseBinaryOp < BinaryOp, Lhs, Rhs > > { enum { ColsAtCompileTime, MaxColsAtCompileTime }; typedef typename result_of < BinaryOp (typename Lhs::Scalar, typename Rhs::Scalar) >::type Scalar; typedef typename traits < Lhs >::Index Index; }; template < typename, typename Lhs, typename Rhs > class CwiseBinaryOp:public CwiseBinaryOpImpl < int, Matrix < std::complex < double >, 0, 0, 0, 0, 0 >, Rhs, typename traits < Rhs >::StorageKind > { }; template < typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool HasDirectAccess > struct traits >:traits < XprType > { }; template < typename Derived > inline typename traits < Derived >::Scalar DenseBase < Derived >::sum ()constconst { if (size ()) return 0; return this->redux (0); } void print_matrix (const Matrix < double, 0, 1 > &) { } template < typename Derived > std::ostream & operator << (std::ostream, const DenseBase < Derived > &p2) { print_matrix (p2.eval ()); } template < typename Derived > template < typename OtherDerived > inline const typename ProductReturnType < OtherDerived >::Type MatrixBase < Derived >::operator* (const MatrixBase < OtherDerived > &p1) const const const const { return typename ProductReturnType < OtherDerived >::Type (derived (), p1.derived ()); } template < typename MatrixType, typename AtomicType, int = NumTraits < typename traits < MatrixType >::Scalar >::IsComplex > class MatrixFunction { typedef traits < MatrixType > Traits; static const int MaxCols = Traits::MaxColsAtCompileTime; typedef std::complex < typename Traits::Scalar > ComplexScalar; typedef Matrix < ComplexScalar, 0, 0, 0, 0, MaxCols > ComplexMatrix; public: MatrixFunction (MatrixType &, AtomicType & p2):m_atomic (p2) { } ComplexMatrix compute_CA = m_A.template cast < ComplexScalar > (); ComplexMatrix compute_Cresult; template < typename ResultType > void compute (ResultType &) { MatrixFunction < ComplexMatrix, AtomicType > mf (compute_CA, m_atomic); mf.compute (compute_Cresult); } MatrixType m_A; AtomicType & m_atomic; }; template < typename MatrixType, typename AtomicType > class MatrixFunction < MatrixType, AtomicType, 1 > { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Index Index; static const int ColsAtCompileTime = traits < MatrixType >::ColsAtCompileTime; typedef Matrix < Scalar, 0, ColsAtCompileTime > DynMatrixType; public:MatrixFunction (const MatrixType &, AtomicType &); template < typename ResultType > void compute (ResultType &); Block < MatrixType > block (); DynMatrixType solveTriangularSylvester (const DynMatrixType &, const DynMatrixType &); AtomicType & m_atomic; Matrix < Index, 0, 1 > m_clusterSize; }; template < typename MatrixType, typename AtomicType > MatrixFunction < MatrixType, AtomicType, 1 >::MatrixFunction (const MatrixType &, AtomicType & p2): m_atomic (p2) { } template < typename MatrixType, typename AtomicType > template < typename ResultType > void MatrixFunction < MatrixType, AtomicType, 1 >::compute (ResultType &) { for (Index diagIndex; m_clusterSize.rows (); diagIndex++) { DynMatrixType A = block (), B = block (); block () = solveTriangularSylvester (A, B); } } template < typename MatrixType, typename AtomicType > typename MatrixFunction < MatrixType, AtomicType, 1 >::DynMatrixType MatrixFunction < MatrixType, AtomicType, 1 >::solveTriangularSylvester (const DynMatrixType & p1, const DynMatrixType & p2) { DynMatrixType X; for (Index m; m;) Matrix < Scalar, 1, 1 > XBmatrix = X.row (0).head (0) * p2.col (0).head (0); } template < typename Derived > class MatrixFunctionReturnValue:public ReturnByValue < MatrixFunctionReturnValue < Derived > > { public:Derived StemFunction; template < typename ResultType > void evalTo (ResultType & p1) const { typedef typename Derived::PlainObject PlainObject; MatrixFunctionAtomic atomic (0); PlainObject Aevaluated = m_A.eval (); MatrixFunction < PlainObject, MatrixFunctionAtomic > mf (Aevaluated, atomic); mf. compute (p1); } Derived m_A; }; template < typename Derived > struct traits < MatrixFunctionReturnValue < Derived > > { typedef typename Derived::PlainObject ReturnType; }; template < typename Derived > const MatrixFunctionReturnValue < Derived > MatrixBase < Derived >::matrixFunction () const const const const { } namespace std { ostream cout; } main () { Matrix < double, 0, 0 > A; std::cout << "" << A.matrixFunction () << ""; }