ROOT  6.06/08
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;
357  memcpy(a,b,n*sizeof(int));
358  return a;
359 }
360 
361 //________________________________________________________
362 inline float *TCL::ucopy(const float *b, float *a, int n)
363 {
364  //to be documented
365  if (n <= 0) return 0;
366  memcpy(a,b,n*sizeof(float));
367  return a;
368 }
369 
370 //________________________________________________________
371 inline float *TCL::ucopy(const double *b, float *a, int n)
372 {
373  //to be documented
374  if (n <= 0) return 0;
375  for (int i=0;i<n;i++,a++,b++) *a = float(*b);
376  return a;
377 }
378 
379 //________________________________________________________
380 inline double *TCL::ucopy(const float *b, double *a, int n)
381 {
382  //to be documented
383  if (n <= 0) return 0;
384  for (int i=0;i<n;i++,a++,b++) *a = double(*b);
385  return a;
386 }
387 
388 //________________________________________________________
389 inline double *TCL::ucopy(const double *b, double *a, int n)
390 {
391  //to be documented
392  if (n <= 0) return 0;
393  memcpy(a,b,n*sizeof(double));
394  return a;
395 }
396 
397 //________________________________________________________
398 inline void **TCL::ucopy(const void **b, void **a, int n)
399 {
400  //to be documented
401  if (n <= 0) return 0;
402  memcpy(a,b,n*sizeof(void *));
403  return a;
404 }
405 
406 
407 //________________________________________________________
408 inline float *TCL::vadd(const float *b, const float *c, float *a, int n)
409 {
410  //to be documented
411  if (n <= 0) return 0;
412  for (int i=0;i<n;i++) a[i] = b[i] + c[i];
413  return a;
414 }
415 
416 //________________________________________________________
417 inline double *TCL::vadd(const double *b, const double *c, double *a, int n)
418 {
419  //to be documented
420  if (n <= 0) return 0;
421  for (int i=0;i<n;i++) a[i] = b[i] + c[i];
422  return a;
423 }
424 
425 //________________________________________________________
426 inline float *TCL::vadd(const float *b, const double *c, float *a, int n)
427 {
428  //to be documented
429  if (n <= 0) return 0;
430  for (int i=0;i<n;i++) a[i] = b[i] + c[i];
431  return a;
432 }
433 
434 //________________________________________________________
435 inline double *TCL::vadd(const double *b, const float *c, double *a, int n)
436 {
437  //to be documented
438  if (n <= 0) return 0;
439  for (int i=0;i<n;i++) a[i] = b[i] + c[i];
440  return a;
441 }
442 
443 //________________________________________________________
444 inline float TCL::vdot(const float *b, const float *a, int n)
445 {
446  //to be documented
447  float x=0;
448  if (n>0)
449  for (int i=0;i<n;i++,a++,b++) x += (*a) * (*b);
450  return x;
451 }
452 //________________________________________________________
453 inline double TCL::vdot(const double *b, const double *a, int n)
454 {
455  //to be documented
456  double x=0;
457  if (n>0)
458  for (int i=0;i<n;i++,a++,b++) x += (*a) * (*b);
459  return x;
460 }
461 //________________________________________________________
462 inline float *TCL::vsub(const float *a, const float *b, float *x, int n)
463 {
464  //to be documented
465  if (n <= 0) return 0;
466  for (int i=0;i<n;i++) x[i] = a[i]-b[i];
467  return x;
468 }
469 
470 //________________________________________________________
471 inline double *TCL::vsub(const double *a, const double *b, double *x, int n)
472 {
473  //to be documented
474  if (n <= 0) return 0;
475  for (int i=0;i<n;i++) x[i] = a[i]-b[i];
476  return x;
477 }
478 //________________________________________________________
479 inline float *TCL::vsub(const float *b, const double *c, float *a, int n)
480 {
481  //to be documented
482  if (n <= 0) return 0;
483  for (int i=0;i<n;i++) a[i] = b[i] - c[i];
484  return a;
485 }
486 
487 //________________________________________________________
488 inline double *TCL::vsub(const double *b, const float *c, double *a, int n)
489 {
490  //to be documented
491  if (n <= 0) return 0;
492  for (int i=0;i<n;i++) a[i] = b[i] - c[i];
493  return a;
494 }
495 //________________________________________________________
496 inline float *TCL::vcopyn(const float *a, float *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 inline double *TCL::vcopyn(const double *a, double *x, int n)
505 {
506  //to be documented
507  if (n <= 0) return 0;
508  for (int i=0;i<n;i++) x[i] = -a[i];
509  return x;
510 }
511 
512 //________________________________________________________
513 inline float *TCL::vzero(float *a, int n1)
514 {
515  //to be documented
516  if (n1 <= 0) return 0;
517  return (float *)memset(a,0,n1*sizeof(float));
518 }
519 
520 //________________________________________________________
521 inline double *TCL::vzero(double *a, int n1)
522 {
523  //to be documented
524  if (n1 <= 0) return 0;
525  return (double *)memset(a,0,n1*sizeof(double));
526 }
527 
528 //________________________________________________________
529 inline void **TCL::vzero(void **a, int n1)
530 {
531  //to be documented
532  if (n1 <= 0) return 0;
533  return (void **)memset(a,0,n1*sizeof(void *));
534 }
535 
536 //________________________________________________________
537 inline float *TCL::vscale(const float *a, float scale, float *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 double *TCL::vscale(const double *a, double scale, double *b, int n)
546 {
547  //to be documented
548  for (int i=0;i<n;i++) b[i]=scale*a[i];
549  return b;
550 }
551 
552 //________________________________________________________
553 inline float *TCL::vlinco(const float *a, float fa, const float *b, float fb, float *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 double *TCL::vlinco(const double *a, double fa, const double *b, double fb,double *x, int n)
562 {
563  //to be documented
564  for (int i=0;i<n;i++) x[i]=a[i]*fa+b[i]*fb;
565  return x;
566 }
567 
568 //_____________________________________________________________________________
569 inline float *TCL::vmatl(const float *G, const float *c, float *x, int n,int m)
570 {
571  // x = G*c
572  for (int i=0; i<n; i++) {
573  double sum = 0;
574  for (int j=0; j<m; j++) sum += G[j + m*i]*c[j];
575  x[i] = sum;
576  }
577  return x;
578 }
579 
580 //_____________________________________________________________________________
581 inline double *TCL::vmatl(const double *G, const double *c, double *x, int n,int m)
582 {
583  // x = G*c
584  for (int i=0; i<n; i++) {
585  double sum = 0;
586  for (int j=0; j<m; j++) sum += G[j + m*i]*c[j];
587  x[i] = sum;
588  }
589  return x;
590 }
591 
592 //_____________________________________________________________________________
593 inline float *TCL::vmatr(const float *c, const float *G, float *x, int n,int m)
594 {
595  // x = c*G
596  for (int j=0; j<m; j++) {
597  double sum = 0;
598  for (int i=0; i<n; i++) sum += G[j + n*i]*c[i];
599  x[j] = sum;
600  }
601  return x;
602 }
603 
604 //_____________________________________________________________________________
605 inline double *TCL::vmatr(const double *c, const double *G, double *x, int n,int m)
606 {
607  // x = c*G
608  for (int j=0; j<m; j++) {
609  double sum = 0;
610  for (int i=0; i<n; i++) sum += G[j + n*i]*c[i];
611  x[j] = sum;
612  }
613  return x;
614 }
615 
616 #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:593
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:537
static float vdot(const float *b, const float *a, int n)
Definition: TCernLib.h:444
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:569
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:513
static float * vadd(const float *b, const float *c, float *a, int n)
Definition: TCernLib.h:408
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:496
static float * vlinco(const float *a, float fa, const float *b, float fb, float *x, int n)
Definition: TCernLib.h:553
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:462
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