<commit_before>#include "maths.hpp"

namespace stats
{
	// normal distribution

	template <typename float_t> class norm
	{
		float_t mu, sigma, unit;
		
	 public:
	 
	 	norm(float_t mu=0, float_t sigma=1)
	 	{
	 	 	unit = maths::sqrt2pi*sigma;
	 	 	this->sigma = sigma;
	 		this->mu = mu;
	 	}
	 	
	 	float_t pdf(float_t x)
	 	{
	 		float_t z = (x - mu)/sigma;
	 		return maths::exp(-z*z/2)/unit;
	 	}
	 	
	 	float_t cdf(float_t x)
	 	{
	 		float_t z = (x - mu)/sigma;
	 		return (1 + maths::erf(z/maths::sqrt2))/2/sigma;
	 	}
	};

	template <typename float_t> float_t dnorm(float_t x, float_t mu=0, float_t sigma=1)
	{
		return norm<float_t>(mu, sigma).pdf(x);
	}

	template <typename float_t> float_t pnorm(float_t x, float_t mu=0, float_t sigma=1)
	{
		return norm<float_t>(mu, sigma).cdf(x);
	}

}; // namespace stats
<commit_msg>Added gamma distribution pdf and cdf<commit_after>#include "maths.hpp"

namespace stats
{
	// normal distribution

	template <typename float_t>
	float_t dnorm(float_t x, float_t mu=0, float_t sigma=1)
	{
		float_t z = (x -  mu)/sigma;
		return maths::exp(-z*z/2)/maths::sqrt2pi/sigma;
	}

	template <typename float_t>
	float_t pnorm(float_t x, float_t mu=0, float_t sigma=1)
	{
		float_t z = (x - mu)/sigma;
		return (1 + maths::erf(z/maths::sqrt2))/2/sigma;
	}

	// gamma distribution

	template <typename float_t>
	float_t dgamma(float_t x, float_t a, float_t b)
	{
		return maths::pow(x*b, a)*maths::exp(-x*b)/maths::tgamma(a)/x;
	}

	template <typename float_t>
	float_t pgamma(float_t x, float_t a, float_t b)
	{
		return maths::igamma(a, x*b)/maths::tgamma(a);
	}

}; // namespace stats

{'fraction_non_alphanumeric': 0.14996926859250154, 'fraction_numerical': 0.012292562999385371, 'mean_word_length': 3.484848484848485, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, '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': '6042846', 'n_tokens_mistral': 762, 'n_tokens_neox': 689, 'n_words': 147}