I can't understand how to write templated function that accepts both vector and matrix column?
For example:
template<typename T>
void foo(
const Eigen::MatrixX<T>& M){
}
int main(){
Eigen::VectorX<double> v(3);
Eigen::MatrixX<double> m(4,3);
foo(m); // fine
foo(m.col(0)); // broken
foo(m.row(0)); // broken
foo(v); // broken
}
only foo(m);
is ok.
I've seen examples that do this with predefined types and I've seen examples that explore templates. Neither of them do shows how to solve described task with templated function.
Edit: Also I would like to pass dynamic size vector and, but not necessary, fixed size