<commit_before>package ptrman.math;

import org.apache.commons.math3.linear.ArrayRealVector;
import ptrman.Datastructures.Vector2d;

/**
 *
 */
public class ArrayRealVectorHelper {
    public static class Dimensions2 {
        public static ArrayRealVector getTangent(final ArrayRealVector vector) {
            final double x = vector.getDataRef()[0];
            final double y = vector.getDataRef()[1];

            return new ArrayRealVector(new double[]{-y, x});
        }
    }

    public static ArrayRealVector normalize(ArrayRealVector vector) {
        ArrayRealVector result = new ArrayRealVector(vector.getDimension());
        double length = vector.getNorm();
        double inverseLength = 1.0/length;

        for( int i = 0; i < vector.getDimension(); i++ ) {
            result.getDataRef()[i] = inverseLength * vector.getDataRef()[i];
        }

        return result;
    }

    public static ArrayRealVector getScaled(ArrayRealVector vector, double scale) {
        ArrayRealVector result = new ArrayRealVector(vector.getDimension());

        for( int i = 0; i < vector.getDimension(); i++ ) {
            result.getDataRef()[i] = vector.getDataRef()[i] * scale;
        }

        return result;
    }

    public static Vector2d<Integer> arrayRealVectorToInteger(ArrayRealVector vector) {
        return new Vector2d<>((int)(vector.getDataRef()[0]), (int)(vector.getDataRef()[1]));
    }
}
<commit_msg> * [math] integer to ArrayRealVector<commit_after>package ptrman.math;

import org.apache.commons.math3.linear.ArrayRealVector;
import ptrman.Datastructures.Vector2d;

/**
 *
 */
public class ArrayRealVectorHelper {
    public static ArrayRealVector integerToArrayRealVector(final Vector2d<Integer> vector) {
        return new ArrayRealVector(new double[]{vector.x, vector.y});
    }

    public static class Dimensions2 {
        public static ArrayRealVector getTangent(final ArrayRealVector vector) {
            final double x = vector.getDataRef()[0];
            final double y = vector.getDataRef()[1];

            return new ArrayRealVector(new double[]{-y, x});
        }
    }

    public static ArrayRealVector normalize(ArrayRealVector vector) {
        ArrayRealVector result = new ArrayRealVector(vector.getDimension());
        double length = vector.getNorm();
        double inverseLength = 1.0/length;

        for( int i = 0; i < vector.getDimension(); i++ ) {
            result.getDataRef()[i] = inverseLength * vector.getDataRef()[i];
        }

        return result;
    }

    public static ArrayRealVector getScaled(ArrayRealVector vector, double scale) {
        ArrayRealVector result = new ArrayRealVector(vector.getDimension());

        for( int i = 0; i < vector.getDimension(); i++ ) {
            result.getDataRef()[i] = vector.getDataRef()[i] * scale;
        }

        return result;
    }

    public static Vector2d<Integer> arrayRealVectorToInteger(ArrayRealVector vector) {
        return new Vector2d<>((int)(vector.getDataRef()[0]), (int)(vector.getDataRef()[1]));
    }
}

{'fraction_non_alphanumeric': 0.11592775041050903, 'fraction_numerical': 0.008866995073891626, 'mean_word_length': 3.0184696569920844, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 8, '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': '8609', 'n_tokens_mistral': 851, 'n_tokens_neox': 851, 'n_words': 197}