Author Archive

I assume that you have already read Sample code in C++ to run TAUCS. The goal in this section is to compare two codes to run different sparse solvers when the purpose of the code is actually quite similar.  We would like to develop a command line tool that will read a matrix and a right-hand side run_mumps […]

Now let us employ Matrix and SparseMatrix to run TAUCS. The goal will be to develop a command line tool that will read a matrix and a right-hand side run_taucs matrix rhs in the Matrix Market format and then writes the solution of the system of linear equations in file rhs.solution also in the Matrix […]

When one programs a dense matrix, basically there is necessary only to decide whether the matrix will be stored column-wise or row-wise. Here there is a huge difference with a sparse matrix where one can find many different storage schemes, see for example Section 2.1 Storage Formats in the SPARSKIT paper Each storage scheme has […]

The right-hand-side is usually dense or at least it was the case in my applications. In this case I have used the class Matrix that was already employed previously in sections devoted to dense matrices. I will describe this class in more detail here. The class is declared in matrices.h and actually most functions are defined […]

In this chapter I will show how one can use sparse solvers from C++. I assume that the sparse solvers as well as the optimized BLAS are already available as compiled libraries and the goal would be mere to use them from C++. Note that a sparse direct solver requires matrix reordering and to this […]

I like C++ and after I have switched from Fortran to C++ at the beginning of the nineties, I wanted to do everything in C++ including linear algebra. My first linear algebra in C++ was GNUSSL by Robert D. Pierce. It was a nice template library that helped me a lot to understand how one […]

The goal of this section is basically to repeat the rules from the section Using Fortran Subroutines from C++ with the example of the Fortran subroutines decomp and solve from the book Computer Methods for Mathematical Computations. I will use a simple matrix class described in matrix.h (see also Class Matrix). The class is based on vector<double> and it […]

The LAPACK library for linear algebra is integrated in many interactive environments (for example, Mathematica or Matlab) and this is the simplest way to access it. In this chapter, I will demonstrate the use of some LAPACK routines from SciPy in Python. Below it is assumed that NumPy and SciPy are installed in your Python […]

When one starts using libraries, an problem that happens often is a linking error. Compilation went through but the linker complains that it cannot find something. A useful tool in this respect is nm and I will describe below how one can employ it. I will do it with my gcc example Compiling and Linking: Simple […]

decomp is a simple implementation in Fortran of the LU-decomposition from the book Computer Methods for Mathematical Computations. It is just 169 lines and theoretically one can use the code to learn the algorithm. It also allows you to get the flavor of Fortran, the code, I guess, is written in Fortran IV. Fortran is a […]