def _generateRandomCovarianceMatrices(self, num):
varDiag1 = rand(num)*<NUM_LIT>+<NUM_LIT:1.0><EOL>varDiag2 = rand(num)*<NUM_LIT>+<NUM_LIT:1.0><EOL>rotAngle = <NUM_LIT>*pi*rand(num)<EOL>sigma1 = zeros(num)<EOL>sigma2 = zeros(num)<EOL>rho12 = zeros(num)<EOL>for i in range(num): <EOL><INDENT>rotationMatrix=array([[cos(rotAngle[i]), sin(rotAngle[i])], [-sin(rotAngle[i]), cos(rotAngle[i])]])<EOL>covMatrix = dot(rotationMatrix,dot(diag([varDiag1[i],varDiag2[i]]),transpose(rotationMatrix)))<EOL>sigma1[i] = sqrt(covMatrix[<NUM_LIT:0>,<NUM_LIT:0>])<EOL>sigma2[i] = sqrt(covMatrix[<NUM_LIT:1>,<NUM_LIT:1>])<EOL>rho12[i] = covMatrix[<NUM_LIT:0>,<NUM_LIT:1>]/(sigma1[i]*sigma2[i])<EOL><DEDENT>return sigma1, sigma2, rho12<EOL>
Generate random covariance matrices through the transformation of diagonal positive definite
matrices.

Parameters
----------

num - Number of matrices to generate.

Returns
-------

sigma1 - Square root of variance of first variable.
sigma2 - Square root of variance of second variable.
rho12  - Correlation coefficient between errors on variables 1 and 2