1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Open & read command in fortran

  1. Dec 7, 2009 #1
    I have two files I need to read arrays out of using the "open" command and I keep getting a compiler error saying "(col. 1) remark: LOOP WAS VECTORIZED." I assume this is because I am reading the data out of the files incorrectly but I don't really understand what "loop was vectorized" means. The data in the files is formatted as
    IxJ
    number
    number
    number
    ....

    where I and J are the dimensions the array and number represents numbers in the array

    Here's what I have although I am pretty sure my error lies in my reading of the array

    Code (Text):
    PROGRAM MAT_MUL_FORTRAN_INTRINSIC_FUNC
    IMPLICIT NONE
    CHARACTER(LEN=30) :: INPUT_FILE_1, INPUT_FILE_2
    REAL, DIMENSION(10000,10000) :: DATA_ARRAY_1, DATA_ARRAY_2, DATA_ARRAY_3

    PRINT *, "PLEASE ENTER THE COMPLETE NAME OF THE TWO FILES CONTAINING THE MATRICES YOU WISH TO MULTIPLY"
    READ *, INPUT_FILE_1, INPUT_FILE_2

    OPEN(1, FILE=INPUT_FILE_1, ACTION="READ", FORM='FORMATTED')
    READ(1) DATA_ARRAY_1
    CLOSE(1)

    OPEN(2, FILE=INPUT_FILE_1, ACTION="READ", FORM='FORMATTED')
    READ(2) DATA_ARRAY_2
    CLOSE(2)

    DATA_ARRAY_3 = DATA_ARRAY_1*DATA_ARRAY_2

    OPEN(3, FILE="RESULTING_MATRIX.dat", ACTION="WRITE", FORM='FORMATTED')
    WRITE(3) DATA_ARRAY_3
    CLOSE(3)

    END PROGRAM MAT_MUL_FORTRAN_INTRINSIC_FUNC
     
    Thanks in advance for the help!




    2. Relevant equations



    3. The attempt at a solution
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Open & read command in fortran
  1. Fortran reading csv (Replies: 2)

Loading...