Skip to content

Instantly share code, notes, and snippets.

View kaityo256's full-sized avatar
🤖
I, Robot

Hiroshi Watanabe kaityo256

🤖
I, Robot
View GitHub Profile
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
//----------------------------------------------------------------------
const int N = 20000;
const double L = 10.0;
const int D = 3;
const int X = 0;
@kaityo256
kaityo256 / gist:0573714fdce2a44b3f0a
Last active August 29, 2015 14:19
.zshrc.git (zsh RPROMPT for git)
# put "source .zshrc.git" on your .zshrc
autoload -U colors; colors
function rprompt-git {
local name st color
name=`git symbolic-ref HEAD 2> /dev/null | sed -e "s/refs\/heads\///g"`
if [[ -z $name ]]; then
return
fi
//----------------------------------------------------------------------
#include <stdio.h>
#include <emmintrin.h>
#include <immintrin.h>
//----------------------------------------------------------------------
void
printm256(__m256d r){
double *a = (double*)(&r);
printf("%f %f %f %f\n",a[0],a[1],a[2],a[3]);
}
# Constructing a maze with a clustering algorithm
# (C) Copyright H. Watanabe 2015
# Distributed under the Boost Software License, Version 1.0.
# (See copy at http://www.boost.org/LICENSE_1_0.txt)
class Maze
def initialize(s)
@lx = s
@ly = @lx*297/210
@bond_h = Array.new((@lx+1)*@ly) { false}
@bond_v = Array.new(@lx*(@ly+1)) { false}
@kaityo256
kaityo256 / random_shuffle.cc
Created May 19, 2015 10:37
A problem on random_shuffle with rand() on clang++
#include <iostream>
#include <algorithm>
#include <vector>
#include <stdlib.h>
//----------------------------------------------------------------------
int
myrand(const int max) {
double r = static_cast<double>(rand()) / (static_cast<double>(RAND_MAX) + 1.0);
return static_cast<int>(r * max);
};
#include <iostream>
#include <algorithm>
#include <stdlib.h>
//----------------------------------------------------------------------
bool called_srand = false;
//----------------------------------------------------------------------
int
myrand(const int max) {
if(called_srand){
called_srand = false;
@kaityo256
kaityo256 / file1.txt
Created June 18, 2015 04:09
std::fill_nをmemcpyで書いてみた ref: http://qiita.com/kaityo256/items/22c705fbfff164dd4ef6
$ icpc --version
icpc (ICC) 12.1.4 20120410
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
$ g++ --version
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
@kaityo256
kaityo256 / pi.cc
Last active August 29, 2015 14:24
MC calculation of Pi
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//----------------------------------------------------------------------
const int N = 10000;
const int SAMPLE = 65536;
//----------------------------------------------------------------------
double
myrand(void){
@kaityo256
kaityo256 / pi_acc.cc
Last active August 29, 2015 14:24
MC calculation of Pi (OpenACC)
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//----------------------------------------------------------------------
const int N = 10000;
const int SAMPLE = 65535;
//----------------------------------------------------------------------
double
myrand(void){
@kaityo256
kaityo256 / pi_curand.cc
Last active August 29, 2015 14:24
MC calculation of Pi (OpenACC+CURAND)
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <curand.h>
//----------------------------------------------------------------------
const int N = 10000;
const int SAMPLE = 65536;
//----------------------------------------------------------------------
double