Fortran Fortran Transpose: Transform a 4D Array into 2D

  • Thread starter Thread starter Milentije
  • Start date Start date
  • Tags Tags
    Fortran Transpose
AI Thread Summary
The discussion centers around the challenges of transposing a four-dimensional array in Fortran 90, specifically the array zmdsens(iper,i,1,iprd), which stores Magnetotelluric (MT) functions related to conductivity across multiple periods and sites. The user seeks to transpose a matrix representing derivatives of MT functions but faces limitations since Fortran 90 only supports transposition for two-dimensional arrays. The conversation highlights confusion regarding the nature of the array and the concept of transposing a function. A proposed solution involves defining a three-dimensional array and using intrinsic transpose functions, but the user encounters an error related to array allocation. The discussion emphasizes the need for a method to convert a one-dimensional array into a two-dimensional format to utilize the transpose function effectively.
Milentije
Messages
47
Reaction score
0
Here is the problem.I have this array zmdsens(iper,i,1,iprd) where iper is period,i site,1 mt function and iprd conductivity.This array stores MT functions for all above mentioned.I need tot find transpose of MT function,but fortran 90 can easily do that only with 2dimensional arrays.How to transform this?
 
Technology news on Phys.org
Milentije said:
Here is the problem.I have this array zmdsens(iper,i,1,iprd) where iper is period,i site,1 mt function and iprd conductivity.This array stores MT functions for all above mentioned.I need tot find transpose of MT function,but fortran 90 can easily do that only with 2dimensional arrays.How to transform this?
This doesn't make much sense. What you are describing as an array - zmdsens - looks like a function call or subroutine call to me.

What does it mean to take the transpose of a function?
What is an MT function?
 
Well I will try to explain more.I have two-dimensional mesh,every cell has conductivity.On the surface I calculate MT functions with respect to conductivity.The reason why we store them in 4-dimensional array is that we measure MT for more periods and sites on the surface.I need transpose of matrix which represents derivatives of MT with respect to conductivity.FORTRAN 90 requires 2d array for such operation.
 
For example we define a 3D array, like f(9, 9, 9). I think transpose f with the second index fixed would be: transpose( f ( :, 1, : ) ). Does this solve your problem?
 
No actually I will try to cope in the different way.Still I have problems how to go from 1d to 2d array,then just use intrinsic transpose.
program io_test
real, dimension(:,:), allocatable :: x
real, dimension(:,:), allocatable :: y
integer :: n
open (unit=99, file='array.txt', status='old', action='read')
read(99, *), n
allocate(x(n))
read(99,*) x
write(*,*) x
y=transpose(x)
write(*,*)y
end
I get this:
ifort -c io.f
io.f(8): error #6792: The rank of the allocate-shape-spec-list differs from the rank of the allocate-object. [X]
allocate(x(n))
------------------^
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
4
Views
2K
Replies
8
Views
3K
Replies
2
Views
9K
Replies
10
Views
25K
Replies
8
Views
2K
Replies
2
Views
3K
Back
Top