grid_tools  1.9.0
pmat4 Module Reference

Module for handy vector and matrix operations in Euclidean geometry. More...

Data Types

interface  absv
 
interface  axial
 
interface  axtoq
 
interface  axtorot
 
interface  corral
 
interface  cross_product
 
interface  ctoz
 
interface  det
 
interface  diag
 
interface  dlltoxy
 
interface  expmat
 
interface  gram
 
interface  hav
 
interface  huarea
 
interface  identity
 
interface  mobius
 
interface  mobiusi
 
interface  mulqq
 
interface  normalize
 
interface  normalized
 
interface  orthogonalized
 
interface  outer_product
 
interface  qtoax
 
interface  qtorot
 
interface  qtospin
 
interface  rottoax
 
interface  rottoq
 
interface  rowops
 
interface  sarea
 
interface  setem
 
interface  setmobius
 
interface  spintoq
 
interface  trace
 
interface  triple_product
 
interface  znfun
 
interface  zntay
 
interface  ztoc
 

Functions/Subroutines

real(dp) function absv_d (a)
 Return the absolute magnitude of a double precision real vector. More...
 
real(sp) function absv_s (a)
 Return the absolute magnitude of a single precision real vector. More...
 
real(dp) function, dimension(3) axial33_d (b)
 Return the 3-vector corresponding to the given antisymmetric "axial vector" matrix, assuming a right-handed correspondence. More...
 
real(sp) function, dimension(3) axial33_s (b)
 Return the 3-vector corresponding to the given antisymmetric "axial vector" matrix, assuming a right-handed correspondence. More...
 
real(dp) function, dimension(3, 3) axial3_d (a)
 Return the axial "vector", as an antisymmetric matrix, corresponding to the given 3-vector assuming a right-handed correspondence. More...
 
real(sp) function, dimension(3, 3) axial3_s (a)
 Return the axial "vector", as an antisymmetric matrix, corresponding to the given 3-vector assuming a right-handed correspondence. More...
 
subroutine, public axtoq (v, q)
 Go from an axial 3-vector to its equivalent quaternion. More...
 
subroutine, public axtorot (ax3, orth33)
 Construct the 3*3 orthogonal matrix, orth33, that corresponds to the proper rotation encoded by the 3-vector, ax3. More...
 
subroutine cmobius (aa, bb, cc, dd, vz, vw)
 Perform a complex Mobius transformation from cartesian vz to cartesian vw where the transformation coefficients are the standard aa,bb,cc,dd. More...
 
subroutine, public corral (m, n, mask, a, d, aa, e)
 Find positive diagonals D and E and a Lagrange multiplier F that minimize the row-sum +column-sum of masked terms, (D_i +log(|A_ij|) +E_j)^2 subject to the single constraint, sum_j E_j =0, where the mask permits only nonnegligible A_ij to participate in the quadratic quantities. More...
 
real(dp) function, dimension(3) cross_product_d (a, b)
 Return the cross product of two double precision real 3-vectors. More...
 
real(sp) function, dimension(3) cross_product_s (a, b)
 Return the cross product of two single precision real 3-vectors. More...
 
subroutine, public ctoz (v, z, infz)
 Utility codes for various Mobius transformations. More...
 
real(dp) function det_d (a)
 Return the determinant of a double precision matrix. More...
 
integer(spi) function det_i (a)
 Return the determinant of a single precision integer matrix. More...
 
integer(dpi) function det_id (a)
 Return the determinant of a double precision integer matrix. More...
 
real(sp) function det_s (a)
 Return the determinant of a single precision matrix. More...
 
real(dp) function, dimension(size(a), size(a)) diagn_d (a)
 Return the diagonal matrix whose elements are the given vector. More...
 
integer(spi) function, dimension(size(a), size(a)) diagn_i (a)
 Return the diagonal matrix whose elements are the given vector. More...
 
real(sp) function, dimension(size(a), size(a)) diagn_s (a)
 Return the diagonal matrix whose elements are the given vector. More...
 
real(dp) function, dimension(size(b, 1)) diagnn_d (b)
 Return the vector whose elements are the diagonal ones of a given matrix. More...
 
integer(spi) function, dimension(size(b, 1)) diagnn_i (b)
 Return the vector whose elements are the diagonal ones of a given matrix. More...
 
real(sp) function, dimension(size(b, 1)) diagnn_s (b)
 Return the vector whose elements are the diagonal ones of a given matrix. More...
 
subroutine dlltoxy_d (rlat, drlat, drlon, x2)
 From a reference latitude, and increments of latitude and longitude, return the local cartesian 2-vector corresponding to the projection of the increment onto the tangent plane of the reference point. More...
 
subroutine dlltoxy_s (rlat, drlat, drlon, x2)
 From a reference latitude, and increments of latitude and longitude, return the local cartesian 2-vector corresponding to the projection of the increment onto the tangent plane of the reference point. More...
 
real(dp) function dqarea_d (rlat, drlata, drlona, drlatb, drlonb, drlatc, drlonc)
 Compute the area of the spherical quadrilateral with a vertex at latitude rlat, and three other vertices at A, B, and C in turn, whose incremented latitudes and longitudes are drlata,drlona (for A), drlatb,drlonb (for B), and drlatc,drlonc (for C). More...
 
real(sp) function dqarea_s (rlat, drlata, drlona, drlatb, drlonb, drlatc, drlonc)
 Compute the area of the spherical quadrilateral with a vertex at latitude rlat, and three other vertices at A, B, and C in turn, whose incremented latitudes and longitudes are drlata,drlona (for A), drlatb,drlonb (for B), and drlatc,drlonc (for C). More...
 
real(dp) function dtarea_d (rlat, drlata, drlona, drlatb, drlonb)
 Compute the area of the spherical triangle with a vertex at latitude rlat, and two other vertices, A and B, whose incremented latitudes and longitudes are drlata,drlona (for A) and drlatb,drlonb (for B). More...
 
real(sp) function dtarea_s (rlat, drlata, drlona, drlatb, drlonb)
 Compute the area of the spherical triangle with a vertex at latitude rlat, and two other vertices, A and B, whose incremented latitudes and longitudes are drlata,drlona (for A) and drlatb,drlonb (for B). More...
 
subroutine, public expmat (n, a, b, detb)
 Evaluate the exponential, B, of a matrix, A, of degree n. More...
 
subroutine expmatd (n, a, b, bd, detb, detbd)
 Like expmat, but for the 1st derivatives also. More...
 
subroutine expmatdd (n, a, b, bd, bdd, detb, detbd, detbdd)
 Like expmat, but for the 1st and 2nd derivatives also. More...
 
subroutine gram_d (as, b, nrank, det)
 Apply a form of Gram-Schmidt orthogonalization process to return as many normalized orthogonal basis column vectors in matrix B as possible in the space spanned by the columns of matrix A. More...
 
subroutine gram_s (as, b, nrank, det)
 Apply a form of Gram-Schmidt orthogonalization process to return as many normalized orthogonal basis column vectors in matrix B as possible in the space spanned by the columns of matrix A. More...
 
subroutine graml_d (as, b, nrank, detsign, ldet)
 A version of gram_d where the determinant information is returned in logarithmic form (to avoid overflows for large matrices). More...
 
real(dp) function hav_d (t)
 Haversine function in double precision. More...
 
real(sp) function hav_s (t)
 Haversine function in single precision. More...
 
real(dp) function huarea_d (sa, sb)
 Spherical area of right-angle triangle whose orthogonal sides have orthographic projection dimensions, sa and sb, sphere of unit radius. More...
 
real(sp) function huarea_s (sa, sb)
 Spherical area of right-angle triangle whose orthogonal sides have orthographic projection dimensions, sa and sb, sphere of unit radius. More...
 
integer(spi) function, dimension(3, 3) identity3_i ()
 Return the 3-dimensional integer identity matrix. More...
 
integer(spi) function, dimension(n, n) identity_i (n)
 Return the integer identity matrix for a given dimensionality. More...
 
real(dp) function, dimension(0:3), public mulqq (a, b)
 Multiply quaternions, a*b, assuming operation performed from right to left. More...
 
subroutine normalize_d (v)
 Normalize the given double precision real vector. More...
 
subroutine normalize_s (v)
 Normalize the given single precision real vector. More...
 
real(dp) function, dimension(size(a)) normalized_d (a)
 Return the normalized version of a double precision real vector. More...
 
real(sp) function, dimension(size(a)) normalized_s (a)
 Return the normalized version of a single precision real vector. More...
 
real(dp) function, dimension(size(u)) orthogonalized_d (u, a)
 Return the part of vector a that is orthogonal to unit vector u. More...
 
real(sp) function, dimension(size(u)) orthogonalized_s (u, a)
 Return the part of vector a that is orthogonal to unit vector u. More...
 
real(dp) function, dimension(size(a), size(b)) outer_product_d (a, b)
 Return the outer product matrix of two double precision real vectors. More...
 
integer(spi) function, dimension(size(a), size(b)) outer_product_i (a, b)
 Return the outer product matrix of two integer vectors. More...
 
real(sp) function, dimension(size(a), size(b)) outer_product_s (a, b)
 Return the outer product matrix of two single precision real vectors. More...
 
subroutine plaingram_d (b, nrank)
 A "plain" (unpivoted) version of Gram-Schmidt, for square matrices only. More...
 
subroutine plaingram_s (b, nrank)
 A "plain" (unpivoted) version of Gram-Schmidt, for square matrices only. More...
 
subroutine, public qtoax (q, v)
 Go from quaternion to axial 3-vector. More...
 
subroutine, public qtorot (q, rot)
 Go from quaternion to rotation matrix representations. More...
 
subroutine, public qtospin (q, cspin)
 Go from the unit quaternion to the complex spinor representation. More...
 
subroutine, public rottoax (orth33, ax3)
 Assuming that given orth33 is a 3*3 proper rotation matrix, derive an axial 3-vector, ax3, such that orth33 is implied by ax3 when the latter is interpreted as encoding a rotation (as in subroutine axtorot). More...
 
subroutine, public rottoq (rot, q)
 Go from rotation matrix to a corresponding unit quaternion representation. More...
 
subroutine rowgram (m, n, a, ipiv, tt, b, rank)
 Without changing (tall) rectangular input matrix a, perform pivoted gram- Schmidt operations to orthogonalize the rows, until rows that remain become negligible. More...
 
subroutine, public rowops (m, n, ipiv, tt, v, vv)
 Apply the row-operations, implied by ipiv and tt returned by rowgram, to the single column vector, v, to produce the transformed vector vv. More...
 
real(dp) function sarea_d (v1, v2, v3)
 Compute the area of the spherical triangle, {v1,v2,v3}. More...
 
real(sp) function sarea_s (v1, v2, v3)
 Compute the area of the spherical triangle, {v1,v2,v3}, measured in the right-handed sense, by dropping a perpendicular to u0 on the longest side so that the area becomes the sum of areas of the two simpler right-angled triangles. More...
 
subroutine setem (c, d, e, g, r)
 Given the 4 components of a unit quaternion, return the associated 3*3 rotation matrix. More...
 
subroutine, public setmobius (xc0, xc1, xc2, aa, bb, cc, dd)
 Find the Mobius transformation complex coefficients, aa,bb,cc,dd, with aa*dd-bb*cc=1, for a standard (north-)polar stereographic transformation that takes cartesian point, xc0 to the north pole, xc1 to (lat=0,lon=0), xc2 to the south pole (=complex infinity). More...
 
subroutine, public spintoq (cspin, q)
 Go from the complex spinor matrix to the unit quaternion representation. More...
 
real(dp) function trace_d (b)
 Return the trace of a given double precision real matrix. More...
 
integer(spi) function trace_i (b)
 Return the trace of a given integer matrix. More...
 
real(sp) function trace_s (b)
 Return the trace of a given single precision real matrix. More...
 
real(dp) function, dimension(4) triple_cross_product_d (u, v, w)
 Return the triple_cross_product for 4-vectors. More...
 
real(sp) function, dimension(4) triple_cross_product_s (u, v, w)
 Deliver the triple-cross-product, x, of the three 4-vectors, u, v, w, with the sign convention that ordered, {u,v,w,x} form a right-handed quartet in the generic case (determinant >= 0). More...
 
real(dp) function triple_product_d (a, b, c)
 Return the triple product of three double precision real 3-vectors. More...
 
real(sp) function triple_product_s (a, b, c)
 Return the triple product of three single precision real 3-vectors. More...
 
subroutine zmobius (aa, bb, cc, dd, z, infz, w, infw)
 Perform a complex Mobius transformation from (z,infz) to (w,infw) where the transformation coefficients are the standard aa,bb,cc,dd. More...
 
subroutine zmobiusi (aa, bb, cc, dd, zz, infz, zw, infw)
 Perform the inverse of the mobius transformation with coefficients, {aa,bb,cc,dd}. More...
 
subroutine, public znfun (n, z, zn, znd, zndd, znddd)
 For a given nonnegative integer n and real argument z, evaluate the nth,...,(n+3)th derivatives, wrt z, of the function C(z) = cosh(sqrt(2z)) or, equivalently, of C(z) = cos(sqrt(-2z)), according to the sign of z. More...
 
subroutine, public zntay (n, z, zn)
 Evaluate, by Taylor-Maclaurin expansion, the nth-derivative of the function, C(z)=cosh(sqrt(2z)), or equiavlently, of C(z)=cos(sqrt(-2z)). More...
 
subroutine zsetmobius (z0, infz0, z1, infz1, z2, infz2, aa, bb, cc, dd)
 Find the Mobius transformation complex coefficients, aa,bb,cc,dd, with aa*dd-bb*cc=1, that takes polar stereographic point, z0 to the north pole, z1 to (lat=0,lon=0), z2 to the south pole (=complex infinity). More...
 
subroutine, public ztoc (z, infz, v)
 Given a complex z, return the equivalent cartesian unit 3-vector associated by the polar stereographic projection. More...
 
subroutine ztocd (z, infz, v, vd)
 The convention adopted for the complex derivative is that, for a complex infinitesimal map displacement, delta_z, the corresponding infinitesimal change of cartesian vector position is delta_v given by: delta_v = Real(vd*delta_z). More...
 

Detailed Description

Module for handy vector and matrix operations in Euclidean geometry.

This package is primarily intended for 3D operations and three of the functions (Cross_product, Triple_product and Axial) do not possess simple generalizations to a generic number N of dimensions. The others, while admitting such N-dimensional generalizations, have not all been provided with such generic forms here at the time of writing, though some of these may be added at a future date.

May 2017: Added routines to facilitate manipulation of 3D rotations, their representations by axial vectors, and routines to compute the exponentials of matrices (without resort to eigen methods). Also added Quaternion and spinor representations of 3D rotations, and their conversion routines. FUNCTION:

  • absv: Absolute magnitude of vector as its euclidean length
  • Normalized: Normalized version of given real vector
  • Orthogonalized: Orthogonalized version of second vector rel. to first unit v.
  • Cross_product: Vector cross-product of the given 2 vectors
  • Outer_product: outer-product matrix of the given 2 vectors
  • Triple_product: Scalar triple product of given 3 vectors
  • Det: Determinant of given matrix
  • Axial: Convert axial-vector <–> 2-form (antisymmetric matrix)
  • Diag: Diagnl of given matrix, or diagonal matrix of given elements
  • Trace: Trace of given matrix
  • Identity: Identity 3*3 matrix, or identity n*n matrix for a given n
  • Sarea: Spherical area subtended by three vectors, or by lat-lon increments forming a triangle or quadrilateral
  • Huarea: Spherical area subtended by right-angled spherical triangle SUBROUTINE:
  • Gram: Right-handed orthogonal basis and rank, nrank. The first nrank basis vectors span the column range of matrix given, OR ("plain" version) simple unpivoted Gram-Schmidt of a square matrix.

    In addition, we include routines that relate to stereographic projections and some associated mobius transformation utilities, since these complex operations have a strong geometrical flavor.

    Author
    R. J. Purser

Function/Subroutine Documentation

◆ absv_d()

real(dp) function pmat4::absv_d ( real(dp), dimension(:), intent(in)  a)
private

Return the absolute magnitude of a double precision real vector.

Parameters
[in]areal type input vector
Returns
s result, double precision real scalar
Author
R. J. Purser

Definition at line 131 of file pmat4.f90.

Referenced by normalized_d().

◆ absv_s()

real(sp) function pmat4::absv_s ( real(sp), dimension(:), intent(in)  a)
private

Return the absolute magnitude of a single precision real vector.

Parameters
[in]areal type input vector
Returns
s result, single precision real scalar
Author
R. J. Purser

Definition at line 119 of file pmat4.f90.

Referenced by normalized_s().

◆ axial33_d()

real(dp) function, dimension(3) pmat4::axial33_d ( real(dp), dimension(3,3), intent(in)  b)

Return the 3-vector corresponding to the given antisymmetric "axial vector" matrix, assuming a right-handed correspondence.

Parameters
[in]breal type input antisymmetric matrix "axial vector" B
Returns
a result, 3-vector corresponding to B
Author
R. J. Purser

Definition at line 462 of file pmat4.f90.

References pietc::o2.

◆ axial33_s()

real(sp) function, dimension(3) pmat4::axial33_s ( real(sp), dimension(3,3), intent(in)  b)

Return the 3-vector corresponding to the given antisymmetric "axial vector" matrix, assuming a right-handed correspondence.

Parameters
[in]breal type input antisymmetric matrix "axial vector" B
Returns
a result, 3-vector corresponding to B
Author
R. J. Purser

Definition at line 448 of file pmat4.f90.

◆ axial3_d()

real(dp) function, dimension(3,3) pmat4::axial3_d ( real(dp), dimension(3), intent(in)  a)

Return the axial "vector", as an antisymmetric matrix, corresponding to the given 3-vector assuming a right-handed correspondence.

Parameters
[in]areal type input 3-vector A
Returns
b result, antisymmetrix "axial vector" matrix corresponding to A
Author
R. J. Purser

Definition at line 434 of file pmat4.f90.

References pietc::u0.

◆ axial3_s()

real(sp) function, dimension(3,3) pmat4::axial3_s ( real(sp), dimension(3), intent(in)  a)

Return the axial "vector", as an antisymmetric matrix, corresponding to the given 3-vector assuming a right-handed correspondence.

Parameters
[in]areal type input 3-vector A
Returns
b result, antisymmetrix "axial vector" matrix corresponding to A
Author
R. J. Purser

Definition at line 420 of file pmat4.f90.

◆ axtoq()

subroutine, public pmat4::axtoq ( real(dp), dimension(3), intent(in)  v,
real(dp), dimension(0:3), intent(out)  q 
)

Go from an axial 3-vector to its equivalent quaternion.

Parameters
[in]vaxial 3-vector
[out]qquaternion
Author
R. J. Purser

Definition at line 1658 of file pmat4.f90.

◆ axtorot()

subroutine, public pmat4::axtorot ( real(dp), dimension(3), intent(in)  ax3,
real(dp), dimension(3,3), intent(out)  orth33 
)

Construct the 3*3 orthogonal matrix, orth33, that corresponds to the proper rotation encoded by the 3-vector, ax3.

The antisymmetric matrix ax33 equivalent to the axial vector ax3 is exponentiated to obtain orth33.

Parameters
[in]ax3axial 3-vector
[out]orth333*3 orthogonal matrix
Author
R. J. Purser

Definition at line 1548 of file pmat4.f90.

◆ cmobius()

subroutine pmat4::cmobius ( complex(dpc), intent(in)  aa,
complex(dpc), intent(in)  bb,
complex(dpc), intent(in)  cc,
complex(dpc), intent(in)  dd,
real(dp), dimension(3), intent(in)  vz,
real(dp), dimension(3), intent(out)  vw 
)
private

Perform a complex Mobius transformation from cartesian vz to cartesian vw where the transformation coefficients are the standard aa,bb,cc,dd.

Parameters
[in]aaMobius transformation coefficient
[in]bbMobius transformation coefficient
[in]ccMobius transformation coefficient
[in]ddMobius transformation coefficient
[in]vzCartesian unit 3-vector representation of input argument
[out]vwCartesian unit 3-vector representation of output
Author
R. J. Purser

Definition at line 2312 of file pmat4.f90.

References zmobius().

◆ corral()

subroutine, public pmat4::corral ( integer(spi), intent(in)  m,
integer(spi), intent(in)  n,
logical, dimension(m,n), intent(in)  mask,
real(dp), dimension(m,n), intent(in)  a,
real(dp), dimension(m ), intent(out)  d,
real(dp), dimension(m,n), intent(out)  aa,
real(dp), dimension( n), intent(out)  e 
)

Find positive diagonals D and E and a Lagrange multiplier F that minimize the row-sum +column-sum of masked terms, (D_i +log(|A_ij|) +E_j)^2 subject to the single constraint, sum_j E_j =0, where the mask permits only nonnegligible A_ij to participate in the quadratic quantities.

Once a solution for D and E is found, return their exponentials, d and e, together with the rescaled matrix aa such that a = d.aa.e when d and e are interpreted as diagonal matrices.

Parameters
[in]mnumber of rows of A
[in]nnumber of columns of A
[in]masklogical mask
[in]areal rectangular matrix A
[out]dpositive diagonal matrix of dimension m
[in]aarescaled version of A
[out]epositive diagonal matrix of dimension n
Author
R. J. Purser

Definition at line 1441 of file pmat4.f90.

References pietc::u0, and pietc::u1.

◆ cross_product_d()

real(dp) function, dimension(3) pmat4::cross_product_d ( real(dp), dimension(3), intent(in)  a,
real(dp), dimension(3), intent(in)  b 
)
private

Return the cross product of two double precision real 3-vectors.

Parameters
[in]areal type input 3-vector
[in]breal type input 3-vector
Returns
c result, double precision real 3-vector
Author
R. J. Purser

Definition at line 215 of file pmat4.f90.

◆ cross_product_s()

real(sp) function, dimension(3) pmat4::cross_product_s ( real(sp), dimension(3), intent(in)  a,
real(sp), dimension(3), intent(in)  b 
)
private

Return the cross product of two single precision real 3-vectors.

Parameters
[in]areal type input 3-vector
[in]breal type input 3-vector
Returns
c result, single precision real 3-vector
Author
R. J. Purser

Definition at line 202 of file pmat4.f90.

◆ ctoz()

subroutine, public pmat4::ctoz ( real(dp), dimension(3), intent(in)  v,
complex(dpc), intent(out)  z,
logical, intent(out)  infz 
)

Utility codes for various Mobius transformations.

If aa1,bb1,cc1,dd1 are the coefficients for one transformation, and aa2,bb2,cc2,dd2 are the coefficients for a second one, then the coefficients for the mapping of a test point, zz, by aa1 etc to zw, followed by a mapping of zw, by aa2 etc to zv, is equivalent to a single mapping zz–>zv by the transformatn with coefficients aa3,bb3,cc3,dd3, such that, as 2*2 complex matrices:

 [ aa3, bb3 ]   [ aa2, bb2 ]   [ aa1, bb1 ]
 [          ] = [          ] * [          ]
 [ cc3, dd3 ]   [ cc2, dd2 ]   [ cc1, dd1 ] .
 

Note that the determinant of these matrices is always +1. Given a cartesian 3-vector representation of a point on the Riemann unit sphere, return the stereographically equivalent complex number.

Parameters
[in]vcartesian 3-vector representation of point on Riemann sphere
[out]zcomplex point stereographically equivalent to v
[out]infzlogical indicator for z being the point at infinity
Author
R. J. Purser

Definition at line 2027 of file pmat4.f90.

References pkind::dpc, pietc::u0, and pietc::u1.

◆ det_d()

real(dp) function pmat4::det_d ( real(dp), dimension(:,:), intent(in)  a)

Return the determinant of a double precision matrix.

Parameters
[in]areal type input matrix A
Returns
det result, determinant of matrix A
Author
R. J. Purser

Definition at line 369 of file pmat4.f90.

References pietc::u0.

◆ det_i()

integer(spi) function pmat4::det_i ( integer(spi), dimension(:,:), intent(in)  a)

Return the determinant of a single precision integer matrix.

Parameters
[in]ainteger type input matrix A
Returns
idet result, determinant of matrix A
Author
R. J. Purser

Definition at line 390 of file pmat4.f90.

◆ det_id()

integer(dpi) function pmat4::det_id ( integer(dpi), dimension(:,:), intent(in)  a)
private

Return the determinant of a double precision integer matrix.

Parameters
[in]ainteger type input matrix A
Returns
idet result, determinant of matrix A
Author
R. J. Purser

Definition at line 404 of file pmat4.f90.

References pkind::dp, and pkind::dpi.

◆ det_s()

real(sp) function pmat4::det_s ( real(sp), dimension(:,:), intent(in)  a)
private

Return the determinant of a single precision matrix.

Parameters
[in]areal type input matrix A
Returns
det result, determinant of matrix A
Author
R. J. Purser

Definition at line 348 of file pmat4.f90.

◆ diagn_d()

real(dp) function, dimension(size(a),size(a)) pmat4::diagn_d ( real(dp), dimension(:), intent(in)  a)

Return the diagonal matrix whose elements are the given vector.

Double precision version

Parameters
[in]areal type input vector A listing the diagonal elements
Returns
b result, diagonal matrix with the elements of A
Author
R. J. Purser

Definition at line 492 of file pmat4.f90.

References pietc::u0.

◆ diagn_i()

integer(spi) function, dimension(size(a),size(a)) pmat4::diagn_i ( integer(spi), dimension(:), intent(in)  a)

Return the diagonal matrix whose elements are the given vector.

Integer version.

Parameters
[in]ainteger input vector A listing the diagonal elements
Returns
b result, diagonal matrix with the elements of A
Author
R. J. Purser

Definition at line 508 of file pmat4.f90.

◆ diagn_s()

real(sp) function, dimension(size(a),size(a)) pmat4::diagn_s ( real(sp), dimension(:), intent(in)  a)

Return the diagonal matrix whose elements are the given vector.

Single precision version.

Parameters
[in]areal type input vector A listing the diagonal elements
Returns
b result, diagonal matrix with the elements of A
Author
R. J. Purser

Definition at line 476 of file pmat4.f90.

References pietc::u0.

◆ diagnn_d()

real(dp) function, dimension(size(b,1)) pmat4::diagnn_d ( real(dp), dimension(:,:), intent(in)  b)
private

Return the vector whose elements are the diagonal ones of a given matrix.

Single precision version.

Parameters
[in]breal type input matrix
Returns
a result, vector listing the diagonal elements of the given matrix.
Author
R. J. Purser

Definition at line 538 of file pmat4.f90.

◆ diagnn_i()

integer(spi) function, dimension(size(b,1)) pmat4::diagnn_i ( integer(spi), dimension(:,:), intent(in)  b)
private

Return the vector whose elements are the diagonal ones of a given matrix.

Integer version.

Parameters
[in]binteger type input matrix
Returns
a result, vector listing the diagonal elements of the given matrix.
Author
R. J. Purser

Definition at line 553 of file pmat4.f90.

◆ diagnn_s()

real(sp) function, dimension(size(b,1)) pmat4::diagnn_s ( real(sp), dimension(:,:), intent(in)  b)
private

Return the vector whose elements are the diagonal ones of a given matrix.

Single precision version.

Parameters
[in]breal type input matrix
Returns
a result, vector listing the diagonal elements of the given matrix.
Author
R. J. Purser

Definition at line 523 of file pmat4.f90.

◆ dlltoxy_d()

subroutine pmat4::dlltoxy_d ( real(dp), intent(in)  rlat,
real(dp), intent(in)  drlat,
real(dp), intent(in)  drlon,
real(dp), dimension(2), intent(out)  x2 
)

From a reference latitude, and increments of latitude and longitude, return the local cartesian 2-vector corresponding to the projection of the increment onto the tangent plane of the reference point.

Double precision version.

Parameters
[in]rlatlatitude
[in]drlatlatitude
[in]drlonlongitudes
[out]x2output
Author
R. J. Purser

Definition at line 936 of file pmat4.f90.

References pietc::u2.

◆ dlltoxy_s()

subroutine pmat4::dlltoxy_s ( real(sp), intent(in)  rlat,
real(sp), intent(in)  drlat,
real(sp), intent(in)  drlon,
real(sp), dimension(2), intent(out)  x2 
)
private

From a reference latitude, and increments of latitude and longitude, return the local cartesian 2-vector corresponding to the projection of the increment onto the tangent plane of the reference point.

Single precision version.

Parameters
[in]rlatlatitude
[in]drlatlatitude
[in]drlonlongitudes
[out]x2output
Author
R. J. Purser

Definition at line 916 of file pmat4.f90.

◆ dqarea_d()

real(dp) function pmat4::dqarea_d ( real(dp), intent(in)  rlat,
real(dp), intent(in)  drlata,
real(dp), intent(in)  drlona,
real(dp), intent(in)  drlatb,
real(dp), intent(in)  drlonb,
real(dp), intent(in)  drlatc,
real(dp), intent(in)  drlonc 
)
private

Compute the area of the spherical quadrilateral with a vertex at latitude rlat, and three other vertices at A, B, and C in turn, whose incremented latitudes and longitudes are drlata,drlona (for A), drlatb,drlonb (for B), and drlatc,drlonc (for C).

The computations are designed to give a proportionately accurate area estimate even when the quadrilateral is very small, provided the diagonal making the B-increment is not disproportionately small compared to the characteristic size of the quadrilateral. Double precision version.

Parameters
[in]rlatlatitude of reference point
[in]drlataincremental latitude of point A
[in]drlonaincremental longitude of point A
[in]drlatbincremental latitude of point B
[in]drlonbincremental longitude of point B
[in]drlatcincremental latitude of point C
[in]drloncincremental longitude of point C
Returns
area
Author
R. J. Purser

Definition at line 898 of file pmat4.f90.

◆ dqarea_s()

real(sp) function pmat4::dqarea_s ( real(sp), intent(in)  rlat,
real(sp), intent(in)  drlata,
real(sp), intent(in)  drlona,
real(sp), intent(in)  drlatb,
real(sp), intent(in)  drlonb,
real(sp), intent(in)  drlatc,
real(sp), intent(in)  drlonc 
)

Compute the area of the spherical quadrilateral with a vertex at latitude rlat, and three other vertices at A, B, and C in turn, whose incremented latitudes and longitudes are drlata,drlona (for A), drlatb,drlonb (for B), and drlatc,drlonc (for C).

The computations are designed to give a proportionately accurate area estimate even when the quadrilateral is very small, provided the diagonal making the B-increment is not disproportionately small compared to the characteristic size of the quadrilateral. Single precision version.

Parameters
[in]rlatlatitude of reference point
[in]drlataincremental latitude of point A
[in]drlonaincremental longitude of point A
[in]drlatbincremental latitude of point B
[in]drlonbincremental longitude of point B
[in]drlatcincremental latitude of point C
[in]drloncincremental longitude of point C
Returns
area result
Author
R. J. Purser

Definition at line 869 of file pmat4.f90.

◆ dtarea_d()

real(dp) function pmat4::dtarea_d ( real(dp), intent(in)  rlat,
real(dp), intent(in)  drlata,
real(dp), intent(in)  drlona,
real(dp), intent(in)  drlatb,
real(dp), intent(in)  drlonb 
)

Compute the area of the spherical triangle with a vertex at latitude rlat, and two other vertices, A and B, whose incremented latitudes and longitudes are drlata,drlona (for A) and drlatb,drlonb (for B).

The computations are designed to give a proportionately accurate area estimate even when the triangle is very small, provided the B-increment is not disproportionately small compared to the other two sides. Double precision version.

Parameters
[in]rlatlatitude of reference point
[in]drlataincremental latitude of A
[in]drlonaincremental longitude of A
[in]drlatbincremental latitude of B
[in]drlonbincremental longitude of B
Returns
area result
Author
R. J. Purser

Definition at line 825 of file pmat4.f90.

References pietc::u0, and pietc::u1.

◆ dtarea_s()

real(sp) function pmat4::dtarea_s ( real(sp), intent(in)  rlat,
real(sp), intent(in)  drlata,
real(sp), intent(in)  drlona,
real(sp), intent(in)  drlatb,
real(sp), intent(in)  drlonb 
)
private

Compute the area of the spherical triangle with a vertex at latitude rlat, and two other vertices, A and B, whose incremented latitudes and longitudes are drlata,drlona (for A) and drlatb,drlonb (for B).

The computations are designed to give a proportionately accurate area estimate even when the triangle is very small, provided the B-increment is not disproportionately small compared to the other two sides. Single precision version.

Parameters
[in]rlatlatitude of reference point
[in]drlataincremental latitude of A
[in]drlonaincremental longitude of A
[in]drlatbincremental latitude of B
[in]drlonbincremental longitude of B
Returns
area result
Author
R. J. Purser

Definition at line 786 of file pmat4.f90.

◆ expmat()

subroutine, public pmat4::expmat ( integer(spi), intent(in)  n,
real(dp), dimension(n,n), intent(in)  a,
real(dp), dimension(n,n), intent(out)  b,
real(dp), intent(out)  detb 
)

Evaluate the exponential, B, of a matrix, A, of degree n.

Apply the iterated squaring method, m times, to the approximation to exp(A/(2**m)) obtained as a Taylor expansion of degree L See Fung, T. C., 2004, Int. J. Numer. Meth. Engng, 59, 1273–1286.

Parameters
[in]norder of square matrix A
[in]ainput matrix A
[out]bmatrix B, the exponential of matrix A
[out]detbdeterminant of matrix B
Author
R. J. Purser

Definition at line 1729 of file pmat4.f90.

References pietc::o2, pietc::u0, pietc::u1, and pietc::u2.

◆ expmatd()

subroutine pmat4::expmatd ( integer(spi), intent(in)  n,
real(dp), dimension(n,n), intent(in)  a,
real(dp), dimension(n,n), intent(out)  b,
real(dp), dimension(n,n,(n*(n+1))/2), intent(out)  bd,
real(dp), intent(out)  detb,
real(dp), dimension((n*(n+1))/2), intent(out)  detbd 
)

Like expmat, but for the 1st derivatives also.

Parameters
[in]norder of square matrix A
[in]ainput matrix A
[out]bmatrix B, the exponential of matrix A
[out]bdderivative of B wrt elements of A
[out]detbdeterminant of matrix B
[out]detbdderivative of detb wrt elements of A
Author
R. J. Purser

Definition at line 1767 of file pmat4.f90.

References pietc::o2, pietc::u0, pietc::u1, and pietc::u2.

◆ expmatdd()

subroutine pmat4::expmatdd ( integer(spi), intent(in)  n,
real(dp), dimension(n,n), intent(in)  a,
real(dp), dimension(n,n), intent(out)  b,
real(dp), dimension(n,n,(n*(n+1))/2), intent(out)  bd,
real(dp), dimension(n,n,(n*(n+1))/2,(n*(n+1))/2), intent(out)  bdd,
real(dp), intent(out)  detb,
real(dp), dimension((n*(n+1))/2), intent(out)  detbd,
real(dp), dimension((n*(n+1))/2,(n*(n+1))/2), intent(out)  detbdd 
)

Like expmat, but for the 1st and 2nd derivatives also.

Parameters
[in]norder of the matrix A
[in]ainput matrix A
[out]bmatrix B, exponential of matrix A
[out]bdderivative of B wrt elements of A
[out]bdd2nd derivative of B wrt elements of A
[out]detbdeterminant of matrix B
[out]detbdderivative of detb wrt elements of A
[out]detbdd2nd derivative of detb wrt elements of A
Author
R. J. Purser

Definition at line 1834 of file pmat4.f90.

References pietc::o2, pietc::u0, pietc::u1, and pietc::u2.

◆ gram_d()

subroutine pmat4::gram_d ( real(dp), dimension(:,:), intent(in)  as,
real(dp), dimension(:,:), intent(out)  b,
integer(spi), intent(out)  nrank,
real(dp), intent(out)  det 
)

Apply a form of Gram-Schmidt orthogonalization process to return as many normalized orthogonal basis column vectors in matrix B as possible in the space spanned by the columns of matrix A.

The number of columns returned is the rank, nrank, of A, and the determinant of the projection of A into the subspace of B is returned as det.

Parameters
[in]asgiven matrix A
[out]bmatrix B containing nrank orthonormal column vectors
[out]nrankrank of A
[out]detdeterminant of projection of A into subspace of B
Author
R. J. Purser

Definition at line 1078 of file pmat4.f90.

References pietc::u0, and pietc::u1.

◆ gram_s()

subroutine pmat4::gram_s ( real(sp), dimension(:,:), intent(in)  as,
real(sp), dimension(:,:), intent(out)  b,
integer(spi), intent(out)  nrank,
real(sp), intent(out)  det 
)

Apply a form of Gram-Schmidt orthogonalization process to return as many normalized orthogonal basis column vectors in matrix B as possible in the space spanned by the columns of matrix A.

The number of columns returned is the rank, nrank, of A, and the determinant of the projection of A into the subspace of B is returned as det.

Parameters
[in]asgiven matrix A
[out]bmatrix B containing nrank orthonormal column vectors
[out]nrankrank of A
[out]detdeterminant of projection of A into subspace of B
Author
R. J. Purser

Definition at line 1007 of file pmat4.f90.

◆ graml_d()

subroutine pmat4::graml_d ( real(dp), dimension(:,:), intent(in)  as,
real(dp), dimension(:,:), intent(out)  b,
integer(spi), intent(out)  nrank,
integer(spi), intent(out)  detsign,
real(dp), intent(out)  ldet 
)

A version of gram_d where the determinant information is returned in logarithmic form (to avoid overflows for large matrices).

When the matrix is singular, the "sign" of the determinant, detsign, is returned as zero (instead of either +1 or -1) and ldet is then just the log of the nonzero factors found by the process.

Parameters
[in]asgiven matrix A
[out]bmatrix B of orthonormal columns
[out]nrankrank of A
[out]detsignsign of determinant
[out]ldetlogarithm of absolute value of determinant
Author
R. J. Purser

Definition at line 1150 of file pmat4.f90.

References pietc::u0.

◆ hav_d()

real(dp) function pmat4::hav_d ( real(dp), intent(in)  t)

Haversine function in double precision.

Parameters
[in]tinput argument
Returns
a result
Author
R. J. Purser

Definition at line 964 of file pmat4.f90.

References pietc::o2.

◆ hav_s()

real(sp) function pmat4::hav_s ( real(sp), intent(in)  t)

Haversine function in single precision.

Parameters
[in]tinput argument
Returns
a result
Author
R. J. Purser

Definition at line 951 of file pmat4.f90.

References pietc::t.

◆ huarea_d()

real(dp) function pmat4::huarea_d ( real(dp), intent(in)  sa,
real(dp), intent(in)  sb 
)
private

Spherical area of right-angle triangle whose orthogonal sides have orthographic projection dimensions, sa and sb, sphere of unit radius.

Double precision version.

Parameters
[in]saorthographic projection of triangle's side A
[in]sborthographic projection of triangle's side B
Returns
area (steradians) of the right-angle spherical triangle
Author
R. J. Purser

Definition at line 648 of file pmat4.f90.

◆ huarea_s()

real(sp) function pmat4::huarea_s ( real(sp), intent(in)  sa,
real(sp), intent(in)  sb 
)
private

Spherical area of right-angle triangle whose orthogonal sides have orthographic projection dimensions, sa and sb, sphere of unit radius.

Single precision version.

Parameters
[in]saorthographic projection of triangle's side A
[in]sborthographic projection of triangle's side B
Returns
area (steradians) of the right-angle spherical triangle
Author
R. J. Purser

Definition at line 630 of file pmat4.f90.

◆ identity3_i()

integer(spi) function, dimension(3,3) pmat4::identity3_i ( )
private

Return the 3-dimensional integer identity matrix.

Returns
a result, identity matrix in 3 dimensions.
Author
R. J. Purser

Definition at line 615 of file pmat4.f90.

◆ identity_i()

integer(spi) function, dimension(n,n) pmat4::identity_i ( integer(spi), intent(in)  n)
private

Return the integer identity matrix for a given dimensionality.

Parameters
[in]ninput integer dimensionality
Returns
a result, identity matrix of the given dimensionality
Author
R. J. Purser

Definition at line 603 of file pmat4.f90.

◆ mulqq()

real(dp) function, dimension(0:3), public pmat4::mulqq ( real(dp), dimension(0:3), intent(in)  a,
real(dp), dimension(0:3), intent(in)  b 
)

Multiply quaternions, a*b, assuming operation performed from right to left.

Parameters
[in]ainput quaternion
[in]binput quaternion
Returns
c result quaternion a*b
Author
R. J. Purser

Definition at line 1709 of file pmat4.f90.

◆ normalize_d()

subroutine pmat4::normalize_d ( real(dp), dimension(:), intent(inout)  v)

Normalize the given double precision real vector.

Parameters
[in,out]vvector
Author
R. J. Purser

Definition at line 988 of file pmat4.f90.

References pietc::u0, and pietc::u1.

◆ normalize_s()

subroutine pmat4::normalize_s ( real(sp), dimension(:), intent(inout)  v)

Normalize the given single precision real vector.

Parameters
[in,out]vvector
Author
R. J. Purser

Definition at line 976 of file pmat4.f90.

◆ normalized_d()

real(dp) function, dimension(size(a)) pmat4::normalized_d ( real(dp), dimension(:), intent(in)  a)

Return the normalized version of a double precision real vector.

Parameters
[in]areal type input vector
Returns
b result, double precision real vector
Author
R. J. Purser

Definition at line 157 of file pmat4.f90.

References absv_d(), and pietc::u0.

◆ normalized_s()

real(sp) function, dimension(size(a)) pmat4::normalized_s ( real(sp), dimension(:), intent(in)  a)
private

Return the normalized version of a single precision real vector.

Parameters
[in]areal type input vector
Returns
b result, single precision real vector
Author
R. J. Purser

Definition at line 143 of file pmat4.f90.

References absv_s().

◆ orthogonalized_d()

real(dp) function, dimension(size(u)) pmat4::orthogonalized_d ( real(dp), dimension(:), intent(in)  u,
real(dp), dimension(:), intent(in)  a 
)
private

Return the part of vector a that is orthogonal to unit vector u.

Parameters
[in]ureal type input unit vector
[in]areal type input vector
Returns
b result, double precision real vector
Author
R. J. Purser

Definition at line 187 of file pmat4.f90.

◆ orthogonalized_s()

real(sp) function, dimension(size(u)) pmat4::orthogonalized_s ( real(sp), dimension(:), intent(in)  u,
real(sp), dimension(:), intent(in)  a 
)

Return the part of vector a that is orthogonal to unit vector u.

Parameters
[in]ureal type input unit vector
[in]areal type input vector
Returns
b result, single precision real vector
Author
R. J. Purser

Definition at line 172 of file pmat4.f90.

◆ outer_product_d()

real(dp) function, dimension(size(a),size(b)) pmat4::outer_product_d ( real(dp), dimension(:), intent(in)  a,
real(dp), dimension(:), intent(in)  b 
)
private

Return the outer product matrix of two double precision real vectors.

Parameters
[in]areal type input vector
[in]breal type input vector
Returns
c result, rank-1 matrix outer product
Author
R. J. Purser

Definition at line 289 of file pmat4.f90.

◆ outer_product_i()

integer(spi) function, dimension(size(a),size(b)) pmat4::outer_product_i ( integer(spi), dimension(:), intent(in)  a,
integer(spi), dimension(:), intent(in)  b 
)
private

Return the outer product matrix of two integer vectors.

Parameters
[in]ainteger type input vector
[in]binteger type input vector
Returns
c result, rank-1 matrix outer product
Author
R. J. Purser

Definition at line 305 of file pmat4.f90.

◆ outer_product_s()

real(sp) function, dimension(size(a),size(b)) pmat4::outer_product_s ( real(sp), dimension(:), intent(in)  a,
real(sp), dimension(:), intent(in)  b 
)
private

Return the outer product matrix of two single precision real vectors.

Parameters
[in]areal type input vector
[in]breal type input vector
Returns
c result, rank-1 matrix outer product
Author
R. J. Purser

Definition at line 273 of file pmat4.f90.

◆ plaingram_d()

subroutine pmat4::plaingram_d ( real(dp), dimension(:,:), intent(inout)  b,
integer(spi), intent(out)  nrank 
)

A "plain" (unpivoted) version of Gram-Schmidt, for square matrices only.

Double precision version.

Parameters
[in,out]binput as given matrix, output as orthogonalized vectors
[out]nrankeffective rank of given matrix
Author
R. J. Purser

Definition at line 1263 of file pmat4.f90.

References pietc::u0.

◆ plaingram_s()

subroutine pmat4::plaingram_s ( real(sp), dimension(:,:), intent(inout)  b,
integer(spi), intent(out)  nrank 
)

A "plain" (unpivoted) version of Gram-Schmidt, for square matrices only.

Single precision version.

Parameters
[in,out]binput as given matrix, output as orthogonalized vectors
[out]nrankeffective rank of given matrix
Author
R. J. Purser

Definition at line 1227 of file pmat4.f90.

◆ qtoax()

subroutine, public pmat4::qtoax ( real(dp), dimension(0:3), intent(in)  q,
real(dp), dimension(3), intent(out)  v 
)

Go from quaternion to axial 3-vector.

Parameters
[in]qquaternion
[in]vaxial 3-vector
Author
R. J. Purser

Definition at line 1672 of file pmat4.f90.

◆ qtorot()

subroutine, public pmat4::qtorot ( real(dp), dimension(0:3), intent(in)  q,
real(dp), dimension(3,3), intent(out)  rot 
)

Go from quaternion to rotation matrix representations.

Parameters
[in]qquaternion representation
[out]rotrotation matrix representations
Author
R. J. Purser

Definition at line 1646 of file pmat4.f90.

◆ qtospin()

subroutine, public pmat4::qtospin ( real(dp), dimension(0:3), intent(in)  q,
complex(dpc), dimension(2,2), intent(out)  cspin 
)

Go from the unit quaternion to the complex spinor representation.

Parameters
[in]qgiven unit quaternion representation
[out]cspinspinor representation
Author
R. J. Purser

Definition at line 1575 of file pmat4.f90.

◆ rottoax()

subroutine, public pmat4::rottoax ( real(dp), dimension(3,3), intent(in)  orth33,
real(dp), dimension(3), intent(out)  ax3 
)

Assuming that given orth33 is a 3*3 proper rotation matrix, derive an axial 3-vector, ax3, such that orth33 is implied by ax3 when the latter is interpreted as encoding a rotation (as in subroutine axtorot).

Note that such ax3 are not unique – adding any multiple of 2*pi times the parallel unit vector leads to the same orth33.

Parameters
[in]orth333*3 proper rotation matrix
[out]ax3axial 3-vector
Author
R. J. Purser

Definition at line 1518 of file pmat4.f90.

◆ rottoq()

subroutine, public pmat4::rottoq ( real(dp), dimension(3,3), intent(in)  rot,
real(dp), dimension(0:3), intent(out)  q 
)

Go from rotation matrix to a corresponding unit quaternion representation.

Parameters
[in]rotgiven rotation matrix
[out]qquaternion representation
Author
R. J. Purser

Definition at line 1590 of file pmat4.f90.

References pietc::u0, pietc::u1, and pietc::u2.

◆ rowgram()

subroutine pmat4::rowgram ( integer(spi), intent(in)  m,
integer(spi), intent(in)  n,
real(dp), dimension(m,n), intent(in)  a,
integer(spi), dimension(n), intent(out)  ipiv,
real(dp), dimension(m,n), intent(out)  tt,
real(dp), dimension(n,n), intent(out)  b,
integer(spi), intent(out)  rank 
)

Without changing (tall) rectangular input matrix a, perform pivoted gram- Schmidt operations to orthogonalize the rows, until rows that remain become negligible.

Record the pivoting sequence in ipiv, and the row-normalization in tt(j,j) and the row-orthogonalization in tt(i,j), for i>j. Note that tt(i,j)=0 for i<j (tt is truncated lower triangular). The orthonormalized rows are returned in square array b, which is complete even when the effective rank < n. The recorded row operations can be repeated on independent column vectors through the use of subroutine ROWOPS (in this module). It is recommended to rescale the original matrix A via a call to CORRAL (in this module) because the negligibility criterion depends upon an "epsilon" value that is fixed (10**(-13)) and assumes elements of a are never too different in magnitude from unity, unless they are actually zero.

Parameters
[in]mnumber of rows of A
[in]nnumber of columns of A
[in]arectangular input matrix A
[out]ipivpivoting sequence
[out]ttrow-normalization
[out]borthonormalized rows
[in]rankeffective rank of A
Author
R. J. Purser

Definition at line 1315 of file pmat4.f90.

References pietc::u0, and pietc::u1.

◆ rowops()

subroutine, public pmat4::rowops ( integer(spi), intent(in)  m,
integer(spi), intent(in)  n,
integer(spi), dimension(n), intent(in)  ipiv,
real(dp), dimension(m,n), intent(in)  tt,
real(dp), dimension(m), intent(in)  v,
real(dp), dimension(m), intent(out)  vv 
)

Apply the row-operations, implied by ipiv and tt returned by rowgram, to the single column vector, v, to produce the transformed vector vv.

Parameters
[in]mnumber of rows of matrix tt, dimension of vectors V and VV
[in]nnumber of columns of matrix tt
[in]ipivinteger vector encoding the pivoting sequence
[in]ttrow-normalized matrix provided by subroutine rowgram
[in]vinput single column vector
[out]vvoutput column vector vector
Author
R. J. Purser

Definition at line 1400 of file pmat4.f90.

◆ sarea_d()

real(dp) function pmat4::sarea_d ( real(dp), dimension(3), intent(in)  v1,
real(dp), dimension(3), intent(in)  v2,
real(dp), dimension(3), intent(in)  v3 
)
private

Compute the area of the spherical triangle, {v1,v2,v3}.

Parameters
[in]v1unit-3-vector vertex of the spherical triangle
[in]v2unit-3-vector vertex of the spherical triangle
[in]v3unit-3-vector vertex of the spherical triangle
Returns
area result
Author
R. J. Purser

Definition at line 723 of file pmat4.f90.

References cyclic(), and pietc::u0.

◆ sarea_s()

real(sp) function pmat4::sarea_s ( real(sp), dimension(3), intent(in)  v1,
real(sp), dimension(3), intent(in)  v2,
real(sp), dimension(3), intent(in)  v3 
)
private

Compute the area of the spherical triangle, {v1,v2,v3}, measured in the right-handed sense, by dropping a perpendicular to u0 on the longest side so that the area becomes the sum of areas of the two simpler right-angled triangles.

Parameters
[in]v1area of the spherical triangle
[in]v2area of the spherical triangle
[in]v3area of the spherical triangle
Returns
area result
Author
R. J. Purser

Definition at line 668 of file pmat4.f90.

References cyclic().

◆ setem()

subroutine pmat4::setem ( real(dp), intent(in)  c,
real(dp), intent(in)  d,
real(dp), intent(in)  e,
real(dp), intent(in)  g,
real(dp), dimension(3,3), intent(out)  r 
)
private

Given the 4 components of a unit quaternion, return the associated 3*3 rotation matrix.

Parameters
[in]c0th component of given quaternion
[in]d1st component of given quaternion
[in]e2nd component of given quaternion
[in]g3rd component of given quaternion
[in]routput 3*3 real rotation matrix
Author
R. J. Purser

Definition at line 1690 of file pmat4.f90.

◆ setmobius()

subroutine, public pmat4::setmobius ( real(dp), dimension(3), intent(in)  xc0,
real(dp), dimension(3), intent(in)  xc1,
real(dp), dimension(3), intent(in)  xc2,
complex(dpc), intent(out)  aa,
complex(dpc), intent(out)  bb,
complex(dpc), intent(out)  cc,
complex(dpc), intent(out)  dd 
)

Find the Mobius transformation complex coefficients, aa,bb,cc,dd, with aa*dd-bb*cc=1, for a standard (north-)polar stereographic transformation that takes cartesian point, xc0 to the north pole, xc1 to (lat=0,lon=0), xc2 to the south pole (=complex infinity).

Parameters
[in]xc0cartesian point that will map to (0,0,1)
[in]xc1cartesian point that will map to (1,0,0)
[in]xc2cartesian point that will map to (0,0,-1)
[out]aaMobius transformation complex coefficient
[out]bbMobius transformation complex coefficient
[out]ccMobius transformation complex coefficient
[out]ddMobius transformation complex coefficient
Author
R. J. Purser

Definition at line 2123 of file pmat4.f90.

◆ spintoq()

subroutine, public pmat4::spintoq ( complex(dpc), dimension(2,2), intent(in)  cspin,
real(dp), dimension(0:3), intent(out)  q 
)

Go from the complex spinor matrix to the unit quaternion representation.

Parameters
[in]cspincomplex spinor representation
[out]qunit quaternion representation
Author
R. J. Purser

Definition at line 1562 of file pmat4.f90.

◆ trace_d()

real(dp) function pmat4::trace_d ( real(dp), dimension(:,:), intent(in)  b)
private

Return the trace of a given double precision real matrix.

Parameters
[in]breal type input matrix B
Returns
s result, trace, or sum of diagonal elements, of B
Author
R. J. Purser

Definition at line 579 of file pmat4.f90.

◆ trace_i()

integer(spi) function pmat4::trace_i ( integer(spi), dimension(:,:), intent(in)  b)
private

Return the trace of a given integer matrix.

Parameters
[in]binteger type input matrix B
Returns
s result, trace, or sum of diagonal elements, of B
Author
R. J. Purser

Definition at line 591 of file pmat4.f90.

◆ trace_s()

real(sp) function pmat4::trace_s ( real(sp), dimension(:,:), intent(in)  b)
private

Return the trace of a given single precision real matrix.

Parameters
[in]breal type input matrix B
Returns
s result, trace, or sum of diagonal elements, of B
Author
R. J. Purser

Definition at line 567 of file pmat4.f90.

◆ triple_cross_product_d()

real(dp) function, dimension(4) pmat4::triple_cross_product_d ( real(dp), dimension(4), intent(in)  u,
real(dp), dimension(4), intent(in)  v,
real(dp), dimension(4), intent(in)  w 
)
private

Return the triple_cross_product for 4-vectors.

Parameters
[in]ureal type input 4-vector
[in]vreal type input 4-vector
[in]wreal type input 4-vector
Returns
x result, triple-cross-product 4-vector
Author
R. J. Purser

Definition at line 253 of file pmat4.f90.

◆ triple_cross_product_s()

real(sp) function, dimension(4) pmat4::triple_cross_product_s ( real(sp), dimension(4), intent(in)  u,
real(sp), dimension(4), intent(in)  v,
real(sp), dimension(4), intent(in)  w 
)
private

Deliver the triple-cross-product, x, of the three 4-vectors, u, v, w, with the sign convention that ordered, {u,v,w,x} form a right-handed quartet in the generic case (determinant >= 0).

Parameters
[in]ureal type input 4-vector
[in]vreal type input 4-vector
[in]wreal type input 4-vector
Returns
x result, triple-cross-product 4-vector
Author
R. J. Purser

Definition at line 232 of file pmat4.f90.

◆ triple_product_d()

real(dp) function pmat4::triple_product_d ( real(dp), dimension(3), intent(in)  a,
real(dp), dimension(3), intent(in)  b,
real(dp), dimension(3), intent(in)  c 
)
private

Return the triple product of three double precision real 3-vectors.

Parameters
[in]areal type input 3-vector
[in]breal type input 3-vector
[in]creal type input 3-vector
Returns
tripleproduct result, scalar triple product
Author
R. J. Purser

Definition at line 336 of file pmat4.f90.

◆ triple_product_s()

real(sp) function pmat4::triple_product_s ( real(sp), dimension(3), intent(in)  a,
real(sp), dimension(3), intent(in)  b,
real(sp), dimension(3), intent(in)  c 
)
private

Return the triple product of three single precision real 3-vectors.

Parameters
[in]areal type input 3-vector
[in]breal type input 3-vector
[in]creal type input 3-vector
Returns
tripleproduct result, scalar triple product
Author
R. J. Purser

Definition at line 322 of file pmat4.f90.

◆ zmobius()

subroutine pmat4::zmobius ( complex(dpc), intent(in)  aa,
complex(dpc), intent(in)  bb,
complex(dpc), intent(in)  cc,
complex(dpc), intent(in)  dd,
complex(dpc), intent(in)  z,
logical, intent(in)  infz,
complex(dpc), intent(out)  w,
logical, intent(out)  infw 
)
private

Perform a complex Mobius transformation from (z,infz) to (w,infw) where the transformation coefficients are the standard aa,bb,cc,dd.

Infz is .TRUE. only when z is at complex infinity; likewise infw and w. For these infinite cases, it is important that numerical z==(0,0).

Parameters
[in]aaMobius transformation complex coefficient
[in]bbMobius transformation complex coefficient
[in]ccMobius transformation complex coefficient
[in]ddMobius transformation complex coefficient
[in]zcomplex input argument of the Mobius transformation
[in]infzlogical indicator for z being a point at infinity
[out]wcomplex output of the Mobius transformation
[out]infwlogical indicator for w being a point at infinity
Author
R. J. Purser

Definition at line 2277 of file pmat4.f90.

Referenced by cmobius(), and zmobiusi().

◆ zmobiusi()

subroutine pmat4::zmobiusi ( complex(dpc), intent(in)  aa,
complex(dpc), intent(in)  bb,
complex(dpc), intent(in)  cc,
complex(dpc), intent(in)  dd,
complex(dpc), intent(in)  zz,
logical, intent(in)  infz,
complex(dpc), intent(out)  zw,
logical, intent(out)  infw 
)
private

Perform the inverse of the mobius transformation with coefficients, {aa,bb,cc,dd}.

Parameters
[in]aainverse Mobius transformation coefficient
[in]bbinverse Mobius transformation coefficient
[in]ccinverse Mobius transformation coefficient
[in]ddinverse Mobius transformation coefficient
[in]zzcomplex input argument
[in]infzlogical indicator for zz the point at infinity
[out]zwcomplex output argument
[out]infwlogical indicator for zw the point at infinity
Author
R. J. Purser

Definition at line 2336 of file pmat4.f90.

References zmobius().

◆ znfun()

subroutine, public pmat4::znfun ( integer(spi), intent(in)  n,
real(dp), intent(in)  z,
real(dp), intent(out)  zn,
real(dp), intent(out)  znd,
real(dp), intent(out)  zndd,
real(dp), intent(out)  znddd 
)

For a given nonnegative integer n and real argument z, evaluate the nth,...,(n+3)th derivatives, wrt z, of the function C(z) = cosh(sqrt(2z)) or, equivalently, of C(z) = cos(sqrt(-2z)), according to the sign of z.

Parameters
[in]ninteger order of the first of the returned derivatives of C.
[in]zreal input argument in the function C(z)
[out]znnth-derivative of C(z)
[out]znd(n+1)th-derivative of C(z)
[out]zndd(n+2)th-derivative of C(z)
[out]znddd(n+3)th-derivative of C(z)
Author
R. J. Purser

Definition at line 1960 of file pmat4.f90.

References pietc::u0, pietc::u2, and pietc::u3.

◆ zntay()

subroutine, public pmat4::zntay ( integer(spi), intent(in)  n,
real(dp), intent(in)  z,
real(dp), intent(out)  zn 
)

Evaluate, by Taylor-Maclaurin expansion, the nth-derivative of the function, C(z)=cosh(sqrt(2z)), or equiavlently, of C(z)=cos(sqrt(-2z)).

Parameters
[in]ninteger order of the derivative
[in]zreal argument
[in]znreturned value of the nth derivative
Author
R. J. Purser

Definition at line 1921 of file pmat4.f90.

References pietc::u2.

◆ zsetmobius()

subroutine pmat4::zsetmobius ( complex(dp), intent(in)  z0,
logical, intent(in)  infz0,
complex(dp), intent(in)  z1,
logical, intent(in)  infz1,
complex(dp), intent(in)  z2,
logical, intent(in)  infz2,
complex(dpc), intent(out)  aa,
complex(dpc), intent(out)  bb,
complex(dpc), intent(out)  cc,
complex(dpc), intent(out)  dd 
)
private

Find the Mobius transformation complex coefficients, aa,bb,cc,dd, with aa*dd-bb*cc=1, that takes polar stereographic point, z0 to the north pole, z1 to (lat=0,lon=0), z2 to the south pole (=complex infinity).

Should any one of z0,z1,z2 be itself the "point at infinity" its corresponding infz will be set "true" (and the z value itself not used). This routine is like setmobius, except the three fixed points defining the mapping are given in standard complex stereographic form, together with the logical codes "infzn" that are TRUE if that point is itself the projection pole (i.e., the South Pole for a north polar stereographic).

Parameters
[in]z0complex input point that will map to (0,0)
[in]infz0logical indicator that z0 is the point at infinity
[in]z1complex input point that will map to (1,0)
[in]infz1logical indicator that z1 is the point at infinity
[in]z2complex input point that will map to infinity
[in]infz2logical indicator that z2 is the point at infinity
[out]aaMobius transformation complex coefficient
[out]bbMobius transformation complex coefficient
[out]ccMobius transformation complex coefficient
[out]ddMobius transformation complex coefficient
Author
R. J. Purser

Definition at line 2206 of file pmat4.f90.

◆ ztoc()

subroutine, public pmat4::ztoc ( complex(dpc), intent(in)  z,
logical, intent(in)  infz,
real(dp), dimension(3), intent(out)  v 
)

Given a complex z, return the equivalent cartesian unit 3-vector associated by the polar stereographic projection.

Parameters
[in]zcomplex input argument
[in]infzlogical indicator for z being the point at infinity
[out]vcartesian unit 3-vector position equivalent to z
Author
R. J. Purser

Definition at line 2053 of file pmat4.f90.

◆ ztocd()

subroutine pmat4::ztocd ( complex(dpc), intent(in)  z,
logical, intent(in)  infz,
real(dp), dimension(3), intent(out)  v,
complex(dpc), dimension(3), intent(out)  vd 
)
private

The convention adopted for the complex derivative is that, for a complex infinitesimal map displacement, delta_z, the corresponding infinitesimal change of cartesian vector position is delta_v given by: delta_v = Real(vd*delta_z).

Thus, by a kind of Cauchy-Riemann relation, Imag(vd)=v CROSS Real(vd).

Note
The derivative for the ideal point at infinity has not been coded yet.
Parameters
[in]zcomplex input argument
[in]infzlogical indicator for z being the point at infinity
[out]vcartesian unit 3-vector position equivalent to z
[out]vdderivative of cartesian v wrt z
Author
R. J. Purser

Definition at line 2083 of file pmat4.f90.

References pkind::dpc.