RE:How can I use complex number with ROO

Masaharu Goto (MXJ02154@niftyserve.or.jp)
Tue, 26 May 1998 20:53:00 +0900


Seya-san,

I guess you try to simulate DSP algorithm probably about some kind of
modulation/demodulation. There are several ways to answer your question.

1) STL availability
STL is only partly supported on cint. STL header files specially arranged
for cint is included in cint source package. Download cint.tar.gz from
http://hpsalo.cern.ch/root/Cint.thml and unpack it. You'll find 'stl'
directory. Copy that directory as $ROOTDIR/cint/stl . You can somehow
use STL on ROOT.
Unfortunately, STL can not be prepared as precompiled library. I do not
recommend using STL heavily on ROOT/CINT.

2) Complex class availability
Classical form of complex class library is provided with cint source package.

$CINTSYSDIR/include/complex.h
array.h array.c
carray.h carray.c
fft.h fft.c

This is not a modern complex and vector library but usable enough for
engineering purposes. You can precompile array.c, carray.c and fft.c which
become array.dl , carray.dl and fft.dl. Those precompiled library made for
cint can be directly imported to ROOT.

Another kind of example is in $CINTSYSDIR/demo/makecint/Array and
$CINTSYSDIR/demo/makecint/Complex directory.

3) If you insist using complex<> template , give me following information.
I could help you more specifically.

* Computer platform
* C/C++ Compiler you have
* Area of specific application (wireless com, audio or video codec,etc...)
* Type of analysis
* Do you want to use vector<complex<double> > ?

Masaharu Goto

>Is there any way to use complex number with ROOT ?
>I would like to do the calculation like below;
>
>#include <iostream>
>#include <complex>
>using namespace std;
>
>void main()
>{
> complex<double> a(1,2);
> cout << a << endl;
> cout << sin(a) << endl; //<-- I want the complex result !!
>}
>
>How can I get the result back in complex ?
>
>Thank you in advance,
>Keisuke Seya