Sparse Poisson problem in eigen

OwlgenBack to scientific computing. Lately, I have been using the Eigen libraries for linear algebra. They were recommended by the CGAL project, and they indeed share a common philosophy. Thanks to the rather high C++ level they can accomplish this sort of magic:


  int n = 100;
  VectorXd x(n), b(n);
  SpMat A(n,n);

  fill_A(A);

  fill_b(b);

  // solve Ax = b
  Eigen::BiCGSTAB<SpMat> solver;
  //ConjugateGradient<SpMat> solver;

  solver.compute(A);

  x = solver.solveWithGuess(b,x0);

Notice that A is a sparse matrix! I am next describing how to use this in order to solve the 1D Poisson equation.

Continue reading

CGAL from scratch

So, you need computational geometry. It could be you need some nice Voronoi division of some domain. Or you need to mesh a surface. Whatever your needs, you may know there is this CGAL project that has these things implemented in a very professional manner.

Here is a list of steps in order to get these routines working for you.

Continue reading

The alpha shapes

Typical problem in computational geometry: given a set of points, what is its shape? This may often be intuitive for a human being, but try to define this concept mathematically, then implement it numerically.

One of the proposals is called the “α shape”, and is closely related to the Delaunay triangulation. More details below.

See also alpha shapes, for a recent application of this concept to molecular simulation. Check out the movie too!

Continue reading