queso-0.53.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) const
 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 58 of file MetropolisHastingsSG.h.

Constructor & Destructor Documentation

QUESO::MHRawChainInfoStruct::MHRawChainInfoStruct ( )

Constructor.

Definition at line 41 of file MetropolisHastingsSG.C.

References reset().

42 {
43  reset();
44 }
void reset()
Resets Metropolis-Hastings chain info.
QUESO::MHRawChainInfoStruct::MHRawChainInfoStruct ( const MHRawChainInfoStruct rhs)

Copy constructor.

Definition at line 46 of file MetropolisHastingsSG.C.

References copy().

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

Destructor.

Definition at line 51 of file MetropolisHastingsSG.C.

52 {
53 }

Member Function Documentation

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

Copies Metropolis-Hastings chain info from src to this.

Definition at line 101 of file MetropolisHastingsSG.C.

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

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

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

Calculates the MPI sum of this.

Definition at line 121 of file MetropolisHastingsSG.C.

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

122 {
123  comm.Allreduce((void *) &runTime, (void *) &sumInfo.runTime, (int) 7, RawValue_MPI_DOUBLE, RawValue_MPI_SUM,
124  "MHRawChainInfoStruct::mpiSum()",
125  "failed MPI.Allreduce() for sum of doubles");
126 
127  comm.Allreduce((void *) &numTargetCalls, (void *) &sumInfo.numTargetCalls, (int) 5, RawValue_MPI_UNSIGNED, RawValue_MPI_SUM,
128  "MHRawChainInfoStruct::mpiSum()",
129  "failed MPI.Allreduce() for sum of unsigned ints");
130 
131  return;
132 }
#define RawValue_MPI_SUM
Definition: MpiComm.h:52
#define RawValue_MPI_DOUBLE
Definition: MpiComm.h:48
#define RawValue_MPI_UNSIGNED
Definition: MpiComm.h:49
MHRawChainInfoStruct & QUESO::MHRawChainInfoStruct::operator+= ( const MHRawChainInfoStruct rhs)

Addition assignment operator.

Definition at line 63 of file MetropolisHastingsSG.C.

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

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

Assignment operator.

Definition at line 56 of file MetropolisHastingsSG.C.

References copy().

57 {
58  this->copy(rhs);
59  return *this;
60 }
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 83 of file MetropolisHastingsSG.C.

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

Referenced by MHRawChainInfoStruct().

84 {
85  runTime = 0.;
86  candidateRunTime = 0.;
87  targetRunTime = 0.;
88  mhAlphaRunTime = 0.;
89  drAlphaRunTime = 0.;
90  drRunTime = 0.;
91  amRunTime = 0.;
92 
93  numTargetCalls = 0;
94  numDRs = 0;
97  numRejections = 0;
98 }

Member Data Documentation

double QUESO::MHRawChainInfoStruct::amRunTime

Definition at line 99 of file MetropolisHastingsSG.h.

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

double QUESO::MHRawChainInfoStruct::candidateRunTime

Definition at line 94 of file MetropolisHastingsSG.h.

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

double QUESO::MHRawChainInfoStruct::drAlphaRunTime

Definition at line 97 of file MetropolisHastingsSG.h.

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

double QUESO::MHRawChainInfoStruct::drRunTime

Definition at line 98 of file MetropolisHastingsSG.h.

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

double QUESO::MHRawChainInfoStruct::mhAlphaRunTime

Definition at line 96 of file MetropolisHastingsSG.h.

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

unsigned int QUESO::MHRawChainInfoStruct::numDRs

Definition at line 102 of file MetropolisHastingsSG.h.

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

unsigned int QUESO::MHRawChainInfoStruct::numOutOfTargetSupport

Definition at line 103 of file MetropolisHastingsSG.h.

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

unsigned int QUESO::MHRawChainInfoStruct::numOutOfTargetSupportInDR

Definition at line 104 of file MetropolisHastingsSG.h.

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

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

Definition at line 101 of file MetropolisHastingsSG.h.

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

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

Definition at line 95 of file MetropolisHastingsSG.h.

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


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

Generated on Thu Jun 11 2015 13:52:35 for queso-0.53.0 by  doxygen 1.8.5