0

I am converting an old fortran code to java but I am stuck with following line:

PARAMETER (MAXC=15)
REAL CKV(MAXC,MAXC)

DATA (CKV( 1,J),J= 2,15)/10*0.,.45,.02,.12,.08/
DATA (CKV( 2,J),J= 3,15)/ 9*0.,.45,.06,.15,.07/

Can someone explain the above last two lines.

Thanks

1 Answer 1

2
PARAMETER (MAXC=15)

This declares MAXC a parameter (constant) and assign the value 15.

REAL CKV(MAXC,MAXC)

This is a declaration of the floating point (single precision) array CKV of dimensions (MAXC,MAXC)

DATA (CKV( 1,J),J= 2,15)/10*0.,.45,.02,.12,.08/
DATA (CKV( 2,J),J= 3,15)/ 9*0.,.45,.06,.15,.07/

This statement assigns initial values to CKV (at least to some elements). 10*0. means "take 10 times the 0.".

To clarify my answer (as requested in the comment):

(CKV( 1,J),J= 2,15) means "initialize the array subsection CKV( 1,2:15)", i.e. 14 elements. This matches the 14 elements on the right-hand-side (10x0., .45,.02,.12,.08).

The second implicit loop starts at 3, so only 13 elements are assigned. Therefore, it is just 9*0..

Sign up to request clarification or add additional context in comments.

1 Comment

You reply partially ans my Q. As i understand the first part of above line means CKV(1,2) and CKV(1,15) then why there are 5 values (10*0. , .45, .02, .12, .08) to the right of it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.