public static ZMatrixRMaj hermitianPosDef(int width, Random rand) {
        // This is not formally proven to work.  It just seems to work.
        ZMatrixRMaj a = RandomMatrices_ZDRM.rectangle(width,1,rand);
        ZMatrixRMaj b = new ZMatrixRMaj(1,width);
        ZMatrixRMaj c = new ZMatrixRMaj(width,width);

        CommonOps_ZDRM.transposeConjugate(a,b);
        CommonOps_ZDRM.mult(a, b, c);

        for( int i = 0; i < width; i++ ) {
            c.data[2*(i*width+i)] += 1;
        }

        return c;
    }
public static ZMatrixRMaj hermitianPosDef ( int width , Random rand ) { ZMatrixRMaj a = RandomMatrices_ZDRM . rectangle ( width , 1 , rand ) ; ZMatrixRMaj b = new ZMatrixRMaj ( 1 , width ) ; ZMatrixRMaj c = new ZMatrixRMaj ( width , width ) ; CommonOps_ZDRM . transposeConjugate ( a , b ) ; CommonOps_ZDRM . mult ( a , b , c ) ; for ( int i = 0 ; i < width ; i ++ ) { c . data [ 2 * ( i * width + i ) ] += 1 ; } return c ; }
Creates a random symmetric positive definite matrix.

@param width The width of the square matrix it returns.
@param rand Random number generator used to make the matrix.
@return The random symmetric  positive definite matrix.