queso-0.56.0
Public Attributes | List of all members
QUESO::MHRawChainInfoStruct Struct Reference

A struct that represents a Metropolis-Hastings sample. More...

#include <MetropolisHastingsSG.h>

Public Member Functions

Constructor/Destructor methods
 MHRawChainInfoStruct ()
 Constructor. More...
 
 MHRawChainInfoStruct (const MHRawChainInfoStruct &rhs)
 Copy constructor. More...
 
 ~MHRawChainInfoStruct ()
 Destructor. More...
 
Set methods
MHRawChainInfoStructoperator= (const MHRawChainInfoStruct &rhs)
 Assignment operator. More...
 
MHRawChainInfoStructoperator+= (const MHRawChainInfoStruct &rhs)
 Addition assignment operator. More...
 
Misc methods
void copy (const MHRawChainInfoStruct &src)
 Copies Metropolis-Hastings chain info from src to this. More...
 
void reset ()
 Resets Metropolis-Hastings chain info. More...
 
void mpiSum (const MpiComm &comm, MHRawChainInfoStruct &sumInfo)
 Calculates the MPI sum of this. More...
 

Public Attributes

double runTime
 
double candidateRunTime
 
double targetRunTime
 
double mhAlphaRunTime
 
double drAlphaRunTime
 
double drRunTime
 
double amRunTime
 
unsigned int numTargetCalls
 
unsigned int numDRs
 
unsigned int numOutOfTargetSupport
 
unsigned int numOutOfTargetSupportInDR
 
unsigned int numRejections
 

Detailed Description

A struct that represents a Metropolis-Hastings sample.

Some of the information about the Metropolis-Hastings sample generator includes the allowed number of delayed rejections, number of rejections, number of positions in or out of target support, and so on. This struct is responsible for the storage of such info.

Definition at line 61 of file MetropolisHastingsSG.h.

Constructor & Destructor Documentation

QUESO::MHRawChainInfoStruct::MHRawChainInfoStruct ( )

Constructor.

Definition at line 44 of file MetropolisHastingsSG.C.

References reset().

45 {
46  reset();
47 }
void reset()
Resets Metropolis-Hastings chain info.
QUESO::MHRawChainInfoStruct::MHRawChainInfoStruct ( const MHRawChainInfoStruct rhs)

Copy constructor.

Definition at line 49 of file MetropolisHastingsSG.C.

References copy().

50 {
51  this->copy(rhs);
52 }
void copy(const MHRawChainInfoStruct &src)
Copies Metropolis-Hastings chain info from src to this.
QUESO::MHRawChainInfoStruct::~MHRawChainInfoStruct ( )

Destructor.

Definition at line 54 of file MetropolisHastingsSG.C.

55 {
56 }

Member Function Documentation

void QUESO::MHRawChainInfoStruct::copy ( const MHRawChainInfoStruct src)

Copies Metropolis-Hastings chain info from src to this.

Definition at line 104 of file MetropolisHastingsSG.C.

References amRunTime, candidateRunTime, drAlphaRunTime, drRunTime, mhAlphaRunTime, numDRs, numOutOfTargetSupport, numOutOfTargetSupportInDR, numRejections, numTargetCalls, runTime, and targetRunTime.

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

105 {
106  runTime = rhs.runTime;
107  candidateRunTime = rhs.candidateRunTime;
108  targetRunTime = rhs.targetRunTime;
109  mhAlphaRunTime = rhs.mhAlphaRunTime;
110  drAlphaRunTime = rhs.drAlphaRunTime;
111  drRunTime = rhs.drRunTime;
112  amRunTime = rhs.amRunTime;
113 
114  numTargetCalls = rhs.numTargetCalls;
115  numDRs = rhs.numDRs;
116  numOutOfTargetSupport = rhs.numOutOfTargetSupport;
117  numOutOfTargetSupportInDR = rhs.numOutOfTargetSupportInDR;
118  numRejections = rhs.numRejections;
119 
120  return;
121 }
void QUESO::MHRawChainInfoStruct::mpiSum ( const MpiComm comm,
MHRawChainInfoStruct sumInfo 
)

Calculates the MPI sum of this.

Definition at line 124 of file MetropolisHastingsSG.C.

References QUESO::MpiComm::Allreduce(), numTargetCalls, RawValue_MPI_SUM, and runTime.

125 {
126  comm.Allreduce<double>(&runTime, &sumInfo.runTime, (int) 7, RawValue_MPI_SUM,
127  "MHRawChainInfoStruct::mpiSum()",
128  "failed MPI.Allreduce() for sum of doubles");
129 
130  comm.Allreduce<unsigned int>(&numTargetCalls, &sumInfo.numTargetCalls, (int) 5, RawValue_MPI_SUM,
131  "MHRawChainInfoStruct::mpiSum()",
132  "failed MPI.Allreduce() for sum of unsigned ints");
133 
134  return;
135 }
#define RawValue_MPI_SUM
Definition: MpiComm.h:71
MHRawChainInfoStruct & QUESO::MHRawChainInfoStruct::operator+= ( const MHRawChainInfoStruct rhs)

Addition assignment operator.

Definition at line 66 of file MetropolisHastingsSG.C.

References amRunTime, candidateRunTime, drAlphaRunTime, drRunTime, mhAlphaRunTime, numDRs, numOutOfTargetSupport, numOutOfTargetSupportInDR, numRejections, numTargetCalls, runTime, and targetRunTime.

67 {
68  runTime += rhs.runTime;
69  candidateRunTime += rhs.candidateRunTime;
70  targetRunTime += rhs.targetRunTime;
71  mhAlphaRunTime += rhs.mhAlphaRunTime;
72  drAlphaRunTime += rhs.drAlphaRunTime;
73  drRunTime += rhs.drRunTime;
74  amRunTime += rhs.amRunTime;
75 
76  numTargetCalls += rhs.numTargetCalls;
77  numDRs += rhs.numDRs;
78  numOutOfTargetSupport += rhs.numOutOfTargetSupport;
79  numOutOfTargetSupportInDR += rhs.numOutOfTargetSupportInDR;
80  numRejections += rhs.numRejections;
81 
82  return *this;
83 }
MHRawChainInfoStruct & QUESO::MHRawChainInfoStruct::operator= ( const MHRawChainInfoStruct rhs)

Assignment operator.

Definition at line 59 of file MetropolisHastingsSG.C.

References copy().

60 {
61  this->copy(rhs);
62  return *this;
63 }
void copy(const MHRawChainInfoStruct &src)
Copies Metropolis-Hastings chain info from src to this.
void QUESO::MHRawChainInfoStruct::reset ( )

Resets Metropolis-Hastings chain info.

Definition at line 86 of file MetropolisHastingsSG.C.

References amRunTime, candidateRunTime, drAlphaRunTime, drRunTime, mhAlphaRunTime, numDRs, numOutOfTargetSupport, numOutOfTargetSupportInDR, numRejections, numTargetCalls, runTime, and targetRunTime.

Referenced by MHRawChainInfoStruct().

87 {
88  runTime = 0.;
89  candidateRunTime = 0.;
90  targetRunTime = 0.;
91  mhAlphaRunTime = 0.;
92  drAlphaRunTime = 0.;
93  drRunTime = 0.;
94  amRunTime = 0.;
95 
96  numTargetCalls = 0;
97  numDRs = 0;
100  numRejections = 0;
101 }

Member Data Documentation

double QUESO::MHRawChainInfoStruct::amRunTime

Definition at line 102 of file MetropolisHastingsSG.h.

Referenced by copy(), operator+=(), and reset().

double QUESO::MHRawChainInfoStruct::candidateRunTime

Definition at line 97 of file MetropolisHastingsSG.h.

Referenced by copy(), operator+=(), and reset().

double QUESO::MHRawChainInfoStruct::drAlphaRunTime

Definition at line 100 of file MetropolisHastingsSG.h.

Referenced by copy(), operator+=(), and reset().

double QUESO::MHRawChainInfoStruct::drRunTime

Definition at line 101 of file MetropolisHastingsSG.h.

Referenced by copy(), operator+=(), and reset().

double QUESO::MHRawChainInfoStruct::mhAlphaRunTime

Definition at line 99 of file MetropolisHastingsSG.h.

Referenced by copy(), operator+=(), and reset().

unsigned int QUESO::MHRawChainInfoStruct::numDRs

Definition at line 105 of file MetropolisHastingsSG.h.

Referenced by copy(), operator+=(), and reset().

unsigned int QUESO::MHRawChainInfoStruct::numOutOfTargetSupport

Definition at line 106 of file MetropolisHastingsSG.h.

Referenced by copy(), operator+=(), and reset().

unsigned int QUESO::MHRawChainInfoStruct::numOutOfTargetSupportInDR

Definition at line 107 of file MetropolisHastingsSG.h.

Referenced by copy(), operator+=(), and reset().

unsigned int QUESO::MHRawChainInfoStruct::numRejections
unsigned int QUESO::MHRawChainInfoStruct::numTargetCalls

Definition at line 104 of file MetropolisHastingsSG.h.

Referenced by copy(), mpiSum(), operator+=(), and reset().

double QUESO::MHRawChainInfoStruct::runTime
double QUESO::MHRawChainInfoStruct::targetRunTime

Definition at line 98 of file MetropolisHastingsSG.h.

Referenced by copy(), operator+=(), and reset().


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

Generated on Tue Nov 29 2016 10:53:15 for queso-0.56.0 by  doxygen 1.8.5