小编MSa*_*Sap的帖子

Sourced allocation from transposed array

I'm trying to understand a bug that I encountered in my code. When trying to allocate an array using the transpose of an array, I use an allocate statement with source=transpose(original_array) in my code. However, I don't get the expected result using this method. It seems that the indexing is off by one and the first row of the source array is skipped.

Example:

program testalloc
    real*8, allocatable :: a(:, :)
    real*8, allocatable :: b(:, :)

    allocate(b(2, 3))
    b(1, :) …
Run Code Online (Sandbox Code Playgroud)

fortran gfortran

5
推荐指数
1
解决办法
50
查看次数

标签 统计

fortran ×1

gfortran ×1