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 http://www-users.cs.umn.edu/~saad/software/SPARSKIT/index.html Each storage scheme has [...]
Author Archive
Filed under: Dense Matrices, Sparse Matrices
Social Tagging: C++
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 [...]
Filed under: Sparse Matrices
Social Tagging: Matrix Market
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 [...]
Filed under: Dense Matrices
Social Tagging: C++ • gcc • LAPACK • MKL • SciPy
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 [...]
Filed under: Dense Matrices
Social Tagging: C++ • Fortran
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 [...]
Filed under: Dense Matrices
Social Tagging: LAPACK • NumPy • SciPy
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 [...]
Filed under: Dense Matrices
Social Tagging: Fortran
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 [...]
Solution of a system of linear equations is the task encountered most often in linear algebra. A good starting point from the theoretical side is the page in Wikipedia http://en.wikipedia.org/wiki/System_of_linear_equations Numerical methods to solve a linear system are divided in two groups: direct and iterative methods. For dense matrices, people use mostly direct methods and [...]
Filed under: Dense Matrices, Tools
Social Tagging: NumPy • SciPy
At IMTEK, I have been working with Mathematica and I should say that it is a pretty good tool for fast prototyping. The only disadvantage is that it is a commercial tool and it is necessary to purchase a license. As a result, when I finished my work at IMTEK, I have decided to look what [...]
RSS