Вы можете реализовать тип самостоятельно.Вот грязный и неэффективный способ сделать это.
module WeirdArray
implicit none
private
type, public :: Warray
private
integer, dimension(:), allocatable :: indeces
real, dimension(:), allocatable :: vals
contains
procedure, pass :: init
procedure, pass :: get
procedure, pass :: set
end type
contains
subroutine init(this, i, v)
class(warray), intent(out) :: this
integer, dimension(:) :: i
real, dimension(size(i)) :: v
this%indeces = i
this%vals = v
end subroutine init
function get(this, indx) result(x)
class(warray), intent(in) :: this
integer, intent(in) :: indx
real :: x
integer, dimension(:), allocatable :: p
integer :: i
p = pack([(i,i=1,size(this%indeces))],this%indeces==indx)
x = this%vals( p(1) )
end function get
subroutine set(this, indx, x)
class(warray), intent(inout) :: this
integer, intent(in) :: indx
real, intent(in) :: x
integer, dimension(:), allocatable :: p
integer :: i
p = pack([(i,i=1,size(this%indeces))],this%indeces==indx)
this%vals( p(1) ) = x
end subroutine set
end module WeirdArray
И вы можете использовать это так:
program main
use weirdArray
implicit none
type(Warray) :: wa
call wa%init([5,12], [10.0, 24.0])
write(*,*) wa%get(5)
call wa%set(5, 3.14)
write(*,*) wa%get(5)
write(*,*) wa%get(12)
end program main