25 #include <queso/VectorRV.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
32 template<
class V,
class M>
37 m_env (imageSet.env()),
38 m_prefix ((std::string)(prefix)+
"rv_"),
39 m_imageSet (imageSet),
59 template<
class V,
class M>
70 template <
class V,
class M>
77 template<
class V,
class M>
84 template<
class V,
class M>
93 template<
class V,
class M>
102 template<
class V,
class M>
111 template<
class V,
class M>
117 return *m_unifiedCdf;
120 template<
class V,
class M>
131 template <
class V,
class M>
141 unsigned int k = UQ_INFTH_ANN_KNN;
142 double eps = UQ_INFTH_ANN_EPS;
146 unsigned int dim = this->imageSet().vectorSpace().dimGlobal();
150 unsigned int N = this->realizer().subPeriod();
152 N = UQ_INFTH_ANN_NO_SMP;
157 dists =
new double[N];
160 V smpRV( this->imageSet().vectorSpace().zeroVector() );
161 for(
unsigned int i = 0; i < N; i++ ) {
163 this->realizer().realization( smpRV );
165 for(
unsigned int j = 0; j <
dim; j++ ) {
166 data[ i ][ j ] = smpRV[ j ];
172 distANN_XY( data, data, dists, dim, dim, N, N, k+1, eps );
177 double sum_log_dist = 0.0;
178 for(
unsigned int i = 0; i < N; i++ ) {
179 if( dists[ i ] > 0 ) {
180 sum_log_dist += log( 2.0*dists[ i ] );
183 ENT_est = - gsl_sf_psi_int( k ) + gsl_sf_psi_int( N ) + (double)dim / (
double)N * sum_log_dist;
191 #endif // QUESO_HAS_ANN
196 template <
class P_V,
class P_M,
class Q_V,
class Q_M>
201 unsigned int localNumSamples,
216 queso_require_msg(!((numRows != pqCovMatrix.numRows()) || (numCols != pqCovMatrix.numCols())),
"inconsistent dimensions for covariance matrix");
218 queso_require_msg(!((numRows != pqCorrMatrix.numRows()) || (numCols != pqCorrMatrix.numCols())),
"inconsistent dimensions for correlation matrix");
232 for (
unsigned int k = 0; k < localNumSamples; ++
k) {
234 localWorkingPSeq.setPositionValues(k,tmpP);
237 localWorkingQSeq.setPositionValues(k,tmpQ);
unsigned int displayVerbosity() const
const BaseVectorRealizer< V, M > & realizer() const
Finds a realization (sample) of the PDF of this vector RV; access to private attribute m_realizer...
A templated class for handling sets.
BaseVectorRV(const char *prefix, const VectorSet< V, M > &imageSet)
Constructor.
A templated base class for handling vector RV.
const BaseEnvironment & env() const
QUESO environment; access to private attribute m_env.
A templated (base) class for handling joint PDFs.
A templated (base) class for handling CDFs of vector functions.
void ComputeCovCorrMatricesBetweenVectorSequences(const BaseVectorSequence< P_V, P_M > &subPSeq, const BaseVectorSequence< Q_V, Q_M > &subQSeq, unsigned int subNumSamples, P_M &pqCovMatrix, P_M &pqCorrMatrix)
void ComputeCovCorrMatricesBetweenVectorRvs(const BaseVectorRV< P_V, P_M > ¶mRv, const BaseVectorRV< Q_V, Q_M > &qoiRv, unsigned int localNumSamples, P_M &pqCovMatrix, P_M &pqCorrMatrix)
virtual ~BaseVectorRV()
Virtual destructor.
const BaseVectorCdf< V, M > & unifiedCdf() const
Finds the Cumulative Distribution Function of this vector RV, considering the unified sequence of dat...
const V & zeroVector() const
Returns a vector filled with zeros.
DLL_API void annDeallocPts(ANNpointArray &pa)
const BaseVectorCdf< V, M > & subCdf() const
Finds the Cumulative Distribution Function of this vector RV, considering only the sub-sequence of da...
virtual void realization(V &nextValues) const =0
Performs a realization (sample) from a probability density function. See template specialization...
#define queso_require_msg(asserted, msg)
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
A templated (base) class for handling sampling from vector RVs.
const BaseJointPdf< V, M > & pdf() const
Posterior Density Function of the vector RV; access to private attribute m_pdf.
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
const BaseEnvironment & m_env
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
A templated (base) class for handling MDFs of vector functions.
unsigned int numOfProcsForStorage() const
Returns total number of processes.
DLL_API ANNpointArray annAllocPts(int n, int dim)
virtual const VectorSpace< V, M > & vectorSpace() const =0
Vector space to which this set belongs to. See template specialization.
const BaseVectorMdf< V, M > & mdf() const
Finds the Mass Density Function of this vector RV; access to private attribute m_mdf.