Skip to content

Instantly share code, notes, and snippets.

View certik's full-sized avatar

Ondřej Čertík certik

View GitHub Profile
program mandelbrot
integer, parameter :: Nx = 600, Ny = 450, n_max = 255, dp=kind(0.d0)
real(dp), parameter :: xcenter = -0.5_dp, ycenter = 0.0_dp, &
width = 4, height = 3, dx_di = width/Nx, dy_dj = -height/Ny, &
x_offset = xcenter - (Nx+1)*dx_di/2, y_offset = ycenter - (Ny+1)*dy_dj/2
integer :: image(Nx,Ny), image_color(4,Nx,Ny), palette(3,4), i, j, n, idx
real(dp) :: x, y, x_0, y_0, x_sqr, y_sqr
interface
subroutine show_img_color(w, h, A) bind(c)
integer, intent(in) :: w, h
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
program test_rsqrt
! Prints:
! $ gfortran test_rsqrt.f90 && ./a.out
! 0.81649658092772603
! 0.81649658092772626
! 0.81649658092772603
! 0.81649658092772603
implicit none
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)
; 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 }
$ 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
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)
(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
This contains the contents of https://get.haskellstack.org/stable/osx-x86_64.tar.gz
#include <memory>
#include <iostream>
class objectA {
public:
~objectA() {
std::cout << "A";
}
};