/* ----------------------------------------------------------------------- *//** * * @file EigenIntegration.hpp * *//* ----------------------------------------------------------------------- */ #ifndef MADLIB_DBAL_EIGEN_INTEGRATION_HPP #define MADLIB_DBAL_EIGEN_INTEGRATION_HPP // Plugin with methods to add to Eigen's MatrixBase #define EIGEN_MATRIXBASE_PLUGIN #include #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET #include namespace madlib { namespace dbal { namespace eigen_integration { typedef Eigen::VectorXi IntegerVector; typedef Eigen::VectorXd ColumnVector; typedef Eigen::RowVectorXd RowVector; typedef Eigen::VectorXcd VectorXcd; typedef Eigen::MatrixXd Matrix; typedef Eigen::MatrixXcd ComplexMatrix; typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE Index; typedef Eigen::PermutationMatrix PermutationMatrix; typedef Eigen::SparseVector SparseColumnVector; typedef Eigen::SparseMatrix SparseMatrix; typedef Eigen::LDLT MatrixLDLT; typedef Eigen::HouseholderQR HouseholderQR; typedef Eigen::FullPivLU FullPivLU; typedef Eigen::JacobiSVD JacobiSVD; enum ViewMode { Lower = Eigen::Lower, Upper = Eigen::Upper, StrictlyLower = Eigen::StrictlyLower }; enum DecompositionOptions { ComputeEigenvectors = Eigen::ComputeEigenvectors, EigenvaluesOnly = Eigen::EigenvaluesOnly, ComputeFullU = Eigen::ComputeFullU, ComputeFullV = Eigen::ComputeFullV }; enum SPDDecompositionExtras { ComputePseudoInverse = 0x01 }; using Eigen::Success; // In the following we make several definitions that allow certain object // methods to be called as a plain functions. This makes using Eigen more // similar to Armadillo. template inline typename Eigen::MatrixBase::ConstTransposeReturnType static trans(const Eigen::MatrixBase& mat) { return mat.transpose(); } template inline typename Eigen::internal::scalar_product_traits< typename Eigen::internal::traits::Scalar, typename Eigen::internal::traits::Scalar >::ReturnType static dot( const Eigen::MatrixBase& mat, const Eigen::MatrixBase& other) { return mat.dot(other); } template inline typename Eigen::MatrixBase::CoeffReturnType static as_scalar(const Eigen::MatrixBase& mat) { return mat.value(); } template inline typename Eigen::MatrixBase::template TriangularViewReturnType::Type static triangularView(Eigen::MatrixBase& mat) { return mat.template triangularView(); } template bool static isfinite(const Eigen::MatrixBase& mat) { return mat.is_finite(); } } // namespace eigen_integration } // namespace dbal } // namespace madlib #include "HandleMap_proto.hpp" #include "SymmetricPositiveDefiniteEigenDecomposition_proto.hpp" #include "HandleMap_impl.hpp" #include "SymmetricPositiveDefiniteEigenDecomposition_impl.hpp" #endif // defined(MADLIB_EIGEN_INTEGRATION_HPP)