program oned_array
implicit none
integer i,j,k,seed,n,l
parameter(n=10)
real r0(n),s1(n)
real m
seed=4965817
!____________Generating the 1d array_________
do i=1,n
r0(i)=ran(seed)
write(20,*)r0(i)
enddo
k=1
l=n/5
do i=1,5
m=0
do j=k,l
s1(i)=r0(j)
m=m+s1(i)
write(21,*)i,j,s1(i)
enddo
k=l+1
l=l+n/5
write(22,*)i,m
enddo
stop
end
I think this will work for a 1 dimensional array. But what to do for a matrix?
m
is some quantity that I wanted to calculate for each subarray.
n is the older matrix dimension, ie 10.(10x10 matrix) M is something that I want to calculate This will convert the older matrix to 2*2 matrices and for each matrix I get m. Five 2*2 matrices.