You are on page 1of 3

!

!JohnC's 'starter for 10' version (10)

some code here


some more code here
do j = 1,ncb
c(:,j) = 0
do k = 1,nca
c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j)
end do ! k
end do ! j
almost last code here
last code here
!

! Fortran Style Guide (max(?) 4 spaces version) (10)

some code here


some more code here
do j = 1,ncb
c(:,j) = 0
do k = 1,nca
c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j)
end do ! k
end do ! j
almost last code here
last code here
!

! Eddie's blank lines, No Indent Preference ? (14)

some code here


some more code here

do j = 1,ncb
c(:,j) = 0

do k = 1,nca
c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j)
end do ! k

end do ! j

almost last code here


last code here
!

! John_Silver 2spaces & blank lines version (14+1)

some code here


some more code here

do j = 1,ncb
c(:,j) = 0

do k = 1,nca
c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j)
end do ! k

a bit more code here


end do ! j

almost last code here


last code here
!

! John_Silver 4spaces & blank lines version (14+1)


some code here
some more code here

do j = 1,ncb
c(:,j) = 0

do k = 1,nca
c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j)
end do ! k

a bit more code here


end do ! j

almost last code here


last code here
!

! Utopian Style :- 4spaces indent, 'Eddie spaced' & version - the traceability
optimum ??? (18+1+1)

some code here


some more code here

do j = 1,ncb !--------------------------------------------------------
!
c(:,j) = 0 !
!
do k = 1,nca !--------------------------------- !
! !
c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j) !--- k
loop !--- j loop
! !
end do ! k !--------------------------------- !
!
maybe some more code here !
a bit more code here !
!
end do ! j !----------------------------------------------------------

almost last code here


last code here

! Supplementary coding etiquette question ....


!
! is it more 'politically correct' to write code:
!
! looping over first k then j then i , for matrix(i,j,k)
! or
! looping over first i then j then k for matrix(matrix(k,j,i)
!
! ...... the former being of the form similar to the 2-D array in John C's
code ?
!
!
do k = 1,ncb
c(:,k) = 0
do j = 1,nca
c(1:nra,k) = c(1:nra,k) + a(1:nra,j) * b(j,k)
end do ! j
end do ! k
!