Skip to content

Instantly share code, notes, and snippets.

Avatar

Ondřej Čertík certik

View GitHub Profile
View surfdisp96.f90
subroutine surfdisp96(thkm, vpm, vsm, rhom, nlayer, iflsph, iwave, mode, igr, kmax, t, cg, err)
parameter(ler = 0, lin = 5, lot = 6)
integer :: nl, nl2, nlay
parameter(nl = 100, nlay = 100, nl2 = nl + nl)
integer :: np
parameter(np = 60)
real(4) :: thkm(nlay), vpm(nlay), vsm(nlay), rhom(nlay)
integer :: nlayer, iflsph, iwave, mode, igr, kmax, err
double precision :: twopi, one, onea
double precision :: cc, c1, clow, cm, dc, t1
@certik
certik / test_rsqrt.f90
Last active October 13, 2021 19:09
Testing 1/sqrt(x) implementations
View test_rsqrt.f90
program test_rsqrt
! Prints:
! $ gfortran test_rsqrt.f90 && ./a.out
! 0.81649658092772603
! 0.81649658092772626
! 0.81649658092772603
! 0.81649658092772603
implicit none
View bench3.f90
program bench3
implicit none
integer :: c
c = 0
call g1(c)
call g2(c)
call g3(c)
call g4(c)
call g5(c)
call g6(c)
View intrinsics_04.ll
; ModuleID = 'LFortran'
source_filename = "LFortran"
%array = type { i32*, i32, [1 x %dimension_descriptor] }
%dimension_descriptor = type { i32, i32, i32, i32 }
%array.0 = type { float*, i32, [1 x %dimension_descriptor] }
%size_arg = type { %dimension_descriptor*, i32 }
%complex_8 = type { double, double }
%complex_4 = type { float, float }
View gist:830fc3bc015e66c0976249df8c07756b
$ python
Python 3.9.6 | packaged by conda-forge | (default, Jul 11 2021, 03:35:11)
[Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> scipy.__file__
'/Users/ondrej/repos/scipy/scipy/__init__.py'
>>> scipy.test()
============================= test session starts ==============================
platform darwin -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
View bench3.f90
This file has been truncated, but you can view the full file.
program bench3
implicit none
integer :: c
c = 0
call g1(c)
call g2(c)
call g3(c)
call g4(c)
call g5(c)
call g6(c)
View gist:5ba07a4b4d5ebb679d7c7bdc96a473cb
(TranslationUnit [(Module MaxwellEddy [] [] [(Subroutine destroy_system [(sys)] [] [(Declaration [(sys "type" [] [(Attribute intent [(inout)] [])] ())]) (Declaration [(default "type" [] [] ())])] [(Print () []) (If (FuncCallOrArray allocated [g0] []) [(Print () [])] []) (If (FuncCallOrArray allocated [eps] []) [(Print () [])] []) (If (FuncCallOrArray allocated [mu] []) [(Print () [])] []) (If (FuncCallOrArray allocated [sigma] []) [(Print () [])] []) (If (FuncCallOrArray allocated [emask] []) [(Print () [])] []) (If (FuncCallOrArray allocated [mtr1] []) [(Print () [])] []) (If (FuncCallOrArray allocated [mtr2] []) [(Print () [])] []) (If (FuncCallOrArray allocated [mtr3] []) [(Print () [])] []) (If (FuncCallOrArray allocated [w0mask] []) [(Print () [])] []) (If (FuncCallOrArray allocated [w1mask] []) [(Print () [])] []) (SubroutineCall destroy_msr_matrix [a0]) (SubroutineCall destroy_msr_matrix [a1]) (SubroutineCall destroy [ehist]) (SubroutineCall destroy [bhist]) (= sys default)] []) (Subroutine set_initial
@certik
certik / README
Last active July 21, 2020 15:33
Haskell macOS
View README
This contains the contents of https://get.haskellstack.org/stable/osx-x86_64.tar.gz
View f18_017.cpp
#include <memory>
#include <iostream>
class objectA {
public:
~objectA() {
std::cout << "A";
}
};
View a.f90
program exceptions
use iso_fortran_env, only: Out_of_memory
implicit none
integer :: s
block enable (Out_of_memory)
! Possible failure will be caught in the `handle` block
call mysum(5, s)
print *, s
end block