gambit is hosted by Hepforge, IPPP Durham
 GAMBIT  v1.5.0-2191-ga4742ac a Global And Modular Bsm Inference Tool
Gambit::Cholesky Class Reference

`#include <cholesky.hpp>`

Collaboration diagram for Gambit::Cholesky:

## Public Member Functions

Cholesky ()

Cholesky (const int num)

bool EnterMat (std::vector< std::vector< double >> &a)

void ElMult (std::vector< double > &y) const

std::vector< doubleinvElMult (const std::vector< double > &y) const
x = L^-1 y where L is the lower-diagonal Cholesky matrix More...

double Square (const std::vector< double > &y, const std::vector< double > &y0)

double DetSqrt ()

## Private Attributes

std::vector< std::vector< double > > el

## Detailed Description

Definition at line 26 of file cholesky.hpp.

## ◆ Cholesky() [1/2]

 Gambit::Cholesky::Cholesky ( )
inline

Definition at line 32 of file cholesky.hpp.

32 {}

## ◆ Cholesky() [2/2]

 Gambit::Cholesky::Cholesky ( const int num )
inline

Definition at line 34 of file cholesky.hpp.

34 : el(num, std::vector<double>(num)) {}
std::vector< std::vector< double > > el
Definition: cholesky.hpp:29

## ◆ DetSqrt()

 double Gambit::Cholesky::DetSqrt ( )
inline

Definition at line 127 of file cholesky.hpp.

128  {
129  double temp = 1.0;
130  int num = el.size();
131  for (int i = 0; i < num; i++)
132  temp *= el[i][i];
133  return temp;
134  }
std::vector< std::vector< double > > el
Definition: cholesky.hpp:29
Here is the caller graph for this function:

## ◆ ElMult()

 void Gambit::Cholesky::ElMult ( std::vector< double > & y ) const
inline

Definition at line 69 of file cholesky.hpp.

References b.

70  {
71  int i, j;
72  int num = el.size();
73  std::vector<double> b(num);
74  for(i = 0; i < num; i++)
75  {
76  b[i] = 0.0;
77  for (j = 0; j <= i; j++)
78  {
79  b[i] += el[i][j]*y[j];
80  }
81  }
82
83  y = b;
84  }
START_MODEL b
Definition: demo.hpp:270
std::vector< std::vector< double > > el
Definition: cholesky.hpp:29
Here is the caller graph for this function:

## ◆ EnterMat()

 bool Gambit::Cholesky::EnterMat ( std::vector< std::vector< double >> & a )
inline

Definition at line 36 of file cholesky.hpp.

37  {
38  el = a;
39  int num = el.size();
40  double sum = 0;
41  int i, j, k;
42
43  for (i = 0; i < num; i++)
44  {
45  for (j = i; j < num; j++)
46  {
47  for(sum = el[i][j], k = i - 1; k >= 0; k--)
48  sum -= el[i][k]*el[j][k];
49  if(i == j)
50  {
51  if(sum <= 0.0)
52  {
53  return false;
54  }
55  el[i][i] = std::sqrt(sum);
56  }
57  else
58  el[j][i] = sum/el[i][i];
59  }
60  }
61
62  for (i = 0; i < num; i++)
63  for (j = 0; j < i; j++)
64  el[j][i] = 0.0;
65
66  return true;
67  }
std::vector< std::vector< double > > el
Definition: cholesky.hpp:29
Here is the caller graph for this function:

## ◆ invElMult()

 std::vector Gambit::Cholesky::invElMult ( const std::vector< double > & y ) const
inline

x = L^-1 y where L is the lower-diagonal Cholesky matrix

Found by forward substituion since L is lower-diagonal.

Definition at line 91 of file cholesky.hpp.

References generate_raster_scan_settings::n.

92  {
93  std::vector<double> x(y.size(), 0.);
94  for (int i = 0, n = x.size(); i < n; i++)
95  {
96  double sum_ = 0;
97  for (int j = 0; j < i; j++)
98  {
99  sum_ += el[i][j] * x[j];
100  }
101  x[i] = (y[i] - sum_) / el[i][i];
102  }
103  return x;
104  }
std::vector< std::vector< double > > el
Definition: cholesky.hpp:29
Here is the caller graph for this function:

## ◆ Square()

 double Gambit::Cholesky::Square ( const std::vector< double > & y, const std::vector< double > & y0 )
inline

Definition at line 106 of file cholesky.hpp.

107  {
108  int i, j, num = y.size();
109  double sum;
110  std::vector<double> x(num);
111
112  for (i = 0; i < num; i++)
113  {
114  for (sum = (y[i]-y0[i]), j=0; j < i; j++)
115  sum -= el[i][j]*x[j];
116
117  x[i]=sum/el[i][i];
118  }
119
120  sum = 0.0;
121  for (i = 0; i < num; i++)
122  sum += x[i]*x[i];
123
124  return sum;
125  }
std::vector< std::vector< double > > el
Definition: cholesky.hpp:29
Here is the caller graph for this function:

## ◆ el

 std::vector > Gambit::Cholesky::el
private

Definition at line 29 of file cholesky.hpp.

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