trying to build 2d interpolator with TArrayF, TMatrix

From: Richard Dubois (richard@SLAC.stanford.edu)
Date: Fri Jan 08 1999 - 19:18:21 MET


 I need to make a 2d interpolator. For this I must specify two arrays of
gridpoints and a matrix of the function values at those gridpoints.

 My idea was to use 2 TArrayF's to hold the gridpoints and
TMath::BinarySearch to find the places on the grid for an input (x,y)
point. I would use a TMatrix to hold the function values. This seemed
nicer than managing my own arrays and matrix and keeping track of their
sizes.

 I was then going to keep a TMap of such interpolators using TString as
the key to name them.

 I wasn't able to do any of this! I've had to back off to defining my
own arrays and pseudo-matrix.

BinarySearch will not accept TArrayF's as input. I could not figure out
how to set the matrix values in TMatrix -  there is no Set-type member
function. I assume it must be done via Apply in some way. I had set up
code to access the TMatrix values and the compiler balked at matrix(i,j)
syntax, though such an operator is defined.

 Finally, the compiler reminded me that TString is not a TObject, so
TMap won't take it as a key.

 On the subject of TMaps, is it really necessary, if one wants a simple
builtin type like Int_t or Float_t or char*, to create a new class which
inherits from TObject and solely defines the type? As far as I can tell,
this is the case.

 Can this interpolator be done with the T classes?

Richard
--
Richard Dubois
SLD, Stanford Linear Accelerator Center
Richard@slac.stanford.edu
http://www.slac.stanford.edu/~richard/
650-926-3824
650-926-2923 (FAX)



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:27 MET