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;
342 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
348 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
355 const V& unifiedMeanVec,
356 V& unifiedSamVec)
const;
357 void bmm (
unsigned int initialPos,
358 unsigned int batchLength,
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;
371 unsigned int numBlocks,
374 void geweke (
unsigned int initialPos,
379 V& meanStaccVec)
const;
391 std::vector<V*>& cdfStaccVecs,
392 std::vector<V*>& cdfStaccVecsUp,
393 std::vector<V*>& cdfStaccVecsLow,
394 std::vector<V*>& sortedDataVecs)
const;
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;
437 #ifdef UQ_CODE_HAS_MONITORS
445 V& subMeanInter0Mean,
446 V& subMeanInter0Clt95,
447 V& subMeanInter0Empirical90,
449 V& subMeanInter0Max);
454 unsigned int monitorPosition,
458 unsigned int monitorPosition,
459 const V& subMeanInter0Mean,
460 const V& subMeanInter0Clt95,
461 const V& subMeanInter0Empirical90,
462 const V& subMeanInter0Min,
463 const V& subMeanInter0Max);
465 unsigned int monitorPosition,
476 #ifdef UQ_CODE_HAS_MONITORS
496 #endif // UQ_SEQUENCE_OF_VECTORS_H
void meanStacc(unsigned int initialPos, V &meanStaccVec) const
void subMeanMonitorFree()
Class to accommodate arrays of one-dimensional grid.
void subMeanInter0MonitorFree()
void unifiedMeanCltStd(unsigned int initialPos, unsigned int numPos, const V &unifiedMeanVec, V &unifiedSamVec) const
SequenceOfVectors< V, M > * m_subMeanInter0Clt95
void unifiedMeanMonitorFree()
SequenceOfVectors< V, M > * m_unifiedMeanVecSeq
void writeSubMatlabHeader(std::ofstream &ofs, double sequenceSize, double vectorSizeLocal) const
Helper function to write matlab-specific header info for vectors.
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 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 unifiedWriteContents(const std::string &fileName, const std::string &fileType) const
A class representing a vector space.
void subMeanCltStd(unsigned int initialPos, unsigned int numPos, const V &meanVec, V &samVec) const
void unifiedUniformlySampledCdf(const V &numEvaluationPointsVec, ArrayOfOneDGrids< V, M > &unifiedCdfGrids, ArrayOfOneDTables< V, M > &unifiedCdfValues) const
Uniformly samples from the CDF from the sub-sequence.
void geweke(unsigned int initialPos, double ratioNa, double ratioNb, V &gewVec) const
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.
void resetValues(unsigned int initialPos, unsigned int numPos)
Resets a total of numPos values of the sequence starting at position initialPos.
void copy(const SequenceOfVectors< V, M > &src)
Copies vector sequence src to this.
Class to accommodate arrays of one-dimensional tables.
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...
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...
void subInterQuantileRange(unsigned int initialPos, V &iqrVec) const
Returns the interquartile range of the values in the sub-sequence.
void unifiedReadContents(const std::string &fileName, const std::string &fileType, const unsigned int subSequenceSize)
Reads the unified sequence from a file.
void subUniformlySampledMdf(const V &numEvaluationPointsVec, ArrayOfOneDGrids< V, M > &mdfGrids, ArrayOfOneDTables< V, M > &mdfValues) const
void unifiedCdfPercentageRange(unsigned int initialPos, unsigned int numPos, double range, V &lowerVec, V &upperVec) const
SequenceOfVectors(const VectorSpace< V, M > &vectorSpace, unsigned int subSequenceSize, const std::string &name)
Default constructor.
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 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...
unsigned int subSequenceSize() const
Size of the sub-sequence of vectors.
SequenceOfVectors< V, M > * m_subMeanInter0Empirical90
void subMeanInter0MonitorAlloc(unsigned int numberOfMonitorPositions)
void subMeanInter0MonitorStore(unsigned int i, unsigned int monitorPosition, const V &subMeanInter0Mean, const V &subMeanInter0Clt95, const V &subMeanInter0Empirical90, const V &subMeanInter0Min, const V &subMeanInter0Max)
void unifiedInterQuantileRange(unsigned int initialPos, V &unifiedIqrVec) const
Returns the interquartile range of the values in the unified sequence.
void setPositionValues(unsigned int posId, const V &vec)
Set the values in vec at position posId of the sequence.
SequenceOfVectors< V, M > * m_subMeanCltStdSeq
SequenceOfVectors< V, M > * m_subMeanVecSeq
void subMeanMonitorStore(unsigned int i, unsigned int monitorPosition, const V &subMeanVec, const V &subMeanCltStd)
void unifiedMeanMonitorAlloc(unsigned int numberOfMonitorPositions)
const V * operator[](unsigned int posId) const
void subCdfStacc(unsigned int initialPos, std::vector< V * > &cdfStaccVecs, std::vector< V * > &cdfStaccVecsUp, std::vector< V * > &cdfStaccVecsLow, std::vector< V * > &sortedDataVecs) const
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 unifiedMeanMonitorWrite(std::ofstream &ofs)
void subMeanMonitorAlloc(unsigned int numberOfMonitorPositions)
void writeUnifiedMatlabHeader(std::ofstream &ofs, double sequenceSize, double vectorSizeLocal) const
Class for handling vector samples (sequence of vectors).
const std::string & name() const
Access to protected attribute m_name: name of the sequence of vectors.
void extractScalarSeq(unsigned int initialPos, unsigned int spacing, unsigned int numPos, unsigned int paramId, ScalarSequence< double > &scalarSeq) const
Extracts a sequence of scalars.
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.
Base class for handling vector and array samples (sequence of vectors or arrays). ...
~SequenceOfVectors()
Destructor.
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...
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 unifiedMeanMonitorStore(unsigned int i, unsigned int monitorPosition, V &unifiedMeanVec, V &unifiedMeanCltStd)
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 writeTxtHeader(std::ofstream &ofs, double sequenceSize, double vectorSizeLocal) const
Helper function to write plain txt info for vectors.
SequenceOfVectors< V, M > * m_subMeanInter0Mean
std::vector< const V * >::iterator seqVectorPositionIteratorTypedef
SequenceOfVectors< V, M > * m_subMeanInter0Min
void subCdfPercentageRange(unsigned int initialPos, unsigned int numPos, double range, V &lowerVec, V &upperVec) const
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).
void subMeanMonitorRun(unsigned int monitorPosition, V &subMeanVec, V &subMeanCltStd)
void extractRawData(unsigned int initialPos, unsigned int spacing, unsigned int numPos, unsigned int paramId, std::vector< double > &rawData) const
Extracts the raw data.
void select(const std::vector< unsigned int > &idsOfUniquePositions)
TODO: It shall select positions in the sequence of vectors.
void subMeanInter0MonitorRun(unsigned int currentPosition, V &subMeanInter0Mean, V &subMeanInter0Clt95, V &subMeanInter0Empirical90, V &subMeanInter0Min, V &subMeanInter0Max)
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 getPositionValues(unsigned int posId, V &vec) const
Gets the values of the sequence at position posId and stores them at vec.
SequenceOfVectors< V, M > & operator=(const SequenceOfVectors< V, M > &rhs)
Copies values from rhs to this.
const VectorSpace< V, M > & vectorSpace() const
Vector space; access to protected attribute VectorSpace<V,M>& m_vectorSpace.
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 subUniformlySampledCdf(const V &numEvaluationPointsVec, ArrayOfOneDGrids< V, M > &cdfGrids, ArrayOfOneDTables< V, M > &cdfValues) const
Uniformly samples from the CDF from the sub-sequence.
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 unifiedMeanMonitorRun(unsigned int currentPosition, V &unifiedMeanVec, V &unifiedMeanCltStd)
ScalarSequence< double > * m_subMeanInter0MonitorPosSeq
void subMeanInter0MonitorWrite(std::ofstream &ofs)
double estimateConvBrooksGelman(unsigned int initialPos, unsigned int numPos) const
Estimates convergence rate using Brooks & Gelman method.
void resizeSequence(unsigned int newSubSequenceSize)
Resizes the 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.
ScalarSequence< double > * m_subMeanMonitorPosSeq
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...
SequenceOfVectors< V, M > * m_unifiedMeanCltStdSeq
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...
unsigned int vectorSizeLocal() const
Local dimension (size) of the vector space.
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...
std::vector< const V * >::const_iterator seqVectorPositionConstIteratorTypedef
Struct for handling data input and output from files.
ScalarSequence< double > * m_unifiedMeanMonitorPosSeq
void bmm(unsigned int initialPos, unsigned int batchLength, V &bmmVec) const
void subMeanMonitorWrite(std::ofstream &ofs)
void psdAtZero(unsigned int initialPos, unsigned int numBlocks, double hopSizeRatio, V &psdVec) const
void autoCovariance(unsigned int initialPos, unsigned int numPos, const V &meanVec, unsigned int lag, V &covVec) const
Calculates the autocovariance.
void psd(unsigned int initialPos, unsigned int numBlocks, double hopSizeRatio, unsigned int paramId, std::vector< double > &psdResult) const
SequenceOfVectors< V, M > * m_subMeanInter0Max
void autoCorrViaDef(unsigned int initialPos, unsigned int numPos, unsigned int lag, V &corrVec) const
Calculates the autocorrelation via definition.
void fftForward(unsigned int initialPos, unsigned int fftSize, unsigned int paramId, std::vector< std::complex< double > > &fftResult) const
void erasePositions(unsigned int initialPos, unsigned int numPos)
Erases numPos elements of the sequence starting at position initialPos.
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...