Is there an easy way to evaluate the column wise dot product of 2 matrices (lets call them A and B, of type Eigen::MatrixXd) that have
A
B
Eigen::MatrixXd
There are many ways to achieve this, all performing lazy evaluation:
res = (A.array() * B.array()).colwise().sum(); res = (A.cwiseProduct(B)).colwise().sum();
And my favorite:
res = (A.transpose() * B).diagonal();