src/utils/matrix/ComputableMatrix.java
public int encodeToValue() throws MatrixException {
        if (getColumns() != 1) throw new MatrixException("Matrix must be column vector.");
        int rows = getRows();
        int result = 0;
        for (int row = 0; row < getRows(); row++) {
            double value = getValue(row, 0);
            if (!(value == 0 || value == 1)) throw new MatrixException("Bit column vector must contains values of 0 or 1.");
            result += value * Math.pow(2, (rows - 1) - row);
        }
        return result;
    }
/**
     * Encodes bit column vector value
     *
     * @return value
     * @throws MatrixException throws exception if matrix is not bit column vector.
     */
Encodes bit column vector value

@return value
@throws MatrixException throws exception if matrix is not bit column vector.
Encodes bit column vector value @return value @throws MatrixException throws exception if matrix is not bit column vector .
public int encodeToValue() throws MatrixException {
        if (getColumns() != 1) throw new MatrixException("Matrix must be column vector.");
        int rows = getRows();
        int result = 0;
        for (int row = 0; row < getRows(); row++) {
            double value = getValue(row, 0);
            if (!(value == 0 || value == 1)) throw new MatrixException("Bit column vector must contains values of 0 or 1.");
            result += value * Math.pow(2, (rows - 1) - row);
        }
        return result;
    }
public int encodeToValue ( ) throws MatrixException { if ( getColumns ( ) != 1 ) throw new MatrixException ( "Matrix must be column vector." ) ; int rows = getRows ( ) ; int result = 0 ; for ( int row = 0 ; row < getRows ( ) ; row ++ ) { double value = getValue ( row , 0 ) ; if ( ! ( value == 0 || value == 1 ) ) throw new MatrixException ( "Bit column vector must contains values of 0 or 1." ) ; result += value * Math . pow ( 2 , ( rows - 1 ) - row ) ; } return result ; }
Encodes bit column vector value
Encodes bit column vector value