12 static double cmpLoss(
const Eigen::MatrixXd &o,
const Eigen::MatrixXd &y) {
13 Eigen::MatrixXd cMatrix = o.array() - y.array();
14 cMatrix = cMatrix.unaryExpr(&sqr);
19 static Eigen::MatrixXd cmpLossGrad(
const Eigen::MatrixXd &yHat,
20 const Eigen::MatrixXd &y) {
21 assert(yHat.rows() == y.rows());
22 return (yHat.array() - y.array()).matrix() * 2;