Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Double number product matrix

I have tried to multipliate a number with a matrix, the problem is the next: if i do this operation:

Mat deriv_1 = Mat(groundTruth.size[1], groundTruth.size[0], CV_64F);
double number = 1 / 256;
deriv_1 = -number*(groundTruth - probs);// (-1 / M)*(groundTruth - probs);

all the numbers of matrix are 0 but if i do this:

Mat deriv_1 = Mat(groundTruth.size[1], groundTruth.size[0], CV_64F);
deriv_1 = -0.0039*(groundTruth - probs);// (-1 / M)*(groundTruth - probs);

the result is correct. i dont know why.

Double number product matrix

I have tried to multipliate a number with a matrix, the problem is the next: if i do this operation:

Mat deriv_1 = Mat(groundTruth.size[1], groundTruth.size[0], CV_64F);
double number = 1 / 256;
deriv_1 = -number*(groundTruth - probs);// (-1 / M)*(groundTruth - probs);

all the numbers of matrix are 0 but if i do this:

Mat deriv_1 = Mat(groundTruth.size[1], groundTruth.size[0], CV_64F);
deriv_1 = -0.0039*(groundTruth - probs);// (-1 / M)*(groundTruth - probs);

the result is correct. i dont know why.