<commit_before>#include "vect-ops.h"

float* vox_vector_inv (const vox_dot vect, vox_dot res)
{
    int i;
    for (i=0; i<VOX_N; i++) res[i] = -vect[i];
    return res;
}

float* vox_quat_conj (const vox_quat quat, vox_quat res)
{
    int i;
    for (i=0; i<3; i++) res[i] = -quat[i];
    return res;
}

float vox_dot_product (const vox_dot v1, const vox_dot v2)
{
    float res = 0;
    int i;

    for (i=0; i<VOX_N; i++) res += v1[i]*v2[i];
    return res;
}

static float* vox_cross_product (const vox_dot v1, const vox_dot v2, vox_dot res)
{
    res[0] =  v1[1]*v2[2] - v1[2]*v2[1];
    res[1] = -v1[0]*v2[2] + v1[2]*v2[0];
    res[2] =  v1[0]*v2[1] - v1[1]*v2[0];
    return res;
}

float* vox_quat_mul (const vox_quat q1, const vox_quat q2, vox_quat res)
{
    res[0] = q1[1]*q2[2] - q1[2]*q2[1] + q1[0]*q2[3] + q1[3]*q2[0];
    res[1] = q1[2]*q2[0] - q1[0]*q2[2] + q1[1]*q2[3] + q1[3]*q2[1];
    res[2] = q1[0]*q2[1] - q1[1]*q2[0] + q1[2]*q2[3] + q1[3]*q2[2];
    res[3] = q1[3]*q2[3] - q1[0]*q2[0] - q1[1]*q2[1] - q1[2]*q2[2];
}

float* vox_rotate_vector (const vox_quat base, const vox_dot vector, vox_dot res)
{
    vox_dot tmp, tmp2;
    int i;
    vox_cross_product (base, vector, tmp);
    for (i=0; i<VOX_N; i++) tmp[i] *= 2.0;
    vox_cross_product (base, tmp, tmp2);
    for (i=0; i<VOX_N; i++) res[i] = vector[i] + base[VOX_N]*tmp[i] + tmp2[i];
    
    return res;
}
<commit_msg>Fix a probable bug<commit_after>#include "vect-ops.h"

float* vox_vector_inv (const vox_dot vect, vox_dot res)
{
    int i;
    for (i=0; i<VOX_N; i++) res[i] = -vect[i];
    return res;
}

float* vox_quat_conj (const vox_quat quat, vox_quat res)
{
    int i;
    for (i=0; i<3; i++) res[i] = -quat[i];
    return res;
}

float vox_dot_product (const vox_dot v1, const vox_dot v2)
{
    float res = 0;
    int i;

    for (i=0; i<VOX_N; i++) res += v1[i]*v2[i];
    return res;
}

static float* vox_cross_product (const vox_dot v1, const vox_dot v2, vox_dot res)
{
    res[0] =  v1[1]*v2[2] - v1[2]*v2[1];
    res[1] = -v1[0]*v2[2] + v1[2]*v2[0];
    res[2] =  v1[0]*v2[1] - v1[1]*v2[0];
    return res;
}

float* vox_quat_mul (const vox_quat q1, const vox_quat q2, vox_quat res)
{
    res[0] = q1[1]*q2[2] - q1[2]*q2[1] + q1[0]*q2[3] + q1[3]*q2[0];
    res[1] = q1[2]*q2[0] - q1[0]*q2[2] + q1[1]*q2[3] + q1[3]*q2[1];
    res[2] = q1[0]*q2[1] - q1[1]*q2[0] + q1[2]*q2[3] + q1[3]*q2[2];
    res[3] = q1[3]*q2[3] - q1[0]*q2[0] - q1[1]*q2[1] - q1[2]*q2[2];

    return res;
}

float* vox_rotate_vector (const vox_quat base, const vox_dot vector, vox_dot res)
{
    vox_dot tmp, tmp2;
    int i;
    vox_cross_product (base, vector, tmp);
    for (i=0; i<VOX_N; i++) tmp[i] *= 2.0;
    vox_cross_product (base, tmp, tmp2);
    for (i=0; i<VOX_N; i++) res[i] = vector[i] + base[VOX_N]*tmp[i] + tmp2[i];
    
    return res;
}

{'fraction_non_alphanumeric': 0.2173758865248227, 'fraction_numerical': 0.08156028368794327, 'mean_word_length': 3.3601236476043277, 'pattern_counts': {'":': 0, '<': 13, '<?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': '7519343', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1488, 'n_words': 301}