def generateCoincMatrix(nCoinc=<NUM_LIT:10>, length=<NUM_LIT>, activity=<NUM_LIT:50>):
coincMatrix0 = SM32(int(nCoinc), int(length))<EOL>theOnes = numpy.array([<NUM_LIT:1.0>] * activity, dtype=numpy.float32)<EOL>for rowIdx in range(nCoinc):<EOL><INDENT>coinc = numpy.array(random.sample(range(length),<EOL>activity), dtype=numpy.uint32)<EOL>coinc.sort()<EOL>coincMatrix0.setRowFromSparse(rowIdx, coinc, theOnes)<EOL><DEDENT>coincMatrix = SM32(int(nCoinc), int(length))<EOL>coincMatrix.initializeWithFixedNNZR(activity)<EOL>return coincMatrix0<EOL>
Generate a coincidence matrix. This is used to generate random inputs to the
temporal learner and to compare the predicted output against.

It generates a matrix of nCoinc rows, each row has length 'length' and has
a total of 'activity' bits on.

Parameters:
-----------------------------------------------
nCoinc:        the number of rows to generate
length:        the length of each row
activity:      the number of ones to put into each row.