square() not accessible from Eigen::Product

The component-wise square function is not accessible from Eigen::Product<Eigen::Transpose ...>

in the following context

((x - y).transpose() * A).square()

Instead I use

((x - y).transpose() * A).unaryExpr([](auto z) { return z * z; })