BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
DifArray Class Reference

#include <DifArray.h>

Public Member Functions

 DifArray (int n, int npar=0)
 
 DifArray (const HepVector &v, int npar=0)
 
 DifArray (const DifArray &a)
 
 ~DifArray ()
 
DifNumberoperator[] (int i)
 
DifNumberoperator() (int i)
 
DifNumber fetch (int i) const
 
int nElem () const
 
DifArrayoperator= (const DifArray &)
 
HepMatrix jacobian () const
 
void zero (int npar=0)
 
void print () const
 

Detailed Description

Definition at line 36 of file DifArray.h.

Constructor & Destructor Documentation

◆ DifArray() [1/3]

DifArray::DifArray ( int  n,
int  npar = 0 
)

Definition at line 29 of file DifArray.cxx.

29 :
30 _nElem(n),
31 _pointer(new DifNumber[n])
32{zero(npar);}
const Int_t n
const DifNumber zero

◆ DifArray() [2/3]

DifArray::DifArray ( const HepVector &  v,
int  npar = 0 
)

Definition at line 34 of file DifArray.cxx.

34 :
35 _nElem(a.num_row()),
36 _pointer(new DifNumber[nElem()])
37{copy(a,npar);}
int nElem() const
Definition: DifArray.h:47

◆ DifArray() [3/3]

DifArray::DifArray ( const DifArray a)

Definition at line 40 of file DifArray.cxx.

40 :
41 _nElem(a.nElem()),
42 _pointer(new DifNumber[nElem()])
43{copy(a);}

◆ ~DifArray()

DifArray::~DifArray ( )

Definition at line 45 of file DifArray.cxx.

45{delete[] _pointer;}

Member Function Documentation

◆ fetch()

DifNumber DifArray::fetch ( int  i) const

Definition at line 60 of file DifArray.cxx.

60 {
61 i=i-1;
62 assert(i>=0);
63 assert(i<nElem());
64 return _pointer[i];
65}

◆ jacobian()

HepMatrix DifArray::jacobian ( ) const

Definition at line 72 of file DifArray.cxx.

72 {
73 int npar=_pointer[0].nPar();
74 HepMatrix temp(nElem(),npar,0);
75 for(int i=1; i<=nElem(); i++){
76 for(int j=1; j<=npar; j++) {
77 temp(i,j)=_pointer[i-1].derivative(j);
78 }
79 } //(int i=1; i<=nElem(); i++)
80 return temp;
81}
double derivative(int i) const
Definition: DifNumber.h:90
int nPar() const
Definition: DifNumber.h:92

Referenced by BesPointErr::covRTPMatrix(), BesVectorErr::covRTPMatrix(), BesPointErr::covRZPMatrix(), BesVectorErr::covRZPMatrix(), TrkHelixUtils::helixFromMomErr(), and TrkHelixUtils::lineFromMomErr().

◆ nElem()

int DifArray::nElem ( ) const
inline

Definition at line 47 of file DifArray.h.

47{return _nElem;} // number of elements

Referenced by fetch(), jacobian(), operator()(), operator[](), print(), and zero().

◆ operator()()

DifNumber & DifArray::operator() ( int  i)

Definition at line 53 of file DifArray.cxx.

53 {
54 i=i-1;
55 assert(i>=0);
56 assert(i<nElem());
57 return _pointer[i];
58}

◆ operator=()

DifArray & DifArray::operator= ( const DifArray rhs)

Definition at line 67 of file DifArray.cxx.

67 {
68 copy(rhs);
69 return *this;
70}

◆ operator[]()

DifNumber & DifArray::operator[] ( int  i)

Definition at line 47 of file DifArray.cxx.

47 {
48 assert(i>=0);
49 assert(i<nElem());
50 return _pointer[i];
51}

◆ print()

void DifArray::print ( ) const

Definition at line 104 of file DifArray.cxx.

104 {
105 cout << "nElem=" << nElem() << endl;
106 for(int i=1; i<=nElem(); i++){
107 //SKIP cout << "element(" << i << ")=" << _pointer[i-1];
108 }
109
110}

◆ zero()

void DifArray::zero ( int  npar = 0)

Definition at line 97 of file DifArray.cxx.

97 {
98 for(int i=0; i<nElem(); i++) {
99 _pointer[i]=0.0;
100 _pointer[i].setNPar(npar);
101 }
102}
void setNPar(int i)
Definition: DifNumber.h:79

The documentation for this class was generated from the following files: