Friday, April 20, 2012

Easy way to install gcc-4.6 on Ubuntu 10.04

sudo apt-add-repository ppa:ubuntu-toolchain-r/test/ubuntu
sudo apt-get update
sudo apt-get install gcc-4.6
sudo apt-get install g++-4.6

From here. The alternative is to download gcc sources and install like this

Thursday, April 19, 2012

svn: making trunk identical to a branch

So, I created a branch, made changes within the branch over a period and periodically kept merging from trunk into the branch. 

Now I want to make the trunk identical to the branch. The best approach for this is as described at, namely use the three-way merge option: want to merge "FROM trunk@HEAD TO branch@HEAD" with the working copy pointing to trunk. In essence:
"Give me all the changes I'd need to make trunk identical to branch".

Thursday, April 5, 2012

Copy one sparse matrix into another in Python

Copying Xf into features. In this case, Xf is a scipy.sparse.csr_matrix and features is a dok_matrix.

        nz_indices = Xf.nonzero()
        for ix, jx in zip(nz_indices[0], nz_indices[1]):
            features[ix, jx] = Xf[ix, jx]


1. When I checked, the assignment of a 0 to an element of a dok_matrix resulted in a crash. So 0 assignments have to be avoided.