Construct a vector object
A vector can be instantiated from integer and real data types but the underlying data will always be stored using double precision.
The following code snippet shows all of the valid ways to construct a new vector
type(vector) :: v1, v2, v3, v4, v5, v6, v7, v8 v1 = vector([1, 2, 3]) v2 = vector([1.0, 2.0, 3.0]) v3 = vector([1.0d0, 2.0d0, 3.0d0]) v4 = vector(4) ! [0, 0, 0, 0] v5 = vector(5, 3) ! [3, 3, 3, 3, 3] v6 = vector(2, 2.0) ! [2, 2] v7 = vector(val=4.7d0, dim=3) ! [4.7, 4.7, 4.7] v8 = vector(v7)
Construct a vector from an array of integers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in), | dimension(:) | :: | array | input data |
Construct a vector from an array of single precision reals
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | dimension(:) | :: | array | input data |
Construct a vector from an array of double precision reals
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in), | dimension(:) | :: | array | input data |
Construct a vector by declaring its size Allocate an -dimensional vector and fill its values with 0
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | dim |
|
Construct a vector of dimension and fill its values with integer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | dim |
|
||
| integer, | intent(in) | :: | val |
|
Construct a vector of dimension and fill its values with single precision real
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | dim |
|
||
| real(kind=real32), | intent(in) | :: | val |
|
Construct a vector of dimension and fill its values with double precision real
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | dim |
|
||
| real(kind=real64), | intent(in) | :: | val |
|
Construct a vector from another vector
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vector), | intent(in) | :: | v1 |