Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 ディスカッション

RESHAPE and order argument

gelarimer
ビギナー
1,525件の閲覧回数
TheORDER = (/2,1,3/)argument in the RESHAPE() intrinsic function below does notappear to work or is being ignored.I would like the array GBD_JShift() to look like the layout of the numbers in the code below, but what I am getting is col. 1 is being filledfirst, then col. 2, then col. 3 and so on as ifORDER = (/1,2,3/) is being used.

Any information or comments would be appreciated. Thanks
[plain]MODULE JShift
! MODULE contains Delta J AVG values for diagonal interpolation

IMPLICIT NONE

! Delta J Avg data is from the following spreadsheet:
! IVF WIN32 SeriesScanned SeriesGawn Burrill"GB Max Kt & Kq shift.xls"
REAL(4), PARAMETER, DIMENSION(6,5,5) :: GBD_JShift = &
     RESHAPE(SOURCE = (/ &       
     !Prop 306 thru 320  BAR = 0.5		
     ! Sig 2.0	Sig 1.5	  Sig 1	   Sig  0.75	Sig 0.5     P/D Range	
       0.105,   0.190,    0.150,   0.130,       0.170, &    ! 0.6 to 0.8	
       0.095,   0.110,    0.210,   0.230,       0.195, &    ! 0.8 to 1.0	    
       0.080,   0.100,    0.115,   0.175,       0.160, &    ! 1.0 to 1.2	
       -1.0,     -1.0,    -1.0,    -1.0,        -1.0,  &    ! 1.2 to 1.4
       -1.0,     -1.0,    -1.0,    -1.0,        -1.0,  &    ! 1.4 to 1.6
       0.375,    0.400,   0.505,   0.520,       0.640, &    ! 1.2 to 2.0
     !Prop 406 thru 420  BAR = 0.65
     ! Sig 2.0	Sig 1.5	  Sig 1	   Sig  0.75	Sig 0.5     P/D Range	
       0.075,    0.110,   0.170,   0.150,       0.185, &    ! 0.6 to 0.8	
       0.100,    0.100,   0.135,   0.180,       0.175, &    ! 0.8 to 1.0	    
       0.075,    0.090,   0.105,   0.150,       0.130, &    ! 1.0 to 1.2	
       0.095,    0.105,   0.130,   0.140,       0.185, &    ! 1.2 to 1.4	
       0.085,    0.085,   0.090,   0.125,       0.095, &    ! 1.4 to 1.6	
       0.170,    0.195,   0.235,   0.220,       0.335, &    ! 1.6 to 2.0	
     ! Prop 106 thru 120  BAR = 0.80
     ! Sig 2.0	Sig 1.5	  Sig 1	   Sig  0.75	Sig 0.5     P/D Range	
       0.100,    0.100,   0.145,   0.165,       0.140, &    ! 0.6 to 0.8	
       0.085,    0.105,   0.140,   0.160,       0.160, &    ! 0.8 to 1.0	    
       0.090,    0.090,   0.095,   0.125,       0.170, &    ! 1.0 to 1.2	
       0.085,    0.100,   0.120,   0.115,       0.145, &    ! 1.2 to 1.4	
       0.095,    0.100,   0.110,   0.130,       0.120, &    ! 1.4 to 1.6	
       0.155,    0.160,   0.185,   0.215,       0.245, &    ! 1.6 to 2.0	
     ! Prop 508 thru 520  BAR = 0.95
     ! Sig 2.0	Sig 1.5	  Sig 1	   Sig  0.75	Sig 0.5     P/D Range	
       -1.0,     -1.0,    -1.0,    -1.0,        -1.0,  &    ! 0.6 to 0.8
       0.095,    0.100,   0.115,   0.130,       0.150, &    ! 0.8 to 1.0	    
       0.095,    0.085,   0.090,   0.100,       0.135, &    ! 1.0 to 1.2	
       0.095,    0.110,   0.130,   0.150,       0.125, &    ! 1.2 to 1.4	
       0.095,    0.090,   0.080,   0.105,       0.150, &    ! 1.4 to 1.6	
       0.160,    0.190,   0.230,   0.205,       0.230, &    ! 1.6 to 2.0	
     ! Prop 208 thru 216  BAR = 0.95
     ! Sig 2.0	Sig 1.5	  Sig 1	   Sig  0.75	Sig 0.5     P/D Range	
       -1.0,    -1.0,     -1.0,    -1.0,        -1.0,  &    ! 0.6 to 0.8
       0.085,   0.100,    0.110,   0.130,       0.170, &    ! 0.8 to 1.0	    
       0.125,   0.090,    0.105,   0.090,       0.125, &    ! 1.0 to 1.2	
       0.085,   0.125,    0.105,   0.120,       0.125, &    ! 1.2 to 1.4	
       0.115,   0.075,    0.100,   0.125,       0.155, &    ! 1.4 to 1.6	
       -1.0,    -1.0,     -1.0,    -1.0,        -1.0/),&    ! 1.6 to 2.0 
     SHAPE = (/6,5,5/), ORDER = (/2,1,3/))              


END MODULE[/plain]
0 件の賞賛
8 返答(返信)
gelarimer
ビギナー
1,525件の閲覧回数
The following code produces array Test1() which is identical to array Test2() even though the ORDER argument in the intrinsicRESHAPE() is different.

What am I doing wrong? Thanks for any comments.
[plain]SUBROUTINE Test()

IMPLICIT NONE

REAL(4) ret1, ret2

REAL(4), DIMENSION(2,2,2) :: Test1 = RESHAPE( SOURCE = (/1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0/), &
         SHAPE = (/2,2,2/), ORDER = (/1,2,3/))


REAL(4), DIMENSION(2,2,2) :: Test2 = RESHAPE( SOURCE = (/1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0/), &
         SHAPE = (/2,2,2/), ORDER = (/2,1,3/))
         
       
       ret1 = Test1(2,1,1)
       
       ret2 = Test2(2,1,1)

       RETURN
end[/plain]

Steven_L_Intel1
従業員
1,525件の閲覧回数
I agree this looks odd - I'll investigate.
anthonyrichards
新規コントリビューター III
1,525件の閲覧回数
Are you using IVF or Compaq Visual Fortran?

Using CVF, Iget the same as you , (1,2,3,4,5,6,7,8) with ORDER = (/2,1,3/) instead of the desired (1,5,3,7,2,4,6,8).

Using ORDER = (/3,2,1/) (i.e. C-ordering) I get Test2=(1,5,3,7,2,6,4,8) as desired.

BUTusing ORDER = (/1,3,2/) I get Test2=(1,1,3,3,2,2,4,4) instead of the desired (1,2,5,6,3,4,7,8)

Using IVF, I get the same as you , (1,2,3,4,5,6,7,8) with ORDER = (/2,1,3/) instead of the desired (1,5,3,7,2,4,6,8).

Using ORDER = (/3,2,1/) (i.e. C-ordering) I get Test2=(1,5,3,7,2,6,4,8) as desired.

BUT using ORDER = (/1,3,2/) I get Test2 =(1,2,5,6,3,4,7,8), as desired.

So it looks like CVF had bugs withRESHAPE,and IVF stillhas RESHAPE bugs, but one less than CVF!

I would guess that most effort was concentrated on getting the C-re-ordering right, at the expense of all others.
gelarimer
ビギナー
1,525件の閲覧回数

Thanks Anthony and Steve, I am using IVF.
Steven_L_Intel1
従業員
1,525件の閲覧回数
I reported this as a bug to development.
Steven_L_Intel1
従業員
1,525件の閲覧回数
It turns out that this problem exists only for use of RESHAPE in initialization expressions. If you put it in executable code, such as an assignment statement, it works fine.
Steven_L_Intel1
従業員
1,525件の閲覧回数
This bug is scheduled to be fixed in a future update to version 11.1 (probably August.)
Steven_L_Intel1
従業員
1,525件の閲覧回数
This problem was corrected in 11.1 Update 2.
返信