Skip to content

Instantly share code, notes, and snippets.

View IshitaTakeshi's full-sized avatar
💭
kernel panic

Takeshi Ishita IshitaTakeshi

💭
kernel panic
View GitHub Profile
@IshitaTakeshi
IshitaTakeshi / LICENSE
Last active December 11, 2019 05:15
Huber weighted IRLS
Copyright (C) 2006, Jonathan E. Taylor
All rights reserved.
Copyright (c) 2006-2008 Scipy Developers.
All rights reserved.
Copyright (c) 2009-2018 statsmodels Developers.
All rights reserved.
@IshitaTakeshi
IshitaTakeshi / README.md
Last active November 25, 2022 16:56
Calling LAPACK/BLAS from Kotlin Native

Calling LAPACK/BLAS from Kotlin Native

The original C file is cblas_example1.c

$cinterop -def liblapack.def -o build/c_interop/liblapack
$kotlinc-native lapack.kt -library build/c_interop/liblapack
$./program.kexe 
11.0
14.0
@IshitaTakeshi
IshitaTakeshi / benchmark_histogram.py
Last active May 24, 2018 11:02
Comparison of histogram calculation in NumPy and CuPy
import json
import timeit
from collections import defaultdict
n_executions = 10000
def run_numpy(n_samples, n_bins):
setup = """
import numpy as xp
import numpy as np
from matplotlib.animation import FuncAnimation
from matplotlib import pyplot as plt
from mcl import Environment, MCL, Agent
def particle_weight(particle_observation, agent_observation):
return 1 if particle_observation == agent_observation else 0
import numpy as np
from matplotlib.animation import FuncAnimation
from matplotlib import pyplot as plt
from mcl import Environment, MCL, Agent
def particle_weight(particle_observation, agent_observation):
return 1 if particle_observation == agent_observation else 0
using PyPlot
using PyCall
PyDict(pyimport("matplotlib")["rcParams"])["font.size"] = 18
include("ode_solvers.jl")
f(x, y) = -3sin(10*x) / exp(x+y^2)
@IshitaTakeshi
IshitaTakeshi / doc2vec.py
Created September 8, 2017 15:47
Innovation Project
from xml.etree import ElementTree as ET
from bs4 import BeautifulSoup
from gensim.models.doc2vec import Doc2Vec, TaggedDocument, DocvecsArray
# root = tree.getroot()
# for neighbor in root.iter("neighbor"):
# print(neighbor)
MIN_LINE_LENGTH = 80
def generate_documents():
@IshitaTakeshi
IshitaTakeshi / integration.jl
Last active September 19, 2017 21:13
Numerical Integration
using Base.Test
using Iterators: filter
using Distributions
function h_xs_ys(f, a, b, n_parts)
h = (b - a) / n_parts
xs = linspace(a, b, n_parts + 1)
ys = [f(x) for x in xs]
h, xs, ys
using Base.Test
function integrate(f, a, b, n_samples=100)
assert(b > a)
h = (b - a) / n_samples
xs = linspace(a, b, n_samples)
ys = [f(x) for x in xs]
h * ((ys[1] + ys[end]) / 2 + sum(ys[2:end-1]))
end