<commit_before>/**
* Compute the sum of absolute values.
*
* @see <a href="http://www.netlib.org/lapack/explore-html/de/da4/group__double__blas__level1.html">dasum</a>
*/
#include <math.h>
#include "dasum.h"

/**
* Computes the sum of absolute values.
*
* @param N       number of elements to sum
* @param X       input array
* @param stride  stride length
* @return        sum of absolute values
*/
double c_dasum( const int N, const double *X, const int stride ) {
	double sum;
	int m;
	int n;
	int i;

	sum = 0.0;
	if ( N <= 0 || stride <= 0 ) {
		return sum;
	}
	// If the stride is equal to `1`, use unrolled loops...
	if ( stride == 1 ) {
		m = N % 6;

		// If we have a remainder, run a clean-up loop...
		if ( m > 0 ) {
			for ( i = 0; i < m; i++ ) {
				sum += fabs( X[i] );
			}
		}
		if ( N < 6 ) {
			return sum;
		}
		for ( i = m; i < N; i += 6 ) {
			sum += fabs( X[i] ) + fabs( X[i+1] ) + fabs( X[i+2] ) + fabs( X[i+3] ) + fabs( X[i+4] ) + fabs( X[i+5] );
		}
		return sum;
	}
	n = N * stride;
	for ( i = 0; i < n; i += stride ) {
		sum += fabs( X[i] );
	}
	return sum;
}
<commit_msg>Reorder includes<commit_after>/**
* Compute the sum of absolute values.
*
* @see <a href="http://www.netlib.org/lapack/explore-html/de/da4/group__double__blas__level1.html">dasum</a>
*/
#include "dasum.h"
#include <math.h>

/**
* Computes the sum of absolute values.
*
* @param N       number of elements to sum
* @param X       input array
* @param stride  stride length
* @return        sum of absolute values
*/
double c_dasum( const int N, const double *X, const int stride ) {
	double sum;
	int m;
	int n;
	int i;

	sum = 0.0;
	if ( N <= 0 || stride <= 0 ) {
		return sum;
	}
	// If the stride is equal to `1`, use unrolled loops...
	if ( stride == 1 ) {
		m = N % 6;

		// If we have a remainder, run a clean-up loop...
		if ( m > 0 ) {
			for ( i = 0; i < m; i++ ) {
				sum += fabs( X[i] );
			}
		}
		if ( N < 6 ) {
			return sum;
		}
		for ( i = m; i < N; i += 6 ) {
			sum += fabs( X[i] ) + fabs( X[i+1] ) + fabs( X[i+2] ) + fabs( X[i+3] ) + fabs( X[i+4] ) + fabs( X[i+5] );
		}
		return sum;
	}
	n = N * stride;
	for ( i = 0; i < n; i += stride ) {
		sum += fabs( X[i] );
	}
	return sum;
}

{'fraction_non_alphanumeric': 0.18446160835983644, 'fraction_numerical': 0.017264879600181735, 'mean_word_length': 2.2865671641791043, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6535807', 'n_tokens_mistral': 997, 'n_tokens_neox': 926, 'n_words': 295}