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 

Compiling DLLs - 64 bit not allowed?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
mecej4



Joined: 31 Oct 2006
Posts: 1884

PostPosted: Fri Aug 04, 2017 9:24 pm    Post subject: Reply with quote

Fortran provides other facilities to do what you used FORALL for; among them are array expressions, array constructors and and array assignments. Your entire code could be rewritten as
Code:

PROGRAM example
    IMPLICIT NONE

    INTEGER :: irows, nrows = 5
    INTEGER, ALLOCATABLE :: array(:)

    ALLOCATE(array(nrows))
    array=2*[(irows, irows = 1,nrows)]
    PRINT*,  array
    DEALLOCATE(array)

END PROGRAM

The expression within brackets is an array constructor based on an implied DO loop, and that expression is an array expression even after the multiplication by 2. The statement on that line is an array assignment.
Back to top
View user's profile Send private message
viroxa



Joined: 28 Jul 2017
Posts: 78

PostPosted: Fri Aug 04, 2017 10:18 pm    Post subject: Reply with quote

Good to know, thanks! And how could one handle more complex functions?
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1884

PostPosted: Fri Aug 04, 2017 11:45 pm    Post subject: Reply with quote

That would depend on the nature of the function, so it is not easy to give a universal prescription.

You could program your complicated function using simple code at first, get it to produce correct results, and then look into making the code faster by vectorization, parallelization and other methods.
Back to top
View user's profile Send private message
viroxa



Joined: 28 Jul 2017
Posts: 78

PostPosted: Sat Aug 05, 2017 12:14 pm    Post subject: Reply with quote

OK, thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
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