Implements a vector as an extendable array.
Creates an ivector with all elements from an array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ivector_t), | intent(inout) | :: | this | |||
integer, | intent(in), | dimension(:) | :: | x |
Creates a dvector with all elements from an array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dvector_t), | intent(inout) | :: | this | |||
real(kind=rp), | intent(in), | dimension(:) | :: | x |
Copies the contents of ivector other
to ivector this
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this | |||
class(ivector_t), | intent(in) | :: | other |
Copies the contents of dvector other
to dvector this
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
class(dvector_t), | intent(in) | :: | other |
Copies the contents of ivector other
to dvector this
. Integers
are cast to reals.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
class(ivector_t), | intent(in) | :: | other |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | len_init | = | 8 | ||
integer, | public | :: | len | = | 0 | ||
integer, | public | :: | len_max | = | 16 | ||
integer, | public, | dimension(:), allocatable | :: | buffer |
procedure, public :: delete => ivector_delete | |
procedure, public :: clear => ivector_clear | |
procedure, public :: get_val => ivector_get_val | |
procedure, public :: set_val => ivector_set_val | |
procedure, public :: get_data => ivector_get_data | |
procedure, public :: append => ivector_append | |
procedure, public :: pop => ivector_pop | |
procedure, public :: resize => ivector_resize | |
procedure, public :: shrink_to_fit => ivector_shrink_to_fit | |
procedure, public :: sort => ivector_sort | |
procedure, public :: unique => ivector_unique | |
procedure, public :: print => ivector_print |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | len_init | = | 8 | ||
integer, | public | :: | len | = | 0 | ||
integer, | public | :: | len_max | = | 16 | ||
real(kind=rp), | public, | dimension(:), allocatable | :: | buffer |
procedure, public :: delete => dvector_delete | |
procedure, public :: clear => dvector_clear | |
procedure, public :: get_val => dvector_get_val | |
procedure, public :: set_val => dvector_set_val | |
procedure, public :: get_data => dvector_get_data | |
procedure, public :: append => dvector_append | |
procedure, public :: pop => dvector_pop | |
procedure, public :: resize => dvector_resize | |
procedure, public :: shrink_to_fit => dvector_shrink_to_fit | |
procedure, public :: sort => dvector_sort | |
procedure, public :: unique => dvector_unique | |
procedure, public :: print => dvector_print |
Returns the length of an ivector
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(in) | :: | this |
Returns the length of a dvector
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(in) | :: | this |
Returns the ith element of an ivector.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(in) | :: | this | |||
integer, | intent(in) | :: | i |
Returns the ith element of a dvector.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(in) | :: | this | |||
integer, | intent(in) | :: | i |
Removes the last element and returns it. Calling this method on an empty list
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this |
Removes the last element and returns it. Calling this method on an empty list
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this |
Creates an empty ivector with all elements equal to zero.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ivector_t), | intent(inout) | :: | this | |||
integer, | intent(in), | optional | :: | len_init | Must be > 0 |
|
integer, | intent(out), | optional | :: | ierr |
Creates an empty dvector with all elements equal to zero.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dvector_t), | intent(inout) | :: | this | |||
integer, | intent(in), | optional | :: | len_init | Must be > 0 |
|
integer, | intent(out), | optional | :: | ierr |
Creates an ivector with all elements from an array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ivector_t), | intent(inout) | :: | this | |||
integer, | intent(in), | dimension(:) | :: | x |
Creates a dvector with all elements from an array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dvector_t), | intent(inout) | :: | this | |||
real(kind=rp), | intent(in), | dimension(:) | :: | x |
Deletes an ivector. No access is allowed to this object after this call.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this |
Deletes a dvector. No access is allowed to this object after this call.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this |
Clears an ivector. Access allowed after a call to clear.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this |
Clears a dvector. Access allowed after a call to clear.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this |
Sets the value of the ith element of an ivector. No bounds check is performed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | i | |||
integer, | intent(in) | :: | val |
Sets the value of the ith element of a dvector. No bounds check is performed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | i | |||
real(kind=rp), | intent(in) | :: | val |
Adds an element to the end of an ivector. Reallocation will take place if required.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | val |
Adds an element to the end of a dvector. Reallocation will take place if required.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
real(kind=rp), | intent(in) | :: | val |
Returns a pointer to the underlying data of an ivector
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(in), | target | :: | this | ||
integer, | intent(out), | dimension(:), pointer | :: | res | ||
integer, | intent(in), | optional | :: | ibeg | ||
integer, | intent(in), | optional | :: | iend |
Returns a pointer to the underlying data of a dvector
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(in), | target | :: | this | ||
real(kind=rp), | intent(out), | dimension(:), pointer | :: | res | ||
integer, | intent(in), | optional | :: | ibeg | ||
integer, | intent(in), | optional | :: | iend |
Resizes a vector to a given size. Existing data is truncated if desired size is smaller than current size. Otherwise, the empty spaces are filled with zero.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | new_size | |||
integer, | intent(out), | optional | :: | ierr |
Resizes a vector to a given size. Existing data is truncated if desired size is smaller than current size. Otherwise, the empty spaces are filled with zero.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | new_size | |||
integer, | intent(out), | optional | :: | ierr |
Releases additional memory to fit underlying data of an ivector to a size this%len_init.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this | |||
integer, | intent(out), | optional | :: | ierr |
Releases additional memory to fit underlying data of a dvector to a size this%len_init.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
integer, | intent(out), | optional | :: | ierr |
Sorts an ivector in ascending order. If order
is provided, it will contain
the sorted indices. The size of order
must be at least this%len
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this | |||
integer, | intent(out), | optional | dimension(:) | :: | order |
Sorts a dvector in ascending order. If order
is provided, it will contain
the sorted indices. The size of order
must be at least this%len
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
integer, | intent(out), | optional | dimension(:) | :: | order |
Sorts and removes all duplicate entries of an ivector. Note that the internal
buffer size remains unchanged. To reduce the buffer size, call
ivector_shrink_to_fit
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ivector_t), | intent(inout) | :: | this |
Sorts and removes all duplicate entries of a dvector. Note that the internal
buffer size remains unchanged. To reduce the buffer size, call
dvector_shrink_to_fit
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this |