Algorithms For Ellipsoids
Algorithms For Ellipsoids
Stephen B. Pope
Sibley School of Mechanical & Aerospace Engineering
Cornell University
Ithaca, New York 14853
Report: FDA-08-01
February 2008
Abstract
2 Representation of ellipsoids 3
3 Summary of routines 5
1
12 Orthogonal projection of E onto a given line 29
19 Conclusions 46
20 Acknowledgments 46
2
1 Introduction
In this paper we describe a number of algorithms to perform basic geometric
operations on ellipsoids. These algorithms have been implemented in Fortran
routines which are contained in the library ELL LIB, which is available at
http://eccentric.mae.cornell.edu/∼tcg/ELL LIB.
Ellipsoids arise in numerous computational problems. The algorithms
and routines described here have been developed specifically for use in the
in situ adaptive tabulation (ISAT) algorithm (Pope 1997).
In Sec. 2 we consider different mathematical representations of an ellipsoid
E in <n , for n ≥ 1. For n = 1, E is a line segment; for n = 2, E is an ellipse;
for n = 3, E is an ellipsoid; and for n > 3, E is a hyper-ellipsoid. For
simplicity we generally refer to E (for all n ≥ 1) as an ellipsoid.
A summary of the routines in ELL LIB is provided in Sec. 3. Follow-
ing some preliminary results in Sec. 4, the algorithms used are described in
Secs. 5–18.
2 Representation of ellipsoids
There are many ways to represent ellipsoids, with the different ways arising
naturally in different circumstances. In this section we show the relations
between the different representations.
Let the ellipsoid E be centered at c; let the columns of the n×n orthogonal
matrix U be unit vectors in the directions of E’s principal axes; and let Σ
be the diagonal matrix (with diagonal elements Σii = σi ) such that 1/σi is
the length of the ith principal semi-axis. We assume that the principle axes
are finite and strictly positive, i.e., 0 < σi < ∞. Then E is given by
E ≡ {x | (x − c)T UΣ2 UT (x − c) ≤ 1}. (1)
This may alternatively be expressed as
E ≡ {x | kΣUT (x − c)k ≤ 1}. (2)
or, from the definition w ≡ ΣUT (x − c),
E ≡ {x | x = c + UΣ−1 w, kwk ≤ 1}. (3)
The above three definitions can be re-expressed in terms of different re-
lated matrices. Let A be the matrix
3
A ≡ UΣ2 UT , (4)
1
E ≡ {x | kA 2 (x − c)k ≤ 1}, (6)
1
E ≡ {x | x = c + A− 2 w, kwk ≤ 1}. (7)
Let B be a non-singular square matrix, which we use to form A as
A = BBT , (8)
B = LQ, (14)
4
where L is lower triangular with positive diagonal elements and Q is orthog-
onal. Thus we obtain
A = BBT = LLT , (15)
showing that L is the Cholesky factorization of A. The definitions of E in
terms of B apply equally in terms of L, i.e.,
E ≡ {x | (x − c)T LLT (x − c) ≤ 1}, (16)
3 Summary of routines
Table 2 summarizes the tasks performed by the principal routines in ELL LIB.
Here E, E1 and E2 denote given ellipsoids, and p denotes a given point.
5
Table 1: Routines to transform between different representations
Routine From To
ell bbt2chol B L
ellu bbt2chol B L
ell bbt2eig B (U, Σ)
ell chol2eig L (U, Σ)
ellu chol2eig L (U, Σ)
ell eig2chol (U, Σ) L
ell full2eig A (U, Σ)
ell full2low A Ā
ell low2chol Ā L
y = MT (x − b), (19)
x = b + M−T y. (20)
with
B̂ ≡ M−1 B, (23)
and
ĉ ≡ MT (c − b). (24)
6
Table 2: Tasks performed by principal routines in ELL LIB
Routine Section Task performed
ell rad lower 5 Determine the smallest
principal semi-axis of E
ell rad upper 5 Determine the largest
ellu rad upper principal semi-axis of E
ell radii upper 5 Determine the smallest and largest
ellu radii upper principal semi-axes of E
ell pt in 6 Determine whether
p is covered by E
ell pt dist 7 Determine the relative distance from
p to the boundary of E
ell pt near far 8 Determine the point in E which is
ellu pt near far 9 nearest to or furthest from p
ell pt modify 10.2 Determine EV , the modification
of E of least change of
content whose boundary
intersects with p
ell pt shrink 11 Shrink E based on p
ell pt hyper - Determine a separating hyperplane
between E and p
ell pts uncover 14 Determine an ellipsoid (of
large content) which does
not cover any given point
ell line proj 12 Project E onto a given line
ell aff pr 13 Project E onto a given affine space
ell pair shrink 17 For concentric E1 and E2 ,
shrink E2 (if necessary)
so that it is covered by E1
ell pair separate 15 Determine if E1 and E2
intersect; and, if they
do not, determine a
separating hyperplane
ell pair cover query 16 Determine wether E1 covers E2
ell pair cover 18 Determine an ellipsoid
(of small content) which
covers E1 and E2
7
4.2 Quadratic minimization
Several of the algorithms described below depend on the solution to the fol-
lowing problem: determine a vector x which minimizes the quadratic function
g(x) ≡ 21 xT Ax + bT x, (25)
subject to
xT x ≤ δ 2 , (26)
where δ, b and A are a given scalar, vector, and symmetric matrix, re-
spectively. Such problems are efficiently solved by the routine dgqt from
MINPACK-2 (see Averick et al. 1993).
It is readily shown that H has the following properties (not all independent):
1. H is symmetric: HT = H.
2. H is orthogonal: HT H = I.
8
4.4 Rank-one modification
Let E be an ellipsoid centered at the origin (i.e., c = 0), given in terms of
the positive symmetric definite matrix A, which has SVD A = UΣ2 UT , and
Cholesky decomposition A = LLT . For a given vector w and scalar ρ, let F
be the rank-one modification of A:
F = A + ρwwT . (29)
We require F to be positive symmetric definite, which in turn requires ρ
to exceed a critical value ρ0 (ρ0 < 0) above which all eigenvalues of F are
positive (see item 7 below). Then, the modified ellipsoid E 0 is defined by
E 0 ≡ {x | xT Fx ≤ 1}. (30)
The following results are readily obtained:
1. For ρ ≥ 0, xT Fx is greater than or equal to xT Ax, and hence E covers
E 0.
2. For ρ ≤ 0, xT Fx is less than or equal to xT Ax, and hence E 0 covers
E.
3. The eigenvalues of F are interlaced with those of A (see Golub and
Van Loan 1996, Sec. 8.5.3). Hence the lengths of the principal axes of
E and E 0 are also interlaced.
4. With z ≡ ΣUT x, we have xT Ax = zT z, so that E is the unit ball in
z-space. Correspondingly, E 0 is given by
E 0 = {z | zT (I + ρw̃w̃T )z ≤ 1}. (31)
where
w̃ = Σ−1 UT w. (32)
− 12
Thus in z-space, one principal semi-axis of E 0 is (1 + ρ|w̃|2 ) w̃/|w̃|,
and the others are orthogonal unit vectors.
5. Similarly, with y ≡ LT x, we have xT Ax = yT y, so that E is the unit
ball in y-space. Correspondingly, E 0 is given by
E 0 = {y | yT (I + ρŵŵT )y ≤ 1}. (33)
where
ŵ = L−1 w. (34)
9
6. The rank-one modifications to the identity appearing in Eq.(31) has
the symmetric square root
ρ = 2α + α2 |w̃|2 , (36)
1
α = (±{1 + ρ|w̃|2 } 2 − 1)/|w̃|2 . (37)
The matrix in Eq.(33) has a similar square root, with the same value
of α, since |ŵ| = |w̃|.
ρ0 = −1/|w̃|2 , (38)
λi = σi2 . (41)
10
E
rin
rout
Figure 1: Sketch of an ellipsoid E showing the radii, rin and rout of the inscribed
and circumscribed hyper-spheres.
− 12
The principal semi-axes are given by ri = λi = σi−1 . Thus the smallest
principle semi-axis is
1
rin = [max(λi )]− 2 , (42)
and the largest is
1
rout = [min(λi )]− 2 . (43)
The most stable way to compute rin is as rin = 1/σ1 , where σ1 is obtained
from the SVD of L, and similarly for rout . The routine ell radii determines
both rin and rout using the SVD.
The routines ell rad lower and ell rad upper determine rin and rout at sig-
nificantly lower computational cost, but with less accuracy. Given L, the
routine ell rad lower determines rin via Eq.(42), using the LAPACK routine
dsyevx to compute the largest eigenvalue of A.
The routine ell rad upper determines rout via quadratic minimization. Since
rout is the furthest distance from the center to any point on the ellipsoid we
2
have that rout is the maximum of rT r subject to
rT Ar ≤ 1. (44)
11
subject to
yT y ≤ 1. (46)
and we have
b − c = s (p − c). (50)
Hence, s is determined as
12
f
Figure 2: The points n and f in the ellipsoid E which are nearest and furthest,
respectively, to the given point p.
13
Thus y is obtained via dgqt by minimizing
χ ≡ 12 yT L−1 L−T y + (c − p)T y, (58)
subject to kyk ≤ 1; and then x is obtained from Eq.(56).
14
(a)
p (b)
c
E
p̂
(c) (d)
p
c
E0
p̂
Figure 3: Sketch of: (a) the given ellipsoid E and point p; (b) the transformation
of E to the unit ball, and p to a point on the first axis; (c) the transformed ellipsoid
E 0 ; and (d) the grown ellipsoid E 0 .
y = LT (x − c), (60)
kyk ≤ 1. (61)
p̃ = LT (p − c). (62)
15
There is an orthogonal matrix Q which transforms p̃ to a point on the
1-axis; that is,
p̂ = QT p̃ = QT LT (p − c), (63)
where
p̂i = p̃δi1 , (64)
and p̃ = kp̃k. It is readily shown that Q is simply the Householder matrix
Q = H(p̃). The same transformation applied to E yields the unit ball
zT z ≤ 1, (65)
where
z = QT LT (x − c). (66)
This ball and the point p̂ (p̂i ≡ p̃δi1 ) are shown in Fig. 3 (b). The next step
is to define the modified ellipse E 0 in z-space, as shown in Fig. 3 (c). This
ellipsoid is
zT Λ2 z ≤ 1, (67)
where
Λ2ij = δij + δi1 δj1 (p̃−2 − 1). (68)
Transforming back to the original space, we obtain the equation for E 0
(see Fig. 3 (d)):
(x − c)T LQΛ2 QT LT (x − c) ≤ 1, (69)
or
(x − c)T L0 L0T (x − c) ≤ 1. (70)
Thus the modified ellipsoid E 0 has center c and Cholesky matrix L0 given by
L0 L0T = LQΛ2 QT LT
= (LQΛ)(LQΛ)T . (71)
In summary, given the ellipsoid E (in terms of c and L) and the point p,
then p̃ is determined by Eq.(62), v by Eq.(28), Q by Eq.(27), Λ2 by Eq.(68),
and finally the Cholesky matrix of the modified ellipsoid E 0 is determined by
Eq.(71).
16
10.2 Rank-one modification algorithm
Following from Eqs.(61) and (62), in y-space, the modified ellipsoid E 0 is the
unit ball extended to intersect the point p̃. Thus, based on the results of
Sec. 4.4, we have
E 0 = {y | yT G2 y ≤ 1}, (72)
where
G = I + γ p̃p̃T , (73)
and γ (determined by the condition p̃T G2 p̃ = 1) is
à !
1 1
γ= −1 . (74)
|p̃| |p̃|2
10.3 Behavior
Test are reported for the minimum-volume growing algorithm. The tests are
in two dimensions and are based on an initial ellipsoid E (centered at the
origin and aligned with the coordinate axes). The length of the major semi-
axis is rmajor = 1, and the minor semi-axis is rminor . The grow point p is not
covered by E, and the vector p is at an angle θ to the x1 axis. An example
of the grown ellipse Ẽ given by the minimum-volume algorithm is shown in
Fig. 4.
The lengths of the principal semi-axes of the grown ellipse Ẽ are denoted
by Rmajor and Rminor . A figure of demerit F of the growth operation is
defined by:
F ≡ Rmajor / max(rmajor , |p|) ≥ 1. (76)
Tests suggest the following behavior:
1. For given E and θ, the maximum of F occurs for |p| = rmajor , i.e., for
p being on the bounding circle.
17
Minimum−volume growing for grow point at 70 degrees
0.5
−0.5
−1
3. √
As rminor decreases, θmax tends towards π/2, and Fmax tends towards
2.
18
Amplification of the major axis against the angle of the grow point
1.4
1.35
1.3
1.25
Rmajor/rmajor
1.2
1.15
1.1
1.05
0.95
0 10 20 30 40 50 60 70 80 90
θ
1) p is on the boundary of EV
2) EV is covered by E.
11.1.2 Behavior
We consider the same 2D case as for the minimum-volume growing algorithm,
except that here the shrink point p is covered by the ellipse E. The maximum-
volume shrinking algorithm determines the ellipse EV of maximum volume
which is covered by E and has p on its boundary. This is illustrated in Fig. 6.
We define a figure of merit
19
Figure 6: The maximum-volume shrinking algorithm. The initial ellipse E (solid
blue line); its inscribed circle (green line); the grow point p (magenta); and the
maximum-volume shrunk ellipse EV (red line): rminor = 0.4, rmajor = 1, θ = 70o ,
|p| = 0.48.
where rminor and Rminor are the lengths of the minor semi-axes before and
after shrinking. Based on empirical testing we draw the following conclusions.
1. For given E and θ, the minimum (Fmin ) of F occurs for p = rminor ,
i.e., for p lying on the inscribed circle.
2. As rminor /rmajor decreases, the values of θ at which F is minimum (i.e.,
F (θmin ) = Fmin ) tends to π/2 − rminor /rmajor , and Fmin tends to zero
as 2rminor /rmajor .
Figure 7 shows the case rminor /rmajor = 0.1, θ = θmin = 84.3o for which
Fmin = 0.1962.
20
ellipsoid can exclude a substantial portion of the original ellipsoid which is
closer to the center than the shrink point. Here we describe the alternative
“near-content shrinking algorithm” which yields values of F of one, or close
to one. However, unlike the maximum-volume algorithm, the result depends
on the metric of the space. It is implemented in the routine ell pt shrink (for
the parameter value k ell= 2).
11.2.1 Algorithm
We first describe the algorithm and then give its partial justification.
The initial ellipsoid E centered at c is given in terms of the matrix A with
SVD A = UΣ2 UT . We transform to principal axes (y-space) by defining
y = UT x, (78)
and
p̂ = UT (p − c). (79)
In y-space, the modified ellipsoid EN is defined as the rank-one modification
to E:
EN = {y | yT Fy ≤ 1}, (80)
F = Σ2 + ρwwT , (81)
w = Dp̂, (82)
where the diagonal matrix D is defined by
1. The quantity 1/|p̂|2 − Σ2ii (appearing in Eq.(83)) is positive if, and only
if, the length of the i-th principal semi-axis Σ−1
ii is greater than |p̂|.
21
2. Since E covers p̂, p̂T Dp̂ is strictly positive, and hence a positive value
of ρ exists which satisfies Eq.(84), namely
4. If for some i (1 ≤ i < n), p̂ lies between the balls of radius Σ−1 ii
and Σ−1(i+1)(i+1) , then wj = 0 for j ≤ i, and as a consequence the first
i principal axes of EN are the same as those of E. This again is a
necessary condition for EN to be a maximum nearest content ellipsoid.
11.2.2 Behavior
The behavior of the near-content algorithm is illustrated for a 2D case in
Fig. 8; and it is compared to the maximum-volume algorithm in Fig. 9. There
is a striking difference between the two methods, especially for relatively
small |p|.
22
Max. close content: |p|/rmin=1.5 Max. close content: |p|/rmin=1.01
0.5 0.5
0 0
−0.5 −0.5
0.5 0.5
0 0
−0.5 −0.5
Figure 8: The near-content shrinking algorithm. The initial ellipse E (solid blue
line); its inscribed circle (light blue line); the grow point p (magenta); and the
maximum near content shrunk ellipse EN (red line): rmajor = 1, rminor = 0.4,
θ = 70o .
23
Max. close content: |p|/rmin=1.6 Max. close content: |p|/rmin=1.2
0.5 0.5
0 0
−0.5 −0.5
0.5 0.5
0 0
−0.5 −0.5
8. Tests reveal that the figure of merit F Eq.(77) is never less than unity.
24
Max. close content: |p|/rmin=1.6 Max. close content: |p|/rmin=1.2
0.5 0.5
0 0
−0.5 −0.5
0.5 0.5
0 0
−0.5 −0.5
Figure 10: Conservative shrinking algorithm. The initial ellipse E (solid blue line);
the grow point p (magenta); the maximum-volume shrunk ellipse, EV , (green line);
the near-content shrunk ellipse, EN , (red line); and the conservative shrunk ellipse,
EC , (magenta): rmajor = 1, rminor = 0.4, θ = 70o .
z = Σy = ΣUT x. (88)
EN = {z | zT (I + ρw
e w)z
e ≤ 1}, (89)
with
e = Σ−1 w.
w (90)
And the maximum volume shrunk ellipsoid is
EV = {z | zT (I + γ p
epe T )z ≤ 1}, (91)
where p
e is the transform of p
25
ž2
1 EC
EN p̌
−1 χ 1 ž1
EV
−1
Figure 11: Sketch of E, EN and EV in the ž1 -ž2 plane (in which E is the unit
disc) and of EC which covers EN and EV . The boundaries of both EN and EV
intersect the grow point p̌.
(see Eq.(72)). The scalars ρ and γ are determined by the condition that the
boundaries of EN and EV intersect p e (in z-space).
Note that EN and EV are completely determined by two vectors, w e and
p
e . If these are co-linear, then EN = EV = EC . Otherwise we perform a
rotation
ž = QT z, w̌ = QT w,
e p̌ = QT p
e, (93)
such that w̌ is in the ž1 -direction, and p̌ is in the ž1 -ž2 plane. The appropriate
orthogonal matrix Q is obtained from the QR decomposition
QR = [w
e p
e ]. (94)
26
Figure 11 is a sketch of the intersection of the ellipsoids with the ž1 -ž2
plane. Note that in the other directions the principal semi-axes are unit
vectors aligned with the coordinate axes. The minimum volume ellipsoid EC
covering EN and EV is also shown in the figure. Its intersection with the
ž1 -ž2 plane is given by the ellipse
" #
ž1
EC0 = {(ž1 , ž2 ) | kL̄ T
k ≤ 1}, (95)
ž2
BC = UΣQĽ. (100)
27
γ = (1 − p̌|2 )/|p̌|4 , (102)
and the intersection of EN with the ž1 axis is at ž1 = χ
|p̌1 |
χ= q . (103)
1 − p̌22
Now EC is the ellipse which covers EN (which is the unit disc) and EV
which has principal semi-axes whose directions are given by the columns of
f and whose lengths are Σ
U e −1 . (In general, one of Σ
e −1 and Σ e and Σe is
11 22 11 22
less than unity and one greater than unity.) Thus the covering ellipse EC
has the same principal directions
28
fΣ
EC = {ζ | ζ T U b 2U
fT ζ ≤ 1}, (112)
and eigenvalues
b = min(1, Σ
Σ e ), (113)
11 11
b = min(1, Σ
Σ e ). (114)
22 22
Transforming back to ž1 -ž2 we obtain the required result that EC is given
by Eq.(95), where the 2 × 2 Cholesky matrix L̄ is obtained as
T fΣ
L̄L̄ = CU fT C.
b 2U (115)
L ≡ {x | x = x0 + sv}, (116)
where x0 is a given point and v is a given non-zero vector, see Fig. 12. Given
any point x in the space, its orthogonal projection onto L corresponds to
vT (x − x0 )
s= . (117)
vT v
Now the given ellipsoid E is given by
vT (L−T y + c − x0 )
s =
vT v
= s0 + wT y, for kyk ≤ 1, (119)
where
vT (c − x0 )
s0 ≡ , (120)
vT v
29
s
s+
c
s0
L
E
s−
v
x0
Figure 12: The orthogonal projection of the ellipsoid E onto the line L is the
interval [s− , s+ ].
and
L−1 v
w≡ . (121)
vT v
Given the condition kyk ≤ 1, it is evident from Eq.(119) that the orthogonal
projection of E onto L corresponds to the interval [s , s+ ] in s, with
s± ≡ s0 ± |w|. (122)
30
A ≡ {x | x = d + Tt}, (124)
where d is a given m-vector, T is a given n × m orthogonal matrix, and t
is a vector of m parameters. The orthogonal projection of a general point x
onto A is
P (x) = d + TTT (x − d). (125)
We thus obtain
P (E) = {x | x = d + TTT (c − d + L−T u), kuk ≤ 1}. (126)
Now let the SVD of TT L−T be
TT L−T = U[Σ 0]VT . (127)
Then
TT L−T u = UΣw̃, (128)
where w̃ denotes the first m elements of
w ≡ VT u. (129)
Note that kuk ≤ 1 implies kw̃k ≤ 1. Thus we obtain
P (E) = {x | x = d + T(c̃ + UΣw̃), kw̃k ≤ 1}, (130)
where
c̃ ≡ TT (c − d). (131)
The above equation for P (E) is for an m-dimensional ellipsoid in A. It
can be put in standard form by defining B by
31
14 Generate an ellipsoid which does not cover
any specified points
We are given a point c, a set of P points p(j) (j = 1 : P ) and a positive length
rmax . The problem is to generate an ellipsoid E which
1. is centered at c
1. Ek is centered at c
32
n
X (j)
hj = (yi /ri )2 . (136)
i=1
hj = fj + gj /rk2 , (137)
where
k−1
X (j)
fj = (yi /ri )2 , (138)
i=1
and n
X (j)
gj = (yi )2 . (139)
i=1
The ellipsoid Ek does not cover the point j if hj is greater than unity. This
condition (hj > 1) can be re-expressed as
θ2 < fj ≤ 1, (141)
33
(a) (b) E10
O
E1
v
H0
xh y1
H yh
E2 y2
E20
Figure 13: (a) Sketch of the non-intersecting ellipsoids E1 and E2 and a separating
hyperplane H (b) Corresponding sketch in the transformed space in which E10 is
the unit ball.
or, equivalently,
y1 = v = y2 /ky2 k, (144)
34
so that y1 and y2 are the pair of closest points in E10 and E20 . Note that v is
a unit vector. Then we define
yh ≡ 21 (y1 + y2 ), (145)
H 0 ≡ {y | vT (y − yh ) = 0}. (146)
H ≡ {x | uT (x − xh ) = 0}, (147)
where
L1 v
u= , (148)
kL1 vk
and
xh = c1 + L−T
1 yh . (149)
uT (x2 − x1 )
q≡ ≤ 1. (150)
|x2 − x1 |
This is the distance between the supporting hyperplanes at x1 and x2 relative
to their separation. The maximum possible distance between the supporting
hyperplanes is achieved for q = 1, and this occurs when x1 and x2 are the
mutually closest points in E1 and E2 .
In the routine ell pair separate there is an option to iteratively improve
the quality of the hyperplane. Initially x1 and x2 are set to the points in E1
and E2 corresponding to y1 and y2 (in E10 and E20 ). Then, successively, x1
is replaced by the closest point in E1 to x2 ; and then x2 is replaced by the
closest point in E2 to x1 . The hyperplane is then taken as the perpendicular
bisector of the line x1 − x2 . It is not guaranteed that this hyperplane is
separating, nor that the quality increases with the iterations, although it
generally does. Consequently, H is taken as the hyperplane with the greatest
quality encountered initially or during the iterations.
35
(Note that the separating hyperplane of quality q = 1 could alternatively
be obtained by solving the quadratic programming problem, of determining
the mutually closest points x1 and x2 in E1 and E2 . This has not been
implemented.)
36
(a) (b)
E2 E1 E10
E E0
E20
Figure 14: (a) Sketch of the concentric ellipsoids E1 and E2 and the maximal-
volume ellipsoid E which is covered by them (b) Corresponding ellipsoids in the
transformed space in which E10 is the unit ball.
the lengths of its principal axes are the lesser of those of E10 (all of which are
unity) and those of E20 . Thus if
L02 = UΣVT , (154)
is the SVD of L02 , so that
L02 L0T 2 T
2 = UΣ U , (155)
then the Cholesky matrix of E 0 is given by
2
L0 L0T = UΣ̃ UT , (156)
where the singular values Σ̃ii = σ̃i are given by
σ̃i = max(σi , 1), (157)
where σi ≡ Σii .
The Cholesky matrix of E is obtained by inverting the transformation:
L = L1 L0 . (158)
The same algorithm can be used to determine the minimal-volume el-
lipsoid which covers E1 and E2 . In that case, in contrast to Eq.(157), the
appropriate singular values are:
σ̄i = min(σi , 1). (159)
37
18 Ellipsoid that covers two given ellipsoids
Given two ellipsoids E1 and E2 , the task is to determine a third ellipsoid E
that covers both E1 and E2 . Ideally E is of minimal volume.
It is a problem of convex optimization to determine the minimum-volume
covering ellipsoid (see, e.g., Boyd and Vandenberghe 2004). An algorithm is
provided by Yildirim (2006). It appears that the solution to this convex
optimization problem is computationally expensive. Instead, in the subsec-
tions, we describe heuristic algorithms with determine ellipsoids E (not of
minimal volume) which cover E1 and E2 . These methods are implemented
in the routine ell pair cover, with the parameter algorithm determining the
particular algorithm to be used.
and
38
A variant is the “spheroid algorithm with shrinking” (algorithm = 4), in
which r is decreased to r0 to yield the ball B 0 of minimum volume centered at
c which covers E1 and E2 . The radius r0 is determined as the greatest distance
from c to any point in E1 and E2 (which is determined by ell pt near far).
E1 ≡ {x | (x − c1 )T A1 (x − c1 ) ≤ 1}, (164)
A ≡ αA0 , (166)
and ³ ´−1
A0 ≡ A−1 −1 1
1 + A2 + 4 [c1 − c2 ][c1 − c2 ]
T
, (167)
where α is a positive parameter to be determined.
To determine α, we consider the ellipsoid E0 defined by c and A0 . With
L0 being the Cholesky factor
L0 LT0 = A0 , (168)
y = c + L−T
0 x. (169)
As depicted in Fig. 15, this transforms E0 to the unit ball, and E1 and E2
to ellipsoids denoted by E10 and E20 .
Using the furthest-point algorithm (see Sec. 9), we determine y1 and y2 ,
defined as the points on E10 and E20 , respectively, which are furthest from the
origin (see Fig. 15). Clearly, the ball E 0 of radius
39
E0
E10
E00
y1 y2
E20
Figure 15: In the transformed space, the ellipsoid E00 which is the unit ball, the
ellipsoids E10 and E20 , and the covering ellipsoid E 0 .
α = r−2 . (171)
BT = [L−T
1 L−T
2 d], (172)
A−1 −T −1 T
0 = L0 L0 = B B. (173)
so that
40
BT B = LT L. (175)
By comparing the above two equations, we see that L0 is the inverse of
L. Thus, in this preferred QL implementation of the covariance algorithm,
the Cholesky matrix L0 required in Eq.(169) is obtained as L−1 , where L is
obtained from the QL factorization of B, defined by Eq.(172).
18.3.1 Stage 1
The two ellipsoids E1 and E2 are given in x-space (in terms of c1 , L1 , c2 and
L2 ): see Fig.16(a).
18.3.2 Stage 2
We denote by E10 and E20 the two given ellipsoids shifted to the origin: see
0
Fig.16(b). (In general, Em denotes Em shifted to the origin.)
18.3.3 Stage 3
The transformed variable y is defined by
41
(a) E1 (b) E10
O
c1
E2
E20
c2
Figure 16: In x-space, sketches of (a) the ellipsoids E1 and E2 in stage 1 (b) the
ellipsoids E10 and E20 in stage 2.
E3
E1 E2
O
E20
c2 (y)
y ≡ L−1
1 (x − c1 ), (176)
so that E1 (y) is the unit ball at the origin.
At this stage a test is performed to determine if E1 covers E2 ; if it does,
then E = E1 is the minimal volume covering ellipsoid. Similarly, a test is
performed to determine if E2 covers E1 . The way in which this testing is
performed is described in Section 18.3.7. If neither E1 nor E2 covers the
other, then the algorithm proceeds.
The ellipsoid E3 is defined to be the minimal-volume ellipsoid which cov-
ers E10 and E20 (see Fig.17). This is readily determined: E3 (y) has the same
principal directions as E20 , and the lengths of its principal semi-axes are the
greater of those of E20 (y) and E10 (y) (which are unity).
18.3.4 Stage 4
A transformation (to z-space) is performed which consists of a rotation such
that the principal axes of E1 , E2 and E3 are aligned with the coordinate
42
smax
E2
B2
E1 E4
smin
E3 = B1
L
43
of these intersections by
smin ≡ min(s1− , s1+ , s2− , s2+ ), (177)
and
smax ≡ max(s1− , s1+ , s2− , s2+ ). (178)
The ellipsoid E4 is now defined to be centered at
s0 ≡ 12 (smin + smax ), (179)
to have a principal semi-axis of length 12 (smax − smin ) in the direction w, and
to have all other principal axes unity. In other words, E4 (z) is formed from
the unit ball at s0 by stretching it in the ±w directions so that it intersects
the extrema smin and smax .
18.3.5 Stage 5
A transformation is performed to ζ-space such that E4 (ζ) is the unit ball at
the origin, and the line of centers L(ζ) is in the first coordinate direction:
L(ζ) = {ζ | ζi = tδi1 }, (180)
where t measures the distance along the line (see Fig.19).
The covering ellipsoid being constructed E(ζ) is a ball of radius r0 cen-
tered at a distance t0 along L. It remains to determine r0 and t0 .
Consider a ball centered at a distance t along L. Let r1 (t) denote the
distance from the ball’s center to the furthest point in E1 (ζ). This can
be determined by the algorithm described in Section 9. Similarly, let r2 (t)
denote the distance to the furthest point in E2 (ζ); and we define
r(t) ≡ max(r1 (t), r2 (t)). (181)
Thus the ball centered at a distance t along L and of radius r(t) covers both
E1 (ζ), and E2 (ζ).
In the definition of E(ζ), we take t0 to be (an approximation to) the value
of t at which r(t) is minimum, and then define r0 ≡ r(t0 )
As one moves along the line L from the center of E1 (ζ) to the center
of E2 (ζ), r1 (t) continually increases and r2 (t) continually decreases. Except
in unusual circumstances, the minimum of r(t) occurs between the centers,
where r1 (t) equals r2 (t). A simple iterative procedure usually determines the
location of the minimum (to reasonable accuracy) in two or three iterations.
44
r1 (t) r2 (t) E
2
O t L
E1
E4
Figure 19: In ζ-space, sketch showing ellipsoids in stage 5, the general point t on
the line of centers L, and the distances r1 (t) and r1 (t) to the furthest points in E1
and E2 , respectively.
18.3.6 Stage 6
The covering ellipsoid E(ζ) obtained in Stage 5 is transformed to the original
coordinate system to yield the required ellipsoid E(x) which covers E1 and
E2 .
45
ρ ≤ d + r2,max , (182)
and
ρ ≥ d + r2,min . (183)
We also have
ρ ≥ r2,max . (184)
Thus, if d + r2,max ≤ 1, then ρ ≤ 1, and so E1 covers E2 . On the other hand,
if d + r2,min > 1 or r2,max > 1, then ρ > 1, and so E1 does not cover E2 . In
the remaining cases, E1 may cover E2 , and so ρ is evaluated.
18.3.8 Discussion
While this algorithm is more elaborate and expensive than that given in
Section 18.2, it generally yields a covering ellipsoid E of smaller volume. In
particular it yields the ellipsoid of minimal volume if E1 and E2 are concentric
or if one covers the other.
The principal computational expenses are:
1. The SVD of L2 (y) performed in Stage 3
2. The quadratic minimization involved in the furthest-point algorithm
(Section 9) which is invoked 0, 1 or 2 times (in Stage 3) to determine
if E1 and E2 cover each other
3. The quadratic minimization involved in the furthest-point algorithm
which is invoked twice per iteration (to evaluate r1 (t) and r2 (t)) in
Stage 5.
19 Conclusions
Algorithms have been described for performing some basic geometric opera-
tions on ellipsoids. A Fortran implementation of these algorithms is provided
by the Ell LIB library.
20 Acknowledgments
I am particularly grateful to Professor Charles Van Loan for his help on
numerous occasion with issues of numerical linear algebra.
46
References
Averick, B. M., R. Carter, and J. More (1993). MINPACK-2. http://www-
fp.mcs.anl.gov/OTC/minpack/summary.html.
Boyd, S. and L. Vandenberghe (2004). Convex Optimization. Cambridge:
Cambridge University Press.
Golub, G. H. and C. F. Van Loan (1996). Matrix Computations (3rd ed.).
Baltimore: Johns Hopkins University Press.
Pope, S. B. (1997). Computationally efficient implementation of combus-
tion chemistry using in situ adaptive tabulation. Combust. Theory
Modelling 1, 41–63.
Yildirim, E. A. (2006). On the minimum volume covering ellipsoid of el-
lipsoids. SIAM Journal on Optimization 17, 621–641.
47