vectorops.jl
Missing docs:
- SOFA.rv2m
Astrometry.SOFA.a2af — Function
a2af(ndp::Integer, angle::Real)Decompose radians into degrees, arcminutes, arcseconds, and fraction.
Input
npd–number of useful digitsangle– angle in radians
Output
dms– angle in sign, degrees, minutes, seconds, and fraction
Note
The argument ndp is interpreted as follows:
ndp resolution : ...0000 00 00 -7 1000 00 00 -6 100 00 00 -5 10 00 00 -4 1 00 00 -3 0 10 00 -2 0 01 00 -1 0 00 10 0 0 00 01 1 0 00 00.1 2 0 00 00.01 3 0 00 00.001 : 0 00 00.000...
The largest positive useful value for ndp is determined by the size of angle, the format of Float64 on the target platform, and the risk of overflowing dms[3]. On a typical platform, for angle up to 2pi, the available floating-point precision might correspond to ndp=12. However, the practical limit is typically ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is only 16 bits.
The absolute value of angle may exceed 2pi. In cases where it does not, it is up to the caller to test for and handle the case where days is very nearly 2pi and rounds up to 2pi and rounds up to 360 degree, by testing for dms[0]=360 and setting dms[0-3] to zero.
Astrometry.SOFA.a2tf — Function
a2tf(ndp::Integer, angle::Real)Decompose radians into hours, minutes, seconds, and fraction.
Input
npd– number of useful digitsangle– angle in radians
Output
hms– angle in sign, hour, minutes, seconds, and fraction
Note
The argument ndp is interpreted as follows:
ndp resolution : ...0000 00 00 -7 1000 00 00 -6 100 00 00 -5 10 00 00 -4 1 00 00 -3 0 10 00 -2 0 01 00 -1 0 00 10 0 0 00 01 1 0 00 00.1 2 0 00 00.01 3 0 00 00.001 : 0 00 00.000...
The largest positive useful value for ndp is determined by the size of angle, the format of Float64 on the target platform, and the risk of overflowing hms[3]. On a typical platform, for angle up to 2pi, the available floating-point precision might correspond to ndp=12. However, the practical limit is typically ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is only 16 bits.
The absolute value of angle may exceed 2pi. In cases where it does not, it is up to the caller to test for and handle the case where days is very nearly 2pi and rounds up to 2pi and rounds up to 24 hours, by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
Astrometry.SOFA.af2a — Function
af2a(sign::Char, degree::Integer, minute::Integer, second::Real)Convert degrees, arcminutes, arcseconds to radians.
Input
sign– sign of arcdegree– degrees of arcminute– minutes of arcsecond– seconds of arc
Output
angle– angle in radians
Note
The result is computed even if any of the range checks fail.
Negative ideg, iamin and/or asec produce a warning status, but the absolute value is used in the conversion.
If there are multiple errors, the status value reflects only the first, the smallest taking precedence.
Astrometry.SOFA.anp — Function
anp(angle::Real)Normalize angle into the range 0 <= a < 2p.
Input
angle– angle in radians
Output
angle– angle in radians in range 0-2pi
Astrometry.SOFA.anpm — Function
anpm(angle::Real)Normalize angle into the range -pi <= a < +pi
Input
angle– angle in radians
Output
angle– angle in radians in range +/-pi
Astrometry.SOFA.d2tf — Function
d2tf(ndp::Integer, day::Real)Decompose days to sign, hours, minutes, seconds, fraction.
Input
npd– number of usefule digitsday– interval in days
Output
hms– hms in sign, hours, minutes, seconds, and fraction
Note
The argument ndp is interpreted as follows:
ndp resolution : ...0000 00 00 -7 1000 00 00 -6 100 00 00 -5 10 00 00 -4 1 00 00 -3 0 10 00 -2 0 01 00 -1 0 00 10 0 0 00 01 1 0 00 00.1 2 0 00 00.01 3 0 00 00.001 : 0 00 00.000...
The largest positive useful value for ndp is determined by the size of days, the format of Float64 on the target platform, and the risk of overflowing hms[3]. On a typical platform, for days up to 1.0, the available floating-point precision might correspond to ndp=12. However, the practical limit is typically ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is only 16 bits.
The absolute value of days may exceed 1.0. In cases where it does not, it is up to the caller to test for and handle the case where days is very nearly 1.0 and rounds up to 24 hours, by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
Astrometry.SOFA.tf2a — Function
tf2a(sign::Char, hour::Integer, minute::Integer, second::Real)Convert hours, minutes, seconds to radians.
Input
sign– sign: '-' = negative, otherwise positivehour– hoursminute– minutessecond– seconds
Output
angle– angle in radians
Note
The result is computed even if any of the range checks fail.
Negative ihour, imin and/or sec produce a warning status, but the absolute value is used in the conversion.
If there are multiple errors, the status value reflects only the first, the smallest taking precedence.
Astrometry.SOFA.tf2d — Function
tf2d(sign::Char, hour::Integer, minute::Integer, second::Real)Convert hours, minutes, seconds to days.
Input
sign– sign: '-' = negative, otherwise positivehour– hoursminute– minutessecond– seconds
Output
day– interval in days
Note
The result is computed even if any of the range checks fail.
Negative ihour, imin and/or sec produce a warning status, but the absolute value is used in the conversion.
If there are multiple errors, the status value reflects only the first, the smallest taking precedence.
Astrometry.SOFA.rx — Function
rx(ϕ::Real, r::AbstractMatrix{<:Real})Rotate an r-matrix about the x-axis.
Input
ϕ– angle (radians)r– r-matrix
Output
r– r-matrix, rotated
Note
Calling this function with positive ϕ incorporates in the supplied r-matrix r an additional rotation, about the x-axis, anticlockwise as seen looking towards the origin from positive x.
The additional rotation can be represented by this matrix:
( 1 0 0 ) ( ) ( 0 + cos(ϕ) + sin(ϕ) ) ( ) ( 0 - sin(ϕ) + cos(ϕ) )
Astrometry.SOFA.ry — Function
ry(θ::Real, r::AbstractMatrix{<:Real})Rotate an r-matrix about the y-axis.
Input
θ– angle (radians)r– r-matrix
Output
r– r-matrix, rotated
Note
Calling this function with positive theta incorporates in the supplied r-matrix r an additional rotation, about the y-axis, anticlockwise as seen looking towards the origin from positive y.
The additional rotation can be represented by this matrix:
( + cos(θ) 0 - sin(θ) ) ( ) ( 0 1 0 ) ( ) ( + sin(θ) 0 + cos(θ) )
Astrometry.SOFA.rz — Function
rz(ψ::Real, r::AbstractMatrix{<:Real})Rotate an r-matrix about the z-axis.
Input
ψ– angle (radians)r– r-matrix
Output
r– r-matrix, rotated
Note
Calling this function with positive ψ incorporates in the supplied r-matrix r an additional rotation, about the z-axis, anticlockwise as seen looking towards the origin from positive z.
The additional rotation can be represented by this matrix:
( + cos(ψ) + sin(ψ) 0 ) ( ) ( - sin(ψ) + cos(ψ) 0 ) ( ) ( 0 0 1 )
Astrometry.SOFA.rm2v — Function
rm2v(r::AbstractMatrix{<:Real})Express an r-matrix as an r-vector.
Input
r– rotation matrix
Output
w– rotation vector (Note 1)
Note
A rotation matrix describes a rotation through some angle about some arbitrary axis called the Euler axis. The "rotation vector" returned by this function has the same direction as the Euler axis, and its magnitude is the angle in radians. (The magnitude and direction can be separated by means of the function eraPn.)
If r is null, so is the result. If r is not a rotation matrix the result is undefined; r must be proper (i.e. have a positive determinant) and real orthogonal (inverse = transpose).
The reference frame rotates clockwise as seen looking along the rotation vector from the origin.
Astrometry.SOFA.pap — Function
pap(a::AbstractVector{<:Real}, b::AbstractVector{<:Real})Position-angle from two p-vectors.
Input
a– direction of reference pointb– direction of point whose PA is required
Output
θ– position angle of b with respect to a (radians)
Note
The result is the position angle, in radians, of direction b with respect to direction a. It is in the range -pi to +pi. The sense is such that if b is a small distance "north" of a the position angle is approximately zero, and if b is a small distance "east" of a the position angle is approximately +pi/2.
The vectors a and b need not be of unit length.
Zero is returned if the two directions are the same or if either vector is null.
If vector a is at a pole, the result is ill-defined.
Astrometry.SOFA.pas — Function
pas(λa::Real, ϕa::Real, λb::Real, ϕb::Real)Position-angle from spherical coordinates.
Input
λa– longitude of point A (e.g. RA) in radiansϕa– latitude of point A (e.g. Dec) in radiansλb– longitude of point Bϕb– latitude of point B
Output
θ– position angle of B with respect to A
Note
The result is the bearing (position angle), in radians, of point B with respect to point A. It is in the range -pi to +pi. The sense is such that if B is a small distance "east" of point A, the bearing is approximately +pi/2.
Zero is returned if the two points are coincident.
Astrometry.SOFA.sepp — Function
sepp(a::AbstractVector{<:Real}, b::AbstractVector{<:Real})Angular separation between two p-vectors.
Input
a– first p-vector (not necessarily unit length)b– second p-vector (not necessarily unit length)
Output
θ– angular separation (radians, always positive)
Note
If either vector is null, a zero result is returned.
The angular separation is most simply formulated in terms of scalar product. However, this gives poor accuracy for angles near zero and pi. The present algorithm uses both cross product and dot product, to deliver full accuracy whatever the size of the angle.
Astrometry.SOFA.seps — Function
seps(λa::Real, ϕa::Real, λb::Real, ϕb::Real)Angular separation between two sets of spherical coordinates.
Input
λa– first longitude (radians)ϕa– first latitude (radians)λb– second longitude (radians)ϕb– second latitude (radians)
Output
θ– angular separation (radians)
Astrometry.SOFA.c2s — Function
c2s(pos::AbstractVector{<:Real})P-vector to spherical coordinates.
Input
p– p-vector
Output
θ– longitude angle (radians)ϕ– latitude angle (radians)
Note
The vector p can have any magnitude; only its direction is used.
If p is null, zero θ and ϕ are returned.
At either pole, zero θ is returned.
Astrometry.SOFA.p2s — Function
p2s(pos::AbstractVector{<:Real})P-vector to spherical polar coordinates.
Input
p– p-vector
Output
θ– longitude angle (radians)ϕ– latitude angle (radians)r– radial distance
Note
If P is null, zero θ, ϕ and r are returned.
At either pole, zero θ is returned.
Astrometry.SOFA.pv2s — Function
pv2s(pv::AbstractVector{<:AbstractVector{<:Real}})Convert position/velocity from Cartesian to spherical coordinates.
Input
posvel– position-velocity-vector
Output
θ– longitude angle (radians)ϕ– latitude angle (radians)r– radial distancedθ– rate of change of θdϕ– rate of change of ϕdr– rate of change of r
Note
If the position part of pv is null, theta, ϕ, td and pd are indeterminate. This is handled by extrapolating the position through unit time by using the velocity part of pv. This moves the origin without changing the direction of the velocity component. If the position and velocity components of pv are both null, zeroes are returned for all six results.
If the position is a pole, theta, td and pd are indeterminate. In such cases zeroes are returned for all three.
Astrometry.SOFA.s2c — Function
s2c(θ::Real, ϕ::Real)Convert spherical coordinates to Cartesian.
Input
θ– longitude angle (radians)ϕ– latitude angle (radians)
Output
c– direction cosines
Astrometry.SOFA.s2pv — Function
s2pv(θ::Real, ϕ::Real, r::Real, dθ::Real, dϕ::Real,
dr::Real)Convert position/velocity from spherical to Cartesian coordinates.
Input
θ– longitude angle (radians)ϕ– latitude angle (radians)r– radial distancedθ– rate of change of θdϕ– rate of change of ϕdr– rate of change of r
Output
pv– pv-vector
Astrometry.SOFA.pn — Function
pn(p::AbstractVector{<:Real})Convert a p-vector into modulus and unit vector.
Input
p– p-vector
Output
r– modulusu– unit vector
Note
- If p is null, the result is null. Otherwise the result is a unit vector.
Astrometry.SOFA.pvdpv — Function
pvdpv(a::AbstractVector{<:AbstractVector{<:Real}}, b::AbstractVector{<:AbstractVector{<:Real}})Inner (=scalar=dot) product of two pv-vectors.
Input
a– first pv-vectorb– second pv-vector
Output
adb– a . b (see note)
Note
- If the position and velocity components of the two pv-vectors are ( ap, av ) and ( bp, bv ), the result, a . b, is the pair of numbers ( ap . bp , ap . bv + av . bp ). The two numbers are the dot-product of the two p-vectors and its derivative.
Astrometry.SOFA.pvxpv — Function
pvxpv(a::AbstractVector{<:AbstractVector{<:Real}}, b::AbstractVector{<:AbstractVector{<:Real}})Outer (=vector=cross) product of two pv-vectors.
Input
a– first pv-vectorb– second pv-vector
Output
axb– a x b
Note
- If the position and velocity components of the two pv-vectors are ( ap, av ) and ( bp, bv ), the result, a x b, is the pair of vectors ( ap x bp, ap x bv + av x bp ). The two vectors are the cross-product of the two p-vectors and its derivative.
Astrometry.SOFA.cp — Function
cp(p::AbstractVector{<:Real})Copy a p-vector.
Input
p– p-vector to be copied
Output
c– copy
Astrometry.SOFA.cpv — Function
cpv(pv::AbstractVector{<:AbstractVector{<:Real}})Copy a position/velocity vector.
Input
pv– pv-vector to be copied
Output
c– copy
Astrometry.SOFA.cr — Function
cr(r::AbstractMatrix{<:Real})Copy an r-matrix.
Input
r– r-matrix to be copied
Output
c– copy
Astrometry.SOFA.p2pv — Function
p2pv(p::AbstractVector{<:Real})Extend a p-vector to a pv-vector by appending a zero velocity.
Input
p– p-vector
Output
pv– pv-vector
Astrometry.SOFA.pv2p — Function
pv2p(pv::AbstractVector{<:AbstractVector{<:Real}})Discard velocity component of a pv-vector.
Input
pv– pv-vector
Output
p– p-vector
Astrometry.SOFA.ir — Function
ir()Initialize an r-matrix to the identity matrix.
Output
r– r-matrix
Astrometry.SOFA.zp — Function
zp()Zero a p-vector.
Output
p– zero p-vector
Astrometry.SOFA.zpv — Function
zpv()Zero a pv-vector.
Output
pv– zero pv-vector
Astrometry.SOFA.zr — Function
zr()Initialize an r-matrix to the null matrix.
Output
r– r-matrix
Astrometry.SOFA.rxr — Function
rxr(a::AbstractMatrix{<:Real}, b::AbstractMatrix{<:Real})Multiply two r-matrices.
Input
a– first r-matrixb– second r-matrix
Output
atb– a * b
Note
- It is permissible to re-use the same array for any of the arguments.
Astrometry.SOFA.tr — Function
tr(r::AbstractMatrix{<:Real})Transpose an r-matrix.
Input
r– r-matrix
Output
rt– transpose
Note
- It is permissible for r and rt to be the same array.
Astrometry.SOFA.rxp — Function
rxp(r::AbstractMatrix{<:Real}, p::AbstractVector{<:Real})Multiply a p-vector by an r-matrix.
Input
r– r-matrixp– p-vector
Output
rp– r * p
Note
- It is permissible for p and rp to be the same array.
Astrometry.SOFA.rxpv — Function
rxpv(r::AbstractMatrix{<:Real}, pv::AbstractVector{<:AbstractVector{<:Real}})Multiply a pv-vector by an r-matrix.
Input
r– r-matrixpv– pv-vector
Output
rpv– r * pv
Note
The algorithm is for the simple case where the r-matrix r is not a function of time. The case where r is a function of time leads to an additional velocity component equal to the product of the derivative of r and the position vector.
It is permissible for pv and rpv to be the same array.
Astrometry.SOFA.trxp — Function
trxp(r::AbstractMatrix{<:Real}, p::AbstractVector{<:Real})Multiply a p-vector by the transpose of an r-matrix.
Input
r– r-matrixp– p-vector
Output
trp– r^T * p
Note
- It is permissible for p and trp to be the same array.
Astrometry.SOFA.trxpv — Function
trxpv(r::AbstractMatrix{<:Real}, pv::AbstractVector{<:AbstractVector{<:Real}})Multiply a pv-vector by the transpose of an r-matrix.
Input
r– r-matrixpv– pv-vector
Output
trpv– r^T * pv
Note
The algorithm is for the simple case where the r-matrix r is not a function of time. The case where r is a function of time leads to an additional velocity component equal to the product of the derivative of the transpose of r and the position vector.
It is permissible for pv and rpv to be the same array.
Astrometry.SOFA.s2p — Function
s2p(θ::Real, ϕ::Real, r::Real)Convert spherical polar coordinates to p-vector.
Input
θ– longitude angle (radians)ϕ– latitude angle (radians)r– radial distance
Output
p– Cartesian coordinates
Astrometry.SOFA.pdp — Function
pdp(a::AbstractVector{<:Real}, b::AbstractVector{<:Real})P-vector inner (=scalar=dot) product.
Input
a– first p-vectorb– second p-vector
Output
r– a . b
Astrometry.SOFA.pm — Function
pm(p::AbstractVector{<:Real}) = norm(p)Modulus of p-vector.
Input
p– p-vector
Output
r– modulus
Astrometry.SOFA.pmp — Function
pmp(a::AbstractVector{<:Real}, b::AbstractVector{<:Real})P-vector subtraction.
Input
a– first p-vectorb– second p-vector
Output
amb– a - b
Astrometry.SOFA.ppp — Function
ppp(a::AbstractVector{<:Real}, b::AbstractVector{<:Real})P-vector addition.
Input
a– first p-vectorb– second p-vector
Output
apb– a + b
Astrometry.SOFA.ppsp — Function
ppsp(a::AbstractVector{<:Real}, s::Real, b::AbstractVector{<:Real})P-vector plus scaled p-vector.
Input
a– first p-vectors– scalar (multiplier for b)b– second p-vector
Output
apsb– a + s*b
Astrometry.SOFA.pvm — Function
pvm(pv::AbstractVector{<:AbstractVector{<:Real}})Modulus of pv-vector.
Input
pv– pv-vector
Output
r– modulus of position components– modulus of velocity component
Astrometry.SOFA.pvmpv — Function
pvmpv(a::AbstractVector{<:AbstractVector{<:Real}}, b::AbstractVector{<:AbstractVector{<:Real}})Subtract one pv-vector from another.
Input
a– first pv-vectorb– second pv-vector
Output
amb– a - b
Astrometry.SOFA.pvppv — Function
pvppv(a::AbstractVector{<:AbstractVector{<:Real}}, b::AbstractVector{<:AbstractVector{<:Real}})Add one pv-vector to another.
Input
a– first pv-vectorb– second pv-vector
Output
apb– a + b
Astrometry.SOFA.pvu — Function
pvu(dt::Real, pv::AbstractVector{<:AbstractVector{<:Real}})Update a pv-vector.
Input
dt– time intervalpv– pv-vector
Output
upv– p updated, v unchanged
Note
"Update" means "refer the position component of the vector to a new date dt time units from the existing date".
The time units of dt must match those of the velocity.
Astrometry.SOFA.pvup — Function
pvup(dt::Real, pv::AbstractVector{<:AbstractVector{<:Real}})Update a pv-vector, discarding the velocity component.
Input
dt– time intervalpv– pv-vector
Output
p– p-vector
Note
"Update" means "refer the position component of the vector to a new date dt time units from the existing date".
The time units of dt must match those of the velocity.
Astrometry.SOFA.pxp — Function
pxp(a::AbstractVector{<:Real}, b::AbstractVector{<:Real})P-vector outer (=vector=cross) product.
Input
a– first p-vectorb– second p-vector
Output
axb– a x b
Astrometry.SOFA.s2xpv — Function
s2xpv(s1::Real, s2::Real, pv::AbstractVector{<:AbstractVector{<:Real}})Multiply a pv-vector by two scalars.
Input
s1– scalar to multiply position component bys2– scalar to multiply velocity component bypv– pv-vector
Output
spv– pv-vector: p scaled by s1, v scaled by s2
Astrometry.SOFA.sxp — Function
sxp(s::Real, p::AbstractVector{<:Real})Multiply a p-vector by a scalar.
Input
s– scalarp– p-vector
Output
sp– s * p
Astrometry.SOFA.sxpv — Function
sxpv(s::Real, pv::AbstractVector{<:AbstractVector{<:Real}})Multiply a pv-vector by a scalar.
Input
s– scalarpv– pv-vector
Output
spv– s * pv