src/utils/matrix/MMatrix.java
public Matrix variance(Matrix meanMatrix, Matrix result) throws MatrixException, DynamicParamException {
        if (meanMatrix == null) throw new MatrixException("Mean matrix is not defined");
        if (!hasProcedureFactory()) {
            for (Integer index : matrices.keySet()) result.add(matrices.get(index).subtract(meanMatrix).power(2), result);
            result.divide(size(), result);
        }
        else {
            double expressionLock = procedureFactory.startExpression(this);
            for (Integer index : matrices.keySet()) result.add(matrices.get(index).subtract(meanMatrix).power(2), result);
            result.divide(size(), result);
            result.setProcedureFactory(procedureFactory);
            procedureFactory.createVarianceExpression(expressionLock, this, result);
        }
        return result;
    }
/**
     * Calculates variance.
     *
     * @param meanMatrix matrix containing mean values for variance calculation.
     * @param result result matrix.
     * @return resulting variance
     * @throws MatrixException throws exception if matrices are incorrectly provided.
     * @throws DynamicParamException throws exception if parameter (params) setting fails.
     */
Calculates variance.
@param meanMatrix matrix containing mean values for variance calculation.
@param result result matrix.
@return resulting variance
@throws MatrixException throws exception if matrices are incorrectly provided.
@throws DynamicParamException throws exception if parameter (params) setting fails.
Calculates variance . @param meanMatrix matrix containing mean values for variance calculation . @param result result matrix . @return resulting variance @throws MatrixException throws exception if matrices are incorrectly provided . @throws DynamicParamException throws exception if parameter ( params ) setting fails .
public Matrix variance(Matrix meanMatrix, Matrix result) throws MatrixException, DynamicParamException {
        if (meanMatrix == null) throw new MatrixException("Mean matrix is not defined");
        if (!hasProcedureFactory()) {
            for (Integer index : matrices.keySet()) result.add(matrices.get(index).subtract(meanMatrix).power(2), result);
            result.divide(size(), result);
        }
        else {
            double expressionLock = procedureFactory.startExpression(this);
            for (Integer index : matrices.keySet()) result.add(matrices.get(index).subtract(meanMatrix).power(2), result);
            result.divide(size(), result);
            result.setProcedureFactory(procedureFactory);
            procedureFactory.createVarianceExpression(expressionLock, this, result);
        }
        return result;
    }
public Matrix variance ( Matrix meanMatrix , Matrix result ) throws MatrixException , DynamicParamException { if ( meanMatrix == null ) throw new MatrixException ( "Mean matrix is not defined" ) ; if ( ! hasProcedureFactory ( ) ) { for ( Integer index : matrices . keySet ( ) ) result . add ( matrices . get ( index ) . subtract ( meanMatrix ) . power ( 2 ) , result ) ; result . divide ( size ( ) , result ) ; } else { double expressionLock = procedureFactory . startExpression ( this ) ; for ( Integer index : matrices . keySet ( ) ) result . add ( matrices . get ( index ) . subtract ( meanMatrix ) . power ( 2 ) , result ) ; result . divide ( size ( ) , result ) ; result . setProcedureFactory ( procedureFactory ) ; procedureFactory . createVarianceExpression ( expressionLock , this , result ) ; } return result ; }
Calculates variance.
Calculates variance .