commons-statistics-regression/src/main/java/org/apache/commons/statistics/regression/stored/AbstractRegression.java
/**
     * Validates that the x data and covariance matrix have the same number of rows
     * and that the covariance matrix is square.
     *
     * @param x          the [n,k] array representing the x sample
     * @param covariance the [n,n] array representing the covariance matrix
     * @throws IllegalArgumentException if the number of rows in x is not equal to
     *                                  the number of rows in covariance
     * @throws IllegalArgumentException if the covariance matrix is not square
     */
Validates that the x data and covariance matrix have the same number of rows
and that the covariance matrix is square.

@param x          the [n,k] array representing the x sample
@param covariance the [n,n] array representing the covariance matrix
@throws IllegalArgumentException if the number of rows in x is not equal to
the number of rows in covariance
@throws IllegalArgumentException if the covariance matrix is not square
Validates that the x data and covariance matrix have the same number of rows and that the covariance matrix is square . @param x the [ n k ] array representing the x sample @param covariance the [ n n ] array representing the covariance matrix @throws IllegalArgumentException if the number of rows in x is not equal to the number of rows in covariance @throws IllegalArgumentException if the covariance matrix is not square
protected void validateCovarianceData(double[][] x, double[][] covariance) {
        if (x.length != covariance.length) {
            throw new IllegalArgumentException("x.length = " + x.length + "  covariance.lenth = " + covariance.length);
        }
        if (covariance.length > 0 && covariance.length != covariance[0].length) {
            throw new IllegalArgumentException(
                "covariance.length = " + covariance.length + "  covariance[0].length = " + covariance[0].length);
        }
    }
protected void validateCovarianceData ( double [ ] [ ] x , double [ ] [ ] covariance ) { if ( x . length != covariance . length ) { throw new IllegalArgumentException ( "x.length = " + x . length + "  covariance.lenth = " + covariance . length ) ; } if ( covariance . length > 0 && covariance . length != covariance [ 0 ] . length ) { throw new IllegalArgumentException ( "covariance.length = " + covariance . length + "  covariance[0].length = " + covariance [ 0 ] . length ) ; } }
Validates that the x data and covariance matrix have the same number of rows
 and that the covariance matrix is square.
Validates that the x data and covariance matrix have the same number of rows and that the covariance matrix is square .