eigen: Subtracting a scalar from a vector
The simplest is to move to the so called "array" world:
VECTOR_TYPE test = singular_values.array() - offset;
It's mathematically invalid to subtract a scalar (which is just a one-dimensional vector) from a vector, so Eigen correctly throws an error.
Instead, you should write
auto n = singular_values.size();
VECTOR_TYPE test = singular_values - offset * VECTOR_TYPE::Ones(n);
Moreover, you can have a look at the array()
functionality which provides element-wise transformations.