Tiles the input array n
times. Returns a tiled array that has rank equal
to size(shape(array))+1
and that has values equal to values of array
,
repeated n
times. This version is for 2-d input array of integers. This
procedure is overloaded by the generic procedure tile
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ik), | intent(in), | dimension(:,:) | :: | array | Input array |
|
integer(kind=ik), | intent(in) | :: | n | Number of times to copy input array |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
pure function tile_2d_int(array,n) result(tiled_array)
!! Tiles the input array `n` times. Returns a tiled array that has rank equal
!! to `size(shape(array))+1` and that has values equal to values of `array`,
!! repeated `n` times. This version is for 2-d input array of integers. This
!! procedure is overloaded by the generic procedure `tile`.
integer(kind=ik),dimension(:,:),intent(in) :: array !! Input array
integer(kind=ik),intent(in) :: n !! Number of times to copy input array
integer(kind=ik),dimension(:,:,:),allocatable :: tiled_array
integer(kind=ik) :: i
allocate(tiled_array(size(array,dim=1),size(array,dim=2),n))
do concurrent(i=1:n)
tiled_array(:,:,i) = array(:,:)
enddo
endfunction tile_2d_int