Procedures to manipulate matrices and vectors
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | dp | = | kind(1.d0) |
Double precision setting |
| real(kind=dp), | public, | parameter | :: | pi | = | atan(1._dp)*4._dp |
Value of pi |
| real(kind=dp), | public, | parameter | :: | eps | = | epsilon(1._dp) |
Value of machine epsilon |
| real(kind=dp), | public, | parameter | :: | degToRad | = | pi/180._dp |
For converting degree to radian |
| real(kind=dp), | public, | parameter | :: | radToDeg | = | 180._dp/pi |
For converting radian to degree |
| real(kind=dp), | public, | parameter, dimension(3) | :: | xAxis | = | [1._dp, 0._dp, 0._dp] |
Global x-axis |
| real(kind=dp), | public, | parameter, dimension(3) | :: | yAxis | = | [0._dp, 1._dp, 0._dp] |
Global y-axis |
| real(kind=dp), | public, | parameter, dimension(3) | :: | zAxis | = | [0._dp, 0._dp, 1._dp] |
Global z-axis |
Linear Least Squares fitting (2nd order)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | xQuery | |||
| real(kind=dp), | intent(in), | dimension(:) | :: | xData | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | yData |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:) | :: | xQuery | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | xData | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | yData |
Checks if a == b within a tolerance
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | a |
Real number a |
||
| real(kind=dp), | intent(in) | :: | b |
Real number b |
||
| real(kind=dp), | optional | :: | tol |
Tolerance is epsilon if not specified |
Inverse of a matrix calculated by finding the LU
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | A |
Square matrix A |
Inverse of matrix A
Matrix multiplication
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | A |
Matrix A |
|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | B |
Matrix B |
Matrix multiplication with vector
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | A |
Matrix A |
|
| real(kind=dp), | intent(in), | dimension(:) | :: | X |
Vector X |
Product of matrix A and vector X
Compute length of linesegment between points P1 and P2
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(3) | :: | P1 |
Coordinates of point P1 |
|
| real(kind=dp), | intent(in), | dimension(3) | :: | P2 |
Coordinates of point P2 |
Length of linesegment
Return linearly-spaced array over a specified interval
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | xstart |
Start value of sequence |
||
| real(kind=dp), | intent(in) | :: | xend |
End value of sequence |
||
| integer, | intent(in) | :: | nx |
Number of points sequence |
Array of real numbers
Return cossine-spaced array over a specified interval
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | xstart | |||
| real(kind=dp), | intent(in) | :: | xend | |||
| integer, | intent(in) | :: | nx |
Return half sine-spaced array over a specified interval
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | xstart | |||
| real(kind=dp), | intent(in) | :: | xend | |||
| integer, | intent(in) | :: | nx |
Return tan-spaced array over a specified interval
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | xstart | |||
| real(kind=dp), | intent(in) | :: | xend | |||
| integer, | intent(in) | :: | nx |
Compute cross product between two 3d vectors
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(3) | :: | aVec | ||
| real(kind=dp), | intent(in), | dimension(3) | :: | bVec |
Compute outer product between two 3d vectors
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(3) | :: | aVec | ||
| real(kind=dp), | intent(in), | dimension(3) | :: | bVec |
Angle between two 3d vectors using tan formula Result will be from -pi to pi
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(3) | :: | aVec | ||
| real(kind=dp), | intent(in), | dimension(3) | :: | bVec |
Angle between two 3d vectors using cos formula Assumes no angle > 180 deg exists
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(3) | :: | aVec | ||
| real(kind=dp), | intent(in), | dimension(3) | :: | bVec |
Normalizes a non-zero 3d vector
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(3) | :: | aVec |
Returns 3d vector aVec projected along dirVec
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(3) | :: | aVec | ||
| real(kind=dp), | intent(in), | dimension(3) | :: | dirVec |
Removes component along dirVec from a vector aVec
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(3) | :: | aVec | ||
| real(kind=dp), | intent(in), | dimension(3) | :: | dirVec |
Native implementation of matrix inverse based on Doolittle method
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | A |
Check if Ainv is inverse of matrix A by multiplication
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | A | ||
| real(kind=dp), | intent(in), | dimension(:, :) | :: | Ainv |
Piecewise linear 1d interpolation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:) | :: | x | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | y | ||
| real(kind=dp), | intent(in) | :: | q |
1-d Interpolation using 1st and 2nd order Lagrange polynomials
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | xq | |||
| real(kind=dp), | intent(in), | dimension(:) | :: | x | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | y | ||
| integer, | intent(in) | :: | order |
Linear Least Squares fitting (2nd order)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | xQuery | |||
| real(kind=dp), | intent(in), | dimension(:) | :: | xData | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | yData |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:) | :: | xQuery | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | xData | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | yData |
Transformation matrix (body to global frame)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(2) | :: | cs_phi |
cos(phi), sin(phi) |
|
| real(kind=dp), | intent(in), | dimension(2) | :: | cs_theta |
cos(theta), sin(theta) |
|
| real(kind=dp), | intent(in), | dimension(2) | :: | cs_psi |
cos(psi), sin(psi) |
3x3 transformation matrix
Transformation matrix (global to body frame)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(2) | :: | cs_phi |
cos(phi), sin(phi) |
|
| real(kind=dp), | intent(in), | dimension(2) | :: | cs_theta |
cos(theta), sin(theta) |
|
| real(kind=dp), | intent(in), | dimension(2) | :: | cs_psi |
cos(psi), sin(psi) |
3x3 transformation matrix
Transformation matrix for theta angular rotation about a 3d axis
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | theta |
theta angle in radians |
||
| real(kind=dp), | intent(in), | dimension(3) | :: | axisVec |
3d axis vector |
3x3 transformation matrix
Trapezoid integration with unequal intervals
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:) | :: | y | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | x |
Display in matrix format
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | M |