direct vs. iterative methods


To ng-spice-devel@ieee.ing.uniroma1.it
From Al Davis <aldavis@ieee.org>
Date Wed, 20 Sep 2000 20:34:41 -0700
Delivered-To mailing list ng-spice-devel@ieee.ing.uniroma1.it
In-Reply-To <Pine.LNX.3.96.1000919163600.636A-100000@ieee.ing.uniroma1.it >
Mailing-List contact ng-spice-devel-help@ieee.ing.uniroma1.it; run by ezmlm
References <Pine.LNX.3.96.1000919163600.636A-100000@ieee.ing.uniroma1.it >
Reply-To ng-spice-devel@ieee.ing.uniroma1.it

Here's another long-winded reply, a bit more basic than Steve's.

Strictly speaking, the two are not mutually exclusive.  Spice is
simultaneously direct and iterative.

A "direct" method means that it builds a system of simultaneous
equations, then solves them directly, by "Gauss Elimination", "LU
decomposition" or something like that.  Most "direct" simulators are
strictly iterative because they use the equivalent of Newton's method
to build a linearized circuit, based on a guessed operating point" and
solve that directly.  Since the initial guess is almost always wrong,
this solution generates a better guess, which generates another
linearized equivalent circuit, which is solved.  Repeat .......

To solve a general case nonlinear system, you must use iteration.

You can also use iteration to solve the linear system of equations. 
When someone contrasts a "direct" simulator with an "iterative" one,
this is what they mean by iterative.  For a purely iterative
approach, it would use a "relaxation" method, such as "Gauss-Seidel".

Consider this set of equations:

3x -y -2z = 0
-x +2y -z = 2
-x -2y +3z = 4

Note that it is diagonally dominant.  This is important.  It is
likely not to converge otherwise.  (You could get nonconvergence even
for a simple linear system.)

Rearrange them:

x = (y +2z) /3
y = (2 +x +z) /2
z = (4 +x +2y) /3

Make an initial guess.  Solve.  Repeat until convergence.

This method makes a good programming example in an intro to
programming course to illustrate loops and arrays, partly because it
is virtually guaranteed that no students had seen this method before.
 It is especially effective when I guess the roots to be something
totally unbelievable, and it actually converges to the right answer.

In most cases, this is inferior to the direct (LU decomposition)
method, but there are exceptions.

Simulators that use this method do not actually build the matrix. 
They just evaluate the devices and add the currents.  This means it
is not necessary to evaluate the derivatives, even though strictly
they appear in the equation.  So, it saves the storage.

Simulation requires many repeat solutions, often with almost the same
data.  With this method, it is easy to do a partial solution, which
makes it easier to do "mixed-mode" simulation.

The real advantage of this method is for "one-way" circuits. 
Consider this set of equations:

3x = 0
-x +2y = 2
-x -2y +3z = 4

If you solve for x first, then y, then z, ... you need only one
iteration, making it very fast.  This is reasonable for mosfet
circuits without feedback or loops or floating two terminal devices,
so it is commonly used in "timing" simulators which actually generate
this type of pattern.

Now, if you solve z first ........

It works terrible for circuits with feedback, or if the order is
wrong.

Partial thread listing: