A class for the status of a Rejection Sampler. More...
Public Member Functions | |
real | IntegralEstimate () |
A real estimate of the integral of the function over the domain. | |
std::vector< rvector > | Mean () |
Arithmetic mean of the sampled labeled points in a label-specific way. | |
void | PrintMeans (std::ostream &out) |
Print label-specific sample means from Mean(). | |
void | Print (std::ostream &out) |
Print sampled labeled points in Samples as a matrix with TAB padding. | |
std::vector< LabPnt > | getSample () |
Return a copy of the Samples of sampled labeled points. | |
Public Attributes | |
long | Nprop |
Number of draws from proposal distribution. | |
long | Ntopologies |
Number of labels or topologies. | |
std::vector< int > | LabelSet |
The set of unique integer labels in LabDomainList. | |
int | n_Dim_Max |
The maximum dimension of the labeled boxes in LabDomainList. | |
real | EnvelopeIntegral |
The envelope integral as a cxsc::real. | |
std::vector< LabPnt > | Samples |
An STL vector container to store accepted samples of labeled points. |
A class for the status of a Rejection Sampler.
real RSSample::IntegralEstimate | ( | ) | [inline] |
A real estimate of the integral of the function over the domain.
{ return EnvelopeIntegral*real(int(Samples.size()))/real(Nprop); }
std::vector<rvector> RSSample::Mean | ( | ) | [inline] |
Arithmetic mean of the sampled labeled points in a label-specific way.
Flag for IF a label has been encountered in the samples
number of distinct labels in the samples
sum of distinct labels in the samples
{ std::cout << " Number of labels or topologies = " << Ntopologies << std::endl; std::vector<int>::const_iterator itINTV = max_element(LabelSet.begin(),LabelSet.end()); int MaxLabelNum = *itINTV; std::vector<bool> first(MaxLabelNum+1, true); std::vector<long> L_sums(MaxLabelNum+1, 0); std::vector<rvector> sums(MaxLabelNum+1); std::vector<LabPnt>::const_iterator it = Samples.begin(); for(; it != Samples.end(); it++) { int label = it->L; if(first[label]) { sums[label] = rvector(it->Pnt); L_sums[label] = 1; first[label] = false; } else { sums[label] += it->Pnt; L_sums[label] += 1; } } for(int i=0; i<Ntopologies; i++) { if(L_sums[LabelSet[i]] > 0) { sums[LabelSet[i]] /= (real)L_sums[LabelSet[i]]; } std::cout << "label: " << LabelSet[i] << " proportion: " << (real)L_sums[LabelSet[i]]/(real)(long)Samples.size() << std::endl << "Labelled Mean:\n" << sums[LabelSet[i]] << std::endl; } return sums; }