::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;
    }
 void PrintTo(const Eigen::EigenBase<Derived>& mat, ::std::ostream* os)
 {
     (*os) << mat.derived() << "\n";
 }
Exemple #3
0
inline int size2(const Eigen::EigenBase<Derived> &mat) {
  return mat.cols();
}
 T operator()(const Eigen::EigenBase<Derived>& x) const {
   return T(1) / (T(1) + std::exp(- bias - x.derived().dot(weight)));
 }
Exemple #5
0
inline int size1(const Eigen::EigenBase<Derived> &mat) {
  return mat.rows();
}