Skip to content

Instantly share code, notes, and snippets.

View DSCF-1224's full-sized avatar

DSCF_1224 DSCF-1224

View GitHub Profile
@DSCF-1224
DSCF-1224 / main.f90
Created February 3, 2024 10:01
pong-wars (Fortran 2008 ver)
! original: https://github.com/vnglst/pong-wars
! gfortran -O3 -Wall -std=f2008 main.f90 && time ./a.out && gnuplot ./score.plt
program pong_wars
use , intrinsic :: iso_fortran_env
implicit none
@DSCF-1224
DSCF-1224 / note.md
Last active July 30, 2023 10:57
Data Parallel C++

fig_1_1_hello.cpp

#include <iostream>
#include <sycl/sycl.hpp>

const std::string secret_string{ "Ifmmp-!xpsme\"\012J(n!tpssz-!Ebwf/!"    "J(n!bgsbje!J!dbo(u!ep!uibu/!.!IBM\01" };
const auto secret_string_size = secret_string.size();

int main(void)
@DSCF-1224
DSCF-1224 / main.py
Created March 21, 2023 02:24
Python の pkl ファイルを GitHub からダウンロードし、適当に変換して保存する
import numpy
import os
import pickle
import requests
def convert_data(targetData, fileName):
with open(fileName, 'wb') as writingFileStream:
@DSCF-1224
DSCF-1224 / Makefile
Created January 9, 2023 14:17
Fortran2008 による「ゼロからできるMCMC マルコフ連鎖モンテカルロ法の実践的入門」の実装
# compiler selection
FC = gfortran
# compiler option: Common Options
FFLAGS_COMMON = -ffree-line-length-none -fimplicit-none -pedantic -std=f2008 -Wall -Werror -Wextra
# compiler option: Release mode
FFLAGS_RELEASE = ${FFLAGS_COMMON} -O3
# compiler option: Debug mode
@DSCF-1224
DSCF-1224 / histogram.plt
Created January 4, 2023 14:57
ゼロからできるMCMC / Gaussian_Metropolis.c の Julia への移植
# [reference]
# https://qiita.com/tell/items/5209b92d5f525ca7b028
# https://ja.wikipedia.org/wiki/ヒストグラム
reset session
set datafile separator comma
# DATA_FILE_PATH = '10e3.csv'
# DATA_FILE_PATH = '10e4.csv'
@DSCF-1224
DSCF-1224 / main.f90
Last active March 27, 2022 22:18
組み込み関数 TRIM の挙動の確認
! gfortran, gcc version 7.4.0
! https://stdlib.fortran-lang.org/sourcefile/stdlib_strings.fypp.html
program test
use , intrinsic :: iso_fortran_env
implicit none
character(len=1) , parameter :: ASCII_HT = achar(int(Z'09'))
character(len=1) , parameter :: ASCII_LF = achar(int(Z'0A'))
@DSCF-1224
DSCF-1224 / README.md
Created July 18, 2021 04:32
64bit版 Mersenne Twister(C言語での実装)の unsigned long 出力を signed long 出力に変換する。
@DSCF-1224
DSCF-1224 / test.tex
Last active April 8, 2021 22:06
コンパイル(タイプセット)された時刻をLaTeXの出力に記録する。
% [reference]
% https://tex.stackexchange.com/questions/34424/how-do-i-calculate-n-modulo-3-in-latex
\RequirePackage{plautopatch}
\documentclass[uplatex]{jsarticle}
\makeatletter
\newcommand{\calcQuotient}[2]{{%
\newcount\@quotient%
@DSCF-1224
DSCF-1224 / Makefile
Created February 27, 2021 23:09
Fortran 90の組み込み関数 `COUNT` の使用方法の確認
FCFLAGS = -ffree-line-length-none -O2 -pedantic -std=f2008 -Wall -Wextra # -fbacktrace -fbounds-check
OBJS = ./main.o
main.exe: $(OBJS)
gfortran $(FCFLAGS) -o ./main.exe $(OBJS)
%.o: %.f08
gfortran $(FCFLAGS) -c $<
clean: