Tuesday, October 25, 2011
I'm experimenting with compiling programs for the N9. Go to http://harmattan-dev.nokia.com and get their python script harmattan-sdk-setup.py. Make it executable: chmod a+x harmattan-sdk-setup.py Run the script as root: sudo ./harmattan-sdk-setup.py Press "0" for admininstall. This will start a lengthy install. On my machine it started with installing python-qt4. Then scratchbox (89Mb download for X86 and [...]
Also filed in
|
Tagged N9
|
Friday, November 12, 2010
With finite precision numbers, if you take a small number eps, there comes a point when x == x + eps. Here's some code that figures out when that happens: double epsD(double x) { double r; r = 1000.0; while ( x < (x + r) ) r = r / 2.0; return ( 2.0 [...]
Also filed in
|
|
Wednesday, November 3, 2010
It looks like there is no efficient way of updating (adding and removing) triangles in a polydata-surface in VTK, so for the cutting-simulation I am looking at other visualization options. Despite all the tutorials and documentation out there on the interwebs it always takes about two hours to get these "Hello World" examples running... Download [...]
This example has three times more fibers, and thus also CL-points, than the original one, but it still runs in a reasonable time of ~15s because (1) I hard-coded the matrix-determinant expressions everywhere instead of relying on a slow general purpose function and (2) the batch-processing of the fibers now uses OpenMP in order to [...]
Over at Freesteel, Julian talks about using a "DiamondAngle" in the interval [0,4] for representing a plane angle instead of the usual radian in [0,2PI]. The argument is that using diangles there is an exact floating-point number for north/south/east/west, and that conversion to/from diangles is faster because it doesn't involve calling trigonometric functions. I did [...]
Boost uBLAS provides BLAS functionality, but doesn't have a function for computing the determinant of a matrix. Googling for this turns up a few code snippets, but it's best to document this completely here now since I got it to work, and it will be useful for opencamlib sooner or later. 1 2 3 4 [...]
Wednesday, January 27, 2010
Tried to make the code from last time a bit clearer by splitting it into two files: vtkscreen.py and test2.py conversion to video again by first converting PNG to JPEG: mogrify -format jpg -quality 97 *.png And then encoding JPEGs into a movie: mencoder mf://*.jpg -mf fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -ac copy -o output.avi [...]
Saturday, November 14, 2009
Here's a simple piece of c-code (try zipped version) for testing how to parallelize code with OpenMP. It compiles with gcc -fopenmp -lm otest.c The CPU-load while running looks like this: Looks like two logical CPUs never get used (two low lines beyond "5" in the chart). It outputs some timing information: running with 1 threads: [...]
As I'm very much an amateur programmer with not too much time to learn new stuff I've decided my CAM-algorithms are going to be written in Python (don't hold your breath, they'll be online when they'll be online...). The benefits of rapid development will more than outweigh the performance issues of Python at this stage. [...]
A simple pystone benchmark using the python multiprocessing package. Seems to scale quite well - guess how many cores my machine has! " Simple multiprocessing test.pystones benchmark " " Anders Wallin 2008Jun15 anders.e.e.wallin (at) gmail.com " from test import pystone import processing import time STONES_PER_PROCESS= 10*pystone.LOOPS def f(q): t=pystone.pystones(STONES_PER_PROCESS) q.put(t,block=True) if __name__ == '__main__': print [...]
Also filed in
|
Tagged python
|