Friday, October 29, 2010

CUDA Thrust include path

Never put /thrust folder in a typical include location, nvcc doesn't like it, but a good place for it is "anywhere", like /usr/local/cuda/include.

Source: http://code.google.com/p/thrust/wiki/QuickStartGuide

Thursday, August 5, 2010

Latex captions: advanced

A)
You can put different captions in the List of Figures by including an optional argument of the \caption command:
\begin{figure}
...
... |<----- optional argument of \caption ----->|
\caption[This is what shows up in the List of Figures.]{Here is the text
that appears under the Figure itself. This text is often very long and
complicated, and is only useful when you've got the Figure sitting right
there in front of you. It won't mean much to anyone just reading the
List of Figures.}
\label{example-fig}
\end{figure}

B)
So to get fragile stuff like equation references in the caption, try this:
\begin{figure}
...
\caption{The graph of the function given in (\protect \ref{some-eqn}).}
\end{figure}

Notice that to get parentheses around the number, like "(7)", the
\protect statement has to go inside the
().

Source: http://www.iam.ubc.ca/old_pages/newbury/tex/captions.html#different

Linux: change encoding simply

QUICK: 
 
$ recode UTF-8..latin1 foo
NOTE: The file foo will be overwritten by the command
 
Option 2:
 
iconv --from-code=ISO-8859-1 --to-code=UTF-8 ./oldfile.htm > ./newfile.html

MULTI-FILE:

find . -name "*.txt" -exec iconv -f ISO-8859-1 -t UTF-8 {} -o {}.utf8 \;
 

Linux Locale, Language, Encoding

Check to see what locales are currently installed on your system
$ locale -a
More interesting info, although containing some useless proprietary specifics: http://docs.hp.com/en/5185-4400/

Thursday, July 1, 2010

modulus implementation

according to "Concrete Mathematics: A Foundation for Computer Science", by Graham, Knuth (yes, that Knuth) and Patashnik 2nd ed. (page 82)(http://www.perlmonks.org/?node_id=87384), the modulus 0 operation returns the left operand intact, by definition:

x mod 0 = x

However, this definition is not applied in all programming languages...

Tuesday, June 29, 2010

typical g++ compile options

-Wall : display a maximum number of warnings
-fPIC : necessary for correct DSO treatment. Much more info here: http://people.redhat.com/drepper/dsohowto.pdf

Monday, June 21, 2010

EPS to PDF size conservation

To print EPS images into PDF files with paper size equal to EPS bounding box, use the epstopdf script or LATEX package described here: http://www.ctan.org/pkg/epstopdf

Thursday, June 10, 2010

gsl library usage

source file : inlcude "/gsl/foo.h"
makefile : gcc ... -lgsl -lgslcblas
the former is necessary to load supporting CBLAS library for linear algebra

Wednesday, June 9, 2010

g++ include

Under typical linux folder hierarchy, usr/local/include is the place to dump "orphan" .h and .hh files. This folder is normally visited by g++ when looking for includes.