Thursday, June 26, 2008
Johann Korndoerfer kindly submitted a patch that adds patterns to cl-cairo2, and also includes some code cleanup. Here is the example Johann contributed to the tutorial, a rainbow created with patterns: Thanks for the nice work, Johann! I am happy that others also find cl-cairo2 useful. cl-cairo2 still suffers from the elusive floating point bug (possibly in libcairo), I am still working on that. In the meantime, you can work around that by not generating PS files directly, but converting them from PDF or SVG files. Since common-lisp.net appears to be down, I took the opportunity to migrate the repository to git, which I am now hosting on my webpage. I find git to be much more convenient than SVN, especially when it comes to ease of distribution. As before, the package remains ASDF-installable. Update: the GIT repository is here, but can also be found from the cliki page for cl-cairo2.
I have been using a simple solver (based on Broyden's method) to finds roots of systems of nonlinear equation, but I encountered an ill-behaving class of problems that required heavier artillery. Numerical methods have made a lot of progress in the last 50 years. Methods presented in introductory textbooks are quite straightforward and very simple to code, but do not cut the mustard when it comes to more difficult situations (eg when you don't have a good initial guess, your function looks like the fjords of Norway, etc). State of the art methods are powerful, but they are tricky to program: the main idea is easy to grasp, but one has to cover a lot of special cases (eg line-search, niceties of trust-region methods) so implementing them from scratch takes a lot of time (and debugging). This is why most researchers rely on Fortran (or most recently, C) packages of these methods. Common Lisp users generally have two alternatives if they don't want to implement these methods from scratch. They can use the foreign code directly via the FFI, or translate the code using f2cl, which is available as part of CLOCC. I found the second option more appealing, for the following reasons:
- fewer dependencies (no need to install/compile foreign libraries)
- no need to have callbacks (which are a pain in the neck)
- better integration into Lisp (eg you can use the condition system)