Posted on August 12, 2009 by kurniawano
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 [...]
Filed under: Uncategorized | Tagged: c++, C++ Libraries, IT++, numerical, scientific computing | Leave a Comment »
Posted on August 12, 2009 by kurniawano
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 [...]
Filed under: Uncategorized | Tagged: c++, C++ Libraries, IT++, numerical | Leave a Comment »
Posted on May 6, 2009 by kurniawano
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);
Filed under: Uncategorized | Tagged: c++ | 2 Comments »
Posted on May 6, 2009 by kurniawano
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 [...]
Filed under: Uncategorized | Tagged: c++ | Leave a Comment »
Posted on May 5, 2009 by kurniawano
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
Filed under: Uncategorized | Tagged: c++, programming | 1 Comment »
Posted on April 15, 2009 by kurniawano
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 [...]
Filed under: Uncategorized | Tagged: c++, libraries | 2 Comments »
Posted on February 18, 2009 by kurniawano
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 [...]
Filed under: Uncategorized | Tagged: c++, IT++, programming | Leave a Comment »
Posted on December 1, 2008 by kurniawano
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 [...]
Filed under: Uncategorized | Tagged: c++, IT++, mpi | Leave a Comment »
Posted on November 28, 2008 by kurniawano
#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.
Filed under: Uncategorized | Tagged: Add new tag, c++, mpi | Leave a Comment »
Posted on November 21, 2008 by kurniawano
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 [...]
Filed under: Uncategorized | Tagged: c++, IT++ | 6 Comments »