<commit_before>#include "mex.h"
#include "mex_im_utils.h"

/**
   Returns sum of squared differences of two arbitrarily dimensioned
   arrays. Note the must have the same number of elements and both be
   of type double. This function is nominally for histogram cubes, but
   will work on a reasonable variety of things.  */

const mxArray* cube1;
const mxArray* cube2;
double* c1ptr;
double* c2ptr;
double val;
double total;
unsigned int numPixels;
unsigned int i;

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
  ASSERT_NUM_RHS_ARGS_EQUALS(2);
  ASSERT_IS_DOUBLE(prhs[0]);
  ASSERT_IS_DOUBLE(prhs[1]);
  ASSERT_SAME_SIZE(prhs[0],prhs[1]);

  cube1 = prhs[0];
  cube2 = prhs[1];

  c1ptr = mxGetPr(cube1);
  c2ptr = mxGetPr(cube2);

  total = 0.0;
  for (i=0; i<numPixels; i++) {
    val = (*c1ptr - *c2ptr);
    total += val * val;
    c1ptr++;
    c2ptr++;
  }

  plhs[0] = mxCreateDoubleScalar(total);
}
    <commit_msg>Fixed regression in cube_diff_sse.c<commit_after>#include "mex.h"
#include "mex_im_utils.h"

/**
   Returns sum of squared differences of two arbitrarily dimensioned
   arrays. Note the must have the same number of elements and both be
   of type double. This function is nominally for histogram cubes, but
   will work on a reasonable variety of things.  */

const mxArray* cube1;
const mxArray* cube2;
double* c1ptr;
double* c2ptr;
double val;
double total;
unsigned int numPixels;
unsigned int i;

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
  ASSERT_NUM_RHS_ARGS_EQUALS(2);
  ASSERT_IS_DOUBLE(prhs[0]);
  ASSERT_IS_DOUBLE(prhs[1]);
  ASSERT_SAME_SIZE(prhs[0],prhs[1]);

  cube1 = prhs[0];
  cube2 = prhs[1];

  c1ptr = mxGetPr(cube1);
  c2ptr = mxGetPr(cube2);

  numPixels = num_elements(cube1);
  total = 0.0;
  for (i=0; i<numPixels; i++) {
    val = (*c1ptr - *c2ptr);
    total += val * val;
    c1ptr++;
    c2ptr++;
  }

  plhs[0] = mxCreateDoubleScalar(total);
}
    
{'fraction_non_alphanumeric': 0.12227295788939624, 'fraction_numerical': 0.0258751902587519, 'mean_word_length': 4.00507614213198, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3462123', 'n_tokens_mistral': 771, 'n_tokens_neox': 772, 'n_words': 211}