<commit_before>/*
	large prime sample for 64-bit arch
	make MCL_USE_LLVM=1 MCL_MAX_BIT_SIZE=768
*/
#include <mcl/fp.hpp>
#include <cybozu/benchmark.hpp>
#include <sstream>
#include "../src/low_func.hpp"

typedef mcl::FpT<> Fp;

using namespace mcl::fp;
const size_t N = 12;

void testMul()
{
	Unit ux[N], uy[N], a[N * 2], b[N * 2];
	for (size_t i = 0; i < N; i++) {
		ux[i] = -i * i + 5;
		uy[i] = -i * i + 9;
	}
	mulPreGmp(a, ux, uy, N);
	MulPre<N, Gtag>::f(b, ux, uy);
	for (size_t i = 0; i < N * 2; i++) {
		if (a[i] != b[i]) {
			printf("ERR %016llx %016llx\n", (long long)a[i], (long long)b[i]);
		}
	}
	puts("end testMul");
	CYBOZU_BENCH("gmp ", mulPreGmp, ux, ux, uy, N);
	CYBOZU_BENCH("kara", (MulPre<N, Gtag>), ux, ux, uy);
}

void mulGmp(mpz_class& z, const mpz_class& x, const mpz_class& y, const mpz_class& p)
{
	z = (x * y) % p;
}
void compareGmp(const std::string& pStr)<commit_msg>update low function<commit_after>/*
	large prime sample for 64-bit arch
	make MCL_USE_LLVM=1 MCL_MAX_BIT_SIZE=768
*/
#include <mcl/fp.hpp>
#include <cybozu/benchmark.hpp>
#include <sstream>
#include "../src/low_func.hpp"

typedef mcl::FpT<> Fp;

using namespace mcl::fp;
const size_t N = 12;

void testMul()
{
	Unit ux[N], uy[N], a[N * 2], b[N * 2];
	for (size_t i = 0; i < N; i++) {
		ux[i] = -i * i + 5;
		uy[i] = -i * i + 9;
	}
	MulPreCore<N, Gtag>::f(a, ux, uy);
	MulPreCore<N, Ltag>::f(b, ux, uy);
	for (size_t i = 0; i < N * 2; i++) {
		if (a[i] != b[i]) {
			printf("ERR %016llx %016llx\n", (long long)a[i], (long long)b[i]);
		}
	}
	puts("end testMul");
	CYBOZU_BENCH("gmp ", (MulPreCore<N, Gtag>::f), ux, ux, uy);
	CYBOZU_BENCH("kara", (MulPre<N, Gtag>::karatsuba), ux, ux, uy);
}

void mulGmp(mpz_class& z, const mpz_class& x, const mpz_class& y, const mpz_class& p)
{
	z = (x * y) % p;
}
void compareGmp(const std::string& pStr)
{'fraction_non_alphanumeric': 0.2125340599455041, 'fraction_numerical': 0.022888283378746595, 'mean_word_length': 3.9487870619946093, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, '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': '4178976', 'n_tokens_mistral': 976, 'n_tokens_neox': 920, 'n_words': 225}