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 the double[6] array a. This function computes the lower-triangular matrix L, defined by the double[6] array l, such that Lᵀ⋅L = A.

The array l must be pre-allocated; it is modified by this function. Note that storage of the coefficients of L 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 the double[6] array l (see _cholesky_decomp() for ordering of the coefficients). This function solves (by substitution) the linear system Lᵀ⋅L⋅x = b, where the vectors x and b are specified through their double[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 preallocated double[2] array out: out[0] = μ² and out[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 the double[3] array r12. The symmetric, positive-definite matrices Q₁ and Q₂ are specified through the double[6] arrays q1 and q2.

The value of λ is specified through the parameter lambda.

This function returns the value of -f(λ) (the “minus” sign comes from the fact that we seek the maximum of f, 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 radius c and the direction of its axis of revolution, n (unit-vector, double[3] array).

q is the representation of a symmetric matrix as a double[6] array. It is modified in-place.