Programming Projects in C
for students of
Engineering, Sciences and Mathematics
Rouben Rostamian
2014

Resources for Project UMFPACK

Errata

In the code fragment on page 91 we have

int N = 20, k = 0 // N=20 is an overestimate; N=12 will do
Overestimating the lengths N of the triplet arrays is okay, and at times inevitable, but it needs to be done with care.

The value of N is passed as the third argument to umfpack_di_triplet_to_col(), and therefore UMFPACK scans all N entries of each of the triplet arrays Ti, Tj, Tx. If these arrays have been only partially filled, their tail ends will generally contain junk which may cause UMFPACK to abort with an error code of UMFPACK_ERROR_invalid_matrix (whose numeric value is −8).

The solution is to initialize the triplet arrays ahead of the time, as in:


    for (int i = 0; i < N; i++) {
            Ti[i] = 0;
            Tj[i] = 0;
            Tx[i] = 0.0;
    }

Of course this isn't necessary if you are not overestimating the array lengths.

Installing UMFPACK

There is a great deal of variation in the way UMFPACK is installed on various platforms, so I cannot provide a very helpful advice here other than pointing you to UMFPACK's home and letting you figure it out from there. That said, you may find the following information of some use.

On Linux

If you are working on a Linux platform, you are in luck since most Linux distributions come with a ready to install UMFPACK package but even here the name of the package and the way it is installed varies from one distribution to another. If yours is a Debian flavor of Linux, such as Ubuntu or Mint, then install UMFPACK through the commands:

sudo apt-get install libsuitesparse-dev
sudo apt-get install libsuitesparse-doc

To include UMFPACK's header files in your programs, do:

#include <suitesparse/umfpack.h>
To link your program with the UMFPACK library, give the ‘-lumfpack’ flag to the compiler.

On a Mac

These installation instructions for Mac users is courtesy of Dr. Tulin Kaman.



Programming Projects in C Valid HTML 5 Valid CSS