0

# Fortran unknown aray size

I have two matrix lets say a(5,200) b(200,1) i want to calculate : c = (transpose(a))*a. And d = (transpose ((a))*b If i dont know the size of matrix c and d how i can declare them in the begining i have tried c(:,:) and d(:,:) but it doesnt work and the one in google is complicated . Explain to me pls

1 Answer

0

The problem you are trying to solve is fairly straightforward. If you do not know the size of the array at the start, you should use dynamically allocated array.
real, dimension(:,:), allocatable :: c, d
Later when you get to know the sizes of a and b, you allocate those arrays as
integer clen = awidth
integer cwidth = awidth
integer dlen = alen
integer dwithd = bwidth
allocate( c (clen,cwidth) &
,d (dlen,dwidth) &
)
and proceed with the calculations as planned.

Hot today

Please help me with HTML

1 Votes

What is the mistake here?

3 Votes

Unable to overload +

2 Votes

Hey! [SOLVED]

0 Votes

Pls rectify the errors.

1 Votes