This is some of the software I developed during the years. Most of the code is not under development anymore. If you want to extend some of the work please contact me and we can work together if you like.
All the software in this page is provided as it is, without any warranty.

If you find a bug feel free to fix it and send the patch to me.

Machine Learning

This is what my research is about.
  • MaxPooling: A Matlab function to compute the max-pooling operation. It takes the max value over non overlapping subregions in the image(s). It is parallelised using openMP.
    The max-pooling operation supports 4D tensors shaped as: (rows, cols, channels, samples) and returns the pooled data with the corresponding indices: [m, idx] = MaxPooling(IM, [2 2])
    IM can also be a 2D tensor, the missing dims are set to 1.
    This implementation uses templates and works for single and double precision floats but can be easily extended.
    Languages: Matlab
  • RBM in PyCuda: Implementation of a Restricted Boltzmann Machine (RBM) with visible and hidden binary units which makes use of a cuda device to speed up the computation. It is based upon the excellent PyCuda framework, with a little help for the linear algebra by the parret cublas wrapper (modified because a little buggy for sgemm).
    The learning can be done using either contrastive divergence and persistent (CD) contrastive divergence (PCD). Both are supported for custom chain length.
    It dumps filters learnt during the training and it samples from the model after the learning. Here the filters after 15 epochs and the corresponding generated samples for the mnist dataset.
    It is easy extendible to a DBN (Deep Belief Network). Just for a reference, it takes about takes about 170s per epoch on my macbook pro 13" with a nvidia 320m.
    You can find more explanations on how this works here and here where you can also find another implementation in Theano (which btw I really like). However as you can expect this plain flavored implementation is much faster.
    In order to run the code you need also the mnist dataset which can be downloaded in pickled format from here (courtesy of the Theano team).
    Languages: Python


These are some of the project I am or I have been involved into.
  • tripLOA: TripLOA is a generalized Car sharing (it is trip sharing) Web based system. The system has been developed in the Application Oriented Laboratory at University of Pisa. The system provides support to users for posting trips and joining them (and provide anonymized communications and feedback). It is implemented in C# and uses maps (google and Virtual Earth. A nice feature is the integration with Facebook (and possiblty with other Social Networks) to suggest trips with potential friends, and the stats which are displayed using Silverlight that accounts for the amount of CO2 saved by sharing.
    I was part of the search engine but and I developed also a small compiler to map simple statements into LinQ queries.
    Languages: C# and ASP.NET, COCO for the attributed grammar of the compiler.
  • CIWorms: This was my final term project of the exam Interface Construction. I began with the idea of developing a clone of the well known game Worms. However, since I like more writing code than "painting" I ended up developing a GUI framework and a game engine, completely extendible and customizable, on which I developed the demo of the game.
    It uses SDL as basic rendering engine and chipmunk as physics engine.
    Language: C++

Bits Utilities

  • bitVector: This library provides some basic bit packing techniques to allow you to address single bits instead of machine words. No language, in facts, allows you to address a single bit so various techniques exist to wrap bits in packets to let you write and read just one of them. Here you will find a static and dynamic version (streaming features). Also some test sets are provided.
    Language: C++
  • bitRanker: This library provides the rank feature of the rank-select query. It is a quite straightforward implementation which was made looking toward a simple and fast development more than on supa-performance (no crazy things). Briefly it returns the number of selected elements preceding the given one: 1000101 => rank(5) = 2. A test suite is provided as well.
    Language: C++

Data structures

  • prefix_list: This is my implementation of the data structure described by Hidetoshi Yokoo in the paper CPM'99, LNCS 1645, pp. 150-162, 1999. It is a data structure to keep all the prefixes of a string sorted according to the lexicographic order.
    Hosted on google code.
    Language: C


These are implementations of some of the most widely used coders.
  • huffman: Everyone knows about this coder which is perhaps the most famous and cited ever. You can compile it as a library of use the provided main to test it.
    Language: C++ -> get it!
    I also gave a practical introduction of the algorithm when I was still a student (unfortunately in italian) on my old blog using Python as a didactic tool.
    Language: Python -> get it!
  • golomb: This is another lossless entropy encoder which can be used only on positive numbers. Here is provided the rice/golomb variant which performs better on machines since it works using powers of two, namely shifts.
    Language: C++ -> get it!
    The following is just a small script to convert non positive numbers into positive ones. It maps x on -2x-1 if x≤0 and on 2x if x≥0 (it does not waste the 0).
    Language: C++ -> get it!
  • elias/gamma: also this one for positive integers.
    Language: C++ -> get it!


  • KMP (Knuth-Morris-Pratt): one of the most famous string searching algorithms. Here it is provided a demonstration version, you can also look at the old blog page (in italian).
    Language: Python -> get it!