## Friday, July 30, 2010

### Independent Component Analysis

I was already familiar with the Principal component analysis, which is a method for finding a linear combination of variables such that the possible correlation between them disappears i.e. elimination of the diagonal elements of the covariance matrix. Statistical independence implies the elimination of correlation but the opposite is not necessarily true because there is possible association between the variables on higher orders.  The Independent Component Analysis seems to be the generalization needed to go beyond the simple correlation.

• Bartlett, M.S. and Movellan, J.R. and Sejnowski, T.J., Face recognition by independent component analysis, IEEE Transactions on neural networks,13, pp 1450--1464, 2002

• Hyvarinen, A. and Oja, E. Independent component analysis: a tutorial, Neural Networks, 13, pp 411--430 2000
` `
` `

### 10th International Mathematica Symposium

I just returned from the 10th International Mathematica Symposium held in Beijing China, where I gave a talk. It was a great opportunity to see the work of other people around the world and the new features of Mathematica 8.

Some of the topics included medical imaging, stochastic simulations, video editing, real-time control, automatic C code generation, CUDA and more.

## Wednesday, July 7, 2010

### Quantum entanglement and classical chaos

I recently attended a talk about the connection between quantum entanglement and classical chaos

http://www.nature.com/nature/journal/v461/n7265/full/nature08396.html

This tells me that the underlying reason of the sensitivity to initial conditions in classical mechanics may be the rise of entanglement in a sequence with the collapse of the wave function.

## Monday, July 5, 2010

### Venn diagrams in R

This is my first attempt to use R, the well known program for statistics.

I am using the package LIMMA and the instructions found here in order to draw Venn diagrams. My code is

-----------------------------------------
library(limma)

set1<-data1\$x
set2<-data2\$x
set3<-data3\$x

set123<-union(set1,union(set2,set3))

bool1 = logical(length(set123))
bool2 = logical(length(set123))
bool3 = logical(length(set123))

for(i in 1:length(set123)) bool1[i]<-is.element(set123[i],set1)
for(i in 1:length(set123)) bool2[i]<-is.element(set123[i],set2)
for(i in 1:length(set123)) bool3[i]<-is.element(set123[i],set3)

c3<-cbind(bool1, bool2, bool3)

a <- vennCounts(c3)

vennDiagram(a)
-----------------------------------------------

Note.- The data is stored in a column with label "x"

## Friday, July 2, 2010

### Mersenne Twister in CUDA

The Mersenne Twister algorithm (what a cool name) for generating random numbers is implemented as an example in the SDK folder provided by NVIDIA. However, as it happens with all the examples, it depends on the CUTIL library, which is not part of the standard CUDA API. There is another problem, the compilation of each example is carried out by a general set of makefiles customized for compiling all the examples. These are big problems if we want to generate a stand alone version of the examples. This is desirable because in this way we could adapt the code for our own purposes and eventually link with extra code.

In the rest of this post I will give the makefiles that accomplish the stand alone compilation independent of CUTIL for the Mersenne Twister example.

You will have to follow the following steps :

- Make a copy of the Mersenne Twister folder from the SDK (I renamed as MersenneTwisterCUDA),

- Remove all the references for the CUTIL library

- Add the following lines on MersenneTwister.cu

char raw_path[] = "/YOUR_PATH/MersenneTwisterCUDA/data/MersenneTwister.raw";
char dat_path[] = "/YOUR_PATH/MersenneTwisterCUDA/data/MersenneTwister.dat";

while removing the corresponding lines that originally define raw_path and dat_path.

- Finally, paste the make files I will provide and run \$make on the command line
(Define YOUR_PATH according to the structure of your directories)

file: common
----------------------------------------------------------------

CUDA_PATH = /usr/local/cuda

C := gcc
CC := c++
NVCC := \$(CUDA_PATH)/bin/nvcc

CUDA_INCLUDE_PATH = /usr/local/cuda/include
CUDA_LIB_PATH := \$(CUDA_PATH)/lib64
CUDA_FLAGS = -lcuda -lcudart

===================================================

file: Makefile:
----------------------------------------------------------------------------
include ./common.mk

MersenneTwister.out: genmtrand.c.o MersenneTwister_gold.cpp.o MersenneTwister.cu.o
\$(NVCC) -L\$(CUDA_LIB_PATH) \$(CUDA_FLAGS) genmtrand.c.o MersenneTwister_gold.cpp.o MersenneTwister.cu.o -o MersenneTwister.out

MersenneTwister.cu.o: MersenneTwister.cu dci.h MersenneTwister.h MersenneTwister_kernel.cu
\$(NVCC) -c -I\$(CUDA_INCLUDE_PATH) MersenneTwister.cu -o MersenneTwister.cu.o

MersenneTwister_gold.cpp.o: MersenneTwister_gold.cpp
\$(CC) -c MersenneTwister_gold.cpp -o MersenneTwister_gold.cpp.o

genmtrand.c.o: genmtrand.c
\$(C) -c genmtrand.c -o genmtrand.c.o