Skip to content

Instantly share code, notes, and snippets.

@certik
Created April 29, 2011 04:55
Show Gist options
  • Save certik/947861 to your computer and use it in GitHub Desktop.
Save certik/947861 to your computer and use it in GitHub Desktop.
Gfortran warning
all:
gfortran -Wextra -Wall -o w.o -c w.f90
module mixings
implicit none
private
public mixing_linear
integer, parameter :: dp=kind(0.d0)
contains
function mixing_linear(R, x0, max_iter, alpha)
! Finds "x" so that R(x) = 0, uses x0 as the initial estimate
real(dp), intent(in) :: x0(:), alpha
integer, intent(in) :: max_iter
real(dp) :: mixing_linear(size(x0))
interface
function R(x, i)
implicit none
integer, parameter :: dp=kind(0.d0)
real(dp), intent(in) :: x(:)
integer, intent(in) :: i ! iteration #
real(dp) :: R(size(x))
end function
end interface
real(dp), dimension(size(x0)) :: x_i
integer :: i
x_i = x0
do i = 1, max_iter
x_i = x_i + alpha * R(x_i, i)
end do
mixing_linear = x_i
end function
end module
@certik
Copy link
Author

certik commented Apr 29, 2011

If you compile this, it will produce the following warning:

$ make
gfortran -W -Wall -o w.o -c w.f90
w.f90:11:0: warning: unused parameter ‘r’

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment