queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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 46 of file MetropolisHastingsSG.C.

References reset().

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

Copy constructor.

Definition at line 51 of file MetropolisHastingsSG.C.

References copy().

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

Destructor.

Definition at line 56 of file MetropolisHastingsSG.C.

57 {
58 }

Member Function Documentation

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

Copies Metropolis-Hastings chain info from src to this.

Definition at line 106 of file MetropolisHastingsSG.C.

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

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

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

Calculates the MPI sum of this.

Definition at line 126 of file MetropolisHastingsSG.C.

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

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

Addition assignment operator.

Definition at line 68 of file MetropolisHastingsSG.C.

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

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

Assignment operator.

Definition at line 61 of file MetropolisHastingsSG.C.

References copy().

62 {
63  this->copy(rhs);
64  return *this;
65 }
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 88 of file MetropolisHastingsSG.C.

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

Referenced by MHRawChainInfoStruct().

89 {
90  runTime = 0.;
91  candidateRunTime = 0.;
92  targetRunTime = 0.;
93  mhAlphaRunTime = 0.;
94  drAlphaRunTime = 0.;
95  drRunTime = 0.;
96  amRunTime = 0.;
97 
98  numTargetCalls = 0;
99  numDRs = 0;
102  numRejections = 0;
103 }

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::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 Jun 5 2018 19:49:34 for queso-0.57.1 by  doxygen 1.8.5