This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module linspace_mod | |
use iso_fortran_env, only: dp => real64 | |
implicit none | |
contains | |
!> | |
! Return evenly spaced numbers over a specified interval. | |
! | |
! Returns `num` evenly spaced samples, calculated over the interval `[start, stop]`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subroutine C_F_STRPOINTER (STRARRAY, FSTRPTR, MAXLEN) | |
use, intrinsic :: ISO_C_BINDING | |
implicit none | |
character, dimension(*), target, intent(in) :: STRARRAY | |
character(:), pointer, intent(out) :: FSTRPTR | |
integer, intent(in), optional :: MAXLEN | |
integer :: curlen | |
curlen = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from fractions import Fraction | |
def continued_fraction(r,steps=10): | |
cf = [] | |
for step in range(steps): | |
i = math.floor(r) | |
cf.append(i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module cbrt_mod1 | |
implicit none | |
private | |
public :: cbrt, sp, r | |
interface cbrt | |
module procedure cbrt_sp_sp | |
module procedure cbrt_csp_csp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module cbrt_mod2 | |
implicit none | |
private | |
public :: cbrt, sp | |
interface cbrt | |
module procedure cbrt_sp_sp | |
module procedure cbrt_sp_csp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module m_multa | |
implicit none | |
private | |
public :: multa | |
contains | |
subroutine multa(A,X,ndims,nrens,iblkmax) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! @(#)s_cbrt.c 5.1 93/09/24 | |
! | |
! ==================================================== | |
! Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | |
! | |
! Developed at SunPro, a Sun Microsystems, Inc. business. | |
! Permission to use, copy, modify, and distribute this | |
! software is freely granted, provided that this notice | |
! is preserved. | |
! ==================================================== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! For an explanation see: | |
! https://scicomp.stackexchange.com/questions/36261/factorization-of-cubic-spline-interpolation-matrix | |
! | |
! compile with: | |
! gfortran -Wall spline_test_driver.f90 -o spline_test_driver -llapack | |
! | |
module spline_test | |
implicit none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! Compile with: | |
! $ gfortran -Wall polynomial_companion_matrix.f90 -o polynomial_companion_matrix -llapack | |
! | |
! To run the code: | |
! $ ./polynomial_companion_matrix | |
! | |
program main | |
implicit none | |
integer, parameter :: sp = kind(1.0) | |
integer, parameter :: n = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module polyfit_mod | |
implicit none | |
contains | |
function vander(x,N,increasing) result(v) | |
real, intent(in) :: x(:) | |
integer, intent(in) :: N | |
logical, intent(in), optional :: increasing |