intrinsic_unpack.f90

来自「Mac OS X 10.4.9 for x86 Source Code gcc」· F90 代码 · 共 22 行

F90
22
字号
! Program to test the UNPACK intrinsicprogram intrinsic_unpack   integer, dimension(3, 3) :: a, b   logical, dimension(3, 3) :: mask;   character(len=50) line1, line2   integer i   mask = reshape ((/.false.,.true.,.false.,.true.,.false.,.false.,&                    &.false.,.false.,.true./), (/3, 3/));   a = reshape ((/1, 0, 0, 0, 1, 0, 0, 0, 1/), (/3, 3/));   b = unpack ((/2, 3, 4/), mask, a)   if (any (b .ne. reshape ((/1, 2, 0, 3, 1, 0, 0, 0, 4/), (/3, 3/)))) &      call abort   write (line1,'(10I4)') b   write (line2,'(10I4)') unpack((/2, 3, 4/), mask, a)   if (line1 .ne. line2) call abort   b = -1   b = unpack ((/2, 3, 4/), mask, 0)   if (any (b .ne. reshape ((/0, 2, 0, 3, 0, 0, 0, 0, 4/), (/3, 3/)))) &      call abortend program

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?