Wouldn't it make sense to also allow .diagonal() for Eigen::Arrays? I know the differences in interface between Matrix and Array come from their mathematical interpretation, but can't you speak of the diagonal of a 2D array as well? It certainly would be handy for me, as I often want to manipulate just the diagonal of an Array.
in the meantime you can still write:
I cannot think about use cases where diagonal would make sense for arrays too, so could you please precise a bit your use case/context?