Posts Tagged ‘C++’

So far we have defined an interface in the class LinearSolver and then implemented it for different solvers: UMFPACK, TAUCS, MUMPS and PARDISO. The implementation in solver_*.cpp uses solvers.h but the application code actually needs almost nothing from these files. The word almost means that it is still necessary to instantiate a particular solver class […]

Solvers MUMPS and PARDISO are different from TAUCS and UMFPACK in respect that they posses more functionality within the same interface. For example they can work with positive definite, indefinite or unsymmetric matrices and the switch is done through a single variable. They also support out-of-core and this setting  is controlled by another variable. The LinearSolver interface for […]

TAUCS library contains several solvers and there are accordingly more classes in solver_taucs.cpp. Each solver has its own class:  TAUCSllt – Cholesky decomposition column by column (slow); TAUCSldlt – LDLT factorization for indefinite matrices (slow); TAUCSllt_mf – Multifrontal supernodal Cholesky decomposition (the best among TAUCS library for positive definite matrices); TAUCSllt_ll – Left-looking supernodal Cholesky decomposition; TAUCSllt_ooc – […]

The complete code that implement the LinearSolver interface for the UMFPACK solver is in solver_umfpack.cpp including the declaration of the class UMFPACK. This may look unusual but the reason is quite simple. The declaration of the class UMFPACK is used only to compile the code of the class and it will be never accessed from the application code directly. The […]

Two specialized drivers, run_taucs.cpp and run_mumps.cpp presented previously show a common problem when one needs to deal with a sparse solver. If you expect that in the future you may need to change a sparse solver, you must be then ready to modify the part of your code that works with the sparse solver. For example all algorithms that use […]

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 […]

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 […]

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 […]

A compiler converts a code to an object file and then a linker links different object files with each other. As a result, it is possible to mix programming languages in one project. What is just necessary is to know conventions accepted in different programming languages. Below there is a short description on how one […]

Introduction Interactive System for Numerical Linear Algebra Direct Implementation with Compiled Language Fortran C C++ Using Specialized Libraries: BLAS and ATLAS Using make Compiling BLAS and ATLAS Calling DGEMM from Fortran Calling DGEMM from C and C++ Conclusion Problems Discussion code for the chapter compiled ATLAS 3.6 for Windows Introduction Matrix multiplication is a common […]