Ask Your Question
1

Double number product matrix

asked 2017-08-02 04:04:23 -0500

Alvaro gravatar image

updated 2017-08-02 08:28:37 -0500

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2017-08-02 04:44:33 -0500

updated 2017-08-02 09:35:55 -0500

Change double number = 1 / 256; to double number = 1.0/ 256.0;

edit flag offensive delete link more

Comments

1.0 / 256 enough

sturkmen gravatar imagesturkmen ( 2017-08-02 09:54:21 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-08-02 04:04:23 -0500

Seen: 118 times

Last updated: Aug 02 '17