Skip to content

Instantly share code, notes, and snippets.

:octocat:
poyo

prime number primenumber

:octocat:
poyo
Block or report user

Report or block primenumber

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View even_odd.py
def relu(x):
return max(x, 0)
def linear1(x, n):
return [x, 2.0 * x - 2 ** n]
def linear2(x):
return x[0] + -1.0 * x[1]
def block(x, n):
@primenumber
primenumber / othello_solver.cu
Last active Dec 16, 2018
CUDA Othello Solver
View othello_solver.cu
// CUDA Othello Solver
// License: GPL 3
#include <cstdio>
#include <cassert>
constexpr int threadsPerBlock = 128;
constexpr int simdWidth = 4;
constexpr int nodesPerBlock = threadsPerBlock/simdWidth;
constexpr int MAX_DEPTH = 10;
@primenumber
primenumber / bsr.cpp
Last active Mar 25, 2018
Parallel bit scan reverse
View bsr.cpp
// author: prime (prime@kmc.gr.jp)
// License: MIT License
#include <iostream>
#include <vector>
#include <bitset>
#include <x86intrin.h>
#include <boost/timer/timer.hpp>
inline __m256i bsr_256_8_naive(__m256i x);
inline __m256i bsr_256_8_cvtfloat(__m256i x);
View unpack.cpp
#include <iostream>
#include <x86intrin.h>
#include <boost/timer/timer.hpp>
inline __m128i mm_delta_swap_epi64(__m128i a, __m128i mask, int delta) {
__m128i x = _mm_and_si128(_mm_xor_si128(a, _mm_srli_epi64(a, delta)), mask);
return _mm_xor_si128(_mm_xor_si128(a, x), _mm_slli_epi64(x, delta));
}
inline __m128i mm_unpacklo_epb_unpack_dswap(__m128i a, __m128i b) {
@primenumber
primenumber / quine.bf
Created Nov 28, 2016
Brainf*ckでQuine
View quine.bf
>>>>>>+++++>+++>++++++>+++>+>+>+>+>+>+>+>+++++>++>+>+>+>+>+>+>+>+>+>+++>++++>++++++>++>++++>+++++++>+++++++>+++++++>+++++++>+++++++>+++>+++>+>+>+>+>+>+>+++++>++>+>+>+>+>+>+>+>+++>++++>++++++>++>+>++>++>+++++>+++>+++++++>++>+++++>+++>+++>+++++++>+++>+>++>++>++>++++>++++++>+++>+++++>++>+>+++>++++>++++++>+++>+++++>++>+>+++>++++>++++++>++>++>++>++++++>+++>+++>+++>+++>+++++>+++>++++++>++>+++++>+++>+>++>++++>+++++>++++>+++++>++++>+++++>++++>+++++>++++>+++++>++++>+++++>+++>+>+>+>+>+++++>++>+>+>+>+>+>+>+>+>+>+++>++++>++++++>++>+++++++>+++++>++++>++++++>++++++>+++>+++++>+>+>+>+>+>+>+>+>+++++>++>+>+>+>+>+>+>+>+>+>+>+++>++++>++++++>++>+>+>+>+++++++>+++++>++++>++++++>+++>++++++>++>++++++>+++>+++++>+>+>+>+>+>+>+>+>+++++>++>+>+>+>+>+>+>+>+>+>+>+++>++++>++++++>++>+>+++++++>+++++>++++>++++++>+++>++++++>++>++++++>+++>+++++>+>+>+>+>+++++>++>+>+>+>+>+>+>+>+>+>+++>++++>++++++>++>+++++++>+++++>++++>++++++>+++>++++++>++>++++++>+++>+++++>+>+>+>+>+>+++++>++>+>+>+>+>+>+>+>+>+>+>+++>++++>++++++>++>+++++++>+++++>++++>++++++>+++>++++++>
@primenumber
primenumber / a.cpp
Last active Dec 3, 2015
高速文字列処理ライブラリ「A」
View a.cpp
#include "a.hpp"
#include <cmath>
A::size_type find(const A &lhs, const A &rhs) {
if (lhs.n >= rhs.n) return 0;
else return A::npos;
}
A replace(const A &dest, const A &pattern, const A &rep) {
A::size_type count = dest.n / pattern.n;
@primenumber
primenumber / tanzaku_filter.rb
Created Jul 2, 2015
鬱陶しい短冊ツイートを非表示にするmikutterプラグイン
View tanzaku_filter.rb
# -*- coding: utf-8 -*-
Plugin.create(:tanzaku_filter) do
filter_show_filter do |msgs|
msgs = msgs.select {|m|
/(┏|★)(┷|┻)\n(┃[[:print:]]?┃\n)+┗━(┛|★)/.match(m.to_s) == nil
}
[msgs]
end
end
View pokemon_parse.rb
# encoding: utf-8
require 'json'
require 'nkf'
require 'unf'
def func(name)
fx = name.gsub(/♂/u, "オス")
fx = fx.gsub(/♀/u, "メス")
fx = fx.gsub(/2/u, "ツー")
fx = fx.gsub(/Z/u, "ゼット")
@primenumber
primenumber / replace_nested.bfm
Created Dec 26, 2014
ソースコード置換を二重に掛けるテスト
View replace_nested.bfm
[>]<[-]<[[>+>+<<-]>>[<<+>>-]<<<[>->>+<<<-]>[[-]>[<<+>>-]<]>[-]<<]+>+>+>[-]>----------[++++++++++[>]>>>>[>>>]+[<<<]<<[<]>[[>]>>>>[>>>]<<<<+>[<<<]<<[<]>-]<+>>----------]>----------[++++++++++[>]>>>>[>>>]>>>[>>>]+[<<<]<<<[<<<]<<[<]>[[>]>>>>[>>>]>>>[>>>]<<<<+>[<<<]<<<[<<<]<<[<]>-]<+>>----------]>[[>]>>>>[>>>]>>>[>>>]>>>[>>>>]+>+<[<<<<]<<[<<<]<<<[<<<]<<[<]>[[>]>>>>[>>>]>>>[>>>]>>>[>>>>]<<<<<+>[<<<<]<<[<<<]<<<[<<<]<<[<]>-]<+>>]>>>>[>>>]>>>[>>>]>>>[>>>>]+>+<<<<<[<<<<]>>>>->-<<<<<<<[<<<]<<<[<<<]<+<<[-]<[-]<[-]>>>>[->>>>[-<[>>+>>[>>>]>>>[>>>]>>>[>>>>]>>+<<<<<<[<<<<]<<[<<<]<<<[<<<]<-]>>[<<+>>-]>>[>>>]>>>[>>>]>>>[>>>>]<[<+>>>>-<<<-]<[>+<-]+>>>>[[-]<<<<-<<[<<<<]<<[<<<]<<<[<<<]>+>>[>>>]>>>[>>>]>>>[>>>>]>>]<<<<[->>+>>+>>[-<<->>]<<[-<<[<<<<]<<[<<<]>+<<<<[<<<]+[>>>]<<<->>>>>>[>>>]>>>[>>>>]<<]]<<[<<<<]<<[<<<]<<<[<<<]>[-<+>>>[>>>]>>>[>>>]>>>[>>>>]>[<+<<<<->]<+>+>+>[<->[>>>+<<<-]>[-]>[-]<<]>>>[<<<+>>>-]<<<<[-<[<<<<]<<<[<<<]>+<<<<[<<<]+[>>>]<<<->>>>>>[>>>]>>>>[>>>>]<<<]<[<<<<]<<<[<<<]<<<[<<<]>]<<[>+<[>>+<<-]]>>[<<+>>-]>>]<+>>[-<
@primenumber
primenumber / replace_helloworld.bfm
Created Dec 26, 2014
文字列置換により動的にコード生成を行うBFmetaプログラム
View replace_helloworld.bfm
[>]<[-]<[[>+>+<<-]>>[<<+>>-]<<<[>->>+<<<-]>[[-]>[<<+>>-]<]>[-]<<]+>+>+>[-]>----------[++++++++++[>]>>>>[>>>]+[<<<]<<[<]>[[>]>>>>[>>>]<<<<+>[<<<]<<[<]>-]<+>>----------]>----------[++++++++++[>]>>>>[>>>]>>>[>>>]+[<<<]<<<[<<<]<<[<]>[[>]>>>>[>>>]>>>[>>>]<<<<+>[<<<]<<<[<<<]<<[<]>-]<+>>----------]>[[>]>>>>[>>>]>>>[>>>]>>>[>>>>]+>+<[<<<<]<<[<<<]<<<[<<<]<<[<]>[[>]>>>>[>>>]>>>[>>>]>>>[>>>>]<<<<<+>[<<<<]<<[<<<]<<<[<<<]<<[<]>-]<+>>]>>>>[>>>]>>>[>>>]>>>[>>>>]+>+<<<<<[<<<<]>>>>->-<<<<<<<[<<<]<<<[<<<]<+<<[-]<[-]<[-]>>>>[->>>>[-<[>>+>>[>>>]>>>[>>>]>>>[>>>>]>>+<<<<<<[<<<<]<<[<<<]<<<[<<<]<-]>>[<<+>>-]>>[>>>]>>>[>>>]>>>[>>>>]<[<+>>>>-<<<-]<[>+<-]+>>>>[[-]<<<<-<<[<<<<]<<[<<<]<<<[<<<]>+>>[>>>]>>>[>>>]>>>[>>>>]>>]<<<<[->>+>>+>>[-<<->>]<<[-<<[<<<<]<<[<<<]>+<<<<[<<<]+[>>>]<<<->>>>>>[>>>]>>>[>>>>]<<]]<<[<<<<]<<[<<<]<<<[<<<]>[-<+>>>[>>>]>>>[>>>]>>>[>>>>]>[<+<<<<->]<+>+>+>[<->[>>>+<<<-]>[-]>[-]<<]>>>[<<<+>>>-]<<<<[-<[<<<<]<<<[<<<]>+<<<<[<<<]+[>>>]<<<->>>>>>[>>>]>>>>[>>>>]<<<]<[<<<<]<<<[<<<]<<<[<<<]>]<<[>+<[>>+<<-]]>>[<<+>>-]>>]<+>>[-<
You can’t perform that action at this time.