Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Fortran Example

By: mrmMM on Nov 26th, 2012  |  syntax: Fortran  |  size: 0.62 KB  |  views: 49  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. program reshapeArray
  2.  
  3.     implicit none
  4.    
  5.     integer, parameter :: ntens = 3
  6.     integer, parameter :: ndim = 7
  7.     integer i,j
  8.     integer, dimension(ndim) :: inArray
  9.    
  10.     integer, dimension(2,ntens) :: newarray
  11.    
  12.     inArray(1) = 1
  13.     inArray(2) = 2
  14.     inArray(3) = 3
  15.     inArray(4) = 4
  16.     inArray(5) = 5
  17.     inArray(6) = 6
  18.     inArray(7) = 7
  19.  
  20.    
  21.         do i = 1, ndim
  22.                 write(*,*) 'InArray', inArray(i)
  23.         end do
  24.  
  25.  !   reshape(inArray(1:6),[2,ntens], order[2,1])
  26.     reshape(inArray(1:6),[2,ntens])
  27.  
  28.     do i = 1,ntens
  29.         write(*,*) inArray(i,1:2)
  30.     end do
  31.  
  32. end program reshapeArray