I’m trying to generate a Bernoulli matrix, with values bounded between -1 and 1. I am using OpenCV’s cv::Mat as the data structure to hold the values. Is there an easy way to generate such a matrix? As far as I know, OpenCV does not provide a way to do this so I’m happy to use another library if required.
I’m trying to generate a Bernoulli matrix, with values bounded between -1 and 1.
Share
You need to iterate through the values and assign a random number one-by-one.
Here is how to do that: