Hi,
try for(int i=0; i<4; i++) cout << idx[i] << " " << a[idx[i]] <<endl
and it makes more sense,
Eddy
> X-Authentication-Warning: pcroot.cern.ch: majordomo set sender to
owner-roottalk@root.cern.ch using -f
> Date: Tue, 25 Mar 2003 23:38:58 +0900
> From: Allister Levi Sanchez <allister@hep.sc.niigata-u.ac.jp>
> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003
> X-Accept-Language: en-us, en
> MIME-Version: 1.0
> To: roottalk <roottalk@pcroot.cern.ch>
> Subject: [ROOT] TMath::Sort() bug???
> Content-Transfer-Encoding: 7bit
>
> Hi,
>
> I wanted to use TMath::Sort() so I tried a simple test first. I got a
> weird result:
> root [0] double a[4] = {0.34,-2.28,-0.1,4.2}
> root [2] Int_t idx[4]
> root [3] TMath::Sort(4,a,idx)
> root [4] for(int i=0; i<4; i++) cout << idx[i] << " " << a[i] << endl
> 3 0.34
> 0 -2.28
> 2 -0.1
> 1 4.2
>
> Is this the expected result? or is this a bug? I'm using ROOT 3.05/02
> binary distribution for gcc3.2 on my Red Hat 8.
>
> Best regards,
> Allister Levi Sanchez
>
> --
> from..._ _ _ _ | Allister Levi C. Sanchez
> __ _| | | | (_)___| |_ ___ _ _ | High Energy Physics Laboratory
> / _' | | | | | / __| _|/ _ \| '_| | Graduate School of Science & Technology
> | (_| | |_| |_| \__ \ |_ __/| | | Niigata University
> \__,_|\__|\__|_|___/\__|\____|_|@ | Ikarashi 2-8050 Niigata 950-2181
> hep.sc.niigata-u.ac.jp | Japan
>
>
Eddy A.J.M. Offermann
Renaissance Technologies Corp.
Route 25A, East Setauket NY 11733
e-mail: eddy@rentec.com
http://www.rentec.com
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET