-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_vec.f90
46 lines (39 loc) · 1.01 KB
/
test_vec.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
! This is file : test_vec
! Author= zaikunzhang
! Started at: 16.04.2022
! Last Modified: Monday, May 02, 2022 PM11:57:00
!
! NAG Fortran Compiler Release 7.0 (Yurakucho) Build 7066 fails to compile this file with the
! following error message:
!
! ```
! $ nagfor test_vec.f90
! NAG Fortran Compiler Release 7.0(Yurakucho) Build 7066
! Panic: test_vec.f90: Unexpected contiguous vector subscript ntype 639
! Internal Error -- please report this bug
! ```
module trueloc_mod
implicit none
contains
function trueloc(x) result(loc)
implicit none
logical, intent(in) :: x(:)
integer, allocatable :: loc(:)
integer :: i
allocate (loc(count(x)))
loc = pack([(i, i=1, size(x))], mask=x)
end function trueloc
end module trueloc_mod
program test_vec
use, non_intrinsic :: trueloc_mod, only : trueloc
implicit none
integer, parameter :: n = 2
real :: A(n, n), x(n), y(n)
A = 1.0
x = 1.0
y(1) = 1.0
y(2) = 2.0
write (*, *) x(trueloc(y > 1))
write (*, *) A(trueloc(y > 1), :)
write (*, *) matmul(A(trueloc(y > 1), :), x)
end program test_vec