forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Trouble with Shape

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
GlenFlint



Joined: 04 Nov 2011
Posts: 23

PostPosted: Thu Dec 01, 2011 5:40 pm    Post subject: Trouble with Shape Reply with quote

This website has an example of how to use the reshape function.

http://www.nsc.liu.se/~boein/f77to90/a5.html#section17
Code:

! PROGRAM TO TEST THE OPTIONAL ARGUMENTS TO RESHAPE
  INTERFACE
     SUBROUTINE WRITE_MATRIX(A)
         REAL, DIMENSION(:,:) :: A
     END SUBROUTINE  WRITE_MATRIX
  END INTERFACE

  REAL, DIMENSION (1:9) :: B = (/ 11, 12, 13, 14, 15, 16, 17, 18, 19 /)
  REAL, DIMENSION (1:3, 1:3) :: C, D, E
  REAL, DIMENSION (1:4, 1:4) :: F, G, H

  INTEGER, DIMENSION (1:2) :: ORDER1 = (/ 1, 2 /)
  INTEGER, DIMENSION (1:2) :: ORDER2 = (/ 2, 1 /)
  REAL, DIMENSION (1:16)   :: PAD1 = (/ -1, -2, -3, -4, -5, -6, -7, -8, &
                                 &   -9, -10, -11, -12, -13, -14, -15, -16 /)

  C = RESHAPE( B, (/ 3, 3 /) )
  CALL WRITE_MATRIX(C)

  D = RESHAPE( B, (/ 3, 3 /), ORDER = ORDER1)
  CALL WRITE_MATRIX(D)

  E = RESHAPE( B, (/ 3, 3 /), ORDER = ORDER2)
  CALL WRITE_MATRIX(E)

  F = RESHAPE( B, (/ 4, 4 /), PAD = PAD1)
  CALL WRITE_MATRIX(F)

  G = RESHAPE( B, (/ 4, 4 /), PAD = PAD1, ORDER = ORDER1)
  CALL WRITE_MATRIX(G)

  H = RESHAPE( B, (/ 4, 4 /), PAD = PAD1, ORDER = ORDER2)
  CALL WRITE_MATRIX(H)

  END

  SUBROUTINE WRITE_MATRIX(A)
  REAL, DIMENSION(:,:) :: A
  WRITE(*,*)
  DO I = LBOUND(A,1), UBOUND(A,1)
     WRITE(*,*) (A(I,J), J = LBOUND(A,2), UBOUND(A,2))
  END DO
  END SUBROUTINE WRITE_MATRIX


The expected result is:
Code:
  11.0000000  14.0000000  17.0000000
  12.0000000  15.0000000  18.0000000
  13.0000000  16.0000000  19.0000000

  11.0000000  14.0000000  17.0000000
  12.0000000  15.0000000  18.0000000
  13.0000000  16.0000000  19.0000000

  11.0000000  12.0000000  13.0000000
  14.0000000  15.0000000  16.0000000
  17.0000000  18.0000000  19.0000000

  11.0000000  15.0000000  19.0000000  -4.0000000
  12.0000000  16.0000000  -1.0000000  -5.0000000
  13.0000000  17.0000000  -2.0000000  -6.0000000
  14.0000000  18.0000000  -3.0000000  -7.0000000

  11.0000000  15.0000000  19.0000000  -4.0000000
  12.0000000  16.0000000  -1.0000000  -5.0000000
  13.0000000  17.0000000  -2.0000000  -6.0000000
  14.0000000  18.0000000  -3.0000000  -7.0000000

  11.0000000  12.0000000  13.0000000  14.0000000
  15.0000000  16.0000000  17.0000000  18.0000000
  19.0000000  -1.0000000  -2.0000000  -3.0000000
  -4.0000000  -5.0000000  -6.0000000  -7.0000000


Silverfrost doesn't give the same result as the website.
[code:1:92705f07c5]

11.0000 14.0000 17.0000
12.0000 15.0000 18.0000
13.0000 16.0000 19.0000

11.0000 14.0000 17.0000
12.0000 15.0000 18.0000
13.0000 16.0000 19.0000

11.0000 12.0000 13.0000
14.0000 15.0000 16.0000
17.0000 18.0000 19.0000

11.0000 15.0000 19.0000 0.00000
12.0000 16.0000 -1.00000 0.00000
13.0000 17.0000 6.611734E-37 6.611657E-37
14.0000 18.0000 0.00000 0.00000

11.0000 15.0000 19.0000 0.00000
12.0000 16.0000 -1.00000 0.00000
13.0000 17.0000 6.611763E-37 3.098880E-29
14.0000 18.0000 0.00000 0.00000

11.0000 12.0000 13.0000 14.0000
15.0000 16.0000 17.0000 18.0000
19.0000 -1.00000 6.61179
Back to top
View user's profile Send private message
GlenFlint



Joined: 04 Nov 2011
Posts: 23

PostPosted: Thu Dec 01, 2011 5:48 pm    Post subject: Results from Silverfrost Reply with quote

My previous post is being truncated.

Here are the Silverfrost results.
Code:

      11.0000         14.0000         17.0000
      12.0000         15.0000         18.0000
      13.0000         16.0000         19.0000

      11.0000         14.0000         17.0000
      12.0000         15.0000         18.0000
      13.0000         16.0000         19.0000

      11.0000         12.0000         13.0000
      14.0000         15.0000         16.0000
      17.0000         18.0000         19.0000

      11.0000         15.0000         19.0000         0.00000
      12.0000         16.0000        -1.00000         0.00000
      13.0000         17.0000        6.611734E-37    6.611657E-37
      14.0000         18.0000         0.00000         0.00000

      11.0000         15.0000         19.0000         0.00000
      12.0000         16.0000        -1.00000         0.00000
      13.0000         17.0000        6.611763E-37    3.098880E-29
      14.0000         18.0000         0.00000         0.00000

      11.0000         12.0000         13.0000         14.0000
      15.0000         16.0000         17.0000         18.0000
      19.0000        -1.00000        6.611792E-37     0.00000
      0.00000         0.00000         0.00000         0.00000


What is the correct answer?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7928
Location: Salford, UK

PostPosted: Thu Dec 01, 2011 9:22 pm    Post subject: Reply with quote

The "expected" result looks good.
The padding is clearly not working in FTN95.
I will log this as a bug to fix.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7928
Location: Salford, UK

PostPosted: Fri Feb 24, 2012 4:39 pm    Post subject: Reply with quote

I have fixed this bug for the next release.
Took me a while to find it but in the end the fix was to remove one character from a character string.
Back to top
View user's profile Send private message AIM Address
GlenFlint



Joined: 04 Nov 2011
Posts: 23

PostPosted: Fri Feb 24, 2012 5:01 pm    Post subject: Reply with quote

Thanks Paul,

When will the fix be available?

Glen
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7928
Location: Salford, UK

PostPosted: Fri Feb 24, 2012 5:51 pm    Post subject: Reply with quote

The last release was in December 2011. The Announcements section of this Forum gives an indication of how often releases are made. The interval varies but it is usually from 6 to 12 months from the last release.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group