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 / memo_evalpoly_20200809_01.ipynb
Created August 9, 2020 14:29
Julia の Base.Math.evalpoly の動作検証メモ
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DSCF-1224
DSCF-1224 / test_20200904_01.f08
Created September 3, 2020 21:38
負値のインデックスをもつ形状引継配列を引き渡した時の挙動の確認
!gfortran, gcc version 7.4.0
!reference: https://qiita.com/implicit_none/items/08f894bc851c29b40b58#%E4%BB%AE%E5%BC%95%E6%95%B0
program test_20200904_01
use, intrinsic :: iso_fortran_env
implicit none
@DSCF-1224
DSCF-1224 / 20200915_0648.jl
Last active September 14, 2020 22:17
自作複合型に対する演算子オーバーロード
module Coordinate
export Rect2d
mutable struct Rect2d{T}
x :: T
y :: T
end
function Base.:+(coordinate_left::Rect2d{T}, coordinate_right::Rect2d{T}) where T <: Core.Number
@DSCF-1224
DSCF-1224 / test_20201030_01.ipynb
Last active October 29, 2020 22:06
sympy のサンプルコード : x * exp(-(x**2+y**2+z**2))の偏微分の評価
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
@DSCF-1224
DSCF-1224 / README.md
Created November 23, 2020 00:02
Kahan summation algorithm の実装と検証
@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 / 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 / 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: