<commit_before>package at.archistar.crypto.math;

import de.flexiprovider.common.math.linearalgebra.GF2mMatrix;

/**
 *
 * GF2mMatrix does not support rightMultiply, add a (very) simple implementation
 * of this operation.
 *
 * @author <NAME> <<EMAIL>>
 */
public class CustomMatrix extends GF2mMatrix {

    public CustomMatrix(int[][] data) {
        super(GF256.gf256, data);
    }

    public CustomMatrix(byte[] encoded) {
        super(GF256.gf256, encoded);
    }

    public int[] rightMultiply(int vec[]) {

        assert (vec.length == matrix.length);
        assert (vec.length == matrix[0].length);

        int[] result = new int[vec.length];
        for (int i = 0; i < vec.length; i++) {
            int tmp = 0;
            for (int j = 0; j < vec.length; j++) {
                tmp = GF256.add(tmp, GF256.mult(matrix[i][j], vec[j]));
            }
            result[i] = tmp;
        }

        return result;
    }

    public int[] getRow(int i) {
        return matrix[i];
    }

    public void output() {
        System.err.println("matrix:");
        for (int[] tmp : matrix) {
            for (int i : tmp) {
                System.err.print(" " + i);
            }
            System.err.println("");
        }
    }

}
<commit_msg>removed dependency from GF256's gf256<commit_after>package at.archistar.crypto.math;

import de.flexiprovider.common.math.codingtheory.GF2mField;
import de.flexiprovider.common.math.linearalgebra.GF2mMatrix;

/**
 *
 * GF2mMatrix does not support rightMultiply, add a (very) simple implementation
 * of this operation.
 *
 * @author <NAME> <<EMAIL>>
 */
public class CustomMatrix extends GF2mMatrix {
	private static final GF2mField gf256 = new GF2mField(8, 0x11d); // Galois-Field (x^8 + x^4 + x^3 + x + 1 = 0) / 285
	
    public CustomMatrix(int[][] data) {
        super(gf256, data);
    }

    public CustomMatrix(byte[] encoded) {
        super(gf256, encoded);
    }

    public int[] rightMultiply(int vec[]) {

        assert (vec.length == matrix.length);
        assert (vec.length == matrix[0].length);

        int[] result = new int[vec.length];
        for (int i = 0; i < vec.length; i++) {
            int tmp = 0;
            for (int j = 0; j < vec.length; j++) {
                tmp = GF256.add(tmp, GF256.mult(matrix[i][j], vec[j]));
            }
            result[i] = tmp;
        }

        return result;
    }

    public int[] getRow(int i) {
        return matrix[i];
    }

    public void output() {
        System.err.println("matrix:");
        for (int[] tmp : matrix) {
            for (int i : tmp) {
                System.err.print(" " + i);
            }
            System.err.println("");
        }
    }

}

{'fraction_non_alphanumeric': 0.14464944649446496, 'fraction_numerical': 0.025092250922509225, 'mean_word_length': 1.9922737306843268, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6537784', 'n_tokens_mistral': 927, 'n_tokens_neox': 849, 'n_words': 212}