apply_multiclass ported to Eigen3