CPPLapack
 All Classes Files Functions Variables Friends Pages
CPPLapack Documentation


What's new?

[Feb. 8th 2014] "cpplapack-2014.02.08" has been released. This release is only for the users who don't like to use svn. (We still highly recomend users to use the latest svn code!!) Not only "tar.gz", "rpm" and "deb" (made by alien) packages were prepared. See the logs of svn to get the "ChangeLog".

[Mar. 27th 2010] "cpplapack-2010.03.27" has been released. This release is only for the users who don't like to use svn. (We still recomend users to use svn.:)) Not only "tar.gz" but also "rpm" and "deb" packages were prepared. See the logs of svn to get the "ChangeLog".

[Sep. 25th 2006] "cpplapack-2006_09_25" has been released. The general sparse matrix(dgsmatrix, zgsmatrix) and symmetric or hermitial sparse matrix(dssmatrix,zhsmatrix) were formally added. This release also contains some bug fixes. See "ChangeLog" for the detail.

[Mar. 25th 2005] "cpplapack-2005_03_25" has been released. This release contains some bug fixes and modification. See "ChangeLog" for the detail. It also contains the alpha version of sparse matrix classes (dssmatrix and zssmatrix). These classes are still so buggy, but it is OK as long as you don't use these classes in your code.

[Oct. 15th 2004] Mr. Ueshima wrote a tutorial of CPPLapack in Japanese. "cpplapack-2004_04_24" has been released. It is very useful for beginners of CPPLapack. The HTML version is available at http://cpplapack.sourceforge.net/tutorial/japanese/index.html, and the PDF version is available at http://cpplapack.sourceforge.net/tutorial/japanese/CPPLapack_Tutorial-Japanese.pdf

[Apr. 24th 2004] "cpplapack-2004_04_24" has been released. OpenMP macros (#pragma omp parallel for private(j,k)) are added to all triple for-loops. The search engine for this documentation is added. This search engine is case-sensitive.

[Apr. 1st 2004] "cpplapack-2004_04_01" has been released. The complex double-precision matrix and vector classes (zgematrix, zgbmatrix, zhematrix, zcovector, zrovector) are newly added.



Introduction

CPPLapack is a C++ class wrapper for BLAS, LAPACK and PARDISO.

The interfaces of Fortran BLAS, LAPACK, CBLAS, and CLAPACK are not user-friendly, and induce a lot of coding mistakes not only for LAPACK beginners but also experienced programmers. Because of its difficult interface, BLAS functions are not widely used for simple matrix calculations such as "+", "-", "*", and so on even though these calculations are frequently required. If there is a user-friendly library using BLAS and LAPACK in the background, it is really useful to minimize the program development time and computational time at the same time. Existing matrix libraries, however, are not sufficient as far as we know.

CPPLapack has a very user-friendly interface as same as ordinary C++ matrix libraries. Moreover, CPPLapack uses BLAS and LAPACK functions in the background though programmers just need to write simple codes such as "A=B*C;", "A.dgesv(y);", and so on.

The advantage of using CPPLapack are not only user-friendly interface and fast computational speed but also saving memory space. In case of large-size matrix calculation, the number of copy times of objects affects required memory space and computational time materially. CPPLapack has a mechanism called "Smart-Temporary" system to minimize the number of copy times. The "Smart-Temporary" system is also hidden in CPPLapack library so that programmers don't need to pay any attention for this system. (CPPLapack used to employed "to_return" system. Now CPPLapack uses this system to realize the same purpose with keeping the compatibility with old versions.)

This program is designed for large matrix calculation. If you don't have mind to handle large matrices, to use another matrix library is recommended.

CPPLapack is still a beta program so far. It is a shame but there are a few bugs and unsupported BLAS and LAPACK functions. If you are going to use CPPLapack, please be aware this situation. Of course, it is very nice if you help us to develop CPPLapack.


Special Features

All of the features are hidden in C++ class library so that programmers are not required to do any special programming.


Where to Get

The official distribution site of CPPLapack is here. It is highly recommended to use the latest svn code on the linked page.


How to Install

Actually, you don't need to install CPPLapack. CPPLapack is a bunch of C++ header files. Just expand the package at somewhere you like, and write a include path in your "Makefile". All you need to include is only "cpplapack.h".

But CPPLapack needs BLAS and LAPACK written in Fortran installed. Just make sure these two libraries are installed and modify "Makefile" to include and link to them. In stead of original BLAS and LAPACK packages, bender-supplied libraries such as Intel math kernel library (MKL) are also acceptable. Note that Intel MKL is necessary to use PARDISO for sparse matrices.

What BLAS and LAPACK need to link depends on your platform. Some examples of "Makefile" are prepared. See Typical "Makefile"s for Various Platforms.

For Cygwin users, a simple instructions on how to install ATLAS and LAPACK is prepared. See How to install ATLAS and LAPACK on Cygwin.


Important Specification


Test Programs

Test programs to check the operations are there in "test" directory. They are also easy examples for you to learn how to use CPPLapack.


Benchmark Programs

Some programs to estimate the speed of CPPLapack are prepared in "benchmark" directory.

The performance of CPPLapack is almost the same as the performance of original BLAS and LAPACK. However, some of arguments of BLAS and LAPACK functions such as ALPHA, BETA, TRANS, and so on are fixed at certain values. When you want to make the full-use of BLAS and LAPACK functions, you can call their functions directory in codes of CPPLapack as usual.


FAQ

(Q)I found my program using CPPLapack consuming the memory larger and larger in a loop. Why does this happen?
(A)Most likely, you leave out some returned matrix or vector object in the loop. Please read "Important Specification" section carefully.

(Q)When I print components of a matrix or vector, I sometimes see "nan" printed. What is the possible reason?
(A)First of all, please make sure that your objects are initialized. The constructor with size arguments such as "CPPL::dgematrix A(5,10);" does NOT initialize its array components. The "resize" function does NOT initialize, neither. Please initialize objects using substitutions, or use "identity" or "zero" function to initialize them.

(Q)All the member variables are in "public". Why don't you set "private" for capsulation?
(A)Matrix programings are frequently required to be custom-made. Choosing "public" or "private" was a tough choice, and we chose "public" so that users could make custom-made functions without modifying CPPLapack itself.


License

CPPLapack is a GPL software without any guarantee.


Author and Cooperators

Author:   Yuki ONISHI
Cooperator:   Masafumi IAI,   Toshiyasu SHIMIZU,   Masashi UESHIMA


Bug Report

Please send bug reports to yuki.onishi@gmail.com. I also welcome any kind of comments.


Links

CPPLapack Documents in Japanese:

The sister project of CPPLapack:

CPPLapack is based on and thanks to:

Have fun.