# Structurally and Numerically Singular Matrices

When you solve a model, the software may report that a solution cannot be obtained because the left-hand-side matrix is structurally or numerically singular.

These problems can be tricky to analyse and fix. Unfortunately we do not know of a fool-proof, general-purpose method for tracking down and eliminating these problems. However there are several things you can do (as described below).

A description of the difference between these two types of singularity can be found here. That section also suggests some options you can use to gain more information about these problems. Other things to try are suggested below.

### Structurally Singular Case

Most models come with one or more standard closures. Most closures are obtained from these by making one or more swaps (swapping one variable from the exogenous list with another from the endogenous list).

Structural singularity is nearly always a closure problem. A good strategy is to start from the nearest standard (or working) closure and attempt to move towards the troublesome closure making one swap at a time. The first time you get a singular matrix, examine carefully the last swap to try to identify the problem.

### Numerically Singular Case

Numerically singular matrices can be the result of a problem with the closure or a problem with the data.

The comments above under "Structurally Singular Case" may be relevant if your problem is related to the closure. The comments below may be relevant if your problem is related to the data or to the closure.

If your matrix is numerically singular, you may gain more information by switching to the alternative sparse-linear-solving routines.
If you are using MA48, try using MA28 by putting the statement "m28 = yes ;" in your Command file.
If you are using MA28, try using MA48 by putting the statement "m28 = no ;" in your Command file.
However, if the model is singular with one of these but not with the other, you should be highly skeptical about the validity of the results.

If you have different data sets for the same model (for example, different aggregations of the data), it may help to try the same closure with a different aggregation.

Numerical singularity (as distinct from structural singularity) can sometimes be overcome by changing one or more data items from zero to a (small) nonzero value. If the model solves with slightly different data (or a different aggregation), zeros in the data may be the cause of your numerical singularity.

Go back to
GEMPACK FAQ Page