N-dimensional array type for optimal control, extends the abstract encap type
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | dim | ||||
integer, | public, | allocatable | :: | shape(:) | |||
real(kind=pfdp), | public, | allocatable | :: | yflatarray(:) | |||
real(kind=pfdp), | public, | allocatable | :: | pflatarray(:) |
Subroutine to set array to a scalar value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray_oc), | 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_oc), | 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_oc), | 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_oc), | 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_oc), | 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_oc), | 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_oc), | intent(inout) | :: | this | |||
integer, | intent(in), | optional | :: | flags |
type, extends(pf_encap_t) :: ndarray_oc
integer :: dim
integer, allocatable :: shape(:)
real(pfdp), allocatable :: yflatarray(:)
real(pfdp), allocatable :: pflatarray(:)
contains
procedure :: setval => ndarray_oc_setval
procedure :: copy => ndarray_oc_copy
procedure :: norm => ndarray_oc_norm
procedure :: pack => ndarray_oc_pack
procedure :: unpack => ndarray_oc_unpack
procedure :: axpy => ndarray_oc_axpy
procedure :: eprint => ndarray_oc_eprint
end type ndarray_oc