grid_tools  1.11.0
pmat4.f90 File Reference

Euclidean geometry, geometric (stereographic) projections, related transformations (Mobius). More...

Go to the source code of this file.

Data Types

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

Modules

module  pmat4
 Module for handy vector and matrix operations in Euclidean geometry.
 

Functions/Subroutines

real(dp) function pmat4::absv_d (a)
 Return the absolute magnitude of a double precision real vector. More...
 
real(sp) function pmat4::absv_s (a)
 Return the absolute magnitude of a single precision real vector. More...
 
real(dp) function, dimension(3) pmat4::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) pmat4::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) pmat4::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) pmat4::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 pmat4::axtoq (v, q)
 Go from an axial 3-vector to its equivalent quaternion. More...
 
subroutine, public pmat4::axtorot (ax3, orth33)
 Construct the 3*3 orthogonal matrix, orth33, that corresponds to the proper rotation encoded by the 3-vector, ax3. More...
 
subroutine pmat4::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 pmat4::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) pmat4::cross_product_d (a, b)
 Return the cross product of two double precision real 3-vectors. More...
 
real(sp) function, dimension(3) pmat4::cross_product_s (a, b)
 Return the cross product of two single precision real 3-vectors. More...
 
subroutine, public pmat4::ctoz (v, z, infz)
 Utility codes for various Mobius transformations. More...
 
subroutine cyclic (u1, u2, u3, d1, d2, d3)
 Cyclically permute real vectors, u1, u2, u3, and scalars, d1, d2, d3. More...
 
subroutine cyclic (u1, u2, u3, d1, d2, d3)
 Cyclically permute real vectors, u1, u2, u3, and scalars, d1, d2, d3. More...
 
real(dp) function pmat4::det_d (a)
 Return the determinant of a double precision matrix. More...
 
integer(spi) function pmat4::det_i (a)
 Return the determinant of a single precision integer matrix. More...
 
integer(dpi) function pmat4::det_id (a)
 Return the determinant of a double precision integer matrix. More...
 
real(sp) function pmat4::det_s (a)
 Return the determinant of a single precision matrix. More...
 
real(dp) function, dimension(size(a), size(a)) pmat4::diagn_d (a)
 Return the diagonal matrix whose elements are the given vector. More...
 
integer(spi) function, dimension(size(a), size(a)) pmat4::diagn_i (a)
 Return the diagonal matrix whose elements are the given vector. More...
 
real(sp) function, dimension(size(a), size(a)) pmat4::diagn_s (a)
 Return the diagonal matrix whose elements are the given vector. More...
 
real(dp) function, dimension(size(b, 1)) pmat4::diagnn_d (b)
 Return the vector whose elements are the diagonal ones of a given matrix. More...
 
integer(spi) function, dimension(size(b, 1)) pmat4::diagnn_i (b)
 Return the vector whose elements are the diagonal ones of a given matrix. More...
 
real(sp) function, dimension(size(b, 1)) pmat4::diagnn_s (b)
 Return the vector whose elements are the diagonal ones of a given matrix. More...
 
subroutine pmat4::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 pmat4::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 pmat4::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 pmat4::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 pmat4::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 pmat4::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 pmat4::expmat (n, a, b, detb)
 Evaluate the exponential, B, of a matrix, A, of degree n. More...
 
subroutine pmat4::expmatd (n, a, b, bd, detb, detbd)
 Like expmat, but for the 1st derivatives also. More...
 
subroutine pmat4::expmatdd (n, a, b, bd, bdd, detb, detbd, detbdd)
 Like expmat, but for the 1st and 2nd derivatives also. More...
 
subroutine pmat4::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 pmat4::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 pmat4::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 pmat4::hav_d (t)
 Haversine function in double precision. More...
 
real(sp) function pmat4::hav_s (t)
 Haversine function in single precision. More...
 
real(dp) function pmat4::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 pmat4::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) pmat4::identity3_i ()
 Return the 3-dimensional integer identity matrix. More...
 
integer(spi) function, dimension(n, n) pmat4::identity_i (n)
 Return the integer identity matrix for a given dimensionality. More...
 
real(dp) function, dimension(0:3), public pmat4::mulqq (a, b)
 Multiply quaternions, a*b, assuming operation performed from right to left. More...
 
subroutine pmat4::normalize_d (v)
 Normalize the given double precision real vector. More...
 
subroutine pmat4::normalize_s (v)
 Normalize the given single precision real vector. More...
 
real(dp) function, dimension(size(a)) pmat4::normalized_d (a)
 Return the normalized version of a double precision real vector. More...
 
real(sp) function, dimension(size(a)) pmat4::normalized_s (a)
 Return the normalized version of a single precision real vector. More...
 
real(dp) function, dimension(size(u)) pmat4::orthogonalized_d (u, a)
 Return the part of vector a that is orthogonal to unit vector u. More...
 
real(sp) function, dimension(size(u)) pmat4::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)) pmat4::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)) pmat4::outer_product_i (a, b)
 Return the outer product matrix of two integer vectors. More...
 
real(sp) function, dimension(size(a), size(b)) pmat4::outer_product_s (a, b)
 Return the outer product matrix of two single precision real vectors. More...
 
subroutine pmat4::plaingram_d (b, nrank)
 A "plain" (unpivoted) version of Gram-Schmidt, for square matrices only. More...
 
subroutine pmat4::plaingram_s (b, nrank)
 A "plain" (unpivoted) version of Gram-Schmidt, for square matrices only. More...
 
subroutine, public pmat4::qtoax (q, v)
 Go from quaternion to axial 3-vector. More...
 
subroutine, public pmat4::qtorot (q, rot)
 Go from quaternion to rotation matrix representations. More...
 
subroutine, public pmat4::qtospin (q, cspin)
 Go from the unit quaternion to the complex spinor representation. More...
 
subroutine, public pmat4::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 pmat4::rottoq (rot, q)
 Go from rotation matrix to a corresponding unit quaternion representation. More...
 
subroutine pmat4::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 pmat4::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 pmat4::sarea_d (v1, v2, v3)
 Compute the area of the spherical triangle, {v1,v2,v3}. More...
 
real(sp) function pmat4::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 pmat4::setem (c, d, e, g, r)
 Given the 4 components of a unit quaternion, return the associated 3*3 rotation matrix. More...
 
subroutine, public pmat4::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 pmat4::spintoq (cspin, q)
 Go from the complex spinor matrix to the unit quaternion representation. More...
 
real(dp) function pmat4::trace_d (b)
 Return the trace of a given double precision real matrix. More...
 
integer(spi) function pmat4::trace_i (b)
 Return the trace of a given integer matrix. More...
 
real(sp) function pmat4::trace_s (b)
 Return the trace of a given single precision real matrix. More...
 
real(dp) function, dimension(4) pmat4::triple_cross_product_d (u, v, w)
 Return the triple_cross_product for 4-vectors. More...
 
real(sp) function, dimension(4) pmat4::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 pmat4::triple_product_d (a, b, c)
 Return the triple product of three double precision real 3-vectors. More...
 
real(sp) function pmat4::triple_product_s (a, b, c)
 Return the triple product of three single precision real 3-vectors. More...
 
subroutine pmat4::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 pmat4::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 pmat4::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 pmat4::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 pmat4::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 pmat4::ztoc (z, infz, v)
 Given a complex z, return the equivalent cartesian unit 3-vector associated by the polar stereographic projection. More...
 
subroutine pmat4::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

Euclidean geometry, geometric (stereographic) projections, related transformations (Mobius).

Author
R. J. Purser
Date
Oct 2005

Definition in file pmat4.f90.

Function/Subroutine Documentation

◆ cyclic() [1/2]

subroutine sarea_s::cyclic ( real(sp), dimension(3), intent(inout)  u1,
real(sp), dimension(3), intent(inout)  u2,
real(sp), dimension(3), intent(inout)  u3,
real(sp), intent(inout)  d1,
real(sp), intent(inout)  d2,
real(sp), intent(inout)  d3 
)

Cyclically permute real vectors, u1, u2, u3, and scalars, d1, d2, d3.

Parameters
[in,out]u1real vector to be shifted
[in,out]u2real vector to be shifted
[in,out]u3real vector to be shifted
[in,out]d1real variable to be shifted
[in,out]d2real variable to be shifted
[in,out]d3real variable to be shifted
Author
R. J. Purser

Definition at line 705 of file pmat4.f90.

Referenced by pmat4::sarea_d(), and pmat4::sarea_s().

◆ cyclic() [2/2]

subroutine sarea_d::cyclic ( real(dp), dimension(3), intent(inout)  u1,
real(dp), dimension(3), intent(inout)  u2,
real(dp), dimension(3), intent(inout)  u3,
real(dp), intent(inout)  d1,
real(dp), intent(inout)  d2,
real(dp), intent(inout)  d3 
)

Cyclically permute real vectors, u1, u2, u3, and scalars, d1, d2, d3.

Parameters
[in,out]u1real vector to be shifted
[in,out]u2real vector to be shifted
[in,out]u3real vector to be shifted
[in,out]d1real variable to be shifted
[in,out]d2real variable to be shifted
[in,out]d3real variable to be shifted
Author
R. J. Purser

Definition at line 760 of file pmat4.f90.