Package pl.mkaczara.bch.math

Examples of pl.mkaczara.bch.math.BinPolynomial


       
        BigInteger testi = new BigInteger(byteArray);
        ArrayList<BinPolynomial> ret = new ArrayList<>();
       
        while(testi.bitLength() > 0){
            ret.add(new BinPolynomial(testi.and(mask), infoPartDegree));
            testi = testi.shiftRight(infoPartDegree + 1);
        }
        return ret;
    }
View Full Code Here


    public BinPolynomial decode(BinPolynomial input) throws UncorrectableErrorsException {
        int w = 0;
        boolean permamentErrors = false;
       
        while (!permamentErrors) {
            BinPolynomial sx = input.modulo(getCode().getGenerator());
            w = getHammingWeight(sx);
            //Bledy w czesci kontrolnej
            if (w <= getCode().getT()) {
                //Korekta
                input = input.add(sx);
View Full Code Here

     *
     * @param in <b>poprawny</b> wielomian slowa kodu
     * @return wielomian danych zakodowanych w slowie
     */
    protected final BinPolynomial getData(BinPolynomial in){
        BinPolynomial res = new BinPolynomial(in.getPolyVector().and(dataMask), getCode().getK() - 1);
        res = res.divideByMonomial(new BinMonomial(getCode().getN() - getCode().getK()));
        return res;
    }
View Full Code Here

        HashMap<Integer, Integer> syndromesToAlphaPowers = new HashMap<>();
        boolean errors = false;

        //Poszukiwanie syndromow S(1) - S(2T)
        for (int i = 1; i <= 2 * getCode().getT(); i++) {
            BinPolynomial currSyndrom = new BinPolynomial(0);
            for (int j = 0; j < getCode().getN(); j++) {
                //S(i) = R(j) * (S(i) + alfa(i*j))
                if (input.getCoefficient(j)) {
                    currSyndrom = currSyndrom.add(gf.getAlpha((i * j) % getCode().getN()));
                }
            }
            //Czy sa bledy
            if (currSyndrom.getPolyVector().compareTo(BigInteger.ZERO) != 0) {
                errors = true;
            }
            //Zapis potegi alfy zgodnej z syndromem na pozycji i-tej
            syndromesToAlphaPowers.put(i, gf.getPower(currSyndrom));
        }
View Full Code Here

     * @param input wielomian informacji
     * @return wielomian slowa kodowego
     */
    public BinPolynomial encode(BinPolynomial input){
        input = input.multiplyByMonomial(new BinMonomial(code.getN() - code.getK()));
        BinPolynomial rx = input.modulo(code.getGenerator());
        input = input.add(rx);
        return input;
    }
View Full Code Here

TOP

Related Classes of pl.mkaczara.bch.math.BinPolynomial

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.