/** * <p> * Creates a random orthogonal or isometric matrix, depending on the number of rows and columns. * The number of rows must be more than or equal to the number of columns. * </p> * * @param numRows Number of rows in the generated matrix. * @param numCols Number of columns in the generated matrix. * @param rand Random number generator used to create matrices. * @return A new isometric matrix. */ public static DenseMatrix64F createOrthogonal( int numRows , int numCols , Random rand ) { if( numRows < numCols ) { throw new IllegalArgumentException("The number of rows must be more than or equal to the number of columns"); } DenseMatrix64F u[] = createSpan(numRows,numCols,rand); DenseMatrix64F ret = new DenseMatrix64F(numRows,numCols); for( int i = 0; i < numCols; i++ ) { SubmatrixOps.setSubMatrix(u[i],ret,0,0,0,i,numRows,1); } return ret; }
/** * <p> * Creates a random orthogonal or isometric matrix, depending on the number of rows and columns. * The number of rows must be more than or equal to the number of columns. * </p> * * @param numRows Number of rows in the generated matrix. * @param numCols Number of columns in the generated matrix. * @param rand Random number generator used to create matrices. * @return A new isometric matrix. */ public static DenseMatrix64F createOrthogonal( int numRows , int numCols , Random rand ) { if( numRows < numCols ) { throw new IllegalArgumentException("The number of rows must be more than or equal to the number of columns"); } DenseMatrix64F u[] = createSpan(numRows,numCols,rand); DenseMatrix64F ret = new DenseMatrix64F(numRows,numCols); for( int i = 0; i < numCols; i++ ) { SubmatrixOps.setSubMatrix(u[i],ret,0,0,0,i,numRows,1); } return ret; }
/** * <p> * Creates a random orthogonal or isometric matrix, depending on the number of rows and columns. * The number of rows must be more than or equal to the number of columns. * </p> * * @param numRows Number of rows in the generated matrix. * @param numCols Number of columns in the generated matrix. * @param rand Random number generator used to create matrices. * @return A new isometric matrix. */ public static DenseMatrix64F createOrthogonal( int numRows , int numCols , Random rand ) { if( numRows < numCols ) { throw new IllegalArgumentException("The number of rows must be more than or equal to the number of columns"); } DenseMatrix64F u[] = createSpan(numRows,numCols,rand); DenseMatrix64F ret = new DenseMatrix64F(numRows,numCols); for( int i = 0; i < numCols; i++ ) { SubmatrixOps.setSubMatrix(u[i], ret, 0, 0, 0, i, numRows, 1); } return ret; }