示例#1
0
    ::testing::AssertionResult assert_same(const char* exp_expr,
        const char* act_expr,
        const Eigen::EigenBase<DerivedExp>& exp,
        const Eigen::EigenBase<DerivedAct>& act)
    {
        if (exp.rows() == act.rows() &&
            exp.cols() == act.cols() &&
            exp.derived() == act.derived())
        {
            return ::testing::AssertionSuccess();
        }

        // if eigen did not define the == operator, you could use
        // exp.derived().cwiseEqual(act.derived()).all();

        ::testing::AssertionResult result = ::testing::AssertionFailure()
            << "Eigen objects are not the same: ("
            << exp_expr << ", " << act_expr << ")\n"
            << exp_expr << ":\n"
            << ::testing::PrintToString(exp)
            << "\n---and\n" << act_expr << ":\n"
            << ::testing::PrintToString(act)
            << "\n---are not equal!\n";

        return result;
    }
示例#2
0
 void PrintTo(const Eigen::EigenBase<Derived>& mat, ::std::ostream* os)
 {
     (*os) << mat.derived() << "\n";
 }
示例#3
0
文件: util.hpp 项目: ALPSCore/CT-HYB
inline int size2(const Eigen::EigenBase<Derived> &mat) {
  return mat.cols();
}
示例#4
0
 T operator()(const Eigen::EigenBase<Derived>& x) const {
   return T(1) / (T(1) + std::exp(- bias - x.derived().dot(weight)));
 }
示例#5
0
文件: util.hpp 项目: ALPSCore/CT-HYB
inline int size1(const Eigen::EigenBase<Derived> &mat) {
  return mat.rows();
}