Problem with idft

I’m using idft in my code, see the excerpt below. I tested it many times and it’s been working fine for a long time for many test examples, but all of the sudden if gave me a strange error:


I have no clue what the problem is and what I’m supposed to do to fix it. Any help?

My code:
Mat PhaseExpRe(1, Nphase, CV_64F);
Mat PhaseExpIm(1, Nphase, CV_64F);
Mat complexIn, complexOut;

for (int i = 0; i < Nphase; i++)
{
	PhaseExpRe.at<double>(0, i) = cos(PhasePolyfit[Nphase - i]);
	PhaseExpIm.at<double>(0, i) = -sin(PhasePolyfit[Nphase - i]);
}
Mat planes[] = { Mat_<double>(PhaseExpRe), Mat_<double>(PhaseExpIm) };
merge(planes, 2, complexIn);         
idft(complexIn, complexOut, DFT_ROWS, DFT_COMPLEX_OUTPUT);