src/utils/matrix/ComputableMatrix.java
public static Matrix encodeToBitColumnVector(int value, int maxBits) throws MatrixException {
        String binaryCode = String.format("%" + maxBits + "s", Integer.toBinaryString(value)).replaceAll(" ", "0");
        if (binaryCode.length() > maxBits) throw new MatrixException("Binary code length: " + binaryCode.length() + " is exceeding number of maximum bits: " + maxBits);
        Matrix encodedMatrix = new DMatrix(binaryCode.length(), 1);
        for (int charIndex = 0; charIndex < binaryCode.length(); charIndex++) {
            char charAt = binaryCode.charAt(charIndex);
            if (charAt == '1') encodedMatrix.setValue(charIndex, 0, 1);
        }
        return encodedMatrix;
    }
/**
     * Encodes to value to bit column vector.
     *
     * @param value value
     * @param maxBits max number of bits.
     * @return bit column vector.
     * @throws MatrixException throws exception if binary code size is exceeding number of maximum bits.
     */
Encodes to value to bit column vector.

@param value value
@param maxBits max number of bits.
@return bit column vector.
@throws MatrixException throws exception if binary code size is exceeding number of maximum bits.
Encodes to value to bit column vector . @param value value @param maxBits max number of bits . @return bit column vector . @throws MatrixException throws exception if binary code size is exceeding number of maximum bits .
public static Matrix encodeToBitColumnVector(int value, int maxBits) throws MatrixException {
        String binaryCode = String.format("%" + maxBits + "s", Integer.toBinaryString(value)).replaceAll(" ", "0");
        if (binaryCode.length() > maxBits) throw new MatrixException("Binary code length: " + binaryCode.length() + " is exceeding number of maximum bits: " + maxBits);
        Matrix encodedMatrix = new DMatrix(binaryCode.length(), 1);
        for (int charIndex = 0; charIndex < binaryCode.length(); charIndex++) {
            char charAt = binaryCode.charAt(charIndex);
            if (charAt == '1') encodedMatrix.setValue(charIndex, 0, 1);
        }
        return encodedMatrix;
    }
public static Matrix encodeToBitColumnVector ( int value , int maxBits ) throws MatrixException { String binaryCode = String . format ( "%" + maxBits + "s" , Integer . toBinaryString ( value ) ) . replaceAll ( " " , "0" ) ; if ( binaryCode . length ( ) > maxBits ) throw new MatrixException ( "Binary code length: " + binaryCode . length ( ) + " is exceeding number of maximum bits: " + maxBits ) ; Matrix encodedMatrix = new DMatrix ( binaryCode . length ( ) , 1 ) ; for ( int charIndex = 0 ; charIndex < binaryCode . length ( ) ; charIndex ++ ) { char charAt = binaryCode . charAt ( charIndex ) ; if ( charAt == '1' ) encodedMatrix . setValue ( charIndex , 0 , 1 ) ; } return encodedMatrix ; }
Encodes to value to bit column vector.
Encodes to value to bit column vector .