Unknown's avatar

another way to track literature

I found using NIH or NSF grant number, such as NIH RO1-EB002123, is another good way to track a series of papers from a particular research group. Actually, the corresponding authors usually pay attention to which grants a paper should mention at the Acknowledgment part, so the papers having the same grant number are often automatically and carefully classified according to the big project they are related to. I think this is worth mentioning in my web note.

Unknown's avatar

how to configure NIST TNT into cygwin gcc environment

NIST TNT and JAMA are very useful libraries designed for complex matrix based computation. The libraries are purely headers containing template based classes and subroutines. To configure the TNT into a cygwin/gcc programming environment, the following can be done:

1. download TNT and JAMA from nist.gov (http://math.nist.gov/tnt/download.html)

2. extract the header files into /usr/local/include/tnt

3. test a cpp file:

#include <tnt/tnt.h>
#include <iostream>
using namespace TNT;
using namespace std;
int main(void)
{
int M = 3;
int N = 3;
Array2D< double > A(M,N, 0.0); /* create MxN array; all zeros */

for (int i=0; i < M; i++)
for (int j=0; j < N; j++)
A[i][j] = i*10+j; /* initalize array values */

Array2D< double > B = A.copy(); /* create a new copy */

Array2D< double > C(B); /* create a new view of B */
/* Both arrays (B & C) share data */
for (int i=0; i<M; i++)
for (int j=0; j<N; j++)
cout<<"A["<<i<<"]["<<j<<"] = "<<A[i][j]<<endl;
return 0;
}

4. write a makefile

CPP = g++
OFLAG = -Wall -o
LFLAG = -l
IFLAG = -I
LIBFLAG = -L
LIBDIR = /usr/local/lib/
INCLUDEDIR = /usr/local/include/TNT/
DEBUGF = -g -D DEBUG
DEBUG = no

.SUFFIXES: .exe .cpp
.cpp.exe:
$(CPP) $(OFLAG) $@ $<
$@

try.exe: try.cpp
$(CPP) $(IFLAG) $(INCLUDEDIR) $(OFLAG) try.exe try.cpp

5. build, and run the try.exe. The result shows:

A[0][0] = 0
A[0][1] = 1
A[0][2] = 2
A[1][0] = 10
A[1][1] = 11
A[1][2] = 12
A[2][0] = 20
A[2][1] = 21
A[2][2] = 22

Unknown's avatar

how to set up fftw for cygwin in Win XP

FFTW is essential for image processing, reconstruction, and other imaging related projects.
How to integrate FFTW into cygwin-Emacs-gcc programming chain:
1. instruction to follow: the INSTALL file in the package

2. 3 steps to build: ./configure, make, make install

3. the files will be placed into
/usr/local/include
/usr/local/bin
/usr/local/lib

4. test a cpp file:

#include <fftw/fftw3.h>
#include <iostream>
using namespace std;
int main()
{
cout << "fftw3.h is included" << endl;
fftw_complex *in, *out;
fftw_plan p;
int N = 64;//size of the fft
in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
p = fftw_plan_dft_1d(N, in , out, FFTW_FORWARD, FFTW_ESTIMATE);
//now start initialize in
for(int i=0; i<N; i++)
{
in[i][0] = 1;
in[i][1] = 0;
}

fftw_execute(p);//actually run the fftw routine

for(int i=0; i<N; i++)
{
cout << "out[" << i << "] = " << out[i][0] << "+" << out[i][1] << "j" << endl;
}
fftw_destroy_plan(p);//
fftw_free(in);
fftw_free(out);
}

5. write the makefile correctly:

CPP = g++
OFLAG = -Wall -o
LFLAG = -l
IFLAG = -I
LIBFLAG = -L
LIBDIR = /usr/local/lib/
INCLUDEDIR = /usr/local/include/
DEBUGF = -g -D DEBUG
DEBUG = no

.SUFFIXES: .exe .cpp
.cpp.exe:
$(CPP) $(OFLAG) $@ $<
$@

main.exe: main.cpp
$(CPP) $(IFLAG) $(INCLUDEDIR) $(OFLAG) main.exe main.cpp $(LIBDIR)libfftw3.a

6. build

7. test the program main.exe

Unknown's avatar

How to setup boost for cygwin in Win XP

Boost is a super powerful and multi-platform C++ library. I always want to make use of this powerful tool. Here is the experience I had on how to install it for a Win XP box with cygwin:

1. the right instruction page to follow: Getting Started on Unix Variants (http://www.boost.org/doc/libs/1_41_0/more/getting_started/unix-variants.html#prepare-to-use-a-boost-library-binary)
2. which package to download: the source code package, e.g., from sourceforge.net (http://sourceforge.net/projects/boost/files/boost/), the version I downloaded was: boost_1_41_0.zip

3. how to build: follow Section 5.1 of the instruction page “Getting Started on Unix Variants”

3.1 cd path/to/boost_1_41_0
3.2 ./bootstrap.sh –prefix=/path/to/installation
3.3 ./bjam
3.4 ./bjam install

4. in /path/to/installation there will be 3 folders generated: bin, include, lib

5. copy these 3 folders to /usr/local/ (this is the local folder for the user installed packages instead of the standard cygwin packages)

6. build the test c++ program with linking to boost library regex
6.1 sample cpp file:
boost.cpp

#include
#include
#include

int main()
{
std::string line;
boost::regex pat( “^Subject: (Re: |Aw: )*(.*)” );

while (std::cin)
{
std::getline(std::cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
std::cout << matches[2] << std::endl;
}
}

6.2 sample makefile
makefile

CPP = g++
OFLAG = -Wall -o
LFLAG = -l
IFLAG = -I
LIBFLAG = -L
LIBDIR = /usr/local/lib/
INCLUDEDIR = /usr/local/include/
DEBUGF = -g -D DEBUG
DEBUG = no

.SUFFIXES: .exe .cpp
.cpp.exe:
    $(CPP) $(OFLAG) $@ $<
    $@

main.exe: boost.cpp
    $(CPP) $(IFLAG) $(INCLUDEDIR) $(OFLAG) boost.exe boost.cpp $(LIBFLAG)$(LIBDIR) $(LFLAG)libboost_regex

7. build the cpp file

8. create the test file to test the regexp functionality used in the above boost.cpp: save the following to test.txt

To: George Shmidlap
From: Rita Marlowe
Subject: Will Success Spoil Rock Hunter?

See subject.

8. test the boost.exe by

test.txt > ./boost.exe

9. the results shows successfully:  Will Success Spoil Rock Hunter?

Key point:

1. find the good instruction to follow

2. copy the include, bin, lib folders into the right path: /usr/local/

3. write the makefile correctly (setup good parameters for the compiler gcc)

Unknown's avatar

how to get ImageMagick work in Cygwin under Win Xp

I tried to 3 methods, only one works well (without too much trouble) with Cygwin:

1. install the binary windows version directly ( ftp://ftp.imagemagick.org/pub/ImageMagick/binaries/). This works in Windows, but not in the cygwin flavor: the display.exe does not work under mintty or other bash shells. Even after I setup export DISPLAY=localhost:0.0, it still complains about: “display.exe: unable to open X server `(null)’ @ display.”

2. build from source code using the ImageMagick’s package (ftp://ftp.imagemagick.org/pub/ImageMagick/), but it seemed that there are some packages, such as QLR, are missing. And after configuration the “make” step failed.

3. searched if cygwin contains a ImageMagick package from the online cygwin package list (http://www.cygwin.com/packages/), it turn out to be in the “graphics” category. After installing it, display.exe was still not working. Then I started the X-Server, and included

export DISPLAY=localhost:0.0

into ~/.bashrc. Then it works.

Unknown's avatar

PACS numbers on literature review

One great tip I learned today: when doing literature review, it is very easy to use the PACS number to find the group of papers together under one PACS number. For example, I found a paper:

@ARTICLE{Winzer-accuracy-error-propagation-ratios-of-rv-2000,
author = {Peter J. Winzer},
collaboration = {},
title = {Accuracy of error propagation exemplified with ratios of random variables},
publisher = {AIP},
year = {2000},
journal = {Review of Scientific Instruments},
volume = {71},
number = {3},
pages = {1447-1454},
}

This paper is from a different area than my own, but its PACS number provides really good information on related topics:
* 06.20.Dk
Metrology, measurements, and laboratory procedures Metrology Measurement and error theory
* 02.30.Mv
Mathematical methods in physics Function theory, analysis Approximations and expansions
* 02.50.Cw
Mathematical methods in physics Probability theory, stochastic processes, and statistics Probability theory

Follow the first PACS link (06.20.Dk), I found the following list of publications very useful:
http://scitation.aip.org/vsearch/servlet/VerityServlet?KEY=FREESR&search=Search&smode=results&possible1=06.20.Dk&possible1zone=article&bool1=and