<commit_before>/*
        Sorts matrix like from something like this:
                [
                        [0, 0, 0],
                        [0, 0, 0],
                        [0, 2, 1],
                        [0, 1, 3],
                        [1, 2, 3],
                        [0, 0, 3]
                ]
        to this:
                [
                        [1, 2, 3],
                        [0, 1, 3],
                        [0, 2, 1],
                        [0, 0, 0],
                        [0, 0, 0],
                        [0, 0, 3]
                ]

        The reason why the [0, 0, 3] is last is because
        the vector has the length of 3, so only
        3 vectors are sorted and the rest (irrelevent vectors) are appended
        later.
        
        It was made to help prepere for reduced row echolon form.
 */
function sort_reduced_matrix(matrix) {
        'use strict';
        var i, j, len, has_pivot, irrelevant, positions, new_matrix, count;

        len       = {};
        len.i     = matrix.length;    // matrix length (row)
        len.j     = matrix[0].length; // vector length (column)
        positions = [];

        has_pivot = [];

        // Find nonzero positions
        for (j = 0; j < len.j; j += 1) {
                for (i = 0; i < len.i; i += 1) {
                        if (matrix[i][j] === 1 && has_pivot[i] !== i) {
                                has_pivot[i] = i;
                                positions[positions.length] = i;
                                break;
                        }
                }
        }

        irrelevant = [];
        count      = 0;

        // Find irrelevant vectors positions<commit_msg>	modified:   to_echelon_form/source.js<commit_after>/*
        Sorts matrix like from something like this:
                [
                        [0, 0, 0],
                        [0, 0, 0],
                        [0, 2, 1],
                        [0, 1, 3],
                        [1, 2, 3],
                        [0, 0, 3]
                ]
        to this:
                [
                        [1, 2, 3],
                        [0, 1, 3],
                        [0, 2, 1],
                        [0, 0, 0],
                        [0, 0, 0],
                        [0, 0, 3]
                ]

        The reason why the [0, 0, 3] is last is because
        the vector has the length of 3, so only
        3 vectors are sorted and the rest (irrelevent vectors) are appended
        later.
        
        It was made to help prepere for reduced row echolon form.
 */
function sort_reduced_matrix(matrix) {
        'use strict';
        var i, j, len, has_pivot, irrelevant, positions, new_matrix, count;

        len       = {};
        len.i     = matrix.length;    // matrix length (row)
        len.j     = matrix[0].length; // vector length (column)
        positions = [];

        has_pivot = [];

        // Find pivot positions
        for (j = 0; j < len.j; j += 1) {
                for (i = 0; i < len.i; i += 1) {
                        if (matrix[i][j] === 1 && has_pivot[i] !== i) {
                                has_pivot[i] = i;
                                positions[positions.length] = i;
                                break;
                        }
                }
        }

        irrelevant = [];
        count      = 0;

        // Find irrelevant vectors positions
{'fraction_non_alphanumeric': 0.1083844580777096, 'fraction_numerical': 0.028045574057843997, 'mean_word_length': 0.831995719636169, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '1430285', 'n_tokens_mistral': 1029, 'n_tokens_neox': 894, 'n_words': 299}