Created
April 29, 2011 04:55
-
-
Save certik/947861 to your computer and use it in GitHub Desktop.
Gfortran warning
This file contains 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
all: | |
gfortran -Wextra -Wall -o w.o -c w.f90 |
This file contains 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 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you compile this, it will produce the following warning: