Game Development Reference

In-Depth Information

class Preconditioner

{
public:

//Solves the system Px=b

virtual
void
solve

(Matrix &P,
const
Vector &b, Vector &x)
const
;

//We ensure that this class cannot be instantiate

protected:

Preconditioner(
void
);

virtual ˜Preconditioner(
void
);

}

;

Listing 10.7.
The preconditioner class is just a virtual interface.

iteration. The condition number
κ
(
S
) can be defined as

κ
(
S
)=
λ
max
/λ
min
,

where
λ
max
and
λ
min
are the maximum and the minimum eigenvalues of
S
.Note

that
κ
(
S
) depends on
S
and
S
depends on the mesh elements. When the mesh

elements are regular, the condition number is smaller. Hence, generating good-

quality meshes is important to obtain the best performance.

Alternatively, we can also reduce the condition number by using a precondi-

tioner
P
(see Listing 10.7). Now, instead of solving Equation (10.22), we com-

pute

P
−
1
S
x
=
P
−
1
b,

where

κ
(
P
−
1
S
)

κ
(
S
)
.

The product
P
−
1
S
is not computed explicitly. Alternatively, in each iteration

step we solve the system

P
x
=
b
,

(10.23)

as is shown in Listing 10.8. Thus,
P
has to be defined in such a way that Equa-

tion (10.23) can be solved easily. Many preconditioners can be found in the lit-

erature. Normally, the condition number of
S
is not very high, although a simple

preconditioner can significantly speed up the system. Therefore, we recommend