Commit b58849c0 authored by ulrich_y's avatar ulrich_y
Browse files

Move shuffle_with_zero to shuffle

parent 53b2acde
......@@ -52,6 +52,24 @@ CONTAINS
END FUNCTION shuffle_product
FUNCTION shuffle_with_zero(a) result(res)
! rows of result are shuffles of a with 0
type(inum) :: a(:)
type(inum) :: res(size(a)+1,size(a)+1)
integer :: i,j, N
N = size(a)+1
do i = 1,N
! i is the index of the row
! j is the index of the zero
j = N+1-i
res(i,j) = izero
res(i,1:j-1) = a(1:j-1)
res(i,j+1:N) = a(j:)
end do
END FUNCTION shuffle_with_zero
END MODULE shuffle
! PROGRAM test
......
......@@ -117,22 +117,6 @@ CONTAINS
enddo
END FUNCTION factorial
FUNCTION shuffle_with_zero(a) result(res)
! rows of result are shuffles of a with 0
type(inum) :: a(:)
type(inum) :: res(size(a)+1,size(a)+1)
integer :: i,j, N
N = size(a)+1
do i = 1,N
! i is the index of the row
! j is the index of the zero
j = N+1-i
res(i,j) = izero
res(i,1:j-1) = a(1:j-1)
res(i,j+1:N) = a(j:)
end do
END FUNCTION shuffle_with_zero
! subroutine print(s1,s2,s3,s4,s5)
! character(len = *), intent(in), optional :: s1, s2, s3, s4, s5
! if(print_enabled) then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment