FEDRA emulsion software from the OPERA Collaboration
VtVertex.hh File Reference
#include <iosfwd>
#include <vector>
#include "CMatrix.hh"
#include "VtVector.hh"
#include "VtTrack.hh"
#include "VtMassC_list.hh"
#include "VtVertex.icc"
Include dependency graph for VtVertex.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  VERTEX::Vertex
 

Namespaces

namespace  VERTEX
 

Typedefs

typedef std::vector< Track * >::const_iterator VERTEX::Track_cit
 
typedef std::vector< Track * >::iterator VERTEX::Track_it
 
typedef std::vector< Track * > VERTEX::Track_v
 
typedef std::vector< double > VERTEX::Vector_d
 

Functions

void Dinv1 (int *n, double *a, int *idim, double *ir, int *ifail)
 
std::ostream & VERTEX::operator<< (std::ostream &s, const Vertex &a)
 

Function Documentation

◆ Dinv1()

void Dinv1 ( int *  n,
double *  a,
int *  idim,
double *  ir,
int *  ifail 
)
322{
323 static double det = 0;
324
325 *ifail = 0;
326
327 if (*n < 1 || *n > *idim) {
328 *ifail = -1;
329 return;
330 }
331
332 if ( *n == 1)
333 {
334 if (a[0] == 0.) {
335 *ifail = -1;
336 return;
337 }
338 a[0] = 1. / a[0];
339 return;
340 }
341
342 if ( *n == 2)
343 {
344 det = a[0] * a[3] - a[2] * a[1];
345
346 if (det == 0.) { *ifail = -1; return; }
347
348 double s = 1. / det;
349 double c11 = s * a[3];
350
351 a[2] = -s * a[2];
352 a[1] = -s * a[1];
353 a[3] = s * a[0];
354 a[0] = c11;
355 return;
356 }
357
358
359
360 if ( *n == 3 )
361 {
362 static double t1, t2, t3, temp, s;
363 static double c11, c12, c13, c21, c22, c23, c31, c32, c33;
364
365 /* COMPUTE COFACTORS. */
366 c11 = a[4] * a[8] - a[7] * a[5];
367 c12 = a[7] * a[2] - a[1] * a[8];
368 c13 = a[1] * a[5] - a[4] * a[2];
369 c21 = a[5] * a[6] - a[8] * a[3];
370 c22 = a[8] * a[0] - a[2] * a[6];
371 c23 = a[2] * a[3] - a[5] * a[0];
372 c31 = a[3] * a[7] - a[6] * a[4];
373 c32 = a[6] * a[1] - a[0] * a[7];
374 c33 = a[0] * a[4] - a[3] * a[1];
375
376 t1 = fabs(a[0]);
377 t2 = fabs(a[1]);
378 t3 = fabs(a[2]);
379
380 /* (SET TEMP=PIVOT AND DET=PIVOT*DET.) */
381 if(t1 < t2) {
382 if (t3 < t2) {
383 /* (PIVOT IS A21) */
384 temp = a[1];
385 det = c13 * c32 - c12 * c33;
386 } else {
387 /* (PIVOT IS A31) */
388 temp = a[2];
389 det = c23 * c12 - c22 * c13;
390 }
391 } else {
392 if(t3 < t1) {
393 /* (PIVOT IS A11) */
394 temp = a[0];
395 det = c22 * c33 - c23 * c32;
396 } else {
397 /* (PIVOT IS A31) */
398 temp = a[2];
399 det = c23 * c12 - c22 * c13;
400 }
401 }
402
403 if (det == 0.) {
404 *ifail = -1;
405 return;
406 }
407
408 /* SET ELEMENTS OF INVERSE IN A. */
409 s = temp / det;
410 a[0] = s * c11;
411 a[3] = s * c21;
412 a[6] = s * c31;
413 a[1] = s * c12;
414 a[4] = s * c22;
415 a[7] = s * c32;
416 a[2] = s * c13;
417 a[5] = s * c23;
418 a[8] = s * c33;
419 return;
420 }
421
422 /* Initialized data */
423
424 static int work[100], jfail;
425 for(int i=0; i<*n; ++i) work[i] = 0;
426
427 /* Function Body */
428
429 /* N.GT.3 CASES. FACTORIZE MATRIX AND INVERT. */
430 Dfactir1(n, a, idim, work, ifail, &det, &jfail);
431 if (*ifail != 0)
432 {
433 cerr << "Dfactir failed!!" << endl;
434 return;
435 }
436 Dfinv1(n, a, idim, work, ifail);
437 return;
438} // Dinv1
Expr< UnaryOp< Fabs< T >, Expr< A, T, D >, T >, T, D > fabs(const Expr< A, T, D > &rhs)
Definition: UnaryOperators.hh:96
void Dfinv1(int *n, double *a, int *idim, int *ir, int *ifail)
Definition: VtSqMatrix.C:131
void Dfactir1(int *n, double *a, int *idim, int *ir, int *ifail, double *det, int *jfail)
Definition: VtSqMatrix.C:31
void a()
Definition: check_aligned.C:59
s
Definition: check_shower.C:55