The python API¶
- pypw85._cholesky_decomp(a: numpy.ndarray[numpy.float64], l: numpy.ndarray[numpy.float64]) → None¶
Compute the Cholesky decomposition of a symmetric, positive matrix.
Let
A
be a symmetric, positive matrix, defined by thedouble[6]
arraya
. This function computes the lower-triangular matrixL
, defined by thedouble[6]
arrayl
, such thatLᵀ⋅L = A
.The array
l
must be pre-allocated; it is modified by this function. Note that storage of the coefficients ofL
is as follows:⎡ l[0] 0 0 ⎤ L = ⎢ l[1] l[3] 0 ⎥. ⎣ l[2] l[4] l[5] ⎦
This function is exposed for testing purposes only.
- pypw85._cholesky_solve(l: numpy.ndarray[numpy.float64], b: numpy.ndarray[numpy.float64], x: numpy.ndarray[numpy.float64]) → None¶
Compute the solution to a previously Cholesky decomposed linear system.
Let
L
be a lower-triangular matrix, defined by thedouble[6]
arrayl
(see_cholesky_decomp()
for ordering of the coefficients). This function solves (by substitution) the linear systemLᵀ⋅L⋅x = b
, where the vectorsx
andb
are specified through theirdouble[3]
array of coordinates;x
is modified by this function.This function is exposed for testing purposes only.
- pypw85.contact_function(r12: numpy.ndarray[numpy.float64], q1: numpy.ndarray[numpy.float64], q2: numpy.ndarray[numpy.float64], out: numpy.ndarray[numpy.float64]) → int¶
Compute the value of the contact function of two ellipsoids.
See
f_neg()
for the meaning of the parameters r12, q1 and q2.This function computes the value of
μ²
, defined as:μ² = max{λ(1-λ)r₁₂ᵀ⋅[(1-λ)Q₁ + λQ₂]⁻¹⋅r₁₂, 0 ≤ λ ≤ 1}
and the maximizer
λ
, see Theory. Both values are stored in the preallocateddouble[2]
arrayout
:out[0] = μ²
andout[1] = λ
.μ
is the common factor by which the two ellipsoids must be scaled (their centers being fixed) in order to be tangentially in contact.This function returns
0
.Todo
This function should return an error code.
- pypw85.f_neg(lambda: float, r12: numpy.ndarray[numpy.float64], q1: numpy.ndarray[numpy.float64], q2: numpy.ndarray[numpy.float64]) → float¶
Return the value of the opposite of the function
f
defined as (see Theory):f(λ) = λ(1-λ)r₁₂ᵀ⋅Q⁻¹⋅r₁₂,
with:
Q = (1-λ)Q₁ + λQ₂,
where ellipsoids 1 and 2 are defined as the sets of points
m
(column-vector) such that:(m-cᵢ)ᵀ⋅Qᵢ⁻¹⋅(m-cᵢ) ≤ 1.
In the above inequality,
cᵢ
is the center;r₁₂ = c₂ - c₁
is the center-to-center radius-vector, represented by thedouble[3]
arrayr12
. The symmetric, positive-definite matricesQ₁
andQ₂
are specified through thedouble[6]
arraysq1
andq2
.The value of
λ
is specified through the parameterlambda
.This function returns the value of
-f(λ)
(the “minus” sign comes from the fact that we seek the maximum off
, or the minimum of(-f)
.This implementation uses Cholesky decompositions.
- pypw85.spheroid(a: float, c: float, n: numpy.ndarray[numpy.float64], q: numpy.ndarray[numpy.float64]) → None¶
Compute the quadratic form associated to a spheroid.
The spheroid is defined by its equatorial radius
a
, its polar radiusc
and the direction of its axis of revolution,n
(unit-vector,double[3]
array).q
is the representation of a symmetric matrix as adouble[6]
array. It is modified in-place.