ROOT  6.06/04
Reference Guide
TCernLib.h
Go to the documentation of this file.
1 // @(#)root/table:$Id$
2 // Author: Valery Fine(fine@bnl.gov) 25/09/99
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TCernLib
13 #define ROOT_TCernLib
14 
15 #include "Rtypes.h"
16 #include <string.h>
17 
18 // https://cern-tex.web.cern.ch/cern-tex/shortwrupsdir/f110/top.html
19 
20 ///////////////////////////////////////////////////////////////////////////////////////
21 // //
22 // The routines of MXPACK compute the product of two matrices or the product of //
23 // their transposed matrices and may add or subtract to the resultant matrix //
24 // a third one, add or subtract one matrix from another, or transfer a matrix, //
25 // its negative, or a multiple of it, transpose a given matrix, build up a unit //
26 // matrix, multiply a matrix by a diagonal (from left or from right) and may //
27 // add the result to another matrix, add to square matrix the multiple of a diagonal //
28 // matrix, compute the products X=ABA' (A' denotes the transpose of A) and X=A'BA. //
29 // It is assumed that matrices are <B>row-wise without gaps</B>, contrary to the //
30 // Fortran convention. //
31 // //
32 ///////////////////////////////////////////////////////////////////////////////////////
33 
34 class TArrayD;
35 
36 class TCL {
37 public:
38  virtual ~TCL() { }
39 
40  static int *ucopy(const int *a, int *b, int n);
41  static float *ucopy(const float *a, float *b, int n);
42  static double *ucopy(const float *a, double *b, int n);
43  static float *ucopy(const double *a, float *b, int n);
44  static double *ucopy(const double *a, double *b, int n);
45  static void **ucopy(const void **a, void **b, int n);
46 
47  static float *vzero(float *a, int n2);
48  static double *vzero(double *a, int n2);
49  static void **vzero(void **a, int n2);
50 
51  static float *vadd(const float *b, const float *c, float *a, int n);
52  static double *vadd(const double *b, const double *c, double *a, int n);
53 
54  static float *vadd(const float *b, const double *c, float *a, int n);
55  static double *vadd(const double *b, const float *c,double *a, int n);
56 
57  static float vdot(const float *b, const float *a, int n);
58  static double vdot(const double *b, const double *a, int n);
59 
60  static float *vsub(const float *a, const float *b, float *x, int n);
61  static double *vsub(const double *a, const double *b, double *x, int n);
62  static float *vsub(const float *b, const double *c, float *a, int n);
63  static double *vsub(const double *b, const float *c, double *a, int n);
64 
65  static float *vcopyn(const float *a, float *x, int n);
66  static double *vcopyn(const double *a, double *x, int n);
67 
68  static float *vscale(const float *a, float scale, float *b, int n);
69  static double *vscale(const double *a, double scale, double *b, int n);
70 
71  static float *vlinco(const float *a, float fa, const float *b, float fb,float *x, int n);
72  static double *vlinco(const double *a, double fa, const double *b, double fb,double *x, int n);
73 
74  static float *vmatl(const float *g, const float *c, float *x, int n=3,int m=3);
75  static double *vmatl(const double *g, const double *c, double *x, int n=3,int m=3);
76 
77  static float *vmatr(const float *c, const float *g, float *x, int n=3,int m=3);
78  static double *vmatr(const double *c, const double *g, double *x, int n=3,int m=3);
79 
80  static float *mxmad_0_(int n, const float *a, const float *b, float *c, int i, int j, int k);
81 
82  static float *mxmad( const float *a, const float *b, float *c, int i, int j, int k);
83  static float *mxmad1(const float *a, const float *b, float *c, int i, int j, int k);
84  static float *mxmad2(const float *a, const float *b, float *c, int i, int j, int k);
85  static float *mxmad3(const float *a, const float *b, float *c, int i, int j, int k);
86  static float *mxmpy( const float *a, const float *b, float *c, int i, int j, int k);
87  static float *mxmpy1(const float *a, const float *b, float *c, int i, int j, int k);
88  static float *mxmpy2(const float *a, const float *b, float *c, int i, int j, int k);
89  static float *mxmpy3(const float *a, const float *b, float *c, int i, int j, int k);
90  static float *mxmub( const float *a, const float *b, float *c, int i, int j, int k);
91  static float *mxmub1(const float *a, const float *b, float *c, int i, int j, int k);
92  static float *mxmub2(const float *a, const float *b, float *c, int i, int j, int k);
93  static float *mxmub3(const float *a, const float *b, float *c, int i, int j, int k);
94 
95  static float *mxmlrt_0_(int n__, const float *a, const float *b, float *c, int ni,int nj);
96  static float *mxmlrt(const float *a, const float *b, float *c, int ni, int nj);
97  static float *mxmltr(const float *a, const float *b, float *c, int ni, int nj);
98  static float *mxtrp(const float *a, float *b, int i, int j);
99 
100  static double *mxmad_0_(int n, const double *a, const double *b, double *c, int i, int j, int k);
101 
102  static double *mxmad (const double *a, const double *b, double *c, int i, int j, int k);
103  static double *mxmad1(const double *a, const double *b, double *c, int i, int j, int k);
104  static double *mxmad2(const double *a, const double *b, double *c, int i, int j, int k);
105  static double *mxmad3(const double *a, const double *b, double *c, int i, int j, int k);
106  static double *mxmpy (const double *a, const double *b, double *c, int i, int j, int k);
107  static double *mxmpy1(const double *a, const double *b, double *c, int i, int j, int k);
108  static double *mxmpy2(const double *a, const double *b, double *c, int i, int j, int k);
109  static double *mxmpy3(const double *a, const double *b, double *c, int i, int j, int k);
110  static double *mxmub (const double *a, const double *b, double *c, int i, int j, int k);
111  static double *mxmub1(const double *a, const double *b, double *c, int i, int j, int k);
112  static double *mxmub2(const double *a, const double *b, double *c, int i, int j, int k);
113  static double *mxmub3(const double *a, const double *b, double *c, int i, int j, int k);
114 
115  static double *mxmlrt_0_(int n__, const double *a, const double *b, double *c, int ni,int nj);
116  static double *mxmlrt(const double *a, const double *b, double *c, int ni, int nj);
117  static double *mxmltr(const double *a, const double *b, double *c, int ni, int nj);
118  static double *mxtrp(const double *a, double *b, int i, int j);
119 
120 // * TR pack
121 
122  static float *traat(const float *a, float *s, int m, int n);
123  static float *tral(const float *a, const float *u, float *b, int m, int n);
124  static float *tralt(const float *a, const float *u, float *b, int m, int n);
125  static float *tras(const float *a, const float *s, float *b, int m, int n);
126  static float *trasat(const float *a, const float *s, float *r, int m, int n);
127  static float *trasat(const double *a, const float *s, float *r, int m, int n);
128  static float *trata(const float *a, float *r, int m, int n);
129  static float *trats(const float *a, const float *s, float *b, int m, int n);
130  static float *tratsa(const float *a, const float *s, float *r, int m, int n);
131  static float *trchlu(const float *a, float *b, int n);
132  static float *trchul(const float *a, float *b, int n);
133  static float *trinv(const float *t, float *s, int n);
134  static float *trla(const float *u, const float *a, float *b, int m, int n);
135  static float *trlta(const float *u, const float *a, float *b, int m, int n);
136  static float *trpck(const float *s, float *u, int n);
137  static float *trqsq(const float *q, const float *s, float *r, int m);
138  static float *trsa(const float *s, const float *a, float *b, int m, int n);
139  static float *trsinv(const float *g, float *gi, int n);
140  static float *trsmlu(const float *u, float *s, int n);
141  static float *trsmul(const float *g, float *gi, int n);
142  static float *trupck(const float *u, float *s, int m);
143  static float *trsat(const float *s, const float *a, float *b, int m, int n);
144 
145 // Victor Perevoztchikov's addition:
146  static float *trsequ(float *smx, int m=3, float *b=0, int n=1);
147 
148 // --- double version
149 
150  static double *traat (const double *a, double *s, int m, int n);
151  static double *tral (const double *a, const double *u, double *b, int m, int n);
152  static double *tralt (const double *a, const double *u, double *b, int m, int n);
153  static double *tras (const double *a, const double *s, double *b, int m, int n);
154  static double *trasat(const double *a, const double *s, double *r, int m, int n);
155  static double *trata (const double *a, double *r, int m, int n);
156  static double *trats (const double *a, const double *s, double *b, int m, int n);
157  static double *tratsa(const double *a, const double *s, double *r, int m, int n);
158  static double *trchlu(const double *a, double *b, int n);
159  static double *trchul(const double *a, double *b, int n);
160  static double *trinv (const double *t, double *s, int n);
161  static double *trla (const double *u, const double *a, double *b, int m, int n);
162  static double *trlta (const double *u, const double *a, double *b, int m, int n);
163  static double *trpck (const double *s, double *u, int n);
164  static double *trqsq (const double *q, const double *s, double *r, int m);
165  static double *trsa (const double *s, const double *a, double *b, int m, int n);
166  static double *trsinv(const double *g, double *gi, int n);
167  static double *trsmlu(const double *u, double *s, int n);
168  static double *trsmul(const double *g, double *gi, int n);
169  static double *trupck(const double *u, double *s, int m);
170  static double *trsat (const double *s, const double *a, double *b, int m, int n);
171 
172 // Victor Perevoztchikov's addition:
173  static double *trsequ(double *smx, int m=3, double *b=0, int n=1);
174 
175  ClassDef(TCL,0) //C++ replacement for CERNLIB matrix / triangle matrix packages: F110 and F112
176 
177 };
178 
179 //___________________________________________________________________________
180 inline float *TCL::mxmad(const float *a, const float *b, float *c, int i, int j, int k)
181 {
182  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
183  return mxmad_0_(0, a, b, c, i, j, k); }
184 
185 //___________________________________________________________________________
186 inline float *TCL::mxmad1(const float *a, const float *q, float *c, int i, int j, int k)
187 {
188  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad1.gif"> </P> End_Html //
189  return mxmad_0_(1, a, q, c, i, j, k); }
190 
191 //___________________________________________________________________________
192 inline float *TCL::mxmad2(const float *p, const float *b, float *c, int i, int j, int k)
193 {
194  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad2.gif"> </P> End_Html //
195  return mxmad_0_(2, p, b, c, i, j, k); }
196 
197 //___________________________________________________________________________
198 inline float *TCL::mxmad3(const float *p, const float *q, float *c, int i, int j, int k)
199 {
200  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad3.gif"> </P> End_Html //
201  return mxmad_0_(3, p, q, c, i, j, k); }
202 
203 //___________________________________________________________________________
204 inline float *TCL::mxmpy(const float *a, const float *b, float *c, int i, int j, int k)
205 {
206  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmpy.gif"> </P> End_Html //
207  return mxmad_0_(4, a, b, c, i, j, k); }
208 
209 //___________________________________________________________________________
210 inline float *TCL::mxmpy1(const float *a, const float *q, float *c, int i, int j, int k)
211 {
212  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmpy1.gif"> </P> End_Html //
213  return mxmad_0_(5, a, q, c, i, j, k); }
214 
215 //___________________________________________________________________________
216 inline float *TCL::mxmpy2(const float *p, const float *b, float *c, int i, int j, int k)
217 {
218  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmpy2.gif"> </P> End_Html //
219  return mxmad_0_(6, p, b, c, i, j, k); }
220 
221 //___________________________________________________________________________
222 inline float *TCL::mxmpy3(const float *p, const float *q, float *c, int i, int j, int k)
223 {
224  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmpy3.gif"> </P> End_Html //
225  return mxmad_0_(7, p, q, c, i, j, k); }
226 
227 //___________________________________________________________________________
228 inline float *TCL::mxmub(const float *a, const float *b, float *c, int i, int j, int k)
229 {
230  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmub.gif"> </P> End_Html //
231  return mxmad_0_(8, a, b, c, i, j, k); }
232 
233 //___________________________________________________________________________
234 inline float *TCL::mxmub1(const float *a, const float *q, float *c, int i, int j, int k)
235 {
236  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmub1.gif"> </P> End_Html //
237  return mxmad_0_(9, a, q, c, i, j, k); }
238 
239 //___________________________________________________________________________
240 inline float *TCL::mxmub2(const float *p, const float *b, float *c, int i, int j, int k)
241 {
242  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmub2.gif"> </P> End_Html //
243  return mxmad_0_(10, p, b, c, i, j, k); }
244 
245 //___________________________________________________________________________
246 inline float *TCL::mxmub3(const float *p, const float *q, float *c, int i, int j, int k)
247 {
248  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmub3.gif"> </P> End_Html //
249  return mxmad_0_(11, p, q, c, i, j, k); }
250 
251 //___________________________________________________________________________
252 inline float *TCL::mxmlrt(const float *a, const float *b, float *x, int ni, int nj)
253 {
254  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmlrt.gif"> </P> End_Html //
255  return mxmlrt_0_(0, a, b, x, ni, nj); }
256 
257 //___________________________________________________________________________
258 inline float *TCL::mxmltr(const float *a, const float *b, float *x, int ni, int nj)
259 {
260  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmltr.gif"> </P> End_Html //
261  return mxmlrt_0_(1, a, b, x, ni, nj); }
262 
263 
264 //-- double version --
265 
266 //___________________________________________________________________________
267 inline double *TCL::mxmad(const double *a, const double *b, double *c, int i, int j, int k)
268 {
269  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
270  return mxmad_0_(0, a, b, c, i, j, k); }
271 
272 //___________________________________________________________________________
273 inline double *TCL:: mxmad1(const double *a, const double *b, double *c, int i, int j, int k)
274 {
275  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
276  return mxmad_0_(1, a, b, c, i, j, k); }
277 
278 //___________________________________________________________________________
279 inline double *TCL::mxmad2(const double *a, const double *b, double *c, int i, int j, int k)
280 {
281  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
282  return mxmad_0_(2, a, b, c, i, j, k); }
283 
284 //___________________________________________________________________________
285 inline double *TCL::mxmad3(const double *a, const double *b, double *c, int i, int j, int k)
286 {
287  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
288  return mxmad_0_(3, a, b, c, i, j, k); }
289 
290 //___________________________________________________________________________
291 inline double *TCL::mxmpy(const double *a, const double *b, double *c, int i, int j, int k)
292 {
293  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
294  return mxmad_0_(4, a, b, c, i, j, k); }
295 
296 //___________________________________________________________________________
297 inline double *TCL::mxmpy1(const double *a, const double *b, double *c, int i, int j, int k)
298 {
299  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
300  return mxmad_0_(5, a, b, c, i, j, k); }
301 
302 //___________________________________________________________________________
303 inline double *TCL::mxmpy2(const double *a, const double *b, double *c, int i, int j, int k)
304 {
305  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
306  return mxmad_0_(6, a, b, c, i, j, k); }
307 
308 //___________________________________________________________________________
309 inline double *TCL::mxmpy3(const double *a, const double *b, double *c, int i, int j, int k)
310 {
311  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
312  return mxmad_0_(7, a, b, c, i, j, k); }
313 
314 //___________________________________________________________________________
315 inline double *TCL::mxmub(const double *a, const double *b, double *c, int i, int j, int k)
316 {
317  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
318  return mxmad_0_(8, a, b, c, i, j, k); }
319 
320 //___________________________________________________________________________
321 inline double *TCL::mxmub1(const double *a, const double *b, double *c, int i, int j, int k)
322 {
323  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
324  return mxmad_0_(9, a, b, c, i, j, k); }
325 
326 //___________________________________________________________________________
327 inline double *TCL::mxmub2(const double *a, const double *b, double *c, int i, int j, int k)
328 {
329  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
330  return mxmad_0_(10, a, b, c, i, j, k); }
331 
332 //___________________________________________________________________________
333 inline double *TCL::mxmub3(const double *a, const double *b, double *c, int i, int j, int k)
334 {
335  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
336  return mxmad_0_(11, a, b, c, i, j, k); }
337 
338 //___________________________________________________________________________
339 inline double *TCL::mxmlrt(const double *a, const double *b, double *c, int ni, int nj)
340 {
341  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
342  return mxmlrt_0_(0, a, b, c, ni, nj); }
343 
344 //___________________________________________________________________________
345 inline double *TCL::mxmltr(const double *a, const double *b, double *c, int ni, int nj)
346 {
347  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/mxpack_mxmad.gif"> </P> End_Html //
348  return mxmlrt_0_(1, a, b, c, ni, nj); }
349 
350 // ----
351 
352 //________________________________________________________
353 inline int *TCL::ucopy(const int *b, int *a, int n)
354 {
355  //to be documented
356  if (n <= 0) return 0; memcpy(a,b,n*sizeof(int)); return a;
357 }
358 
359 //________________________________________________________
360 inline float *TCL::ucopy(const float *b, float *a, int n)
361 {
362  //to be documented
363  if (n <= 0) return 0; memcpy(a,b,n*sizeof(float)); return a;
364 }
365 
366 //________________________________________________________
367 inline float *TCL::ucopy(const double *b, float *a, int n)
368 {
369  //to be documented
370  if (n <= 0) return 0;
371  for (int i=0;i<n;i++,a++,b++) *a = float(*b);
372  return a;
373 }
374 
375 //________________________________________________________
376 inline double *TCL::ucopy(const float *b, double *a, int n)
377 {
378  //to be documented
379  if (n <= 0) return 0;
380  for (int i=0;i<n;i++,a++,b++) *a = double(*b);
381  return a;
382 }
383 
384 //________________________________________________________
385 inline double *TCL::ucopy(const double *b, double *a, int n)
386 {
387  //to be documented
388  if (n <= 0) return 0; memcpy(a,b,n*sizeof(double)); return a;
389 }
390 
391 //________________________________________________________
392 inline void **TCL::ucopy(const void **b, void **a, int n)
393 {
394  //to be documented
395  if (n <= 0) return 0; memcpy(a,b,n*sizeof(void *)); return a;
396 }
397 
398 
399 //________________________________________________________
400 inline float *TCL::vadd(const float *b, const float *c, float *a, int n)
401 {
402  //to be documented
403  if (n <= 0) return 0;
404  for (int i=0;i<n;i++) a[i] = b[i] + c[i];
405  return a;
406 }
407 
408 //________________________________________________________
409 inline double *TCL::vadd(const double *b, const double *c, double *a, int n)
410 {
411  //to be documented
412  if (n <= 0) return 0;
413  for (int i=0;i<n;i++) a[i] = b[i] + c[i];
414  return a;
415 }
416 
417 //________________________________________________________
418 inline float *TCL::vadd(const float *b, const double *c, float *a, int n)
419 {
420  //to be documented
421  if (n <= 0) return 0;
422  for (int i=0;i<n;i++) a[i] = b[i] + c[i];
423  return a;
424 }
425 
426 //________________________________________________________
427 inline double *TCL::vadd(const double *b, const float *c, double *a, int n)
428 {
429  //to be documented
430  if (n <= 0) return 0;
431  for (int i=0;i<n;i++) a[i] = b[i] + c[i];
432  return a;
433 }
434 
435 //________________________________________________________
436 inline float TCL::vdot(const float *b, const float *a, int n)
437 {
438  //to be documented
439  float x=0;
440  if (n>0)
441  for (int i=0;i<n;i++,a++,b++) x += (*a) * (*b);
442  return x;
443 }
444 //________________________________________________________
445 inline double TCL::vdot(const double *b, const double *a, int n)
446 {
447  //to be documented
448  double x=0;
449  if (n>0)
450  for (int i=0;i<n;i++,a++,b++) x += (*a) * (*b);
451  return x;
452 }
453 //________________________________________________________
454 inline float *TCL::vsub(const float *a, const float *b, float *x, int n)
455 {
456  //to be documented
457  if (n <= 0) return 0;
458  for (int i=0;i<n;i++) x[i] = a[i]-b[i];
459  return x;
460 }
461 
462 //________________________________________________________
463 inline double *TCL::vsub(const double *a, const double *b, double *x, int n)
464 {
465  //to be documented
466  if (n <= 0) return 0;
467  for (int i=0;i<n;i++) x[i] = a[i]-b[i];
468  return x;
469 }
470 //________________________________________________________
471 inline float *TCL::vsub(const float *b, const double *c, float *a, int n)
472 {
473  //to be documented
474  if (n <= 0) return 0;
475  for (int i=0;i<n;i++) a[i] = b[i] - c[i];
476  return a;
477 }
478 
479 //________________________________________________________
480 inline double *TCL::vsub(const double *b, const float *c, double *a, int n)
481 {
482  //to be documented
483  if (n <= 0) return 0;
484  for (int i=0;i<n;i++) a[i] = b[i] - c[i];
485  return a;
486 }
487 //________________________________________________________
488 inline float *TCL::vcopyn(const float *a, float *x, int n)
489 {
490  //to be documented
491  if (n <= 0) return 0;
492  for (int i=0;i<n;i++) x[i] = -a[i];
493  return x;
494 }
495 //________________________________________________________
496 inline double *TCL::vcopyn(const double *a, double *x, int n)
497 {
498  //to be documented
499  if (n <= 0) return 0;
500  for (int i=0;i<n;i++) x[i] = -a[i];
501  return x;
502 }
503 
504 //________________________________________________________
505 inline float *TCL::vzero(float *a, int n1)
506 {
507  //to be documented
508  if (n1 <= 0) return 0;
509  return (float *)memset(a,0,n1*sizeof(float));
510 }
511 
512 //________________________________________________________
513 inline double *TCL::vzero(double *a, int n1)
514 {
515  //to be documented
516  if (n1 <= 0) return 0;
517  return (double *)memset(a,0,n1*sizeof(double));
518 }
519 
520 //________________________________________________________
521 inline void **TCL::vzero(void **a, int n1)
522 {
523  //to be documented
524  if (n1 <= 0) return 0;
525  return (void **)memset(a,0,n1*sizeof(void *));
526 }
527 
528 //________________________________________________________
529 inline float *TCL::vscale(const float *a, float scale, float *b, int n)
530 {
531  //to be documented
532  for (int i=0;i<n;i++) b[i]=scale*a[i];
533  return b;
534 }
535 
536 //________________________________________________________
537 inline double *TCL::vscale(const double *a, double scale, double *b, int n)
538 {
539  //to be documented
540  for (int i=0;i<n;i++) b[i]=scale*a[i];
541  return b;
542 }
543 
544 //________________________________________________________
545 inline float *TCL::vlinco(const float *a, float fa, const float *b, float fb, float *x, int n)
546 {
547  //to be documented
548  for (int i=0;i<n;i++){x[i]=a[i]*fa+b[i]*fb;};
549  return x;
550 }
551 
552 //________________________________________________________
553 inline double *TCL::vlinco(const double *a, double fa, const double *b, double fb,double *x, int n)
554 {
555  //to be documented
556  for (int i=0;i<n;i++) x[i]=a[i]*fa+b[i]*fb;
557  return x;
558 }
559 
560 //_____________________________________________________________________________
561 inline float *TCL::vmatl(const float *G, const float *c, float *x, int n,int m)
562 {
563  // x = G*c
564  for (int i=0; i<n; i++) {
565  double sum = 0;
566  for (int j=0; j<m; j++) sum += G[j + m*i]*c[j];
567  x[i] = sum;
568  }
569  return x;
570 }
571 
572 //_____________________________________________________________________________
573 inline double *TCL::vmatl(const double *G, const double *c, double *x, int n,int m)
574 {
575  // x = G*c
576  for (int i=0; i<n; i++) {
577  double sum = 0;
578  for (int j=0; j<m; j++) sum += G[j + m*i]*c[j];
579  x[i] = sum;
580  }
581  return x;
582 }
583 
584 //_____________________________________________________________________________
585 inline float *TCL::vmatr(const float *c, const float *G, float *x, int n,int m)
586 {
587  // x = c*G
588  for (int j=0; j<m; j++) {
589  double sum = 0;
590  for (int i=0; i<n; i++) sum += G[j + n*i]*c[i];
591  x[j] = sum;
592  }
593  return x;
594 }
595 
596 //_____________________________________________________________________________
597 inline double *TCL::vmatr(const double *c, const double *G, double *x, int n,int m)
598 {
599  // x = c*G
600  for (int j=0; j<m; j++) {
601  double sum = 0;
602  for (int i=0; i<n; i++) sum += G[j + n*i]*c[i];
603  x[j] = sum;
604  }
605  return x;
606 }
607 
608 #endif
static float * mxmad2(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:192
static float * traat(const float *a, float *s, int m, int n)
Symmetric Multiplication of Rectangular Matrices.
Definition: TCernLib.cxx:294
static float * mxmlrt(const float *a, const float *b, float *c, int ni, int nj)
Definition: TCernLib.h:252
Definition: TCernLib.h:36
static float * trsmul(const float *g, float *gi, int n)
trsmul.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:1224
static float * mxmpy1(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:210
static float * vmatr(const float *c, const float *g, float *x, int n=3, int m=3)
Definition: TCernLib.h:585
static float * mxmpy3(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:222
TArc * a
Definition: textangle.C:12
static float * mxmltr(const float *a, const float *b, float *c, int ni, int nj)
Definition: TCernLib.h:258
static float * trata(const float *a, float *r, int m, int n)
trata.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:601
#define G(x, y, z)
static float * mxtrp(const float *a, float *b, int i, int j)
Matrix Transposition.
Definition: TCernLib.cxx:229
static float * vscale(const float *a, float scale, float *b, int n)
Definition: TCernLib.h:529
static float vdot(const float *b, const float *a, int n)
Definition: TCernLib.h:436
Double_t x[n]
Definition: legend1.C:17
static float * trinv(const float *t, float *s, int n)
trinv.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:868
#define ClassDef(name, id)
Definition: Rtypes.h:254
static float * trsat(const float *s, const float *a, float *b, int m, int n)
trsat.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:1310
static float * mxmad_0_(int n, const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.cxx:109
static float * vmatl(const float *g, const float *c, float *x, int n=3, int m=3)
Definition: TCernLib.h:561
static float * mxmub(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:228
static float * trpck(const float *s, float *u, int n)
trpck.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:1022
static float * trsequ(float *smx, int m=3, float *b=0, int n=1)
Linear Equations, Matrix Inversion trsequ solves the matrix equation.
Definition: TCernLib.cxx:2118
static float * trsa(const float *s, const float *a, float *b, int m, int n)
trsa.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:1123
static float * tralt(const float *a, const float *u, float *b, int m, int n)
Triangular - Rectangular Multiplication.
Definition: TCernLib.cxx:412
static float * trlta(const float *u, const float *a, float *b, int m, int n)
trlta.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:971
static float * trqsq(const float *q, const float *s, float *r, int m)
trqsq.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:1057
ROOT::R::TRInterface & r
Definition: Object.C:4
static float * mxmpy(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:204
static float * trats(const float *a, const float *s, float *b, int m, int n)
trats.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:641
static int * ucopy(const int *a, int *b, int n)
Definition: TCernLib.h:353
TMarker * m
Definition: textangle.C:8
static float * tral(const float *a, const float *u, float *b, int m, int n)
Triangular - Rectangular Multiplication.
Definition: TCernLib.cxx:353
static float * trchul(const float *a, float *b, int n)
trchul.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:804
static float * trsinv(const float *g, float *gi, int n)
trsinv.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:1172
static float * mxmpy2(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:216
static float * mxmub3(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:246
static float * trasat(const float *a, const float *s, float *r, int m, int n)
Transformation of Symmetric Matrix.
Definition: TCernLib.cxx:550
static float * trsmlu(const float *u, float *s, int n)
trsmlu.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:1189
static float * tras(const float *a, const float *s, float *b, int m, int n)
Symmetric - Rectangular Multiplication.
Definition: TCernLib.cxx:477
static float * mxmlrt_0_(int n__, const float *a, const float *b, float *c, int ni, int nj)
Matrix Multiplication.
Definition: TCernLib.cxx:164
static float * vzero(float *a, int n2)
Definition: TCernLib.h:505
static float * vadd(const float *b, const float *c, float *a, int n)
Definition: TCernLib.h:400
static float * mxmad1(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:186
virtual ~TCL()
Definition: TCernLib.h:38
Array of doubles (64 bits per element).
Definition: TArrayD.h:29
static float * mxmub1(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:234
static float * vcopyn(const float *a, float *x, int n)
Definition: TCernLib.h:488
static float * vlinco(const float *a, float fa, const float *b, float fb, float *x, int n)
Definition: TCernLib.h:545
static float * trupck(const float *u, float *s, int m)
trupck.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:1260
static float * mxmub2(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:240
static float * mxmad(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:180
static float * tratsa(const float *a, const float *s, float *r, int m, int n)
tratsa.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:688
static float * vsub(const float *a, const float *b, float *x, int n)
Definition: TCernLib.h:454
float * q
Definition: THbookFile.cxx:87
const Int_t n
Definition: legend1.C:16
static float * mxmad3(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:198
static float * trchlu(const float *a, float *b, int n)
trchlu.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:744
static float * trla(const float *u, const float *a, float *b, int m, int n)
trla.F – translated by f2c (version 19970219).
Definition: TCernLib.cxx:927