Skip to content

Instantly share code, notes, and snippets.

View yohm's full-sized avatar

Yohsuke Murase yohm

View GitHub Profile
@yohm
yohm / dfa_minimization.cpp
Last active March 25, 2024 15:21
Minimization of the deterministic finite automaton (DFA) using Moore's algorithm in C++
#include <iostream>
#include <utility>
#include <vector>
#include <set>
#include <cassert>
class DFA {
public:
DFA(int n, int z, std::set<int> f, std::vector<std::vector<int>> _delta) :
N(n), Z(z), F(std::move(f)), delta(std::move(_delta)) {
@yohm
yohm / build_run.sh
Last active October 16, 2021 02:35
a sample program of PDGESV of Scalapack in C++
#!/bin/bash -eux
mpicc pdgesv_example.cpp -lscalapack
mpirun -np 6 ./a.out 9 2 2 3
#include <iostream>
#include <random>
#include <array>
// Cooperate : 1, Defect : 0
// Good : 1, Bad : 0
class AssessmentRule {
public:
AssessmentRule(size_t _id = 0) : id(_id) { assert(id >= 0 && id < 256); };
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yohm
yohm / hello_salib.ipynb
Created March 15, 2020 15:15
a sample code of SALib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yohm
yohm / json.cpp
Created March 7, 2020 06:47
basic usage of nlohmann-json
#include <iostream>
#include <fstream>
#include <nlohmann/json.hpp>
// for convenience
using json = nlohmann::json;
namespace ns {
// a simple struct to model a person
struct person {
//
// Created by Yohsuke Murase on 2020/02/10.
//
#define _USE_MATH_DEFINES
#include <iostream>
#include <array>
#include <cmath>
#include <cassert>
#include <random>
(async () => {
const db = inkdrop.main.dataStore.getLocalDB()
inkdrop.commands.add(document.body, "custom:new-note", async () => {
const { queryContext } = inkdrop.store.getState()
if( queryContext.mode === "book" ) {
const template_tag = (await db.tags.all()).find(t => t.name === "template")
const template_notes = await db.notes.findWithTag(template_tag._id)
const template = template_notes.docs.find(d => queryContext.bookId === d.bookId)
@yohm
yohm / index.html
Last active January 7, 2019 03:25
d3.jsでforce directed layout
<!DOCTYPE html>
<style>
div.tooltip {
position: absolute;
text-align: center;
width: 80px;
height: 18px;
padding: 2px;
font: 14px sans-serif;
@yohm
yohm / index.html
Created July 26, 2018 12:54
Kerasの学習結果をchart.jsでインタラクティブに表示する
<html>
<head>
</head>
<body>
<div class="slidecontainer" id="sliders">
X軸 :
<select name="myRange" id="myRange">
<option value="0"> X0</option>
<option value="1"> X1</option>