<commit_before>/*
 * Math basic manipulation utilities
 *
 *
 */

#include <basic\common.h>

#include <math.h>

namespace Gpu_Rvd{

	namespace Math{

		/*
		 * \brief compute the square of the distance of 2 points.
		 */
		template <typename T>
		inline T distance2(const T* p1, const T* p2, coords_index_t dim){
			T result = 0;
			for (coords_index_t c = 0; c < dim; ++c){
				result += (p1[c] - p2[c]) * (p1[c] - p2[c]);
			}
			return result;
		}
	}

}<commit_msg>compute center<commit_after>/*
 * Math basic manipulation utilities
 *
 *
 */

#ifndef H_BASIC_MATH
#define H_BASIC_MATH

#include <basic\common.h>

#include <math.h>

namespace Gpu_Rvd{

	namespace Math{

		/*
		 * \brief compute the square of the distance of 2 points.
		 */
		template <typename T>
		inline T distance2(const T* p1, const T* p2, coords_index_t dim){
			T result = 0;
			for (coords_index_t c = 0; c < dim; ++c){
				result += (p1[c] - p2[c]) * (p1[c] - p2[c]);
			}
			return result;
		}

		inline void compute_center(const double* p1, const double* p2, const double* p3, index_t dim, float* result){
			for (coords_index_t t = 0; t < dim; ++t){
				result[t] = (float)((p1[t] + p2[t] + p3[t]) / 3);
			}
		}
	}

}

#endif /* H_BASIC_MATH */
{'fraction_non_alphanumeric': 0.15472312703583063, 'fraction_numerical': 0.02280130293159609, 'mean_word_length': 2.9517684887459805, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 9, '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': '5806100', 'n_tokens_mistral': 559, 'n_tokens_neox': 491, 'n_words': 140}