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 / 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:
@DSCF-1224
DSCF-1224 / Makefile
Last active February 23, 2021 22:09
Newton法による1変数方程式の数値解法の実装
FCFLAGS = -ffree-line-length-none -O2 -pedantic -std=f2008 -Wall -Wextra # -fbacktrace -fbounds-check
OBJS = ./mod_utility.o ./mod_eqn_func.o ./mod_solver.o ./main.o
main.exe: $(OBJS)
gfortran $(FCFLAGS) -o ./main.exe $(OBJS)
%.o: %.f08
gfortran $(FCFLAGS) -c $<
clean:
@DSCF-1224
DSCF-1224 / Makefile
Created February 16, 2021 14:50
Fortranでの整数の偶奇判定はbtestとmodのどちらが高速か
FCFLAGS = -ffree-line-length-none -O2 -pedantic -std=f2008 -Wall -Wextra # -fbacktrace -fbounds-check
OBJS = ./mod_is_even.o ./mod_test.o ./main.o
main.exe: $(OBJS)
gfortran $(FCFLAGS) -o ./main.exe $(OBJS)
%.o: %.f08
gfortran $(FCFLAGS) -c $<
clean:
@DSCF-1224
DSCF-1224 / Makefile
Created December 27, 2020 12:35
python で fortran の unformatted で出力した INT32 と REAL64 型のデータを読み出す
FCFLAGS= -fbacktrace -fbounds-check -ffree-line-length-none -O2 -pedantic -std=f2008 -Wall -Wextra
main.exe: ./main.f08
gfortran $(FCFLAGS) -o ./main.exe $<
clean:
rm ./*.mod ./*.o ./*.dat
@DSCF-1224
DSCF-1224 / test_20201227_01.py
Created December 27, 2020 11:14
python で fortran の unformatted で出力した INT32 と REAL64 型のデータを読み出す
# -*- coding: utf-8 -*-
import numpy
def read_int32(file_stream):
return numpy.fromfile(file= file_stream, dtype= numpy.int32, count=1)[0]
def read_real64(file_stream):
return numpy.fromfile(file= file_stream, dtype= numpy.float64, count=1)[0]
@DSCF-1224
DSCF-1224 / README.md
Created November 23, 2020 00:02
Kahan summation algorithm の実装と検証
@DSCF-1224
DSCF-1224 / test_20201114_01.f08
Created November 14, 2020 04:37
2個の32bit整数から1個の64bit整数を作成する
program memorandum
use, intrinsic :: iso_fortran_env
implicit none
integer(INT32) :: input_front = -17_INT32
integer(INT32) :: input_rear = +32_INT32
integer(INT64) :: retval