Adding Generalized Eigenvalue functions to IT++

I have added a functions call to lapack DGGEV and ZGGEV functions to solve generalized eigenvalue problem. There are three files to modify: lapack.h, eigen.h, and eigen.cpp. The diff files can be obtained from this link.
To test the code, I ran an example for generalized complex eigenvalue problem found in the NAG site. The test [...]

Calling lapack functions from C++ codes

I have been using IT++ for my C++ class matrix and vectors. It is a great libraries. However, it lacks the function to solve generalized eigenvalue problem. so I need to link directly to lapack to do this. I follow the wrapper used in eigen.cpp to link to ZGGEV function of lapack. I tested the [...]

undefined reference to `vtable for

I got this error when I compile a class:
undefined reference to `vtable for Device’
it turns out that GCC requires every virtual function to be defined, so I need to add an inline {} just to satisfy this.
virtual void setGridSpc(double a){};
instead of
virtual void setGridSpc(double a);

Maintaining C++ Codes

Some Ground rules:
1. Keep class data members private.
2. About global name space:
- Avoid data with external linkage at file scope: put all global variables in a structure, class, namespace, etc. This is to avoid name collison.
- Avoid free functions at file scope in .h files, avoid free functions with external linkage in .c files.
- Avoid [...]

Global Constants in C++

Declaring the global constants can polute the names available and create conflicts as the project grow larger. One solution is to declare it using a namespace.
globalconst.h
namespace GlobalConst{
const double PI=3.14;
};
and in your file, simply use
GlobalConst::PI
UPDATE: I have corrected the code, thanks

Compiling ARPACK++

I have had difficulties in compiling the examples code provided by ARPACK++. After some googling, it turns out that ARPACK++ is not compatible with newer version of GCC. Luckily, I found a page that provide a patch. So let me provide the steps to compile ARPACK++ .
1. First you have to install ARPACK, UMFPACK, and [...]

Compiling IT++ with MKL library

I downloaded it++ 4.0.6 and tried to compile using MKL library. To do that, I need first to set the environment path
export LDFLAGS=-L/opt/intel/Compiler/11.0/081/mkl/lib/32/
export CPPFLAGS=-I/opt/intel/Compiler/11.0/081/mkl/include
and then I run the configure with this option
./configure –prefix=$HOME/local F77=gfortran –with-blas=”-lmkl_intel -lmkl_sequential -lmkl_core -lpthread” –with-lapack=”-lmkl_lapack”
With this settings configure can detect my MKL library
UPDATE: though it can detect MKL, but it gives [...]

Send/receive C++ vector using MPI

I am using IT++ for some of my code and I tried to parallelize it. It came to the point where I need to sum up all the vectors from all the process. So in MPI, I will need to use MPI_Reduce. My question is since IT++ vector is not an array, can we then [...]

Compiling C++ code with MPI for parallel processing

#include “mpi.h”
int main(int argc,char** argv)
{
MPI_Init(&argc,&argv);


MPI_Finalize();
}
then compile with
mpicxx
to run it, use
mpirun -np 4 ./a.out
for using 4 copies in 4 processors.

C++ code using acos for complex number in IT++

I am currently trying out IT++ and so far it was great. It is as easy as Octave but written for C++ programming. One thing that I had trouble was that in my code I need to compute
complex acos(complex a)
However, it gives me error
for the function acos. It turns out acos for complex number was [...]