DownhillSolver::minimize(x) assumes max(step.cols, step.rows) >= 2

When I understand the documentation correctly, then x and the initial step should be n-dimensional vectors. In the source code of minimize() there is the following assertion:

    CV_Assert( std::min(_step.cols, _step.rows) == 1 &&
              std::max(_step.cols, _step.rows) >= 2 &&
              _step.type() == CV_64FC1 );

Either step.cols or step.rows must be larger than 1. However, in the one-dimensional case, x and step would be vectors with a single element only. So, why does minimize() assume std::max(_step.cols, _step.rows) >= 2?

just curious, what is your ‘use-case’ here ?

doesn’t the assertion above forbid that case (N<2) ?

Probably you are right, but then a short notice about N >= 2 in the documentation would be very helpful.
I solved the problem by setting the values of the second dimension to 0. And it works well.