Posted by Andre Sayre in Meta-Blog, Programming on March 27, 2010
This is a test of the code prettification feature/plug-in of Live Writer. The following Snippit is from my k-means implementation.
CentroidDelegate<Point> pointCentroidFunc = delegate( IEnumerable<Point> collection, int count ) { double sumX = 0; double sumY = 0; foreach( Point curPoint in collection ) { sumX += curPoint.X; sumY += curPoint.Y; } Point newCentroid = new Point( sumX / count, sumY / count ); return newCentroid; }; seqKMeans = new SequentialImpl<Point>( ( p1, p2 ) => p1.DistanceSquared( p2 ), pointCentroidFunc ); parKMeans = new ParallelImpl<Point>( ( p1, p2 ) => p1.DistanceSquared( p2 ), pointCentroidFunc );
The class diagram thereof. Again, will add more stuff at a later point, but for now, this is good.
You are currently browsing the archives for the Programming category.
Website by Andre Sayre | Fusion theme by digitalnature | powered by WordPress
Entries (RSS) and Comments (RSS) ^
|
