N-dimensional array type, extends the abstract encap type
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | dim | ||||
integer, | public, | allocatable | :: | shape(:) | |||
real(kind=pfdp), | public, | allocatable | :: | flatarray(:) |
The following are the base subroutines that all encapsulations must provide
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(inout) | :: | this | |||
real(kind=pfdp), | intent(in) | :: | val | |||
integer, | intent(in), | optional | :: | flags |
Subroutine to copy an array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(inout) | :: | this | |||
class(pf_encap_t), | intent(in) | :: | src | |||
integer, | intent(in), | optional | :: | flags |
Subroutine to define the norm of the array (here the max norm)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(in) | :: | this | |||
integer, | intent(in), | optional | :: | flags |
Subroutine to pack an array into a flat array for sending
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(in) | :: | this | |||
real(kind=pfdp), | intent(out) | :: | z(:) | |||
integer, | intent(in), | optional | :: | flags |
Subroutine to unpack a flatarray after receiving
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(inout) | :: | this | |||
real(kind=pfdp), | intent(in) | :: | z(:) | |||
integer, | intent(in), | optional | :: | flags |
Subroutine to compute y = a x + y where a is a scalar and x and y are arrays
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(inout) | :: | this | |||
real(kind=pfdp), | intent(in) | :: | a | |||
class(pf_encap_t), | intent(in) | :: | x | |||
integer, | intent(in), | optional | :: | flags |
Subroutine to print the array to the screen (mainly for debugging purposes)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(inout) | :: | this | |||
integer, | intent(in), | optional | :: | flags |
type, extends(pf_encap_t) :: ndarray
integer :: dim
integer, allocatable :: shape(:)
real(pfdp), allocatable :: flatarray(:)
contains
procedure :: setval => ndarray_setval
procedure :: copy => ndarray_copy
procedure :: norm => ndarray_norm
procedure :: pack => ndarray_pack
procedure :: unpack => ndarray_unpack
procedure :: axpy => ndarray_axpy
procedure :: eprint => ndarray_eprint
end type ndarray