25 #ifndef UQ_SEQUENCE_OF_VECTORS_H
26 #define UQ_SEQUENCE_OF_VECTORS_H
28 #include <queso/VectorSequence.h>
29 #define UQ_SEQ_VEC_USES_SCALAR_SEQ_CODE
30 #undef UQ_SEQ_VEC_USES_OPERATOR
48 template <
class V = GslVector,
class M = GslMatrix>
64 const std::string&
name);
86 void resetValues (
unsigned int initialPos,
unsigned int numPos);
90 void erasePositions (
unsigned int initialPos,
unsigned int numPos);
118 V& unifiedMeanVec)
const;
130 V& unifiedMedianVec)
const;
145 const V& unifiedMeanVec,
146 V& unifiedSamVec)
const;
158 const V& unifiedMeanVec,
159 V& unifiedStdVec)
const;
177 const V& unifiedMeanVec,
178 V& unifiedPopVec)
const;
204 const std::vector<unsigned int>& lags,
205 std::vector<V*>& corrVecs)
const;
211 V& autoCorrsSumVec)
const;
221 V& unifiedMaxVec)
const;
229 std::vector<V*>& centersForAllBins,
230 std::vector<V*>& quanttsForAllBins)
const;
233 const V& unifiedMinVec,
234 const V& unifiedMaxVec,
235 std::vector<V*>& unifiedCentersForAllBins,
236 std::vector<V*>& unifiedQuanttsForAllBins)
const;
249 V& unifiedIqrVec)
const;
262 unsigned int kdeDimension,
266 const V& unifiedIqrVec,
267 unsigned int kdeDimension,
268 V& unifiedScaleVec)
const;
276 const std::vector<V*>& evalParamVecs,
277 std::vector<V*>& densityVecs)
const;
280 const V& unifiedScaleVec,
281 const std::vector<V*>& unifiedEvalParamVecs,
282 std::vector<V*>& unifiedDensityVecs)
const;
292 const std::string& fileName,
293 const std::string& fileType,
294 const std::set<unsigned int>& allowedSubEnvIds)
const;
300 const std::string& fileType)
const;
306 const std::string& fileType)
const;
310 const std::string& fileType)
const;
314 const std::string& fileType,
317 void select (
const std::vector<unsigned int>& idsOfUniquePositions);
321 void filter (
unsigned int initialPos,
322 unsigned int spacing);
326 unsigned int numPos)
const;
332 unsigned int spacing,
334 unsigned int paramId,
337 #ifdef UQ_SEQ_VEC_USES_OPERATOR
338 const V* operator[] (
unsigned int posId)
const;
339 const V*& operator[] (
unsigned int posId);
342 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
343 void subUniformlySampledMdf (
const V& numEvaluationPointsVec,
348 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
349 void subMeanCltStd (
unsigned int initialPos,
353 void unifiedMeanCltStd (
unsigned int initialPos,
355 const V& unifiedMeanVec,
356 V& unifiedSamVec)
const;
357 void bmm (
unsigned int initialPos,
358 unsigned int batchLength,
360 void fftForward (
unsigned int initialPos,
361 unsigned int fftSize,
362 unsigned int paramId,
363 std::vector<std::complex<double> >& fftResult)
const;
365 void psd (
unsigned int initialPos,
366 unsigned int numBlocks,
368 unsigned int paramId,
369 std::vector<double>& psdResult)
const;
370 void psdAtZero (
unsigned int initialPos,
371 unsigned int numBlocks,
374 void geweke (
unsigned int initialPos,
378 void meanStacc (
unsigned int initialPos,
379 V& meanStaccVec)
const;
380 void subCdfPercentageRange (
unsigned int initialPos,
385 void unifiedCdfPercentageRange (
unsigned int initialPos,
390 void subCdfStacc (
unsigned int initialPos,
391 std::vector<V*>& cdfStaccVecs,
392 std::vector<V*>& cdfStaccVecsUp,
393 std::vector<V*>& cdfStaccVecsLow,
394 std::vector<V*>& sortedDataVecs)
const;
395 void subCdfStacc (
unsigned int initialPos,
396 const std::vector<V*>& evalPositionsVecs,
397 std::vector<V*>& cdfStaccVecs)
const;
409 unsigned int spacing,
411 unsigned int paramId,
412 std::vector<double>& rawData)
const;
422 #ifdef UQ_CODE_HAS_MONITORS
423 void subMeanMonitorAlloc (
unsigned int numberOfMonitorPositions);
424 void subMeanInter0MonitorAlloc (
unsigned int numberOfMonitorPositions);
425 void unifiedMeanMonitorAlloc (
unsigned int numberOfMonitorPositions);
426 void subMeanMonitorRun (
unsigned int monitorPosition,
429 void subMeanInter0MonitorRun (
unsigned int currentPosition,
430 V& subMeanInter0Mean,
431 V& subMeanInter0Clt95,
432 V& subMeanInter0Empirical90,
434 V& subMeanInter0Max);
435 void unifiedMeanMonitorRun (
unsigned int currentPosition,
437 V& unifiedMeanCltStd);
438 void subMeanMonitorStore (
unsigned int i,
439 unsigned int monitorPosition,
441 const V& subMeanCltStd);
442 void subMeanInter0MonitorStore (
unsigned int i,
443 unsigned int monitorPosition,
444 const V& subMeanInter0Mean,
445 const V& subMeanInter0Clt95,
446 const V& subMeanInter0Empirical90,
447 const V& subMeanInter0Min,
448 const V& subMeanInter0Max);
449 void unifiedMeanMonitorStore (
unsigned int i,
450 unsigned int monitorPosition,
452 V& unifiedMeanCltStd);
453 void subMeanMonitorFree ();
454 void subMeanInter0MonitorFree ();
455 void unifiedMeanMonitorFree ();
456 void subMeanMonitorWrite (std::ofstream& ofs);
457 void subMeanInter0MonitorWrite (std::ofstream& ofs);
458 void unifiedMeanMonitorWrite (std::ofstream& ofs);
461 #ifdef UQ_CODE_HAS_MONITORS
481 #endif // UQ_SEQUENCE_OF_VECTORS_H
Class to accommodate arrays of one-dimensional grid.
void autoCovariance(unsigned int initialPos, unsigned int numPos, const V &meanVec, unsigned int lag, V &covVec) const
Calculates the autocovariance.
void unifiedPopulationVariance(unsigned int initialPos, unsigned int numPos, const V &unifiedMeanVec, V &unifiedPopVec) const
Finds the population variance of the unified sequence, considering numPos positions starting at posit...
void subMeanExtra(unsigned int initialPos, unsigned int numPos, V &meanVec) const
Finds the mean value of the sub-sequence, considering numPos positions starting at position initialPo...
void extractScalarSeq(unsigned int initialPos, unsigned int spacing, unsigned int numPos, unsigned int paramId, ScalarSequence< double > &scalarSeq) const
Extracts a sequence of scalars.
void subScalesForKde(unsigned int initialPos, const V &iqrVec, unsigned int kdeDimension, V &scaleVec) const
Selects the scales (bandwidth, scaleVec) for the kernel density estimation, considering only the sub-...
void unifiedGaussian1dKde(unsigned int initialPos, const V &unifiedScaleVec, const std::vector< V * > &unifiedEvalParamVecs, std::vector< V * > &unifiedDensityVecs) const
Gaussian kernel for the KDE estimate of the unified sequence.
SequenceOfVectors< V, M > & operator=(const SequenceOfVectors< V, M > &rhs)
Copies values from rhs to this.
void subMinMaxExtra(unsigned int initialPos, unsigned int numPos, V &minVec, V &maxVec) const
Finds the minimum and the maximum values of the sub-sequence, considering numPos positions starting a...
SequenceOfVectors(const VectorSpace< V, M > &vectorSpace, unsigned int subSequenceSize, const std::string &name)
Default constructor.
std::vector< const V * > m_seq
Sequence of vectors.
void filter(unsigned int initialPos, unsigned int spacing)
Filters positions in the sequence of vectors.
void unifiedReadContents(const std::string &fileName, const std::string &fileType, const unsigned int subSequenceSize)
Reads the unified sequence from a file.
Struct for handling data input and output from files.
std::vector< const V * >::const_iterator seqVectorPositionConstIteratorTypedef
void subSampleVarianceExtra(unsigned int initialPos, unsigned int numPos, const V &meanVec, V &samVec) const
Finds the sample variance of the sub-sequence, considering numPos positions starting at position init...
void subInterQuantileRange(unsigned int initialPos, V &iqrVec) const
Returns the interquartile range of the values in the sub-sequence.
~SequenceOfVectors()
Destructor.
void select(const std::vector< unsigned int > &idsOfUniquePositions)
TODO: It shall select positions in the sequence of vectors.
void resetValues(unsigned int initialPos, unsigned int numPos)
Resets a total of numPos values of the sequence starting at position initialPos.
void unifiedUniformlySampledCdf(const V &numEvaluationPointsVec, ArrayOfOneDGrids< V, M > &unifiedCdfGrids, ArrayOfOneDTables< V, M > &unifiedCdfValues) const
Uniformly samples from the CDF from the sub-sequence.
void unifiedMeanExtra(unsigned int initialPos, unsigned int numPos, V &unifiedMeanVec) const
Finds the mean value of the unified sequence, considering numPos positions starting at position initi...
void subPopulationVariance(unsigned int initialPos, unsigned int numPos, const V &meanVec, V &popVec) const
Finds the population variance of the sub-sequence, considering numPos positions starting at position ...
void subSampleStd(unsigned int initialPos, unsigned int numPos, const V &meanVec, V &stdVec) const
Finds the sample standard deviation of the sub-sequence, considering numPos positions starting at pos...
void subUniformlySampledCdf(const V &numEvaluationPointsVec, ArrayOfOneDGrids< V, M > &cdfGrids, ArrayOfOneDTables< V, M > &cdfValues) const
Uniformly samples from the CDF from the sub-sequence.
void autoCorrViaDef(unsigned int initialPos, unsigned int numPos, unsigned int lag, V &corrVec) const
Calculates the autocorrelation via definition.
void subWriteContents(unsigned int initialPos, unsigned int numPos, const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds) const
Writes the sub-sequence to a file.
void setPositionValues(unsigned int posId, const V &vec)
Set the values in vec at position posId of the sequence.
const VectorSpace< V, M > & vectorSpace() const
Vector space; access to protected attribute VectorSpace<V,M>& m_vectorSpace.
double estimateConvBrooksGelman(unsigned int initialPos, unsigned int numPos) const
Estimates convergence rate using Brooks & Gelman method.
std::vector< const V * >::iterator seqVectorPositionIteratorTypedef
void unifiedSampleVarianceExtra(unsigned int initialPos, unsigned int numPos, const V &unifiedMeanVec, V &unifiedSamVec) const
Finds the sample variance of the unified sequence, considering numPos positions starting at position ...
void unifiedScalesForKde(unsigned int initialPos, const V &unifiedIqrVec, unsigned int kdeDimension, V &unifiedScaleVec) const
Selects the scales (bandwidth) for the kernel density estimation, considering the unified sequence...
Class to accommodate arrays of one-dimensional tables.
void extractRawData(unsigned int initialPos, unsigned int spacing, unsigned int numPos, unsigned int paramId, std::vector< double > &rawData) const
Extracts the raw data.
const std::string & name() const
Access to protected attribute m_name: name of the sequence of vectors.
unsigned int subSequenceSize() const
Size of the sub-sequence of vectors.
void subMedianExtra(unsigned int initialPos, unsigned int numPos, V &medianVec) const
Finds the median value of the sub-sequence, considering numPos positions starting at position initial...
void getPositionValues(unsigned int posId, V &vec) const
Gets the values of the sequence at position posId and stores them at vec.
void unifiedInterQuantileRange(unsigned int initialPos, V &unifiedIqrVec) const
Returns the interquartile range of the values in the unified sequence.
void unifiedHistogram(unsigned int initialPos, const V &unifiedMinVec, const V &unifiedMaxVec, std::vector< V * > &unifiedCentersForAllBins, std::vector< V * > &unifiedQuanttsForAllBins) const
Calculates the histogram of the unified sequence.
void resizeSequence(unsigned int newSubSequenceSize)
Resizes the sequence.
A class representing a vector space.
void unifiedMedianExtra(unsigned int initialPos, unsigned int numPos, V &unifiedMedianVec) const
Finds the median value of the unfed sequence, considering numPos positions starting at position initi...
void subHistogram(unsigned int initialPos, const V &minVec, const V &maxVec, std::vector< V * > ¢ersForAllBins, std::vector< V * > &quanttsForAllBins) const
Calculates the histogram of the sub-sequence.
void erasePositions(unsigned int initialPos, unsigned int numPos)
Erases numPos elements of the sequence starting at position initialPos.
void unifiedMinMaxExtra(unsigned int initialPos, unsigned int numPos, V &unifiedMinVec, V &unifiedMaxVec) const
Finds the minimum and the maximum values of the unified sequence, considering numPos positions starti...
Class for handling vector samples (sequence of vectors).
void subGaussian1dKde(unsigned int initialPos, const V &scaleVec, const std::vector< V * > &evalParamVecs, std::vector< V * > &densityVecs) const
Gaussian kernel for the KDE estimate of the sub-sequence.
Base class for handling vector and array samples (sequence of vectors or arrays). ...
void unifiedSampleStd(unsigned int initialPos, unsigned int numPos, const V &unifiedMeanVec, V &unifiedStdVec) const
Finds the sample standard deviation of the unified sequence, considering numPos positions starting at...
void unifiedWriteContents(const std::string &fileName, const std::string &fileType) const
void copy(const SequenceOfVectors< V, M > &src)
Copies vector sequence src to this.
void autoCorrViaFft(unsigned int initialPos, unsigned int numPos, const std::vector< unsigned int > &lags, std::vector< V * > &corrVecs) const
Calculates the autocorrelation via Fast Fourier transforms (FFT).