Skip to content

Instantly share code, notes, and snippets.

/* gcc -DHAVE_SSE2 findpi_dSMFT_openmp.c -O3 -march=native -fopenmp */
/* https://gist.github.com/genkuroki/67a5ab63a44ad88446f31db499f08d1c#file-findpi_dsfmt-c */
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <omp.h>
/*
dSFMT-src-2.2.3 package is downloaded from
@Toru3
Toru3 / ising2d.c
Last active January 20, 2018 05:28
2D Ising model
// http://nbviewer.jupyter.org/gist/genkuroki/4fa46c68c56ee0f3b1a6fc8ec628b9d7
// 上のリンクを参考にして作成
// c99以上が必要
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#include <math.h>
/*
@Toru3
Toru3 / pi_gcd.c
Created January 27, 2018 01:47
calc pi from gcd
//gcc pi_gcd.c -O3 -march=native -lm -fopenmp
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
inline int ctz(long x){
// GCCの組み込み関数
return __builtin_ctzl(x);
}
@Toru3
Toru3 / hw.c
Last active March 11, 2018 07:29
#include <stdio.h>
#include <stdbool.h>
#define N 100
#define M 5
bool check(long x[]){
long sum=0;
for(long i=0; i<M; i++){
sum += x[i];
use std::ops::Add;
struct Wrap<T>(T);
impl<'a, T> Add for &'a Wrap<T>
where
for<'x> &'x T: Add<Output = T>,
{
type Output = Wrap<T>;
fn add(self, rhs: Self) -> Self::Output {
Wrap(&self.0 + &rhs.0)
import math
a1=2675635447296228160719540250289795009536707850774461206972689420065591735784445291680285156331209134798916525477293929946938451620438938740022517298909519085153820755415361888322302973518577139821341161809883522586121996716599256582778576314016326725873350498484870639847919264203323125214051468891067234175339481670931152072685855913501723278818566979565295018903257167844378207681134503696186529529640734252522283578825084527850062393096379737540700445644601941817023643548668049631673287872107536434631910400827290046063917811854682840789945371549567941772526955160813015239225665564566926784468576308848503992195934903747789987890160444053995544710229179448793095444572533587765394788078601764395765917599109925402430291119423917661051986146397457410989252435085291581467011730200353045108101417427663770969263206654629656018009287592864971754664708334414501169947362988951657027920694027246055116160630611393094201867828232288234640232017908107409691212250131168511106672408375430687422649523715560471030