Forces symmetry in theta in the passed array. If isign == 0 then
a(+/- theta)
is replaced by the average of a(+/-theta)
, otherwise
a(+/- theta)
is replaced by +/- (a(theta)-a(-theta))
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(inout), | dimension(-ntgrid:) | :: | a | ||
integer, | intent(in) | :: | isign | |||
integer, | intent(in) | :: | ntgrid |
pure subroutine sym(a, isign, ntgrid)
implicit none
integer, intent(in) :: isign, ntgrid
real, dimension(-ntgrid:), intent (in out) :: a
integer :: i
if (isign == 0) then
do i = 1, ntgrid
a(i) = 0.5 * (a(i) + a(-i))
a(-i) = a(i)
end do
else
do i = 1, ntgrid
a(i) = 0.5 * (a(i) - a(-i))
a(i) = -a(-i)
end do
a(0) = 0.
end if
end subroutine sym