Skip to content

Instantly share code, notes, and snippets.


Ivan Pribec ivan-pi

View GitHub Profile
ivan-pi / fortran_namelist.xml
Created Dec 27, 2021
Fortran namelist configuration file for Notepad++
View fortran_namelist.xml
<UserLang name="Fortran Namelist" ext="nml" udlVersion="2.1">
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
<Keywords name="Comments">00! 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1">.</Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
ivan-pi / fypp.sublime-build
Created Dec 9, 2021
Sublime build system command for fypp (
View fypp.sublime-build
"file_patterns": ["*.fypp", "*.fy90"],
"working_dir": "${file_path}",
"cmd": ["fypp", "${file}", "${file_base_name}.f90"]
ivan-pi / test_optval.fypp
Created Nov 24, 2021
fypp macros for dealing with Fortran optional arguments
View test_optval.fypp
#! Can be used currently
#:def optval(lhs,opt,default)
${lhs}$ = ${default}$
if (present(${opt}$)) ${lhs}$ = ${opt}$
#! This is the F202X conditional expression syntax
#:def optval2(opt,default)
present(${opt}$)) ? ${opt}$ : ${default}$
ivan-pi / lapack_interface.f90
Created Nov 24, 2021
Examle of LU factorization using Fortran parameterized derived types
View lapack_interface.f90
module lapack
implicit none
subroutine sgetrf(m,n,a,lda,ipiv,info)
integer, intent(in) :: m, n, lda
real, intent(inout) :: a(lda,*)
integer, intent(out) :: ipiv(*)
integer, intent(out) :: info
ivan-pi /
Last active Sep 30, 2021
Some ideas for documenting Fortran procedures in (GitHub-Flavored) Markdown documents

Ideas for Fortran documentation in Markdown

Version 1 (f90doc-inspired)


  • Terse, reuses actual procedure declaration
  • All argument attributes are visible


View pad_mod.f90
module pad_mod
implicit none
interface padl
module procedure padl_blank
module procedure padl_char
end interface
interface padr
ivan-pi / integer_list_mod.f90
Created Mar 5, 2021
Fortran experiment with a fixed-size integer list
View integer_list_mod.f90
module integer_list_mod
implicit none
public :: integer_list
type :: index_t
integer :: idx
ivan-pi / chkend.f90
Created Feb 16, 2021
Check processor endianess in Fortran
View chkend.f90
!> Check Endianess
!> Inspect the endianess of the platform.
!> Based on a program posted by @urbanjost (
!> posted at The original
!> program was based on ideas from the Code Tuning co-guide, 1998 Lahey Fortran
!> Users' Conference.
!> Author: Ivan Pribec (
ivan-pi / pcg32.f90
Last active Dec 17, 2020
Attempt of porting the PCG random number generator by Melissa O'Neill to Fortran. The code is not tested. Signed integers are used for the state.
View pcg32.f90
! PCG Random Number Generation for Fortran
! Ported from the minimal C version by Melissa O'Neill
! Copyright 2020 Ivan Pribec <>
! Copyright 2014 Melissa O'Neill <>
ivan-pi / test_spblas.f90
Last active Dec 25, 2020
Intel MKL Sparse BLAS matrix-vector product example
View test_spblas.f90
! Sparse BLAS matrix-vector product example
! The following code demonstrates the creation of
! a CSR matrix, and the sparse matrix-vector product
! using the sparse BLAS functions in Intel MKL.
! For linking options for your specific platform see
! the Intel MKL link line advisor located at: