BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Minuit2::MnUserCovariance Class Reference

Description

Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide internal matrix representation to user

Definition at line 27 of file MnUserCovariance.h.

Collaboration diagram for ROOT::Minuit2::MnUserCovariance:
[legend]

Public Member Functions

 MnUserCovariance ()
 
 MnUserCovariance (const double *data, unsigned int nrow)
 
 MnUserCovariance (const MnUserCovariance &cov)
 
 MnUserCovariance (const std::vector< double > &data, unsigned int nrow)
 
 MnUserCovariance (unsigned int n)
 
 ~MnUserCovariance ()
 
const std::vector< double > & Data () const
 
unsigned int Nrow () const
 
double & operator() (unsigned int row, unsigned int col)
 
double operator() (unsigned int row, unsigned int col) const
 
MnUserCovarianceoperator= (const MnUserCovariance &cov)
 
void Scale (double f)
 
unsigned int size () const
 

Private Attributes

std::vector< double > fData
 
unsigned int fNRow
 

Constructor & Destructor Documentation

◆ MnUserCovariance() [1/5]

ROOT::Minuit2::MnUserCovariance::MnUserCovariance ( )
inline

Definition at line 31 of file MnUserCovariance.h.

31 : fData(std::vector<double>()), fNRow(0) {}

◆ MnUserCovariance() [2/5]

ROOT::Minuit2::MnUserCovariance::MnUserCovariance ( const std::vector< double > &  data,
unsigned int  nrow 
)
inline

Definition at line 34 of file MnUserCovariance.h.

34  :
35  fData(data), fNRow(nrow) {
36  assert(data.size() == nrow*(nrow+1)/2);
37  }

◆ MnUserCovariance() [3/5]

ROOT::Minuit2::MnUserCovariance::MnUserCovariance ( const double *  data,
unsigned int  nrow 
)
inline

Definition at line 40 of file MnUserCovariance.h.

40  :
41  fData(std::vector<double>(data,data+nrow*(nrow+1)/2)),
42  fNRow(nrow) {
43  }

◆ MnUserCovariance() [4/5]

ROOT::Minuit2::MnUserCovariance::MnUserCovariance ( unsigned int  n)
inline

Definition at line 45 of file MnUserCovariance.h.

45  :
46  fData(std::vector<double>(n*(n+1)/2, 0.)), fNRow(n) {}

◆ ~MnUserCovariance()

ROOT::Minuit2::MnUserCovariance::~MnUserCovariance ( )
inline

Definition at line 48 of file MnUserCovariance.h.

48 {}

◆ MnUserCovariance() [5/5]

ROOT::Minuit2::MnUserCovariance::MnUserCovariance ( const MnUserCovariance cov)
inline

Definition at line 50 of file MnUserCovariance.h.

50 : fData(cov.fData), fNRow(cov.fNRow) {}

Member Function Documentation

◆ Data()

const std::vector<double>& ROOT::Minuit2::MnUserCovariance::Data ( ) const
inline

Definition at line 80 of file MnUserCovariance.h.

80 {return fData;}

References fData.

◆ Nrow()

unsigned int ROOT::Minuit2::MnUserCovariance::Nrow ( ) const
inline

Definition at line 82 of file MnUserCovariance.h.

82 {return fNRow;}

References fNRow.

◆ operator()() [1/2]

double& ROOT::Minuit2::MnUserCovariance::operator() ( unsigned int  row,
unsigned int  col 
)
inline

Definition at line 68 of file MnUserCovariance.h.

68  {
69  assert(row < fNRow && col < fNRow);
70  if(row > col)
71  return fData[col+row*(row+1)/2];
72  else
73  return fData[row+col*(col+1)/2];
74  }

References fData, and fNRow.

◆ operator()() [2/2]

double ROOT::Minuit2::MnUserCovariance::operator() ( unsigned int  row,
unsigned int  col 
) const
inline

Definition at line 60 of file MnUserCovariance.h.

60  {
61  assert(row < fNRow && col < fNRow);
62  if(row > col)
63  return fData[col+row*(row+1)/2];
64  else
65  return fData[row+col*(col+1)/2];
66  }

References fData, and fNRow.

◆ operator=()

MnUserCovariance& ROOT::Minuit2::MnUserCovariance::operator= ( const MnUserCovariance cov)
inline

Definition at line 52 of file MnUserCovariance.h.

52  {
53  if(this != &cov) {
54  fData = cov.fData;
55  fNRow = cov.fNRow;
56  }
57  return *this;
58  }

References fData, and fNRow.

◆ Scale()

void ROOT::Minuit2::MnUserCovariance::Scale ( double  f)
inline

Definition at line 76 of file MnUserCovariance.h.

76  {
77  for(unsigned int i = 0; i < fData.size(); i++) fData[i] *= f;
78  }

References fData.

◆ size()

unsigned int ROOT::Minuit2::MnUserCovariance::size ( ) const
inline

Definition at line 85 of file MnUserCovariance.h.

86  { return static_cast < unsigned int > ( fData.size() );
87  }

References fData.

Member Data Documentation

◆ fData

std::vector<double> ROOT::Minuit2::MnUserCovariance::fData
private

Definition at line 91 of file MnUserCovariance.h.

Referenced by Data(), operator()(), operator=(), Scale(), and size().

◆ fNRow

unsigned int ROOT::Minuit2::MnUserCovariance::fNRow
private

Definition at line 92 of file MnUserCovariance.h.

Referenced by Nrow(), operator()(), and operator=().


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